runtraj.concentration.describe_grid#
- runtraj.concentration.describe_grid(ds, units, long_name)[source]#
Give a grid’s coordinates and variables their units and meanings, in place, and return it.
A transport model that makes concentration calls it on each grid it reads, so that every model’s grids say the same about the coordinates. What the variables hold depends on the model and its settings, so the model says it.
- Parameters:
ds (
Dataset) – A grid, with the coordinates ofCONCENTRATION_DIMSandtime_end.units (
str) – Theunitsattribute of every variable.long_name (
str) – Thelong_nameattribute of every variable, where{name}is the variable’s own name.
- Return type:
Examples
>>> import numpy as np >>> ds = xr.Dataset( ... {"TEST": (CONCENTRATION_DIMS, np.zeros((1, 1, 1, 1)))}, ... coords={ ... "time": [0], ... "time_end": ("time", [0]), ... "z": [100], ... "lat": [40.0], ... "lon": [-112.0], ... }, ... ) >>> describe_grid(ds, "mass m-3", "{name} concentration")["TEST"].attrs["long_name"] 'TEST concentration'