用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/cxcscmu/SkillLearnBench --skill netcdf-processing命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | netcdf-processing |
| description | Reading, processing, and analyzing NetCDF output from lake simulation models |
NetCDF (Network Common Data Form) is a self-describing binary format commonly used for scientific data. GLM outputs simulation results in NetCDF format containing temperature, mixing, and other variables across time and depth.
pip install netCDF4 numpy pandas
import netCDF4 as nc
import pandas as pd
# Open NetCDF file
ds = nc.Dataset('/path/to/output.nc', 'r')
# List variables
print(ds.variables.keys())
# List dimensions
print(ds.dimensions.keys())
# Read a variable
temp = ds.variables['temp'][:] # Returns numpy array
time = ds.variables['time'][:]
z = ds.variables['z'][:] # depth dimension
Typical GLM NetCDF output contains:
import netCDF4 as nc
import pandas as pd
def extract_glm_temperatures(nc_file, start_date='2009-01-01'):
"""Extract temperature time series from GLM NetCDF output"""
ds = nc.Dataset(nc_file)
# Get data
temp = ds.variables['temp'][:] # [time, depth]
z = ds.variables['z'][:] # depth
time = ds.variables['time'][:] # time since reference
# Get reference date from time variable
time_var = ds.variables['time']
units = time_var.units # e.g., "seconds since 2009-01-01 00:00:00"
# Convert time to datetime
from netCDF4 import num2date
dates = num2date(time, units)
ds.close()
return temp, z, dates
# Get temperature at specific depth
depth_idx = 5 # 5m depth
temp_5m = temp[:, depth_idx]
# Get temperature at specific time
time_idx = 100 # Time step 100
temp_at_time = temp[time_idx, :]
from netCDF4 import num2date
from datetime import datetime
# Convert netCDF time to datetime
dates = num2date(time_values, time_units)
# Filter to specific date range
start = datetime(2009, 1, 1)
end = datetime(2015, 12, 31)
mask = (dates >= start) & (dates <= end)
filtered_temp = temp[mask, :]
# Interpolate to standard depths
from scipy.interpolate import interp1d
# Get simulated temps at exact depths
standard_depths = [0, 5, 10, 15, 20]
interpolator = interp1d(z, temp[time_idx, :], kind='linear')
interp_temps = interpolator(standard_depths)
temp[:, idx]) to avoid unnecessary I/Ods.close()