Source code for compass.ocean.tests.baroclinic_channel.default

from compass.testcase import TestCase
from compass.ocean.tests.baroclinic_channel.initial_state import InitialState
from compass.ocean.tests.baroclinic_channel.forward import Forward
from compass.ocean.tests import baroclinic_channel
from compass.validate import compare_variables


[docs] class Default(TestCase): """ The default test case for the baroclinic channel test group simply creates the mesh and initial condition, then performs a short forward run on 4 cores. Attributes ---------- resolution : str The resolution of the test case """
[docs] def __init__(self, test_group, resolution): """ Create the test case Parameters ---------- test_group : compass.ocean.tests.baroclinic_channel.BaroclinicChannel The test group that this test case belongs to resolution : str The resolution of the test case """ name = 'default' self.resolution = resolution subdir = '{}/{}'.format(resolution, name) super().__init__(test_group=test_group, name=name, subdir=subdir) self.add_step( InitialState(test_case=self, resolution=resolution)) self.add_step( Forward(test_case=self, ntasks=4, openmp_threads=1, resolution=resolution))
[docs] def configure(self): """ Modify the configuration options for this test case. """ baroclinic_channel.configure(self.resolution, self.config)
# no run() is needed because we're doing the default: running all steps def validate(self): """ Compare ``temperature``, ``salinity``, ``layerThickness`` and ``normalVelocity`` with a baseline if one was provided. """ variables = ['temperature', 'salinity', 'layerThickness', 'normalVelocity'] compare_variables(test_case=self, variables=variables, filename1='forward/output.nc')