From 7217ce94b2b882a216f7b16fa8ce66f92ec1803a Mon Sep 17 00:00:00 2001 From: Tony Bartoletti Date: Thu, 29 Aug 2024 16:52:55 -0700 Subject: [PATCH 1/2] set all mpas_vars handlers to use util.setup_cmor --- e3sm_to_cmip/cmor_handlers/mpas_vars/areacello.py | 6 +++--- e3sm_to_cmip/cmor_handlers/mpas_vars/fsitherm.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/hfds.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/hfsifrazil.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/masscello.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/masso.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/mlotst.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/msftmz.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/pbo.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/pso.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/sfdsi.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/siconc.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/simass.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/sisnmass.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/sisnthick.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/sitemptop.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/sithick.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/sitimefrac.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/siu.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/siv.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/so.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/sob.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/soga.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/sos.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/sosga.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/tauuo.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/tauvo.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/thetao.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/thetaoga.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/thkcello.py | 6 +++--- e3sm_to_cmip/cmor_handlers/mpas_vars/tob.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/tos.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/tosga.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/uo.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/vo.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/volcello.py | 6 +++--- e3sm_to_cmip/cmor_handlers/mpas_vars/volo.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/wfo.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/wo.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/zhalfo.py | 5 +++-- e3sm_to_cmip/cmor_handlers/mpas_vars/zos.py | 5 +++-- 41 files changed, 123 insertions(+), 85 deletions(-) diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/areacello.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/areacello.py index 867c8d95..b0ec110a 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/areacello.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/areacello.py @@ -4,8 +4,8 @@ import xarray import logging -from e3sm_to_cmip import mpas -from e3sm_to_cmip.util import print_message, setup_cmor +from e3sm_to_cmip import mpas, util +from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPAS_mesh', 'MPAS_map'] @@ -65,7 +65,7 @@ def handle(infiles, tables, user_input_path, **kwargs): # area_b is in square radians, so need to multiply by the earth_radius**2 ds[VAR_NAME] = earth_radius**2*area_b*ds[VAR_NAME] - setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, user_input_path=user_input_path) # create axes diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/fsitherm.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/fsitherm.py index 351efc6a..8c642fec 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/fsitherm.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/fsitherm.py @@ -7,7 +7,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed @@ -60,7 +60,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = mpas.remap(ds, 'mpasocean', mappingFileName) - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='ocean') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/hfds.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/hfds.py index a7c0d281..1e244aed 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/hfds.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/hfds.py @@ -7,7 +7,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed @@ -73,7 +73,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = mpas.remap(ds, 'mpasocean', mappingFileName) - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='ocean') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/hfsifrazil.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/hfsifrazil.py index baf5c2e1..419ea1f4 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/hfsifrazil.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/hfsifrazil.py @@ -7,7 +7,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed @@ -76,7 +76,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = mpas.remap(ds, 'mpasocean', mappingFileName) - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='ocean') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/masscello.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/masscello.py index 6030ccd1..7847a515 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/masscello.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/masscello.py @@ -8,7 +8,7 @@ import logging import netCDF4 -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASO', 'MPASO_namelist', 'MPAS_mesh', 'MPAS_map'] @@ -77,7 +77,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds[VAR_NAME] = ds[VAR_NAME].where( ds[VAR_NAME] != netCDF4.default_fillvals['f4'], 0.) - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='ocean') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/masso.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/masso.py index 8155fcea..2a9b9c53 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/masso.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/masso.py @@ -8,7 +8,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASO', 'MPASO_namelist', 'MPAS_mesh'] @@ -69,7 +69,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = mpas.add_time(ds, dsIn) ds.compute() - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='ocean') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/mlotst.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/mlotst.py index 43309b1e..60c34d43 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/mlotst.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/mlotst.py @@ -7,7 +7,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASO', 'MPAS_mesh', 'MPAS_map'] @@ -66,7 +66,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = mpas.add_mask(ds, cellMask2D) ds = mpas.remap(ds, 'mpasocean', mappingFileName) - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='ocean') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/msftmz.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/msftmz.py index 1e255108..e13f897d 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/msftmz.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/msftmz.py @@ -7,7 +7,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASO', 'MPAS_mesh', 'MPASO_MOC_regions', 'MPASO_namelist'] @@ -76,7 +76,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = ds.rename({'moc': VAR_NAME}) - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='ocean') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) region = ['global_ocean', 'atlantic_arctic_ocean'] diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/pbo.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/pbo.py index 792fa1b8..254c6448 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/pbo.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/pbo.py @@ -7,7 +7,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASO', 'MPASO_namelist', 'MPAS_mesh', 'MPAS_map', 'PSL'] @@ -84,7 +84,8 @@ def handle(infiles, tables, user_input_path, **kwargs): with xarray.open_mfdataset(pslFileNames, concat_dim='time') as dsIn: ds[VAR_NAME] = ds[VAR_NAME] + dsIn.PSL.values - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='ocean') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/pso.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/pso.py index 304ac8c8..0043b1a4 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/pso.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/pso.py @@ -7,7 +7,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASO', 'MPASO_namelist', 'MPAS_mesh', 'MPAS_map', 'PSL'] @@ -80,7 +80,8 @@ def handle(infiles, tables, user_input_path, **kwargs): with xarray.open_mfdataset(pslFileNames, concat_dim='time') as dsIn: ds[VAR_NAME] = ds[VAR_NAME] + dsIn.PSL.values - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='ocean') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/sfdsi.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/sfdsi.py index af9e28fa..b3865ab7 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/sfdsi.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/sfdsi.py @@ -7,7 +7,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASO', 'MPAS_map'] @@ -61,7 +61,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = mpas.remap(ds, 'mpasocean', mappingFileName) - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='ocean') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/siconc.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/siconc.py index f9a38943..da328432 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/siconc.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/siconc.py @@ -8,7 +8,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASSI', 'MPAS_mesh', 'MPAS_map'] @@ -63,7 +63,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = mpas.remap(ds, 'mpasseaice', mappingFileName) - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='seaice') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/simass.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/simass.py index ec514576..e61e4f97 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/simass.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/simass.py @@ -8,7 +8,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASSI', 'MPAS_mesh', 'MPAS_map'] @@ -62,7 +62,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = mpas.remap(ds, 'mpasseaice', mappingFileName) - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='seaice') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/sisnmass.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/sisnmass.py index 1542d421..bc0e9d04 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/sisnmass.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/sisnmass.py @@ -8,7 +8,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASSI', 'MPAS_mesh', 'MPAS_map'] @@ -67,7 +67,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = mpas.remap(ds, 'mpasseaice', mappingFileName) - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='seaice') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/sisnthick.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/sisnthick.py index 13de8a81..be2969a7 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/sisnthick.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/sisnthick.py @@ -8,7 +8,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASSI', 'MPAS_mesh', 'MPAS_map'] @@ -67,7 +67,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = mpas.remap(ds, 'mpasseaice', mappingFileName) - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='seaice') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/sitemptop.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/sitemptop.py index 706ea8e1..2c053499 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/sitemptop.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/sitemptop.py @@ -9,7 +9,7 @@ import xarray -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed @@ -67,7 +67,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = mpas.remap(ds, 'mpasseaice', mappingFileName) - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='seaice') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/sithick.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/sithick.py index e9b66c89..81afcffc 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/sithick.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/sithick.py @@ -8,7 +8,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASSI', 'MPAS_mesh', 'MPAS_map'] @@ -66,7 +66,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = mpas.remap(ds, 'mpasseaice', mappingFileName) - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='seaice') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/sitimefrac.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/sitimefrac.py index 591ff362..e5e50216 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/sitimefrac.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/sitimefrac.py @@ -8,7 +8,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASSI', 'MPAS_mesh', 'MPAS_map'] @@ -65,7 +65,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = mpas.remap(ds, 'mpasseaice', mappingFileName) - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='seaice') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/siu.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/siu.py index b3105fbf..74c0972c 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/siu.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/siu.py @@ -8,7 +8,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASSI', 'MPAS_mesh', 'MPAS_map'] @@ -69,7 +69,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = mpas.remap(ds, 'mpasseaice', mappingFileName) - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='seaice') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/siv.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/siv.py index 4fd8b4f4..13337032 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/siv.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/siv.py @@ -8,7 +8,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASSI', 'MPAS_mesh', 'MPAS_map'] @@ -70,7 +70,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = mpas.remap(ds, 'mpasseaice', mappingFileName) - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='seaice') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/so.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/so.py index d622383e..7e744ffc 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/so.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/so.py @@ -7,7 +7,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASO', 'MPAS_mesh', 'MPAS_map'] @@ -67,7 +67,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = mpas.remap(ds, 'mpasocean', mappingFileName) - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='ocean') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/sob.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/sob.py index 81626534..be466429 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/sob.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/sob.py @@ -7,7 +7,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASO', 'MPAS_mesh', 'MPAS_map'] @@ -67,7 +67,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = mpas.remap(ds, 'mpasocean', mappingFileName) - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='ocean') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/soga.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/soga.py index 7f3f0d5c..0661f960 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/soga.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/soga.py @@ -8,7 +8,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASO', 'MPAS_mesh'] @@ -70,7 +70,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = mpas.add_time(ds, dsIn) ds.compute() - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='ocean') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/sos.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/sos.py index 0d4b731e..454823d3 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/sos.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/sos.py @@ -7,7 +7,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASO', 'MPAS_mesh', 'MPAS_map'] @@ -67,7 +67,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = mpas.remap(ds, 'mpasocean', mappingFileName) - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='ocean') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/sosga.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/sosga.py index be153e90..c49ebb5c 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/sosga.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/sosga.py @@ -7,7 +7,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASO', 'MPAS_mesh'] @@ -66,7 +66,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds.compute() ds.compute() - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='ocean') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/tauuo.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/tauuo.py index dea84253..5e2cc7c8 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/tauuo.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/tauuo.py @@ -7,7 +7,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASO', 'MPAS_map'] @@ -61,7 +61,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = mpas.remap(ds, 'mpasocean', mappingFileName) - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='ocean') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/tauvo.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/tauvo.py index 032a2436..fc692495 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/tauvo.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/tauvo.py @@ -7,7 +7,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASO', 'MPAS_map'] @@ -61,7 +61,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = mpas.remap(ds, 'mpasocean', mappingFileName) - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='ocean') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/thetao.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/thetao.py index f35af82c..e3374f2d 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/thetao.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/thetao.py @@ -7,7 +7,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASO', 'MPAS_mesh', 'MPAS_map'] @@ -67,7 +67,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = mpas.remap(ds, 'mpasocean', mappingFileName) - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='ocean') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/thetaoga.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/thetaoga.py index 632c0a21..3d897545 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/thetaoga.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/thetaoga.py @@ -8,7 +8,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASO', 'MPAS_mesh'] @@ -70,7 +70,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = mpas.add_time(ds, dsIn) ds.compute() - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='ocean') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/thkcello.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/thkcello.py index 01e6420e..e50d2f6b 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/thkcello.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/thkcello.py @@ -6,8 +6,8 @@ import logging import netCDF4 -from e3sm_to_cmip import mpas -from e3sm_to_cmip.util import print_message, setup_cmor +from e3sm_to_cmip import mpas, util +from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASO', 'MPAS_mesh', 'MPAS_map'] @@ -71,7 +71,7 @@ def handle(infiles, tables, user_input_path, **kwargs): ds[VAR_NAME] = ds[VAR_NAME].where( ds[VAR_NAME] != netCDF4.default_fillvals['f4'], 0.) - setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, user_input_path=user_input_path) # create axes diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/tob.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/tob.py index 8c08df06..d10cc689 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/tob.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/tob.py @@ -7,7 +7,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASO', 'MPAS_mesh', 'MPAS_map'] @@ -67,7 +67,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = mpas.remap(ds, 'mpasocean', mappingFileName) - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='ocean') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/tos.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/tos.py index 4bc4d36d..b43b35a7 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/tos.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/tos.py @@ -7,7 +7,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASO', 'MPAS_mesh', 'MPAS_map'] @@ -67,7 +67,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = mpas.remap(ds, 'mpasocean', mappingFileName) - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='ocean') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/tosga.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/tosga.py index 34bb9e96..645f1432 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/tosga.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/tosga.py @@ -7,7 +7,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASO', 'MPAS_mesh'] @@ -66,7 +66,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds.compute() ds.compute() - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='ocean') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/uo.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/uo.py index da0562e4..de5b3e2e 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/uo.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/uo.py @@ -7,7 +7,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASO', 'MPAS_mesh', 'MPAS_map'] @@ -67,7 +67,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = mpas.remap(ds, 'mpasocean', mappingFileName) - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='ocean') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/vo.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/vo.py index 0085a97a..76ea08c1 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/vo.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/vo.py @@ -7,7 +7,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASO', 'MPAS_mesh', 'MPAS_map'] @@ -67,7 +67,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = mpas.remap(ds, 'mpasocean', mappingFileName) - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='ocean') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/volcello.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/volcello.py index 9a228bea..dbc519c8 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/volcello.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/volcello.py @@ -6,8 +6,8 @@ import logging import netCDF4 -from e3sm_to_cmip import mpas -from e3sm_to_cmip.util import print_message, setup_cmor +from e3sm_to_cmip import mpas, util +from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASO', 'MPAS_mesh', 'MPAS_map'] @@ -85,7 +85,7 @@ def handle(infiles, tables, user_input_path, **kwargs): # multiply variables in this order so they don't get transposed ds[VAR_NAME] = ds[VAR_NAME]*earth_radius**2*area_b - setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, user_input_path=user_input_path) # create axes diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/volo.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/volo.py index b2e838a7..04ec4135 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/volo.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/volo.py @@ -8,7 +8,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASO', 'MPAS_mesh'] @@ -67,7 +67,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds.compute() - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='ocean') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/wfo.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/wfo.py index 2a4ab15d..c3da4ecb 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/wfo.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/wfo.py @@ -7,7 +7,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASO', 'MPAS_map'] @@ -71,7 +71,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = mpas.remap(ds, 'mpasocean', mappingFileName) - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='ocean') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/wo.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/wo.py index 59995dca..0d07dcd0 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/wo.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/wo.py @@ -8,7 +8,7 @@ import logging import numpy -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASO', 'MPAS_mesh', 'MPAS_map'] @@ -70,7 +70,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = mpas.remap(ds, 'mpasocean', mappingFileName) - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='ocean') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/zhalfo.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/zhalfo.py index 42fe931c..0f4645dd 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/zhalfo.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/zhalfo.py @@ -8,7 +8,7 @@ import logging import numpy -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed RAW_VARIABLES = ['MPASO', 'MPAS_mesh', 'MPAS_map'] @@ -90,7 +90,8 @@ def handle(infiles, tables, user_input_path, **kwargs): depth_coord_half = numpy.zeros(nVertLevels+1) depth_coord_half[1:] = dsMesh.refBottomDepth.values - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='ocean') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', diff --git a/e3sm_to_cmip/cmor_handlers/mpas_vars/zos.py b/e3sm_to_cmip/cmor_handlers/mpas_vars/zos.py index 7903d818..c828256e 100644 --- a/e3sm_to_cmip/cmor_handlers/mpas_vars/zos.py +++ b/e3sm_to_cmip/cmor_handlers/mpas_vars/zos.py @@ -7,7 +7,7 @@ import xarray import logging -from e3sm_to_cmip import mpas +from e3sm_to_cmip import mpas, util from e3sm_to_cmip.util import print_message # 'MPAS' as a placeholder for raw variables needed @@ -69,7 +69,8 @@ def handle(infiles, tables, user_input_path, **kwargs): ds = mpas.remap(ds, 'mpasocean', mappingFileName) - mpas.setup_cmor(VAR_NAME, tables, user_input_path, component='ocean') + util.setup_cmor(var_name=VAR_NAME, table_path=tables, table_name=TABLE, + user_input_path=user_input_path) # create axes axes = [{'table_entry': 'time', From 93bca6d917c01d1cabdf78a5bb3743612187c910 Mon Sep 17 00:00:00 2001 From: Tony Bartoletti Date: Fri, 30 Aug 2024 08:07:43 -0700 Subject: [PATCH 2/2] remove unneeded setup_cmor function --- e3sm_to_cmip/mpas.py | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/e3sm_to_cmip/mpas.py b/e3sm_to_cmip/mpas.py index d0bc696c..498ed417 100644 --- a/e3sm_to_cmip/mpas.py +++ b/e3sm_to_cmip/mpas.py @@ -399,27 +399,6 @@ def convert_namelist_to_dict(fileName): return nml -def setup_cmor(varname, tables, user_input_path, component="ocean", table=None): - """Set up CMOR for MPAS-Ocean or MPAS-Seaice""" - logfile = os.path.join(os.getcwd(), "cmor_logs") - if not os.path.exists(logfile): - os.makedirs(logfile) - logfile = os.path.join(logfile, varname + ".log") - cmor.setup(inpath=tables, netcdf_file_action=cmor.CMOR_REPLACE, logfile=logfile) - cmor.dataset_json(str(user_input_path)) - if table is None: - if component == "ocean": - table = "CMIP6_Omon.json" - elif component == "seaice": - table = "CMIP6_SImon.json" - else: - raise ValueError("Unexpected component {}".format(component)) - try: - cmor.load_table(table) - except Exception: - raise ValueError("Unable to load table from {}".format(varname)) - - def write_cmor(axes, ds, varname, varunits, d2f=True, **kwargs): """Write a time series of a variable in the format expected by CMOR""" axis_ids = list()