Spaces:
Running
Running
Update VULCAN/mcp_output/mcp_plugin/mcp_service.py
Browse files
VULCAN/mcp_output/mcp_plugin/mcp_service.py
CHANGED
|
@@ -246,12 +246,32 @@ def tool_build_atmospheric_structure(dataset: str = 'HD189') -> dict:
|
|
| 246 |
if data.ndim == 1:
|
| 247 |
data = data.reshape(1, -1)
|
| 248 |
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 255 |
except Exception as read_err:
|
| 256 |
pass # Use defaults on read error
|
| 257 |
|
|
|
|
| 246 |
if data.ndim == 1:
|
| 247 |
data = data.reshape(1, -1)
|
| 248 |
|
| 249 |
+
n_data = data.shape[0]
|
| 250 |
+
|
| 251 |
+
# Read columns: pressure, temperature, Kzz
|
| 252 |
+
if data.shape[1] >= 2:
|
| 253 |
+
pressure_read = data[:, 0] # Pressure column
|
| 254 |
+
Tco_read = data[:, 1] # Temperature column (2nd column)
|
| 255 |
+
|
| 256 |
+
# If data size differs from nz, interpolate
|
| 257 |
+
if n_data != nz:
|
| 258 |
+
# Create interpolation indices
|
| 259 |
+
indices_old = np.linspace(0, n_data - 1, n_data)
|
| 260 |
+
indices_new = np.linspace(0, n_data - 1, nz)
|
| 261 |
+
Tco = np.interp(indices_new, indices_old, Tco_read)
|
| 262 |
+
pressure_data = np.interp(indices_new, indices_old, pressure_read)
|
| 263 |
+
else:
|
| 264 |
+
Tco = Tco_read
|
| 265 |
+
pressure_data = pressure_read
|
| 266 |
+
|
| 267 |
+
if data.shape[1] >= 3:
|
| 268 |
+
Kzz_read = data[:, 2] # Kzz column (3rd column)
|
| 269 |
+
if n_data != nz:
|
| 270 |
+
indices_old = np.linspace(0, n_data - 1, n_data)
|
| 271 |
+
indices_new = np.linspace(0, n_data - 1, nz)
|
| 272 |
+
Kzz = np.interp(indices_new, indices_old, Kzz_read)
|
| 273 |
+
else:
|
| 274 |
+
Kzz = Kzz_read
|
| 275 |
except Exception as read_err:
|
| 276 |
pass # Use defaults on read error
|
| 277 |
|