Glm lake mendota

From XuShuwenn/RedAct · View interactive version

Glm lake mendota is an AI agent skill from the GitHub repository XuShuwenn/RedAct. Run General Lake Model (GLM) to simulate vertical water temperature with RMSE < 2 degrees Celsius against observations.

How to use this skill

Skill file

General Lake Model (GLM) Simulation

When to Use

Required Execution Protocol

Input Files

Use these exact absolute paths consistently in every command and script. Do not switch to relative paths like output/output.nc, glm3.nml, or field_temp_oxy.csv when the task specifies /root/... locations.

Output

Key Steps

  1. Load forcing data from /root/bcs/

1a. Before the first run, inspect /root/glm3.nml, sample /root/field_temp_oxy.csv, and confirm the expected forcing files exist under /root/bcs/ so variable names, dates, paths, and driver availability are verified before expensive runs.

  1. Load field observations from CSV
  2. Configure GLM parameters in glm3.nml
  3. Run simulation
  4. Calculate RMSE against observations
  5. Adjust parameters if RMSE > 2°C
  1. Inspect glm3.nml and output.nc metadata before scoring so your RMSE method matches the real variable names, time units/origin, depth structure, and simulation period.

7a. Build one reusable deterministic evaluation script or command sequence early, then use that same scoring pipeline for the baseline and every calibration trial.

7a1. If you create or rewrite an evaluation or calibration script, immediately read it back or print the key sections before executing it; verify the real code contains the intended paths, variable names, date handling, parameter edits, and output locations.

7a1b. Before executing a new Python helper, prefer a concrete validation step such as python3 -m py_compile /root/script.py with the actual available interpreter, then inspect the saved file directly if validation fails or output is ambiguous.

7a2. Do not rely on a script whose contents you have only described in prose or assumed were written correctly.

7b. Inspect /root/field_temp_oxy.csv header and sample rows early, then compute RMSE by aligning simulation and observations on shared datetime and depth bins: read the real NetCDF time units/origin and variable names, convert GLM layer structure into physical depths comparable to the observations, standardize depths only to the observation resolution if needed, handle duplicate time-depth pairs consistently, and score only matched pairs rather than index-aligned arrays.

7b1. Before calibration, also inspect the forcing files under /root/bcs/ enough to confirm they exist and cover the intended simulation period; do not spend time tuning a setup whose drivers cannot support 2009-01-01 to 2015-12-30.

7b2. When validating the RMSE pipeline, print a small alignment sanity summary before trusting the score: matched-pair count, simulation date range, observation date range used, and a few merged datetime/depth rows. If matches are unexpectedly sparse, fix alignment before tuning parameters.

7c. Do this before trusting any custom RMSE script: do not hard-code start dates, lake depth, array indexing, or assumed coordinate names without confirming them from the actual files.

  1. Start with a baseline run and baseline RMSE before changing parameters.

8a. Make the baseline measurable, not implied: run a concrete command or script that reads /root/output/output.nc, aligns it with /root/field_temp_oxy.csv, and prints the baseline RMSE before proposing any parameter edits.

8a1. Do not propose calibration, optimization, or parameter changes until the transcript contains an explicit baseline RMSE calculation from /root/output/output.nc versus /root/field_temp_oxy.csv.

8a2. Treat existing files alone as insufficient evidence: baseline evaluation requires a real command or script whose output visibly prints the computed metric or writes it to a file that you then read back.

8b. If you need automation, first create the evaluator or calibration script as a real file, inspect it briefly, and then call it by path; never use a placeholder shell command that only describes intended work.

8c. Before any iterative calibration, optimization, or script-driven rewriting of /root/glm3.nml, save a backup or known-good copy, and confirm the GLM executable/runtime you plan to call is actually available in this environment; treat a missing executable as an environment problem to fix before tuning parameters.

8d. Prefer one inspected reusable script that performs the full measurable cycle from saved /root/glm3.nml: run GLM, verify fresh readable /root/output/output.nc, align output with /root/field_temp_oxy.csv, and print RMSE. Use this same script first for the baseline and again after each accepted parameter change and for the final confirmation run.

  1. After the first successful baseline run, keep that run and its RMSE as the calibration baseline; inspect signed bias or residual structure by depth/time before the next trial so parameter choice follows the observed error pattern rather than a blind sweep. Larger deep-water bias often points first toward light-extinction or mixing-related parameters; near-surface bias may justify surface heat-flux factors such as modest sw_factor/lw_factor adjustments if present.
  2. If the baseline RMSE misses the target, convert diagnosis into at least one concrete calibration trial: make a small number of confirmed parameter edits in /root/glm3.nml, rerun GLM, and recompute RMSE from the new /root/output/output.nc; do not treat analysis alone as progress

10a. Do not stop after bias or error interpretation. Unless the model is currently unrunnable, the next state after diagnosis must be a real trial with persisted glm3.nml edits, a completed rerun, and a newly computed RMSE.

10b. Do not stop after launching a calibration or optimization script. Wait for it to finish, inspect whether it actually changed parameters and produced a new run, then recompute RMSE from the resulting fresh /root/output/output.nc.

10c. Treat statements like "next I would tune ..." as incomplete until you have actually applied the change, run GLM again, and scored the resulting output..

10d. If baseline RMSE is above 2°C and the model is runnable, do not end the session on analysis alone: complete at least one explicit edit to /root/glm3.nml, rerun GLM, and print the new RMSE before any final summary or completion signal.

  1. For each calibration trial, restore a known-good baseline glm3.nml, apply only that trial's edits, reread or diff the file to confirm the intended parameter change persisted, run GLM, confirm fresh readable /root/output/output.nc, and compare the new RMSE against the previous best.
  2. Prefer one-parameter or small bounded trials before broad optimization, especially when the baseline RMSE is already close to 2°C; start with a compact set of physically meaningful high-impact parameters such as light extinction (Kw), mixing coefficients (for example coef_mix_hyp if present), wind scaling (wind_factor or coef_wind_stir), longwave/shortwave scaling (lw_factor/sw_factor), or related surface exchange coefficients that you have confirmed exist in /root/glm3.nml.
  3. Before any automated search or expensive optimization, validate one complete edit -> run -> verify -> score cycle: confirm the target parameter exists, make one small edit, rerun GLM once, confirm readable fresh /root/output/output.nc, and recompute RMSE with the same evaluator.

13a. Do not start with a full optimization when the baseline RMSE is already close to target; first try one or a few small targeted parameter edits or a tiny bounded sweep that you can monitor end to end.

13b. Any longer calibration loop must be instrumented and bounded before you rely on it: emit per-trial logs, cap the number of trials or runtime, and verify that logs, output files, and metrics are actually updating. If logs stay empty or files do not change, stop and switch to a simpler manual or tightly bounded approach.

13c. If an automated calibration attempt stalls, times out, or produces empty logs, do not keep waiting based on guesswork; inspect process state and outputs once, then fall back to explicit short trials.

13c1. After one timeout or two non-informative status checks, stop passive polling and switch to a bounded foreground workflow you can finish in-session.

13d. For a concrete bounded pattern, see monitorable calibration loops.

13e. Before trusting any automated calibration, show at least one concrete trial command end to end in the transcript: exact parameter edit, exact GLM run command, exact RMSE command or script path, and the resulting metric.

  1. If a run stops early or /root/output/output.nc does not span 2009-01-01 to 2015-12-30, check both the configured start/stop times in glm3.nml and the actual date ranges in the forcing files under /root/bcs/ before recalibrating.
  2. After every run, verify the command exited successfully, /root/output/output.nc was regenerated and is readable, and the output covers 2009-01-01 to 2015-12-30 before using the RMSE.

15a. Treat partial-period output as invalid even if the file is readable or the RMSE looks good: confirm the NetCDF time range reaches the required end date before accepting any score or preserving a trial as working.

15b. If a configuration seems promising, preserve that exact runnable glm3.nml and verify metric plus full date coverage before replacing it or resetting to another configuration.

15c. Verify any reported RMSE with an independent check after model execution: run a separate read-only command or script that reopens fresh /root/output/output.nc, realigns it with /root/field_temp_oxy.csv, and recomputes RMSE before trusting scores produced by a calibration or optimization script.

15d. If the independent verification disagrees, or reveals stale or partial output, trust the independent recomputation and debug run completion, file freshness, date coverage, or scoring alignment before continuing calibration.

  1. Treat the task as complete only after a fresh final run with the saved best configuration, /root/glm3.nml left in that final best reproducible state, and an explicitly recomputed RMSE < 2°C if claiming the target is met.

16a. Final verification must check both metric attainment and artifact persistence: confirm the saved /root/glm3.nml still contains the winning parameter values and that /root/output/output.nc came from a fresh rerun of that saved file, not from a temporary intermediate trial.

  1. When a trial improves RMSE, write the winning values back into /root/glm3.nml, rerun GLM from that saved file, and recompute RMSE from the fresh output before claiming success.

17a. After saving a winning trial, reread or diff the relevant glm3.nml lines to confirm the exact tuned values persisted; do not rely on the edit command alone as evidence.

17b. Before ending, verify that the tuned values visible in /root/glm3.nml match the best-scoring trial you are reporting, and that /root/output/output.nc from that saved configuration was freshly regenerated and still spans the full required period.

  1. If you expect to test more than a couple of parameter sets, script the full loop (edit glm3.nml -> run GLM -> recompute RMSE -> record result) so trials are reproducible and the final saved configuration matches the best-scoring run; see RMSE alignment and bounded calibration.

18d. For focused near-target manual trials or tiny sweeps over high-impact terms, see focused high-impact parameter selection.

18a. Once one manual baseline edit -> run -> verify -> score cycle works, prefer a small reproducible script that bundles parameter edits, GLM execution, and RMSE recomputation in one bounded loop so every candidate is scored with the same pipeline.

18b. Keep that automation inspectable and bounded: print or save one record per trial with parameter values, run status, RMSE, and current best; preserve the best runnable configuration as trials improve; and stop using the loop if it no longer produces fresh output or updated metrics.

18c. After any automated search completes, do not trust an optimizer's in-memory best alone: load the saved best configuration, rerun GLM once from that file, and recompute RMSE from the fresh /root/output/output.nc before claiming improvement or success.

  1. If you create any helper script for RMSE or calibration, immediately read it back or print it and verify it contains real executable code, correct absolute paths, and the intended logic before running it.
  2. Prefer direct one-off commands or a tiny bounded loop until one full edit -> run -> verify -> score cycle is working; do not start a long unattended calibration process unless it has explicit small bounds, visible per-trial output, and enough time to finish.
  3. If you start any background job, treat the task as unfinished until you have waited for completion, checked logs and return status, verified fresh /root/output/output.nc, recomputed RMSE, and then emitted the required completion signal.

Calibration Guardrails

Calibration Guardrails

Tips

Execution and Verification

Execution and Verification

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.