runtraj.models.hysplit.read_cdump#
- runtraj.models.hysplit.read_cdump(path, cmass=0, ichem=0, pollutant=None)[source]#
Read one of HYSPLIT’s binary concentration files (
cdump) as a Dataset.The file holds one grid: its header (the met, the release locations, the grid, the levels, the pollutants), then, for each sampling time, one record per pollutant per level. With
CPACK=1(HYSPLIT’s default; 3 is written the same way) a record lists only the cells that are not zero; withCPACK=0it holds every cell. Both read to the same Dataset.- Parameters:
cmass (
int) – Thecmasssetting the run had: 0 for concentrations, anything else for the mass in each cell. The file does not say, and the variables’unitsandlong_namedo.ichem (
int) – Theichemsetting the run had, which the file does not say either. With 6 the values are divided by air density, and theunitssay so. With 9 the first level reaches from the ground to a share of the mixed layer, andzsays so. With 1 or 10 what the file calls its pollutants are the release locations or the emission cycles of one pollutant, and the Dataset has one variable, named pollutant, with a dimension more (see Notes).pollutant (
str|None) – The name of the run’s one pollutant, with ichem 1 or 10, which the file does not hold.
- Returns:
Dimensions
time,z,lat,lon, and a float32 variable per pollutant, as the module describes.latandlonare the decimal degrees the grid was given, not the 4-byte floats the file holds (40.266, not40.26599884). Its attributes holdcpack,met_model(the met’s four-letter name), and the releaselocationsas[[lon, lat, height], ...]. Two-digit years are read as 1940 to 2039.- Return type:
Notes
With
ichem=1HYSPLIT numbers the release locations in the place of the pollutants (0001,0002, …). They are read as the dimensionsource, 1 to the number of locations, in the order of the release’s points, with the coordinatessource_lon,source_latandsource_heightfrom the file’s header.With
ichem=10HYSPLIT names each emission cycle by the tenths of an hour from the start of the run to the cycle’s start. They are read as the dimensionrelease_time, the UTC time each cycle starts.With
ichem=9each record of the first level holds the depth that level had for the last particle counted, in place of its height, so that depth is not checked, and not kept.- Raises:
ValueError – If the file is cut off, is not a concentration file, or was written with
CPACK=2(one point per grid), which this does not read; or if its pollutants are not what ichem 1 or 10 writes.- Parameters:
- Return type:
Examples
>>> ds = read_cdump("cdump") >>> ds["TEST"].sel(z=100).max()