From a0d8ab8f5f313b7ec35874cd8e11be45e08cc9b4 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Wed, 9 Oct 2024 16:03:39 -0500 Subject: [PATCH] Put low res topography options in a config file This is much less confusing than having them hard-coded deep inside of global ocean. --- compass/ocean/mesh/low_res_topography.cfg | 16 ++++++++++++++++ .../ocean/tests/global_ocean/mesh/__init__.py | 14 ++++---------- 2 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 compass/ocean/mesh/low_res_topography.cfg diff --git a/compass/ocean/mesh/low_res_topography.cfg b/compass/ocean/mesh/low_res_topography.cfg new file mode 100644 index 000000000..c3bf08c61 --- /dev/null +++ b/compass/ocean/mesh/low_res_topography.cfg @@ -0,0 +1,16 @@ +# config options related to remapping topography to an MPAS-Ocean mesh +[remap_topography] + +# the name of the topography file in the bathymetry database +topo_filename = BedMachineAntarctica_v2_and_GEBCO_2022_0.05_degree_20220729.nc + +# variable names in topo_filename +bathy_frac_var = ocean_mask + +# the description to include in metadata +description = Bathymetry is from GEBCO 2022, combined with BedMachine + Antarctica v2 around Antarctica. + +# the target and minimum number of MPI tasks to use in remapping +ntasks = 64 +min_tasks = 4 diff --git a/compass/ocean/tests/global_ocean/mesh/__init__.py b/compass/ocean/tests/global_ocean/mesh/__init__.py index e88a96d61..2d082c3b8 100644 --- a/compass/ocean/tests/global_ocean/mesh/__init__.py +++ b/compass/ocean/tests/global_ocean/mesh/__init__.py @@ -137,20 +137,14 @@ def configure(self, config=None): if config is None: config = self.config config.add_from_package('compass.mesh', 'mesh.cfg', exception=True) - # a description of the bathymetry if 'remap_topography' in self.steps: config.add_from_package('compass.ocean.mesh', 'remap_topography.cfg', exception=True) - if not self.high_res_topography: - filename = 'BedMachineAntarctica_v2_and_GEBCO_2022_0.05_degree_20220729.nc' # noqa: E501 - description = 'Bathymetry is from GEBCO 2022, combined with ' \ - 'BedMachine Antarctica v2 around Antarctica.' - config.set('remap_topography', 'topo_filename', filename) - config.set('remap_topography', 'bathy_frac_var', 'ocean_mask') - config.set('remap_topography', 'description', description) - config.set('remap_topography', 'ntasks', '64') - config.set('remap_topography', 'min_tasks', '4') + if not self.high_res_topography: + config.add_from_package('compass.ocean.mesh', + 'low_res_topography.cfg', + exception=True) if self.mesh_name.startswith('Kuroshio'): # add the config options for all kuroshio meshes