Skip to content

Commit

Permalink
Update global ocean meshes to include topo remapping
Browse files Browse the repository at this point in the history
QU240 and Icos240 meshes don't include this step.
  • Loading branch information
xylar committed Mar 23, 2023
1 parent ec55515 commit 7a4c334
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 12 deletions.
18 changes: 12 additions & 6 deletions compass/ocean/tests/global_ocean/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ def __init__(self, mpas_core):

# we do a lot of tests for QU240/QUwISC240
for mesh_name in ['QU240', 'Icos240', 'QUwISC240']:
mesh = Mesh(test_group=self, mesh_name=mesh_name)
mesh = Mesh(test_group=self, mesh_name=mesh_name,
remap_topography=False)
self.add_test_case(mesh)

init = Init(test_group=self, mesh=mesh,
Expand Down Expand Up @@ -141,7 +142,8 @@ def __init__(self, mpas_core):

# for other meshes, we do fewer tests
for mesh_name in ['EC30to60', 'ECwISC30to60']:
mesh = Mesh(test_group=self, mesh_name=mesh_name)
mesh = Mesh(test_group=self, mesh_name=mesh_name,
remap_topography=True)
self.add_test_case(mesh)

init = Init(test_group=self, mesh=mesh,
Expand All @@ -165,7 +167,8 @@ def __init__(self, mpas_core):

# ARRM10to60: just the version without cavities
for mesh_name in ['ARRM10to60']:
mesh = Mesh(test_group=self, mesh_name=mesh_name)
mesh = Mesh(test_group=self, mesh_name=mesh_name,
remap_topography=True)
self.add_test_case(mesh)

init = Init(test_group=self, mesh=mesh,
Expand All @@ -188,7 +191,8 @@ def __init__(self, mpas_core):

# SO12to60: with and without cavities
for mesh_name in ['SO12to60', 'SOwISC12to60']:
mesh = Mesh(test_group=self, mesh_name=mesh_name)
mesh = Mesh(test_group=self, mesh_name=mesh_name,
remap_topography=True)
self.add_test_case(mesh)

init = Init(test_group=self, mesh=mesh,
Expand All @@ -211,7 +215,8 @@ def __init__(self, mpas_core):

# WC14: just the version without cavities
for mesh_name in ['WC14']:
mesh = Mesh(test_group=self, mesh_name=mesh_name)
mesh = Mesh(test_group=self, mesh_name=mesh_name,
remap_topography=True)
self.add_test_case(mesh)

init = Init(test_group=self, mesh=mesh,
Expand All @@ -234,7 +239,8 @@ def __init__(self, mpas_core):

# Kuroshio meshes without ice-shelf cavities
for mesh_name in ['Kuroshio12to60', 'Kuroshio8to60']:
mesh = Mesh(test_group=self, mesh_name=mesh_name)
mesh = Mesh(test_group=self, mesh_name=mesh_name,
remap_topography=True)
self.add_test_case(mesh)

init = Init(test_group=self, mesh=mesh,
Expand Down
35 changes: 29 additions & 6 deletions compass/ocean/tests/global_ocean/mesh/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
QuasiUniformSphericalMeshStep,
)
from compass.ocean.mesh.cull import CullMeshStep
from compass.ocean.mesh.remap_topography import RemapTopography
from compass.ocean.tests.global_ocean.mesh.arrm10to60 import ARRM10to60BaseMesh
from compass.ocean.tests.global_ocean.mesh.ec30to60 import EC30to60BaseMesh
from compass.ocean.tests.global_ocean.mesh.kuroshio import KuroshioBaseMesh
Expand Down Expand Up @@ -30,7 +31,7 @@ class Mesh(TestCase):
with_ice_shelf_cavities : bool
Whether the mesh includes ice-shelf cavities
"""
def __init__(self, test_group, mesh_name):
def __init__(self, test_group, mesh_name, remap_topography):
"""
Create test case for creating a global MPAS-Ocean mesh
Expand All @@ -41,6 +42,10 @@ def __init__(self, test_group, mesh_name):
mesh_name : str
The name of the mesh
remap_topography : bool
Whether to remap topography as a separate step (as opposed to in
MPAS-Ocean init mode)
"""
name = 'mesh'
subdir = f'{mesh_name}/{name}'
Expand Down Expand Up @@ -82,9 +87,18 @@ def __init__(self, test_group, mesh_name):

self.add_step(base_mesh_step)

if remap_topography:
remap_step = RemapTopography(test_case=self,
base_mesh_step=base_mesh_step,
mesh_name=mesh_name)
self.add_step(remap_step)
else:
remap_step = None

self.add_step(CullMeshStep(
test_case=self, base_mesh_step=base_mesh_step,
with_ice_shelf_cavities=self.with_ice_shelf_cavities))
with_ice_shelf_cavities=self.with_ice_shelf_cavities,
remap_topography=remap_step))

def configure(self, config=None):
"""
Expand All @@ -97,7 +111,12 @@ def configure(self, config=None):
config = self.config
config.set('spherical_mesh', 'add_mesh_density', 'True')
config.set('spherical_mesh', 'plot_cell_width', 'True')
config.add_from_package('compass.mesh', 'mesh.cfg')
config.add_from_package('compass.mesh', 'mesh.cfg', exception=True)
# a description of the bathymetry
if 'remap_topography' in self.steps:
config.add_from_package('compass.ocean.mesh',
'remap_topography.cfg', exception=True)

if self.mesh_name.startswith('Kuroshio'):
# add the config options for all kuroshio meshes
config.add_from_package(
Expand All @@ -114,9 +133,13 @@ def configure(self, config=None):
'Antarctica')

# a description of the bathymetry
config.set('global_ocean', 'bathy_description',
'Bathymetry is from GEBCO 2022, combined with BedMachine '
'Antarctica v2 around Antarctica.')
if 'remap_topography' in self.steps:
description = config.get('remap_topography', 'description')
else:
description = 'Bathymetry is from GEBCO 2022, combined with ' \
'BedMachine Antarctica v3 around Antarctica.'

config.set('global_ocean', 'bathy_description', description)

get_author_and_email_from_git(config)

Expand Down

0 comments on commit 7a4c334

Please sign in to comment.