agentsclimarketplace

Glm config management

Skill cxcscmu/SkillLearnBench/skills/b4-skill-creator-claude-haiku-4-5/temperature-simulation/glm-config-management

[COLM'26] SkillLearnBench is the first benchmark for evaluating continual learning methods that automatically generate agent skills.

Install
npx -y skills add cxcscmu/SkillLearnBench --skill glm-config-management

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

What its author says it does

Copied from the file, not written here

Managing and modifying GLM configuration files (glm3.nml) for calibration. Use this skill whenever you need to safely update GLM parameters, preserve non-calibration settings, validate configuration syntax, or manage multiple parameter sets. Essential for iterative calibration workflows where parameters must change reliably without corrupting the config.

SKILL.md

4.7 KB, as published. Nobody here has run it

GLM Configuration File Management

Configuration File Format

GLM uses Fortran namelist format (.nml files). Structure:

&section_name
  parameter1 = value1
  parameter2 = value2
/

Key rules:

  • Sections delimited by &section_name (start) and / (end)
  • Each parameter on its own line
  • Values must match Fortran types (reals for decimals, integers for ints, strings in quotes, logicals .true./.false.)
  • Commas optional but allow consistency
  • Comments not allowed in namelist sections

Calibration-Safe Parameter Updates

Parameters You CAN Modify

In &light:

  • Kw: Real number, currently ~0.3

In &mixing:

  • coef_mix_hyp: Real number, currently ~0.5

In &meteorology:

  • wind_factor: Real number, currently ~1.0
  • lw_factor: Real number, currently ~1.0
  • ch: Real number, currently ~0.0013

Parameters You MUST NOT MODIFY

&meteorology:

  • sw_factor (solar shortwave multiplier)
  • cd (drag coefficient)
  • ce (evaporation coefficient)

&init_profiles:

  • the_depths (initial depth levels)
  • the_temps (initial temperatures)
  • the_sals (initial salinities)

All other sections:

  • Time period, morphometry, inflows, outflows, etc.

Safe Update Procedure

Python Method (Recommended)

import re

def update_glm_parameter(nml_file, section, param, value):
    """
    Update a single parameter in GLM config, preserving all else.

    Args:
        nml_file: Path to glm3.nml
        section: Section name (e.g., 'light', 'mixing', 'meteorology')
        param: Parameter name (e.g., 'Kw', 'wind_factor')
        value: New value (will be formatted appropriately)
    """
    with open(nml_file, 'r') as f:
        content = f.read()

    # Build regex pattern for the parameter line
    # Matches: param = value (with possible whitespace, commas)
    pattern = rf'({param}\s*=\s*)[-+]?\d*\.?\d+([eE][-+]?\d+)?'

    # Format value
    if isinstance(value, float):
        replacement = rf'\g<1>{value}'
    else:
        replacement = rf'\g<1>{value}'

    # Replace only first occurrence (assumes one per section)
    content_new = re.sub(pattern, replacement, content, count=1)

    # Verify replacement happened
    if content == content_new:
        raise ValueError(f"Parameter {param} not found in &{section}")

    # Write back
    with open(nml_file, 'w') as f:
        f.write(content_new)

    print(f"Updated {section}.{param} to {value}")

# Usage:
update_glm_parameter('/root/glm3.nml', 'light', 'Kw', 0.35)
update_glm_parameter('/root/glm3.nml', 'mixing', 'coef_mix_hyp', 0.45)

Bash Method (Using sed)

# Update Kw in &light section
sed -i 's/Kw = [0-9.e]*/Kw = 0.35/' /root/glm3.nml

# Verify update
grep -A 5 '&light' /root/glm3.nml | grep Kw

Warning: Bash sed is fragile with Fortran format. Use Python for safety.

Validation Procedures

Syntax Check (Python)

import f90wrap  # or similar parser
# Can validate Fortran namelist format
# OR simply run: glm --help (if supported)

Functional Check

cd /root
glm  # Will fail with clear error if config is invalid
# If GLM runs without error, config is OK

Diff Before/After

diff -u glm3.nml.backup glm3.nml

Parameter Ranges and Defaults

ParameterSectionMinDefaultMaxType
Kwlight0.10.30.5real
coef_mix_hypmixing0.30.50.7real
wind_factormeteorology0.71.01.3real
lw_factormeteorology0.71.01.3real
chmeteorology0.00050.00130.002real
sw_factormeteorology-0.95-(locked)
cdmeteorology-0.0013-(locked)
cemeteorology-0.0013-(locked)

Backup Strategy

Before starting calibration:

cp /root/glm3.nml /root/glm3.nml.backup

If config becomes corrupted, restore:

cp /root/glm3.nml.backup /root/glm3.nml

Multi-Iteration Record

For tracking iterations, use a log:

{
  "iteration": 1,
  "parameters": {
    "Kw": 0.30,
    "coef_mix_hyp": 0.50,
    "wind_factor": 1.0,
    "lw_factor": 1.0,
    "ch": 0.0013
  },
  "rmse": {
    "overall": 1.82,
    "annual_deep": 1.90,
    "summer_deep": 1.95
  },
  "timestamp": "2024-03-23T10:30:00Z"
}

This allows retracing steps if needed.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.