HYSPLIT Integration#
HYSPLIT is the transport model behind every simulation, unless a variant
names another. The worker gets it as
runtraj.models.hysplit.HysplitModel (see Execution), which
picks the met files, writes HYSPLIT’s input files, runs hycs_std, and
reads the particles it writes.
Config#
runtraj.models.hysplit.HysplitConfig holds every setting that
shapes the particles HYSPLIT makes. In config.yaml they are the keys
of the hysplit block under models:.
HYSPLIT's config: every setting that shapes the particles it makes. |
The HYSPLIT build#
PYSTILT includes no HYSPLIT. find_hycs_std()
returns the hycs_std a run uses: exec/hycs_std under directory, or else the
first on PATH (Installation).
HysplitModel.sha256
is its checksum, part of each run’s settings, and
HysplitModel.version
the version it prints when it starts, recorded beside them.
data_tables() gives HYSPLIT’s data tables a
run uses, from the bdyfiles/ folder of directory or beside the
hycs_std on PATH.
Return the |
|
Return HYSPLIT's data tables a run uses, by name: a file to link, or the text to write. |
Running HYSPLIT#
write_inputs() writes everything
hycs_std reads into a folder: CONTROL, SETUP.CFG, and the error
and mixed-layer files when the settings call for them. It takes what
CONTROL starts from: a release time and release locations (latitude,
longitude and height, in CONTROL’s order), with kmsl 0 for heights
above ground and 1 above sea level, as SETUP.CFG’s KMSL.
HysplitModel passes a release’s time,
release points (release.coords()) and altitude_ref.
run_hycs_std() runs hycs_std in the
folder, and read_particle_dat() reads its
PARTICLE_STILT.DAT as a particle table. Use them to look at or change
the input files of a run. A project run then adds the release heights and,
when it makes the footprint, the near-field correction
(The Particle Table); by hand:
from pathlib import Path
from stilt.footprint import correct_near_field
from runtraj.particles import add_release_heights
from runtraj.models.hysplit import (
HysplitConfig,
read_particle_dat,
run_hycs_std,
write_inputs,
)
config = HysplitConfig(n_hours=-24, numpar=200)
write_inputs(
"run",
release_time=release.time,
locations=release.coords(),
config=config,
met_files=met_files,
kmsl=1 if release.altitude_ref == "msl" else 0,
)
run_hycs_std(Path("run"))
particles = read_particle_dat("run/PARTICLE_STILT.DAT", config.varsiwant)
particles = add_release_heights(particles, release)
particles = correct_near_field(particles, release, config.veght)
Write everything |
|
Run the |
|
Read HYSPLIT's particle file as a particle table. |
Failure reasons#
When a run ends, PYSTILT reads HYSPLIT’s log for the messages it knows.
When the particles stopped before n_hours, it also checks where: a
particle more than 5 grid cells inside the met’s domain means the met ran
out (MET_COVERAGE), since particles that leave the domain end at its
edge (Validation). A known failure, a timeout, or a run
without particle output raises a
SimulationError whose reason is a
runtraj.models.hysplit.FailureReason. The worker records it, and
stilt.Simulation.failure and stilt status report it.
Each reason, what happened, and what to do:
Reason |
What happened, and what to do |
|---|---|
|
The meteorology does not cover the run. The message says which:
|
|
The met files do not all have the same time step, such as hourly and 3-hourly files mixed in one directory. Keep one product per met. |
|
The transport model ran but wrote no particles. Read the log
( |
|
HYSPLIT stopped with a Fortran error, which the message names. Read
the log and the kept workdir’s |
|
HYSPLIT reached |
|
|
|
The run took longer than |
an error’s name |
Any other error is recorded by its class, such as |
Why a HYSPLIT run failed. |