Commit d87c295c authored by Clément Haëck's avatar Clément Haëck
Browse files

Change kelvin to celsius only if units match

parent 85a14b96
......@@ -19,8 +19,9 @@ def get_root(args=None, **kwargs):
def k2c(ds, variable='analysed_sst'):
ds[variable] -= 273.15
ds[variable].attrs['units'] = 'celsius'
if ds[variable].attrs['units'] == 'kelvin':
ds[variable] -= 273.15
ds[variable].attrs['units'] = 'celsius'
return ds
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment