runtraj.models.flexpart.read_partoutput#

runtraj.models.flexpart.read_partoutput(paths, release_time)[source]#

Read FLEXPART 11 partoutput files as one particle table.

Each row is a particle at an output time when FLEXPART wrote it, so a particle not yet released or already gone has no row. FLEXPART skips a particle in the step it is released, so there is no release row at age = 0.

lon, lat, and z become lon, lat, and zagl; the other fields that HYSPLIT also writes take HYSPLIT’s names (PARTICLE_COLUMNS), so hmix is mlht and rho is dens, and pres is in hPa. Every other field keeps FLEXPART’s name, such as pv or hmix_av, with NaN where FLEXPART wrote its fill value.

Parameters:
  • paths (str | PathLike[str] | Iterable[str | PathLike[str]]) – The partoutput_*.nc files of one run, in any order.

  • release_time (datetime) – Time the particles were released, which age counts from. For a backward run it is usually the run’s IEDATE and IETIME.

Returns:

particle, age (seconds, negative for a backward run), lon, lat, zagl, then the other fields, ordered by output time as FLEXPART wrote them and by particle within a time.

Return type:

DataFrame

Raises:
  • FileNotFoundError – If a file does not exist.

  • ValueError – If no file is given, a file has no lon, lat, or z, a field is on FLEXPART’s grid rather than per particle (the output of a domain-filling run, MDOMAINFILL 1).

Examples

>>> particles = read_partoutput(
...     "output/partoutput_20230601180000_init.nc",
...     release_time=dt.datetime(2023, 6, 1, 18),
... )