-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #429 from xylar/global_ocean_mesh_reorg
Switch `global_ocean` and `hurricane` to framework base and culled mesh
- Loading branch information
Showing
30 changed files
with
526 additions
and
522 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
117 changes: 117 additions & 0 deletions
117
...ass/ocean/tests/global_ocean/mesh/cull.py → compass/ocean/mesh/cull.py
100755 → 100644
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
from mpas_tools.ocean import inject_bathymetry, inject_preserve_floodplain | ||
|
||
from compass.mesh.spherical import QuasiUniformSphericalMeshStep | ||
|
||
|
||
class FloodplainMeshStep(QuasiUniformSphericalMeshStep): | ||
""" | ||
A step for creating a global MPAS-Ocean mesh that includes variables | ||
needed for preserving a floodplain | ||
preserve_floodplain : bool | ||
Whether the mesh includes land cells | ||
""" | ||
|
||
def __init__(self, test_case, name='base_mesh', subdir=None, | ||
cell_width=None, preserve_floodplain=True): | ||
""" | ||
Create a new step | ||
Parameters | ||
---------- | ||
test_case : compass.testcase.TestCase | ||
The test case this step belongs to | ||
name : str | ||
the name of the step | ||
subdir : {str, None} | ||
the subdirectory for the step. The default is ``name`` | ||
cell_width : float, optional | ||
The approximate cell width in km of the mesh if constant resolution | ||
preserve_floodplain : bool, optional | ||
Whether the mesh includes land cells | ||
""" | ||
|
||
super().__init__(test_case=test_case, name=name, subdir=subdir, | ||
cell_width=cell_width) | ||
|
||
self.preserve_floodplain = preserve_floodplain | ||
|
||
self.add_input_file(filename='earth_relief_15s.nc', | ||
target='SRTM15_plus_earth_relief_15s.nc', | ||
database='bathymetry_database') | ||
|
||
def run(self): | ||
""" | ||
Run this step of the test case | ||
""" | ||
super().run() | ||
|
||
config = self.config | ||
|
||
mesh_filename = config.get('spherical_mesh', 'mpas_mesh_filename') | ||
|
||
inject_bathymetry(mesh_file=mesh_filename) | ||
if self.preserve_floodplain: | ||
floodplain_elevation = config.getfloat('spherical_mesh', | ||
'floodplain_elevation') | ||
inject_preserve_floodplain( | ||
mesh_file=mesh_filename, | ||
floodplain_elevation=floodplain_elevation) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.