Skip to content

Commit

Permalink
FIX: make get_derived_eos_raw more robust to no locations
Browse files Browse the repository at this point in the history
  • Loading branch information
C-PROOF committed May 26, 2024
1 parent b8eda9e commit 6c36973
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pyglider/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,9 @@ def get_derived_eos_raw(ds):
('resolution', 0.001)])
attrs = fill_required_attrs(attrs)
ds['salinity'].attrs = attrs
sa = gsw.SA_from_SP(ds['salinity'], ds['pressure'], ds['longitude'],
ds['latitude'])
long = ds.longitude.fillna(ds.longitude.mean(skipna=True))
lat = ds.latitude.fillna(ds.latitude.mean(skipna=True))
sa = gsw.SA_from_SP(ds['salinity'], ds['pressure'], long, lat)
ct = gsw.CT_from_t(sa, ds['temperature'], ds['pressure'])
ds['potential_density'] = (('time'), 1000 + gsw.density.sigma0(sa, ct).values)
attrs = collections.OrderedDict([
Expand Down

0 comments on commit 6c36973

Please sign in to comment.