run2_netcdf_rmse_evaluation
Instructions for safely parsing GLM NetCDF output with netCDF4 and correctly executing an exact datetime + rounded-depth merge.
- License 许可
- MIT
- 最近更新
- 2026-10-02
- Stars
- ★ 93
- Forks
- 8
01 前言 Front Matter
- name
- run2_netcdf_rmse_evaluation
- description
- Instructions for safely parsing GLM NetCDF output with netCDF4 and correctly executing an exact datetime + rounded-depth merge.
03 SKILL.md 正文
GLM Evaluation (Improved)
This skill describes how to correctly open and extract depth and temperature from GLM output.nc without coordinate conflict errors, and how to compute exact match RMSE against field data.
Loading and Interpolating
Using xarray to open output.nc will likely result in a MissingDimensionsError because GLM defines a z variable with a dimension that shares its name.
Instead, rely on the netCDF4 library natively.
import netCDF4 as nc
import pandas as pd
import numpy as np
# Load simulation
ds = nc.Dataset('output.nc')
times = nc.num2date(ds.variables['time'][:], ds.variables['time'].units)
datetimes = pd.to_datetime([t.strftime('%Y-%m-%d %H:%M:%S') for t in times])
z = ds.variables['z'][:, :, 0, 0]
temp = ds.variables['temp'][:, :, 0, 0]
ns = ds.variables['NS'][:] # Number of simulated layers at each time step
Depth Extraction
GLM saves z as distance from the lake bottom. The distance from the surface down (which field data typically uses) is dynamically derived using surface_z - z:
depths = np.array([z[i, ns[i]-1] - z[i, :ns[i]] if ns[i] > 0 else [] for i in range(len(ns))])
Creating Paired Dataset
To perform the exact datetime and rounded-depth merge:
- Construct a flat
sim_dfof valid datetime, rounded depth, and simulated temperature pairs. - Format
obsdatetime to match, and generate itsdepth_rounded. - Perform an explicit merge
pd.merge(obs, sim_df, on=['datetime', 'depth_rounded']). Avoid "alternative depth binning" (likegroupby().mean()) unless explicitly instructed; GLM layers matching the same rounded integer will create multiple paired rows.
04 同仓库更多 Skills
object_counter
Count occurrences of an object in the image using computer vision algorithm.
travel-planning-workflow
Invoke this skill when performing travel planning. It defines a structured workflow for generating itineraries. Following this workflow is essential to ensure the final plan satisfies user requirements.
bundled-dataset-search-tool
invoke this skill when you need to perform database search for travel planning. This skill provides some useful pre-packaged tools to look up accommodations, attractions, cities, driving distance, flights, and restaurants from the bundled dataset.
glm-output
Output-processing guidance for GLM tasks. Especially useful after glm-basics and glm-calibration when you need verifier-matching metrics from output.nc and a final /root/metrics.json.
glm-calibration
Calibration guidance for GLM tasks. Often most effective after glm-basics has clarified the setup; glm-output is the companion skill for exact final metric computation.
glm-basics
A good starting point for GLM calibration tasks. Use to inspect glm3.nml, confirm how GLM runs, and identify the relevant files before moving on to calibration and output evaluation.