用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/cxcscmu/SkillLearnBench --skill data-matching命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | data-matching |
| description | Matching observation data to simulation output with exact datetime and depth binning |
Successfully matching observations to simulations requires careful handling of datetime and depth coordinates. The matching must use exact values with proper rounding—no interpolation or nearest-neighbor approximation.
CSV with columns:
datetime,depth,temp,OXY_oxy
2009-01-21 12:00:00,0,0.1,16.3
2009-01-21 12:00:00,1,0.7,16.3
...
GLM output:
import pandas as pd
obs_df = pd.read_csv('/root/field_temp_oxy.csv')
obs_df['datetime'] = pd.to_datetime(obs_df['datetime'])
Round observation depths to nearest meter (standard practice):
obs_df['depth_rounded'] = obs_df['depth'].round(0)
import netCDF4 as nc
from netCDF4 import num2date
ds = nc.Dataset('/root/output/output.nc')
temp_sim = ds.variables['temp'][:] # [time, depth]
z_sim = ds.variables['z'][:] # depth coordinates
time_sim = ds.variables['time'][:] # time values
# Convert time to datetime
time_var = ds.variables['time']
dates_sim = num2date(time_sim, time_var.units)
ds.close()
def exact_match(obs_df, temp_sim, z_sim, dates_sim):
"""
Match observations to simulation using exact datetime and rounded-depth
Returns: aligned arrays of simulated temps, observed temps,
and metadata for filtering
"""
import numpy as np
matched = {
'sim_temp': [],
'obs_temp': [],
'depth': [],
'datetime': [],
'obs_idx': []
}
for idx, row in obs_df.iterrows():
obs_date = row['datetime']
obs_depth = row['depth_rounded']
obs_temp = row['temp']
# Find time index: exact datetime match
time_idx = None
for i, sim_date in enumerate(dates_sim):
if sim_date == obs_date:
time_idx = i
break
if time_idx is None:
continue # No exact datetime match
# Find depth index: exact depth match
depth_idx = None
for j, sim_z in enumerate(z_sim):
if np.isclose(sim_z, obs_depth, atol=0.01):
depth_idx = j
break
if depth_idx is None:
continue # No exact depth match
# Record match
matched[].append(temp_sim[time_idx, depth_idx])
matched[].append(obs_temp)
matched[].append(obs_depth)
matched[].append(obs_date)
matched[].append(idx)
matched
# Check what percentage of observations were matched
total_obs = len(obs_df)
matched_count = len(matched['sim_temp'])
match_fraction = matched_count / total_obs
print(f"Matched {matched_count}/{total_obs} observations ({100*match_fraction:.1f}%)")
# Check date range of matches
import pandas as pd
match_dates = pd.DataFrame(matched['datetime'])
print(f"Match date range: {match_dates.min()} to {match_dates.max()}")
# Check which depths are represented
import numpy as np
matched_depths = np.array(matched['depth'])
unique_depths = np.unique(matched_depths)
print(f"Matched depths: {sorted(unique_depths)}")
After exact matching, apply semantic filters:
import numpy as np
matched_sim = np.array(matched['sim_temp'])
matched_obs = np.array(matched['obs_temp'])
matched_depths = np.array(matched['depth'])
matched_dates = np.array(matched['datetime'])
# Overall RMSE: all matches
overall_mask = np.ones(len(matched_sim), dtype=bool)
# Annual deep (depths >= 13m)
annual_deep_mask = matched_depths >= 13
# Summer deep (June-Sept, depths >= 13m)
summer_mask = np.array([d.month in [6, 7, 8, 9]
for d in matched_dates])
summer_deep_mask = summer_mask & (matched_depths >= 13)
# Calculate RMSE for each category
from numpy import sqrt, mean
overall_rmse = sqrt(mean((matched_sim - matched_obs)**2))
annual_deep_rmse = sqrt(mean((matched_sim[annual_deep_mask] -
matched_obs[annual_deep_mask])**2))
summer_deep_rmse = sqrt(mean((matched_sim[summer_deep_mask] -
matched_obs[summer_deep_mask])**2))