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

New Mesh: RRSwISC6to18E3r4 #754

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
34 changes: 27 additions & 7 deletions compass/ocean/mesh/cull.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,19 @@ def run(self):
convert_to_cdf5 = config.getboolean('spherical_mesh',
'convert_culled_mesh_to_cdf5')

latitude_threshold = config.getfloat('spherical_mesh',
'latitude_threshold')

sweep_count = config.getint('spherical_mesh', 'sweep_count')

cull_mesh(with_critical_passages=True, logger=logger,
use_progress_bar=use_progress_bar,
preserve_floodplain=preserve_floodplain,
with_cavities=with_ice_shelf_cavities,
process_count=self.cpus_per_task,
convert_to_cdf5=convert_to_cdf5)
convert_to_cdf5=convert_to_cdf5,
latitude_threshold=latitude_threshold,
sweep_count=sweep_count)

if do_inject_bathymetry:
inject_bathymetry(mesh_file='culled_mesh.nc')
Expand All @@ -180,7 +187,8 @@ def run(self):
def cull_mesh(with_cavities=False, with_critical_passages=False,
custom_critical_passages=None, custom_land_blockages=None,
preserve_floodplain=False, logger=None, use_progress_bar=True,
process_count=1, convert_to_cdf5=False):
process_count=1, convert_to_cdf5=False, latitude_threshold=43.,
sweep_count=20):
"""
First step of initializing the global ocean:

Expand Down Expand Up @@ -241,21 +249,29 @@ def cull_mesh(with_cavities=False, with_critical_passages=False,
process_count : int, optional
The number of cores to use to create masks (``None`` to use all
available cores)

convert_to_cdf5 : bool, optional
Convert the culled mesh to PNetCDF CDF-5 format

latitude_threshold : float, optional
Minimum latitude, in degrees, for masking land-locked cells

sweep_count : int, optional
Maximum number of sweeps to search for land-locked cells
"""
with LoggingContext(name=__name__, logger=logger) as logger:
_cull_mesh_with_logging(
logger, with_cavities, with_critical_passages,
custom_critical_passages, custom_land_blockages,
preserve_floodplain, use_progress_bar, process_count,
convert_to_cdf5)
convert_to_cdf5, latitude_threshold, sweep_count)


def _cull_mesh_with_logging(logger, with_cavities, with_critical_passages,
custom_critical_passages, custom_land_blockages,
preserve_floodplain, use_progress_bar,
process_count, convert_to_cdf5):
process_count, convert_to_cdf5, latitude_threshold,
sweep_count):
""" Cull the mesh once the logger is defined for sure """

critical_passages = with_critical_passages or \
Expand Down Expand Up @@ -286,9 +302,9 @@ def _cull_mesh_with_logging(logger, with_cavities, with_critical_passages,

dsBaseMesh = xr.open_dataset('base_mesh.nc')
dsLandMask = xr.open_dataset('land_mask.nc')
dsLandMask = add_land_locked_cells_to_mask(dsLandMask, dsBaseMesh,
latitude_threshold=43.0,
nSweeps=20)
dsLandMask = add_land_locked_cells_to_mask(
dsLandMask, dsBaseMesh, latitude_threshold=latitude_threshold,
nSweeps=sweep_count)
write_netcdf(dsLandMask, 'land_mask_with_land_locked_cells.nc')

# create seed points for a flood fill of the ocean
Expand Down Expand Up @@ -425,6 +441,10 @@ def _cull_mesh_with_logging(logger, with_cavities, with_critical_passages,

dsMask = xr.open_dataset('ice_coverage.nc')

dsMask = add_land_locked_cells_to_mask(
dsMask, dsCulledMesh, latitude_threshold=latitude_threshold,
nSweeps=sweep_count)

landIceMask = dsMask.regionCellMasks.isel(nRegions=0)
dsLandIceMask = xr.Dataset()
dsLandIceMask['landIceMask'] = landIceMask
Expand Down
4 changes: 4 additions & 0 deletions compass/ocean/tests/global_ocean/global_ocean.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ cull_mesh_min_cpus_per_task = 1
cull_mesh_max_memory = 1000
# Whether to convert the culled mesh file to CDF5 format
convert_culled_mesh_to_cdf5 = False
# Minimum latitude, in degrees, for masking land-locked cells
latitude_threshold = 43.0
# Maximum number of sweeps to search for land-locked cells
sweep_count = 20


# Options relate to adjusting the sea-surface height or land-ice pressure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ dynamic_adjustment:
run_duration: 18_00:00:00
output_interval: 10_00:00:00
restart_interval: 06_00:00:00
dt: 00:06:00
btr_dt: 00:00:12
dt: 00:05:00
btr_dt: 00:00:10
Rayleigh_damping_coeff: None
13 changes: 7 additions & 6 deletions compass/ocean/tests/global_ocean/mesh/rrs6to18/rrs6to18.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,22 @@ approx_cell_count = 4000000
# the prefix (e.g. QU, EC, WC, SO)
prefix = RRS
# a description of the mesh and initial condition
mesh_description = MPAS Eddy Closure mesh for E3SM version ${e3sm_version} with
enhanced resolution around the equator (30 km), South pole
(35 km), Greenland (${min_res} km), ${max_res}-km resolution
at mid latitudes, and ${levels} vertical levels
mesh_description = MPAS Rossby-radius scaled (RRS) mesh for E3SM version
${e3sm_version} with ${min_res}-km resolution at the poles,
${max_res}-km resolution at the equator, and <<<levels>>>
vertical levels. This mesh includes cavities under the ice
shelves around Antarctica.
# E3SM version that the mesh is intended for
e3sm_version = 3
# The revision number of the mesh, which should be incremented each time the
# mesh is revised
mesh_revision = 1
mesh_revision = 4
# the minimum (finest) resolution in the mesh
min_res = 6
# the maximum (coarsest) resolution in the mesh, can be the same as min_res
max_res = 18
# The URL of the pull request documenting the creation of the mesh
pull_request = <<<Missing>>>
pull_request = https://github.com/MPAS-Dev/compass/pull/754


# config options related to remapping topography to an MPAS-Ocean mesh
Expand Down
4 changes: 4 additions & 0 deletions compass/ocean/tests/hurricane/hurricane.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@
# Config options related to the step for culling land from the mesh
# Whether to convert the culled mesh file to CDF5 format
convert_culled_mesh_to_cdf5 = False
# Minimum latitude, in degrees, for masking land-locked cells
latitude_threshold = 43.0
# Maximum number of sweeps to search for land-locked cells
sweep_count = 20
Loading