Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

cesm_hawc.config

cesm_hawc.config

source

Read and validate the config.toml file used by the CLI.

A config has one required table, [case] (what to read and where to write), one table per run mode ([fixed], [orbit]) and an optional [instrument] table. Paths are expanded with os.path.expanduser when loaded.

Examples

>>> from cesm_hawc.config import load_config
>>> cfg = load_config("config.toml")
>>> cfg.case.name
'my_case'

ConfigError

class ConfigError(Exception)

source

A config file, table or required key is missing or invalid.

CaseConfig

class CaseConfig(
    name: str,
    waccm_dir: str,
    pattern: str,
    out_dir: str,
    n_workers: int = 1,
    time_index: int = 0,
    start_date: str | None = None,
    end_date: str | None = None,
    run_l2: bool = False,
    strip_ozone: bool = False,
)

source

The [case] table: the model case to process and shared options.

Attributes

CaseConfig.from_toml_dict

classmethod from_toml_dict(d: dict) -> 'CaseConfig'

source

Build from the parsed TOML table d, applying defaults.

Raises

CaseConfig.waccm_dir_for

def waccm_dir_for(name: str) -> str

source

Return waccm_dir with {name} replaced.

Parameters

Returns

FixedConfig

class FixedConfig(
    tangent_lat: float,
    tangent_lon: float,
    sza_deg: float = 60.0,
    saa_deg: float = 0.0,
    obs_time: str | None = None,
)

source

The [fixed] table: one column at a fixed point per history file.

Attributes

FixedConfig.from_toml_dict

classmethod from_toml_dict(d: dict) -> 'FixedConfig'

source

Build from the parsed TOML table d, applying defaults.

Raises

OrbitConfig

class OrbitConfig(
    orbit_dir: str,
    orbit_pattern: str = 'orbit_*.nc',
    orbit_epoch: str = '2019-08-01',
    center_pixel: int = 256,
    h2_cadence: str = 'daily',
    obs_cadence_s: float = 60.0,
)

source

The [orbit] table: observations along a real HAWC orbit track.

The n-th model date (sorted) uses orbit day n mod D, where D is the number of days the orbit set spans from orbit_epoch.

Attributes

OrbitConfig.from_toml_dict

classmethod from_toml_dict(d: dict) -> 'OrbitConfig'

source

Build from the parsed TOML table d, applying defaults.

Raises

InstrumentConfig

class InstrumentConfig(
    wavelengths_nm: list[float],
    alt_grid_start_m: float,
    alt_grid_stop_m: float,
    alt_grid_step_m: float,
)

source

The [instrument] table: simulated wavelengths and altitude grid.

The noise model is not configurable; see cesm_hawc.noise.default_noise_model().

Attributes

InstrumentConfig.from_toml_dict

classmethod from_toml_dict(d: dict) -> 'InstrumentConfig'

source

Build from the parsed TOML table d, applying defaults.

InstrumentConfig.altitude_grid_m

def altitude_grid_m()

source

Return the altitude grid.

Returns

CesmHawcConfig

class CesmHawcConfig(
    case: CaseConfig,
    fixed: FixedConfig | None,
    orbit: OrbitConfig | None,
    instrument: InstrumentConfig,
)

source

A loaded config file, as returned by load_config().

Attributes

load_config

def load_config(path: str | Path) -> CesmHawcConfig

source

Load and validate a config file.

Parameters

Returns

Raises