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

New Mesh: SOwISC12to30E3r4 #829

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
Draft
7 changes: 5 additions & 2 deletions compass/ocean/tests/global_ocean/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def __init__(self, mpas_core):
self._add_tests(mesh_names=['ARRM10to60', 'ARRMwISC10to60'])

self._add_tests(mesh_names=['SO12to30', 'SOwISC12to30'])
self._add_tests(mesh_names=['SOwISC12to30'],
mali_ais_topo='AIS_4to20km')

self._add_tests(mesh_names=['WC14', 'WCwISC14'])

Expand All @@ -65,15 +67,16 @@ def __init__(self, mpas_core):
def _add_tests(self, mesh_names, high_res_topography=True,
include_rk4=False,
include_regression=False, include_phc=False,
include_en4_1900=False):
include_en4_1900=False, mali_ais_topo=None):
""" Add test cases for the given mesh(es) """

default_ic = 'WOA23'
default_time_int = 'split_explicit_ab2'

for mesh_name in mesh_names:
mesh_test = Mesh(test_group=self, mesh_name=mesh_name,
high_res_topography=high_res_topography)
high_res_topography=high_res_topography,
mali_ais_topo=mali_ais_topo)
self.add_test_case(mesh_test)

init_test = Init(test_group=self, mesh=mesh_test,
Expand Down
3 changes: 1 addition & 2 deletions compass/ocean/tests/global_ocean/init/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ def __init__(self, test_group, mesh, initial_condition):
The initial condition dataset to use
"""
name = 'init'
mesh_name = mesh.mesh_name
ic_dir = initial_condition
self.init_subdir = os.path.join(mesh_name, ic_dir)
self.init_subdir = os.path.join(mesh.mesh_subdir, ic_dir)
subdir = os.path.join(self.init_subdir, name)
super().__init__(test_group=test_group, name=name, subdir=subdir)

Expand Down
54 changes: 49 additions & 5 deletions compass/ocean/tests/global_ocean/mesh/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

from compass.mesh.spherical import (
IcosahedralMeshStep,
QuasiUniformSphericalMeshStep,
Expand All @@ -15,6 +17,9 @@
IcosMeshFromConfigStep,
QUMeshFromConfigStep,
)
from compass.ocean.tests.global_ocean.mesh.remap_mali_topography import (
RemapMaliTopography,
)
from compass.ocean.tests.global_ocean.mesh.rrs6to18 import RRS6to18BaseMesh
from compass.ocean.tests.global_ocean.mesh.so12to30 import SO12to30BaseMesh
from compass.ocean.tests.global_ocean.mesh.wc14 import WC14BaseMesh
Expand All @@ -31,6 +36,13 @@ class Mesh(TestCase):

Attributes
----------
mesh_name : str
The name of the mesh

mesh_subdir : str
The subdirectory within the test group for all test cases with this
mesh and topography

package : str
The python package for the mesh

Expand All @@ -43,8 +55,14 @@ class Mesh(TestCase):
high_res_topography : bool
Whether to remap a high resolution topography data set. A lower
res data set is used for low resolution meshes.

mali_ais_topo : str
Short name for the MALI dataset to use for Antarctic Ice Sheet
topography
"""
def __init__(self, test_group, mesh_name, high_res_topography):

def __init__(self, test_group, mesh_name, # noqa: C901
high_res_topography, mali_ais_topo=None):
"""
Create test case for creating a global MPAS-Ocean mesh

Expand All @@ -59,9 +77,20 @@ def __init__(self, test_group, mesh_name, high_res_topography):
high_res_topography : bool
Whether to remap a high resolution topography data set. A lower
res data set is used for low resolution meshes.

mali_ais_topo : str, optional
Short name for the MALI dataset to use for Antarctic Ice Sheet
topography
"""
name = 'mesh'
subdir = f'{mesh_name}/{name}'
if mali_ais_topo is None:
self.mesh_subdir = mesh_name
else:
self.mesh_subdir = os.path.join(mesh_name,
f'MALI_topo_{mali_ais_topo}')

subdir = os.path.join(self.mesh_subdir, name)

super().__init__(test_group=test_group, name=name, subdir=subdir)

with_ice_shelf_cavities = 'wISC' in mesh_name
Expand All @@ -75,6 +104,7 @@ def __init__(self, test_group, mesh_name, high_res_topography):
self.mesh_config_filename = f'{mesh_lower}.cfg'

self.mesh_name = mesh_name
self.mali_ais_topo = mali_ais_topo
self.with_ice_shelf_cavities = with_ice_shelf_cavities
self.high_res_topography = high_res_topography

Expand Down Expand Up @@ -117,9 +147,16 @@ def __init__(self, test_group, mesh_name, high_res_topography):

self.add_step(base_mesh_step)

remap_step = RemapTopography(test_case=self,
base_mesh_step=base_mesh_step,
mesh_name=mesh_name)
if mali_ais_topo is None:
remap_step = RemapTopography(test_case=self,
base_mesh_step=base_mesh_step,
mesh_name=mesh_name)
else:
remap_step = RemapMaliTopography(
test_case=self, base_mesh_step=base_mesh_step,
mesh_name=mesh_name, mali_ais_topo=mali_ais_topo,
ocean_includes_grounded=False)

self.add_step(remap_step)

self.add_step(CullMeshStep(
Expand All @@ -146,6 +183,13 @@ def configure(self, config=None):
'low_res_topography.cfg',
exception=True)

if self.mali_ais_topo is not None:
package = 'compass.ocean.tests.global_ocean.mesh.' \
'remap_mali_topography'
config.add_from_package(package,
f'{self.mali_ais_topo.lower()}.cfg',
exception=True)

if self.mesh_name.startswith('Kuroshio'):
# add the config options for all kuroshio meshes
config.add_from_package(
Expand Down
Loading
Loading