Skip to content

Obtain xsecs from multiple databases, update default config, batch-create spectralfiles, and fill NaN appropriately - #37

Open
nichollsh wants to merge 19 commits into
mainfrom
hn/hybridxsec
Open

nichollsh wants to merge 19 commits into
mainfrom
hn/hybridxsec

Conversation

@nichollsh

@nichollsh nichollsh commented Oct 28, 2026 •

Copy link
Copy Markdown
Member
  • Can assemble a spectral file using xsecs from multiple sources (e.g. exocross and DACE together)
  • Updates the default parameters for creating spectral files
  • Adds a new script which can create multiple spectral files that differ by numbers of bands
  • Fills NaN values in sf_k files appropriately. Rather than setting to zero when the value underflows (at low temperatures), it interpolates from the nearest temperature
  • Update gas list to be consistent with latest SOCRATES
  • Fixes the H2O self-continuum, whose radiation term was previously applied twice. The spectraltools pipeline now passes the MT_CKD 4.3 netCDF file to Ccorr_k directly.
  • Fixes how HITRAN CIA files are read. Ccorr_k reads them in fixed column formats, which many of the current HITRAN files do not follow. spectraltools now rewrites each file in the expected columns before passing it to Ccorr_k.
  • Adds CO2-H2O, N2-CH4, O2-N2 collision-induced absorption from HITRAN.
  • Documents the PROTEUS spectral files in one summary table split by generation, with links to Zenodo and a subsection per codename. Adds a page describing the spectraltools pipeline, with a diagram, and lists the references for the opacity data.

Bumps the SOCRATES version to 2607.4

@nichollsh nichollsh changed the title Obtain xsecs from multiple databases Obtain xsecs from multiple databases, update default config, batch-create spectralfiles, and fill NaN appropriately Oct 28, 2026
The mt_ckd4p3 text tables in data/continua held the MT_CKD self-continuum coefficients already multiplied by the radiation term nu*tanh(hc*nu/2kT), with a factor 296/(101*T). Ccorr_k applies the radiation term itself, so spectral files made with MT_CKD_VERSION = "mt_ckd4p3" had an H2O self-continuum about 10 times too strong near 1000 cm-1 and 20 to 30 times too strong at 2000 to 3000 cm-1 at 296 K. The error varied with temperature, because Ccorr_k interpolates between the two tables.

spectraltools now passes the MT_CKD 4.3 reference netCDF file to Ccorr_k for both temperatures, as in examples/corr_k/prep_spec_300. Ccorr_k then reads coefficients without the radiation term and applies the temperature exponents in that file, (296/T)^texp. read_ckd_range reads the wavenumber range from the netCDF file. The faulty text tables and their plot are removed.

Above about 400 K this power law gives a stronger continuum than the exponential interpolation used with the mt_ckd3p2 tables: near 1000 cm-1 it is 6 times stronger at 600 K and about 1000 times stronger at 1000 K. Spectral files containing H2O that were made with mt_ckd4p3 should be remade.
Ccorr_k reads CIA headers with the fixed format (a20,2f10.4,i7,f7.2,...) and data lines with (f10.4,1x,e10.3). Many of the current HITRAN files do not follow these columns. Some headers give the wavenumber limits and temperature as integers, which are read with an implied decimal point, so a set at 296 K covering 5700-6300 cm-1 is read as 2.96 K covering 0.57-0.63 cm-1. Some data lines have five-digit mantissas, so 1.1391E-48 is read as 1.1391E-4. Others have left-aligned columns, which shifts digits between the two fields.

Reading each file the way Ccorr_k does shows misread values in N2-H2_2024, N2-N2_2021, O2-CO2_2024, O2-O2_2024, O2-N2_2024, CO2-CO2_2024, CO2-H2_2024, CO2-CH4_2024 and CO2-Ar_2021. The 2011 and 2018 files used here are read correctly. A Breezehome file built today has CO2-CO2 k-terms of up to 1e37 m5 kg-2 in five bands between about 1000 and 4650 cm-1 at all temperatures, and O2-O2 k-terms of up to 1.6e37 m5 kg-2 in three bands above 20000 cm-1 at 300 K and above.

calc_kcoeff_cia now writes a copy of each HITRAN file in the expected columns, parsing every line by whitespace, and passes the copy to Ccorr_k. Read back by column, the copies match the originals for every set, with cross-sections rounded to four significant figures (relative change below 5e-4). Spectral files containing pairs from the affected files should be remade.
Both pairs come from the HITRAN CIA database (CO2-H2O_2024.cia and N2-CH4_2024.cia). CO2-H2O has a single set at 296 K covering 5700-6300 cm-1, so Ccorr_k uses the 296 K values at all temperatures. N2-CH4 covers 0-800 cm-1 with 34 sets from 70 to 400 K, and Ccorr_k uses the 400 K values above that.
The pair was disabled because it behaved strangely. Its HITRAN file (O2-N2_2024.cia) is one of those that Ccorr_k misread before the CIA files were rewritten in its columns: 15 of its 33 headers and 15543 of its values. With the rewritten file, Ccorr_k gives k-terms of up to 2e-4 m5 kg-2 between 1300 and 13840 cm-1.
Restructure the PROTEUS spectral file reference into one summary table split by generation, with each band count linked to its Zenodo record, a subsection per codename and the references for the opacity data.

Add an overview page for spectral files, a page describing how spectraltools builds spectral files with a diagram of the pipeline, and a BibTeX file of the opacity references. Enable Mermaid diagrams in mkdocs.yml.
Also drop the note that the build script leaves S2 and H2S out of Atmora, which no longer holds.
Compare the pure-steam runaway limit from Snowline with published models, compare the OLR of Snowline, Breezehome and Volenfell across band counts, and compare Breezehome with line-by-line RFM fluxes for H2O and CO2 between 4026 and 4973 cm-1. The figures are made by the scripts in misc/validation/spectral_files in the AGNI repository, once for each colour scheme of the docs.
Tupload_zenodo.py uploads one record per codename and band count, holding the spectral file, its k-coefficient file, their checksums and the logs of the build. Before uploading it checks block 0 of the spectral file against the generator log, the BLAKE2b checksums, the k-coefficients for NaN or netCDF fill values, and each file against its copy in the packaged zip.

It is a dry run unless --upload is given, and targets the sandbox unless --production is given. It reserves the DOI of each draft, and finds drafts and records from earlier runs on Zenodo by title.
The droplet monitor log is 1.7 GB for a 2048-band file, far larger than the spectral file itself. The record description now names only the programs whose logs are uploaded.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant