Hi Pengwang,

Attached you find a simple example that shows how to set up a lookup table 
either based on batch atmospheres (abs_lookupSetupBatch) or manually with 
abs_lookupSetupWide.

For another example that also demonstrates how to cache the calculated table, 
you might want to look at this script:

https://github.com/atmtools/arts/blob/v2.6.x/controlfiles-python/artscomponents/heatingrates/Test_HeatingRate.py

Note that you need to add the catalog setup to the beginning of that script, if 
you want to run it yourself:

import pyarts
pyarts.cat.download.retrieve()

Cheers,
Oliver


> On 3. Nov 2025, at 21:42, Pengwang Zhai via arts_users.mi 
> <[email protected]> wrote:
>
> Hello,
>
> I wonder if there is an example python script file for ARTS 2.6 that I can 
> study for generating the gas absorption lookup table, as published in this 
> paper:
>
> S.A. Buehler, P. Eriksson, O. Lemke
> Absorption lookup tables in the radiative transfer model ARTS
> J Quant Spectrosc Radiat Transfer, 112 (10) (2011), pp. 1559-1567, 
> 10.1016/j.jqsrt.2011.03.008
>
> I have done this before with earlier versions of arts. I tried to use 
> arts_convert.py to convert my existing arts control files, but the resultant 
> py file generates too many errors.
>
> Yours,
>
> Pengwang




import pyarts
import numpy as np

import pyarts
pyarts.cat.download.retrieve(verbose=True)

ws = pyarts.Workspace()

# This is a minimalistic absorption lookup table example. It shows how to
# generate and safe the table.

kayser_grid = pyarts.arts.Vector(np.arange(1, 2500, 200))
ws.f_grid = pyarts.arts.convert.kaycm2freq(kayser_grid)

# Define absorption species. Add more species here for a more realistic table.
ws.abs_speciesSet(species=["H2O", "H2O-SelfContCKDMT400, H2O-ForeignContCKDMT400"])

# Line catalog.
print("Reading line catalog")
ws.abs_lines_per_speciesReadSpeciesSplitCatalog(basename="lines/")

# MT_CKD 4.0 water vapor continuum.
ws.ReadXML(output=ws.predefined_model_data, filename="model/mt_ckd_4.0/H2O.xml")

# Important, lines must have cutoff to be consistent with continuum.
ws.abs_lines_per_speciesCutoff(option="ByLine", value=750e9)

# We now have all the information required to compute the absorption agenda.
ws.propmat_clearsky_agendaAuto()

# Set a bunch of necessary variables.
ws.stokes_dim = 1
ws.atmosphere_dim = 1
ws.lbl_checkedCalc()

#
# Setup lookup table based on batch atmospheres.
#

# # We load a batch of atmospheres (the Garand profiles). The table will be
# # configured to cover the range of conditions of these atmospheres.
# ws.ReadXML(ws.batch_atm_fields_compact, "planets/Earth/Garand/garand_profiles.xml.gz")
#
# # Configure table generation. This sets up the temperature and humidity.
# # ranges, for example.
# ws.abs_lookupSetupBatch()

#
# Manual setup of a wide lookup table
#
ws.abs_lookupSetupWide(t_min=150., t_max=320., p_step=0.1)

# Calculate / generate table.
print("Calculating lookup table")
ws.abs_lookupCalc()

# Write to file.
ws.WriteXML(input=ws.abs_lookup, output_file_format="binary", filename="lookup.xml")

# Set up the propmat_clearsky_agenda to use the lookup table for calculations hereafter
ws.propmat_clearsky_agendaAuto(use_abs_lookup=1)

# Calculations go here....

Reply via email to