Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Trevor Hillebrand <[email protected]>
  • Loading branch information
andrewdnolan and trhille authored Oct 1, 2024
1 parent 4338977 commit ed7b85e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
10 changes: 4 additions & 6 deletions compass/landice/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ def get_dist_to_edge_and_gl(self, thk, topg, x, y,
logger.info('WARNING: window_size was set to a value smaller'
' than high_dist and/or high_dist_bed. Resetting'
f' window_size to {max(high_dist, high_dist_bed)}, '
' which is max(high_dist, high_dist_bed)')
' which is max(high_dist, high_dist_bed)')
window_size = max(high_dist, high_dist_bed)

dx = x[1] - x[0] # assumed constant and equal in x and y
Expand Down Expand Up @@ -971,8 +971,8 @@ def preprocess_ais_data(self, source_gridded_dataset,

tic = time.perf_counter()
logger.info(f"Beginning interpolation for {field}")
# NOTE: Do not need to evaluate the extrapolator at all gridcells.
# Only needed for ice-free gricells, since it's NN extrapolation
# NOTE: Do not need to evaluate the extrapolator at all grid cells.
# Only needed for ice-free grid cells, since it's NN extrapolation
data.variables[field][0, :] = interp(xGrid, yGrid)
toc = time.perf_counter()
logger.info(f"Interpolation completed in {toc - tic} seconds")
Expand Down Expand Up @@ -1027,7 +1027,7 @@ def interp_gridded2mali(self, source_file, mali_scrip, nProcs, dest_file, proj,
MALI input file to which data should be remapped
proj: str
projection of the source dataset ...
projection of the source dataset
variables: str or list of strings
Expand Down Expand Up @@ -1069,8 +1069,6 @@ def __guess_scrip_name(filename):
check_call(args, logger=logger)

# Generate remapping weights
# Testing shows 5 badger/grizzly nodes works well.
# 2 nodes is too few. I have not tested anything in between.
logger.info('generating gridded dataset -> MPAS weights')
args = ['srun', '-n', nProcs, 'ESMF_RegridWeightGen',
'--source', source_scrip,
Expand Down
4 changes: 2 additions & 2 deletions compass/landice/tests/antarctica/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def run(self):

section_name = 'mesh'

# do we want to add this to the config file?
# TODO: do we want to add this to the config file?
source_gridded_dataset = 'antarctica_8km_2024_01_29.nc'

bm_updated_gridded_dataset = add_bedmachine_thk_to_ais_gridded_data(
Expand Down Expand Up @@ -141,7 +141,7 @@ def run(self):
interp_gridded2mali(self, bedmachine_dataset, dst_scrip_file, nProcs,
self.mesh_filename, src_proj, variables="all")

# only interpolate a subset of MEASURES varibles onto the MALI mesh
# only interpolate a subset of MEaSUREs variables onto the MALI mesh
measures_vars = ['observedSurfaceVelocityX',
'observedSurfaceVelocityY',
'observedSurfaceVelocityUncertainty']
Expand Down
4 changes: 2 additions & 2 deletions compass/landice/tests/greenland/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def run(self):
interp_gridded2mali(self, bedmachine_dataset, dst_scrip_file, nProcs,
self.mesh_filename, src_proj, variables="all")

# only interpolate a subset of MEASURES varibles onto the MALI mesh
# only interpolate a subset of MEaSUREs variables onto the MALI mesh
measures_vars = ['observedSurfaceVelocityX',
'observedSurfaceVelocityY',
'observedSurfaceVelocityUncertainty']
Expand Down Expand Up @@ -149,7 +149,7 @@ def run(self):
dHdtErr = np.abs(dHdt) * 0.05
# Use threshold of |dHdt| > 1.0 to determine invalid data
mask = np.abs(dHdt) > 1.0
# Assign 100% uncertainty where data is missing
# Assign very large uncertainty where data is missing
dHdtErr = dHdtErr.where(~mask, 1.0)
# Remove ridiculous values
dHdt = dHdt.where(~mask, 0.0)
Expand Down
2 changes: 1 addition & 1 deletion compass/landice/tests/greenland/mesh_gen/mesh_gen.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ data_path = /global/cfs/cdirs/fanssie/standard_datasets/GIS_datasets/
# (default value is for Perlmutter)
bedmachine_filename = BedMachineGreenland-v5_edits_floodFill_extrap.nc

# filename of the MEASURES ice velocity dataset
# filename of the MEaSUREs ice velocity dataset
# (default value is for Perlmutter)
measures_filename = greenland_vel_mosaic500_extrap.nc

Expand Down
4 changes: 2 additions & 2 deletions docs/developers_guide/landice/framework.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ clean up steps after interpolation for the AIS mesh case.
to the gridded dataset in order to separate the ice sheet from peripheral ice.

:py:func:`compass.landice.mesh.interp_gridded2mali()` interpolates gridded data
(e.g. BedMachine thickness or MEASURES ice velocity) to a MALI mesh, accounting
(e.g. BedMachine thickness or MEaSUREs ice velocity) to a MALI mesh, accounting
for masking of the ice extent to avoid interpolation ramps. This functions works
for either the Antarctic or Greenland Icesheets.
for both Antarctica and Greenland.

:py:func:`compass.landice.mesh.preprocess_ais_data()` performs adjustments to
gridded AIS datasets needed for rest of compass workflow to utilize them.
Expand Down

0 comments on commit ed7b85e

Please sign in to comment.