Exceptions#

Every exception PYSTILT raises is a stilt.StiltError, so one except clause catches them all:

import stilt

try:
    project.run()
except stilt.StiltError as error:
    print(f"PYSTILT stopped: {error}")

Each one also subclasses the builtin that describes it. A SimulationError is a RuntimeError and a HYSPLITNotFoundError is a FileNotFoundError, so code that catches the builtin keeps working. Plain input checks, such as a negative particle count, raise ValueError.

Base class#

stilt.StiltError

Base class for every exception PYSTILT raises.

Failed runs#

A worker records a SimulationError as a failed simulation (stilt.Simulation.failure). Its reason is a short name for the cause: for HYSPLIT, one of stilt.transport.hysplit.FailureReason, such as MET_COVERAGE, NO_PARTICLE_DATA, or TIMEOUT. A run that the meteorology does not cover fails as MET_COVERAGE.

stilt.exceptions.SimulationError

A simulation failed while it ran.

stilt.exceptions.MeteorologyError

The meteorology files a simulation needs could not be found or staged.

Setup#

stilt.exceptions.HYSPLITNotFoundError

The HYSPLIT executable (hycs_std) is missing.

Empty footprints#

EmptyFootprint is a finished result, not a failure. stilt.calc_footprint() raises it when no particle reaches the grid, and a run writes a footprint file with no rows, marked empty (Output Layout).

stilt.exceptions.EmptyFootprint

No particle is over the footprint grid, so there is no footprint.