cesm_hawc.env¶
Process-wide setup needed by the simulation ([sim]) code paths.
Nothing in cesm_hawc changes global state on import. Call
configure_environment() yourself before running your own scripts
against the simulator, or use the cesm-hawc CLI, which calls it once at
startup.
configure_environment¶
def configure_environment() -> NoneApply the process-wide settings the [sim] code paths rely on.
Safe to call more than once (e.g. once in the main process and again in each worker process); calls after the first do nothing.
Notes¶
This function:
Disables astropy’s IERS Earth-orientation auto-download and its
auto_max_agecheck. Solar-geometry calculations don’t need arcsecond precision, compute nodes often have no internet access, and simulation dates can be years past astropy’s predictive IERS window.Silences the
hamiltonlogger. Hamilton, the DAG frameworkhawcsimulatoris built on, logs an error box for every node exception, including ones handled by the caller (such as a night-side observation being skipped). Genuine failures are still logged by cesm-hawc.Filters one known-benign message from
sys.unraisablehook:sasktran2’s Rust-backed objects raise an “unsendable ... _core_rust”RuntimeErrorwhen garbage-collected on a different thread from the one that created them. It cannot be caught withtry/exceptand does not affect results. Anything else is passed to the original hook.Patches the
hawcsimulatorcalibration-database race condition, ifhawcsimulatoris installed (seecesm_hawc.calibration.patch_calibration_database_race()).