Skip to content

Commit

Permalink
added register_luts() fct
Browse files Browse the repository at this point in the history
  • Loading branch information
vincelhx committed Sep 23, 2024
1 parent e3ffae3 commit d1fe85d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/examples/streaks.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"metadata": {},
"outputs": [],
"source": [
"xsarsea.windspeed.gmfs.GmfModel.activate_gmfs_impl()\n",
"xsarsea.windspeed.available_models()"
]
},
Expand Down
4 changes: 2 additions & 2 deletions src/xsarsea/windspeed/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
windspeed module, for retrieving wind speed from sigma0 and models.
"""
__all__ = ['invert_from_model', 'available_models', 'get_model', 'register_cmod7',
'register_sarwing_luts', 'register_nc_luts', 'nesz_flattening', 'GmfModel']
'register_sarwing_luts', 'register_nc_luts', 'register_luts', 'nesz_flattening', 'GmfModel']
from .windspeed import invert_from_model
from .models import available_models, get_model, register_nc_luts
from .models import available_models, get_model, register_nc_luts, register_luts
from .sarwing_luts import register_sarwing_luts
from .cmod7 import register_cmod7
from .utils import nesz_flattening, get_dsig
Expand Down
31 changes: 30 additions & 1 deletion src/xsarsea/windspeed/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ def _raw_lut(self, **kwargs):
return lut


def register_nc_luts(topdir, gmf_names=None, **kwargs):
def register_nc_luts(topdir, gmf_names=None):
"""
Register all netcdf luts found under `topdir`.
Expand Down Expand Up @@ -518,3 +518,32 @@ def get_model(name):
raise KeyError('model %s not found' % name)

return model


def register_luts(topdir=None, topdir_cmod7=None):
"""
Register gmfModel luts and ncLutModel luts
Parameters
----------
topdir: str
top dir path to nc luts.
topdir_cmod7: str
top dir path to cmod7 luts.
kwargs: dict
kwargs to pass to register_nc_luts
"""

# register gmf luts
import xsarsea.windspeed as windspeed
windspeed.GmfModel.activate_gmfs_impl()

# register nc luts
if topdir != None:
register_nc_luts(topdir)

# register cmod7
if topdir_cmod7 != None:
windspeed.register_cmod7(topdir_cmod7)

0 comments on commit d1fe85d

Please sign in to comment.