Skip to content

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

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

nichollsh wants to merge 13 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, which previously had its 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.

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.

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