Skip to content

Commit

Permalink
added map_sst
Browse files Browse the repository at this point in the history
  • Loading branch information
larsbuntemeyer committed Dec 1, 2023
1 parent 0b77e6f commit b4953af
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions pyremo/preproc/cf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@
import xarray as xr
from cdo import Cdo

from .core import check_lev, convert_units, get_vc, horizontal_dims, open_mfdataset
from .core import (
check_lev,
convert_units,
get_vc,
horizontal_dims,
map_sst,
open_mfdataset,
)

cdo_exe = "cdo"

Expand Down Expand Up @@ -187,7 +194,7 @@ def get_file(self, datetime=None, **kwargs):
return sel.iloc[0].path


def gfile(ds, ref_ds=None, attrs=None, use_cftime=True, invertlev=None):
def gfile(ds, ref_ds=None, tos=None, attrs=None, use_cftime=True, invertlev=None):
"""Creates a global dataset ready for preprocessing.
This function creates a homogenized global dataset. If neccessary,
Expand Down Expand Up @@ -221,6 +228,8 @@ def gfile(ds, ref_ds=None, attrs=None, use_cftime=True, invertlev=None):
ds["akgm"], ds["bkgm"] = get_vc(ds, invertlev)
ds = check_lev(ds, invertlev)

if tos is not None:
ds["tos"] = map_sst(tos, ds)
# ensure correct units
ds = convert_units(ds)
if "sftlf" in ds:
Expand Down

0 comments on commit b4953af

Please sign in to comment.