Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate cmor setup 273 #275

Merged
merged 2 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions e3sm_to_cmip/cmor_handlers/mpas_vars/areacello.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions e3sm_to_cmip/cmor_handlers/mpas_vars/fsitherm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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',
Expand Down
5 changes: 3 additions & 2 deletions e3sm_to_cmip/cmor_handlers/mpas_vars/hfds.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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',
Expand Down
5 changes: 3 additions & 2 deletions e3sm_to_cmip/cmor_handlers/mpas_vars/hfsifrazil.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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',
Expand Down
5 changes: 3 additions & 2 deletions e3sm_to_cmip/cmor_handlers/mpas_vars/masscello.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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',
Expand Down
5 changes: 3 additions & 2 deletions e3sm_to_cmip/cmor_handlers/mpas_vars/masso.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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',
Expand Down
5 changes: 3 additions & 2 deletions e3sm_to_cmip/cmor_handlers/mpas_vars/mlotst.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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',
Expand Down
5 changes: 3 additions & 2 deletions e3sm_to_cmip/cmor_handlers/mpas_vars/msftmz.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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']
Expand Down
5 changes: 3 additions & 2 deletions e3sm_to_cmip/cmor_handlers/mpas_vars/pbo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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',
Expand Down
5 changes: 3 additions & 2 deletions e3sm_to_cmip/cmor_handlers/mpas_vars/pso.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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',
Expand Down
5 changes: 3 additions & 2 deletions e3sm_to_cmip/cmor_handlers/mpas_vars/sfdsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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',
Expand Down
5 changes: 3 additions & 2 deletions e3sm_to_cmip/cmor_handlers/mpas_vars/siconc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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',
Expand Down
5 changes: 3 additions & 2 deletions e3sm_to_cmip/cmor_handlers/mpas_vars/simass.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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',
Expand Down
5 changes: 3 additions & 2 deletions e3sm_to_cmip/cmor_handlers/mpas_vars/sisnmass.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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',
Expand Down
5 changes: 3 additions & 2 deletions e3sm_to_cmip/cmor_handlers/mpas_vars/sisnthick.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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',
Expand Down
5 changes: 3 additions & 2 deletions e3sm_to_cmip/cmor_handlers/mpas_vars/sitemptop.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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',
Expand Down
5 changes: 3 additions & 2 deletions e3sm_to_cmip/cmor_handlers/mpas_vars/sithick.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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',
Expand Down
5 changes: 3 additions & 2 deletions e3sm_to_cmip/cmor_handlers/mpas_vars/sitimefrac.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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',
Expand Down
5 changes: 3 additions & 2 deletions e3sm_to_cmip/cmor_handlers/mpas_vars/siu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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',
Expand Down
5 changes: 3 additions & 2 deletions e3sm_to_cmip/cmor_handlers/mpas_vars/siv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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',
Expand Down
5 changes: 3 additions & 2 deletions e3sm_to_cmip/cmor_handlers/mpas_vars/so.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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',
Expand Down
Loading
Loading