Closed rcaneill closed 2 years ago
My thoughts so far:
units
will always be known even if a suitable standard name doesn't exist. For explicitly unitless values (e.g. practical salinity) we should use the unit of "1"
standard_name
should not be present unless we put a value there.reference_scale
attribute to temperature and practical salinity with the values of "ITS-90"
and "PSS-78"
since the units must be respectively degC and unitless.About the reference_scale
, I don't think that we necessary need to constraint to CF, if it is a common attribute we can add it.
In some play around tests, I found that the name of the returned xr.DataArray
retains the "name" attribute (the class instance attribute, not the attrs dict). We should probably replace that with something relevant. Perhaps the GSW name (e.g. the return from SA_from_SP would be a xr.DataArray
with the name "SA"
)
The following is the current behavior using our testing example dataset:
>>> da = gsw.sigma0(SA=ds.SA, CT=ds.CT)
>>> da
<xarray.DataArray 'SA' (id: 3)>
array([27.17191038, 26.12820162, 24.03930887])
Coordinates:
* id (id) int64 0 1 2
Attributes:
standard_name: sea_water_sigma_t
units: kg m-3
>>> da.name
'SA'
This is indeed a problem... I'll add it along with the ideas of PR #22 it this suits implementation suits you
gsw keeps attributes from the function parameters. What attributes should be kept, and what should be removed? As a short list, I think that:
This means a little refactoring of the wrapping, but probably not too hard work.
I am working on PR #20 to implement all functions, I'll keep the way I do for the moment and I'll replace what is needed depending on what we decide here.