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

Add a tides test case for the VR45to5 mesh #802

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
9 changes: 4 additions & 5 deletions compass/ocean/tests/tides/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from compass.testgroup import TestGroup

from compass.ocean.tests.tides.mesh import Mesh
from compass.ocean.tests.tides.init import Init
from compass.ocean.tests.tides.forward import Forward
from compass.ocean.tests.tides.init import Init
from compass.ocean.tests.tides.mesh import Mesh
from compass.testgroup import TestGroup


class Tides(TestGroup):
Expand All @@ -17,7 +16,7 @@ def __init__(self, mpas_core):
super().__init__(mpas_core=mpas_core,
name='tides')

for mesh_name in ['Icos7']:
for mesh_name in ['Icos7', 'VR45to5']:

mesh = Mesh(test_group=self, mesh_name=mesh_name)
self.add_test_case(mesh)
Expand Down
59 changes: 59 additions & 0 deletions compass/ocean/tests/tides/dem/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import os

import compass.ocean.tests.tides.dem.dem_pixel as dem_pixel
from compass.step import Step


class CreatePixelFile(Step):
"""
A step for creating a pixel file for creating MPAS meshes

Attributes
----------
"""

def __init__(self, test_case):
"""
Create the step

Parameters
----------
test_case : compass.ocean.tests.tides.init.Init
The test case this step belongs to
"""
super().__init__(test_case=test_case, name='pixel',
ntasks=1, min_tasks=1, openmp_threads=1)

self.add_input_file(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Building these DEM datasets could be done once and cached somewhere, as it's pretty expensive and is typically only redone when GEBCO release a new bathymetry (once per year).

filename='GEBCO_2023_sub_ice_topo.nc',
target='GEBCO_2023_sub_ice_topo.nc',
database='bathymetry_database')

self.add_input_file(
filename='RTopo-2.0.4_30sec_bedrock_topography.nc',
target='RTopo-2.0.4_30sec_bedrock_topography.nc',
database='bathymetry_database')

self.add_input_file(
filename='RTopo-2.0.4_30sec_surface_elevation.nc',
target='RTopo-2.0.4_30sec_surface_elevation.nc',
database='bathymetry_database')

self.add_input_file(
filename='RTopo-2.0.4_30sec_ice_base_topography.nc',
target='RTopo-2.0.4_30sec_ice_base_topography.nc',
database='bathymetry_database')

def run(self):
"""
Run this step of the test case
"""

self.init_path = './'

if not os.path.exists('RTopo_2_0_4_30sec_pixel.nc'):
dem_pixel.rtopo_30sec(self.init_path, self.init_path)
if not os.path.exists('GEBCO_v2023_30sec_pixel.nc'):
dem_pixel.gebco_30sec(self.init_path, self.init_path)
if not os.path.exists('RTopo_2_0_4_GEBCO_v2023_30sec_pixel.nc'):
dem_pixel.rtopo_gebco_30sec(self.init_path, self.init_path)
21 changes: 21 additions & 0 deletions compass/ocean/tests/tides/dem/dem_names.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

# -- long_name strings for NetCDF variables

class base:
pass


names = base()
names.bed_elevation = "elevation of bed"
names.ocn_thickness = "thickness of ocn"
names.ice_thickness = "thickness of ice"
names.ocn_cover = "fractional cover of ocn, 0-1"
names.ice_cover = "fractional cover of ice, 0-1"
names.bed_slope = "RMS magnitude of bed slopes"
names.bed_slope_deg = "arc-tangent of RMS bed slopes"
names.bed_dz_dx = "derivative of bed elevation along lon.-axis"
names.bed_dz_dy = "derivative of bed elevation along lat.-axis"
names.bed_elevation_profile = "sub-grid percentiles of bed elevation"
names.bed_slope_profile = "sub-grid percentiles of RMS bed slope"
names.ocn_thickness_profile = "sub-grid percentiles of ocn thickness"
names.ice_thickness_profile = "sub-grid percentiles of ice thickness"
Loading
Loading