It doesn't seem like you follow CF conventions when assigning variable attributes in your xarray objects. It is super useful to do this, because it makes the data almost instantly archivable in national databases, and would also play better with some packages (e.g. https://cf-xarray.readthedocs.io/en/latest/index.html), including xarray itself. In practice it means giving each variable the appropriate standard_name and units (as defined by CF), and also a long_name for plotting or descriptions.
For example, the time variable from the most recent dataset that I loaded has the following attributes:
time
(time)
float64
1.622e+09 1.622e+09 ... 1.625e+09
description :
seconds since 1970-01-01 00:00:00
To follow CF it should look something like:
time
(time)
float64
1.622e+09 1.622e+09 ... 1.625e+09
standard_name :
time
units :
seconds since 1970-01-01 00:00:00
long_name :
Time
calendar :
gregorian
If time were specified in this way, xarray could then automatically parse the UNIX timestamps to datetimes, avoiding awkward conversions.
An issue to consider is that some of the standard names will change depending on the coordinate system, e.g. radial_sea_water_velocity_away_from_instrument ->eastward_sea_water_velocity.
It could be interesting to integrate tsdat (https://github.com/tsdat/tsdat) to this codebase, or follow a short-term solution and provide a how-to to standardize dolfyn datasets using tsdat.
It doesn't seem like you follow CF conventions when assigning variable attributes in your xarray objects. It is super useful to do this, because it makes the data almost instantly archivable in national databases, and would also play better with some packages (e.g. https://cf-xarray.readthedocs.io/en/latest/index.html), including xarray itself. In practice it means giving each variable the appropriate
standard_name
andunits
(as defined by CF), and also along_name
for plotting or descriptions.For example, the
time
variable from the most recent dataset that I loaded has the following attributes:To follow CF it should look something like:
If time were specified in this way, xarray could then automatically parse the UNIX timestamps to datetimes, avoiding awkward conversions.
An issue to consider is that some of the standard names will change depending on the coordinate system, e.g.
radial_sea_water_velocity_away_from_instrument
->eastward_sea_water_velocity
.