Skip to content

Commit 3b6624a

Browse files
authored
Merge pull request #829 from xylar/add-mali-topo
New Mesh: SOwISC12to30E3r4
2 parents 559418a + f8fc709 commit 3b6624a

File tree

11 files changed

+414
-16
lines changed

11 files changed

+414
-16
lines changed

compass/ocean/tests/global_ocean/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ def __init__(self, mpas_core):
4545
self._add_tests(mesh_names=['ARRM10to60', 'ARRMwISC10to60'])
4646

4747
self._add_tests(mesh_names=['SO12to30', 'SOwISC12to30'])
48+
self._add_tests(mesh_names=['SOwISC12to30'],
49+
mali_ais_topo='AIS_4to20km')
4850

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

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

7173
default_ic = 'WOA23'
7274
default_time_int = 'split_explicit_ab2'
7375

7476
for mesh_name in mesh_names:
7577
mesh_test = Mesh(test_group=self, mesh_name=mesh_name,
76-
high_res_topography=high_res_topography)
78+
high_res_topography=high_res_topography,
79+
mali_ais_topo=mali_ais_topo)
7780
self.add_test_case(mesh_test)
7881

7982
init_test = Init(test_group=self, mesh=mesh_test,

compass/ocean/tests/global_ocean/init/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ def __init__(self, test_group, mesh, initial_condition):
4444
The initial condition dataset to use
4545
"""
4646
name = 'init'
47-
mesh_name = mesh.mesh_name
4847
ic_dir = initial_condition
49-
self.init_subdir = os.path.join(mesh_name, ic_dir)
48+
self.init_subdir = os.path.join(mesh.mesh_subdir, ic_dir)
5049
subdir = os.path.join(self.init_subdir, name)
5150
super().__init__(test_group=test_group, name=name, subdir=subdir)
5251

compass/ocean/tests/global_ocean/mesh/__init__.py

Lines changed: 49 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import os
2+
13
from compass.mesh.spherical import (
24
IcosahedralMeshStep,
35
QuasiUniformSphericalMeshStep,
@@ -15,6 +17,9 @@
1517
IcosMeshFromConfigStep,
1618
QUMeshFromConfigStep,
1719
)
20+
from compass.ocean.tests.global_ocean.mesh.remap_mali_topography import (
21+
RemapMaliTopography,
22+
)
1823
from compass.ocean.tests.global_ocean.mesh.rrs6to18 import RRS6to18BaseMesh
1924
from compass.ocean.tests.global_ocean.mesh.so12to30 import SO12to30BaseMesh
2025
from compass.ocean.tests.global_ocean.mesh.wc14 import WC14BaseMesh
@@ -31,6 +36,13 @@ class Mesh(TestCase):
3136
3237
Attributes
3338
----------
39+
mesh_name : str
40+
The name of the mesh
41+
42+
mesh_subdir : str
43+
The subdirectory within the test group for all test cases with this
44+
mesh and topography
45+
3446
package : str
3547
The python package for the mesh
3648
@@ -43,8 +55,14 @@ class Mesh(TestCase):
4355
high_res_topography : bool
4456
Whether to remap a high resolution topography data set. A lower
4557
res data set is used for low resolution meshes.
58+
59+
mali_ais_topo : str
60+
Short name for the MALI dataset to use for Antarctic Ice Sheet
61+
topography
4662
"""
47-
def __init__(self, test_group, mesh_name, high_res_topography):
63+
64+
def __init__(self, test_group, mesh_name, # noqa: C901
65+
high_res_topography, mali_ais_topo=None):
4866
"""
4967
Create test case for creating a global MPAS-Ocean mesh
5068
@@ -59,9 +77,20 @@ def __init__(self, test_group, mesh_name, high_res_topography):
5977
high_res_topography : bool
6078
Whether to remap a high resolution topography data set. A lower
6179
res data set is used for low resolution meshes.
80+
81+
mali_ais_topo : str, optional
82+
Short name for the MALI dataset to use for Antarctic Ice Sheet
83+
topography
6284
"""
6385
name = 'mesh'
64-
subdir = f'{mesh_name}/{name}'
86+
if mali_ais_topo is None:
87+
self.mesh_subdir = mesh_name
88+
else:
89+
self.mesh_subdir = os.path.join(mesh_name,
90+
f'MALI_topo_{mali_ais_topo}')
91+
92+
subdir = os.path.join(self.mesh_subdir, name)
93+
6594
super().__init__(test_group=test_group, name=name, subdir=subdir)
6695

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

77106
self.mesh_name = mesh_name
107+
self.mali_ais_topo = mali_ais_topo
78108
self.with_ice_shelf_cavities = with_ice_shelf_cavities
79109
self.high_res_topography = high_res_topography
80110

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

118148
self.add_step(base_mesh_step)
119149

120-
remap_step = RemapTopography(test_case=self,
121-
base_mesh_step=base_mesh_step,
122-
mesh_name=mesh_name)
150+
if mali_ais_topo is None:
151+
remap_step = RemapTopography(test_case=self,
152+
base_mesh_step=base_mesh_step,
153+
mesh_name=mesh_name)
154+
else:
155+
remap_step = RemapMaliTopography(
156+
test_case=self, base_mesh_step=base_mesh_step,
157+
mesh_name=mesh_name, mali_ais_topo=mali_ais_topo,
158+
ocean_includes_grounded=False)
159+
123160
self.add_step(remap_step)
124161

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

186+
if self.mali_ais_topo is not None:
187+
package = 'compass.ocean.tests.global_ocean.mesh.' \
188+
'remap_mali_topography'
189+
config.add_from_package(package,
190+
f'{self.mali_ais_topo.lower()}.cfg',
191+
exception=True)
192+
149193
if self.mesh_name.startswith('Kuroshio'):
150194
# add the config options for all kuroshio meshes
151195
config.add_from_package(

0 commit comments

Comments
 (0)