Skip to content

Commit

Permalink
Added scripfile output and updated docs for combine_topo/cubed_sphere
Browse files Browse the repository at this point in the history
  • Loading branch information
bmooremaley committed Oct 6, 2024
1 parent abd2886 commit 1ed573a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 15 deletions.
16 changes: 10 additions & 6 deletions compass/ocean/tests/utility/combine_topo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,13 @@ def setup(self):
self.resolution = section.getfloat('resolution_latlon')
self.resolution_name = f'{self.resolution:.4f}_degree'

# Build combined filename
# Build output filenames
datestamp = datetime.now().strftime('%Y%m%d')
scrip_filename = f'{self.resolution_name}_{datestamp}.scrip.nc'
combined_filename = '_'.join([
antarctic_filename.strip('.nc'), global_filename.strip('.nc'),
self.resolution_name, datetime.now().strftime('%Y%m%d.nc'),
antarctic_filename.strip('.nc'),
global_filename.strip('.nc'),
self.resolution_name, f'{datestamp}.nc',
])

# Add bathymetry data input files
Expand All @@ -107,6 +110,7 @@ def setup(self):
target=global_filename,
database='bathymetry_database',
)
self.add_output_file(filename=scrip_filename)
self.add_output_file(filename=combined_filename)

# Get ntasks and min_tasks
Expand Down Expand Up @@ -306,7 +310,7 @@ def _create_target_scrip_file(self):
logger = self.logger
logger.info(f'Create SCRIP file for {self.resolution_name} mesh')

out_filename = f'{self.resolution_name}.scrip.nc'
out_filename = self.outputs[0]

# Build cubed sphere SCRIP file using tempestremap
if self.target_grid == 'cubed_sphere':
Expand Down Expand Up @@ -352,7 +356,7 @@ def _create_weights(self, in_filename, out_filename):
args = [
'ESMF_RegridWeightGen',
'--source', in_filename,
'--destination', f'{self.resolution_name}.scrip.nc',
'--destination', self.outputs[0],
'--weight', out_filename,
'--method', method,
'--netcdf4',
Expand Down Expand Up @@ -567,7 +571,7 @@ def _combine(self):
combined[field] = combined[field].where(valid, fill_val)

# Save combined bathy to NetCDF
combined.to_netcdf(self.outputs[0])
combined.to_netcdf(self.outputs[1])

logger.info(' Done.')

Expand Down
2 changes: 1 addition & 1 deletion compass/ocean/tests/utility/combine_topo/combine_topo.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ renorm_thresh = 1e-3

# the target and minimum number of MPI tasks to use in remapping
ntasks = 1280
min_tasks = 1024
min_tasks = 512

# latitudes between which the topography datasets get blended
latmin = -62.
Expand Down
13 changes: 9 additions & 4 deletions docs/developers_guide/ocean/test_groups/utility.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@ dataset.
combine
~~~~~~~
The class :py:class:`compass.ocean.tests.utility.combine_topo.Combine`
defines a step for combining the datasets above. The GEBCO data is downsampled
to a 1/80 degree latitude-longitude grid to make later remapping to MPAS meshes
more manageable. The BedMachine data is remapped to this same mesh and the
two datasets are blended between 60 and 62 degrees south latitude.
defines a step for combining the datasets above. The GEBCO and BedMachine data
are remapped to a common global grid to make later remapping to MPAS meshes
more manageable, and the two datasets are blended between 60 and 62 degrees
south latitude. The GEBCO global dataset is divided into regional tiles prior
to remapping to improve performance. Two common global target grid options are
provided: a 1/80 degree latitude-longitude grid and an ne3000 cubed sphere
grid. These target grid options are selectable via the ``target_grid`` argument
in the :py:class:`compass.ocean.tests.utility.combine_topo.CombineTopo` test
case class.

cull_restarts
-------------
Expand Down
17 changes: 13 additions & 4 deletions docs/users_guide/ocean/test_groups/utility.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,22 @@ may create datasets for other test groups to use. It is partly designed to
provide provenance for data processing that may be more complex than a single,
short script.

combine_topo
------------
The ``ocean/utility/combine_topo`` test case is used to combine the
combine_topo/lat_lon
--------------------
The ``ocean/utility/combine_topo/lat_lon`` test case is used to combine the
`BedMachine Antarctica v3 <https://nsidc.org/data/nsidc-0756/versions/3>`_
dataset with the `GEBCO 2023 <https://www.gebco.net/data_and_products/gridded_bathymetry_data/>`_
dataset. The result is on a 1/80 degree latitude-longitude grid. This utility
is intended for provenance. It is intended to doucment the process for
is intended for provenance. It is intended to document the process for
producing the topography dataset used for E3SM ocean meshes.

combine_topo/cubed_sphere
-------------------------
The ``ocean/utility/combine_topo/cubed_sphere`` test case is used to combine the
`BedMachine Antarctica v3 <https://nsidc.org/data/nsidc-0756/versions/3>`_
dataset with the `GEBCO 2023 <https://www.gebco.net/data_and_products/gridded_bathymetry_data/>`_
dataset. The result is on an ne3000 cubed sphere grid. This utility
is intended for provenance. It is intended to document the process for
producing the topography dataset used for E3SM ocean meshes.

cull_restarts
Expand Down

0 comments on commit 1ed573a

Please sign in to comment.