Source code for compass.ocean.tests.hurricane.init.initial_state

from compass.model import run_model
from compass.step import Step

[docs]class InitialState(Step): """ A step for creating a mesh and initial condition for hurricane test cases Attributes ---------- mesh : compass.ocean.tests.hurricane.mesh.mesh.MeshStep The step for creating the mesh """
[docs] def __init__(self, test_case, mesh): """ Create the step Parameters ---------- test_case : compass.ocean.tests.hurricane.init.Init The test case this step belongs to mesh : compass.ocean.tests.hurricane.mesh.Mesh The test case that creates the mesh used by this test case """ super().__init__(test_case=test_case, name='initial_state') self.mesh = mesh package = 'compass.ocean.tests.hurricane.init' # generate the namelist, replacing a few default options self.add_namelist_file(package, 'namelist.init', mode='init') # generate the streams file self.add_streams_file(package, 'streams.init', mode='init') mesh_path = mesh.mesh_step.path self.add_input_file( filename='', work_dir_target=f'{mesh_path}/') self.add_input_file( filename='', work_dir_target=f'{mesh_path}/') self.add_model_as_input() for file in ['', '']: self.add_output_file(filename=file)
[docs] def setup(self): """ Set up the test case in the work directory, including downloading any dependencies. """ # get the these properties from the config options config = self.config self.cores = config.getint('hurricane', 'init_cores') self.min_cores = config.getint('hurricane', 'init_min_cores') self.threads = config.getint('hurricane', 'init_threads')
[docs] def run(self): """ Run this step of the testcase """ run_model(self)