LibRadtran_input_generator is a Codex skill and lightweight command-line helper for
creating libRadtran uvspec and mie input files from high-level radiative-transfer
simulation goals.
The package is designed for cases where small convention mistakes can change the physical
meaning of a run: viewing geometry, umu sign, satellite zout, cloud optical thickness,
cloud-file format, spectral model choice, solver choice, and batch sweep bookkeeping.
Use this package to:
- Generate runnable libRadtran
.INPfiles for radiance, irradiance, TOA reflectance, BRDF, cloud, aerosol, and satellite-band simulations. - Choose appropriate
uvspecsettings such asmol_abs_param,rte_solver,number_of_streams,output_quantity, andoutput_user. - Create companion files such as water-cloud
.wcfiles and discrete wavelength grids. - Build parameter sweeps and lookup-table inputs for HPC job arrays.
- Review or debug existing libRadtran inputs for common geometry, path, cloud, and solver mistakes.
- Generate
mieinputs for cloud optical-property files used byuvspec.
The repository contains:
SKILL.md Codex skill instructions
agents/openai.yaml Codex Desktop UI metadata
scripts/libradtran_gen.py JSON spec to libRadtran input generator
references/ Solver, geometry, option, and CLI guidance
assets/templates/ Commented starting-point .INP templates
- Codex Desktop or Codex CLI with local skill support.
- This repository installed under Codex's skills directory.
Install with:
git clone https://github.com/zzbatmos/LibRadtran_input_generator.git \
~/.codex/skills/libradtran-input-generatorStart a new Codex Desktop thread or CLI session after installation so the skill is discovered.
- Python 3 for the command-line generator.
- No third-party Python packages are required.
A working libRadtran installation, ideally libRadtran 2.0.x, including:
- compiled
bin/uvspecandbin/mie, - the
data/directory, - the
examples/directory, - optionally
doc/libRadtran.pdffor detailed option lookup.
The package writes input files. It does not require libRadtran to generate .INP files,
but libRadtran is required to execute them.
Path convention matters: relative paths inside a libRadtran .INP are resolved from the
directory where uvspec is launched. For portable runs, especially on HPC systems, set
libradtran_root in the JSON spec so generated inputs use absolute paths.
Invoke the skill explicitly in Codex:
Use $libradtran-input-generator to create a DISORT uvspec input for satellite-view
water-cloud BRDF at 865 nm, SZA 30, VZA 45, cloud tau 20, reff 10 um, and Cox-Munk ocean
surface with wind speed 7 m/s.
Codex will use the workflow in SKILL.md to:
- Map the request onto atmosphere, source, surface, scatterers, geometry, solver, and output settings.
- Ask only for missing parameters that are physically decisive and unsafe to default.
- Write the
.INPand any companion files. - State assumptions such as cloud layer, view azimuth, or path convention.
- Suggest convergence and sanity checks.
Useful request patterns:
Use $libradtran-input-generator to review this uvspec input for geometry and path errors.
Use $libradtran-input-generator to generate a Nakajima-King lookup-table sweep over cloud
tau and effective radius at 865 and 2100 nm.
Use $libradtran-input-generator to create a MYSTIC polarized Stokes-vector input for a
water cloud and explain which Mie optical-property file I need.
Create a template JSON spec:
python3 scripts/libradtran_gen.py --example > spec.jsonEdit spec.json, then generate input files:
python3 scripts/libradtran_gen.py spec.json --outdir out --printExample minimal spec:
{
"output": "water_cloud_brdf.INP",
"libradtran_root": "/path/to/libRadtran-2.0.6",
"atmosphere": "tropical",
"wavelength": 865,
"spectral_model": "crs",
"surface": {"albedo": 0.05},
"cloud": {
"type": "water",
"tau": 20,
"reff": 10,
"base_km": 2.0,
"top_km": 3.0,
"properties": "hu"
},
"geometry": {
"sza": 30,
"sun_azimuth": "north",
"sensor": "satellite",
"vza": 45,
"view_azimuth": "east"
},
"solver": "disort",
"streams": 16,
"output_quantity": "reflectivity",
"output_user": ["lambda", "uu"]
}Run the generated file:
/path/to/libRadtran-2.0.6/bin/uvspec < out/water_cloud_brdf.INP > out/water_cloud_brdf.OUTList-valued fields create a cross product of cases and a manifest CSV. Supported sweep
fields include cloud.tau, cloud.lwp, cloud.reff, geometry.sza, and geometry.vza.
{
"output": "nk.INP",
"libradtran_root": "/path/to/libRadtran-2.0.6",
"wavelength_list": [865, 2100],
"spectral_model": "crs",
"surface": {"albedo": 0.05},
"cloud": {
"type": "water",
"tau": [1, 3, 10, 30, 100],
"reff": [5, 10, 15, 20, 25, 30],
"properties": "hu"
},
"geometry": {
"sza": 30,
"sun_azimuth": "north",
"sensor": "satellite",
"vza": 45,
"view_azimuth": "east"
},
"solver": "disort",
"streams": 16,
"output_quantity": "reflectivity",
"output_user": ["lambda", "uu"]
}Generate the sweep:
python3 scripts/libradtran_gen.py spec.json --outdir outRun cases in parallel:
tail -n +2 out/nk_manifest.csv | cut -d, -f2 \
| xargs -P 8 -I {} sh -c '/path/to/libRadtran-2.0.6/bin/uvspec < out/{} > out/{}.out'For DISORT radiance or BRDF runs, rerun with doubled number_of_streams and confirm the
result is stable. Clouds and aerosols with sharp forward scattering often need more streams.
For MYSTIC runs, rerun with 3-10x more mc_photons and confirm the Monte Carlo noise is
acceptable. For polarization on the principal plane, Stokes U should be close to zero
within Monte Carlo noise.
Always confirm:
zoutmatches the sensor location, especiallyzout toafor satellite output.umusign matches viewing direction: positive for upwelling/satellite-looking-down, negative for ground-looking-up.- cloud and aerosol optical-property files cover the requested wavelengths and effective radius range.
- relative paths are valid from the directory where
uvspecis launched.