-
Notifications
You must be signed in to change notification settings - Fork 42
Reduce number of empty cells in extended high-resolution Greenland Ice Sheet mesh #937
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
base: main
Are you sure you want to change the base?
Changes from all commits
3cab0b5
75f8256
c942ce4
a02af8d
b017062
ea55469
63adea4
de843b5
15f86b6
886424e
8c92f53
2eefef6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -224,8 +224,9 @@ def clip_mesh_to_bounding_box(mask_ds, base_ds, bounding_box): | |||||||||||||||||||||||||||||||||||||||||||
| return mask_ds | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| def set_cell_width(self, section_name, thk, bed=None, vx=None, vy=None, | ||||||||||||||||||||||||||||||||||||||||||||
| def set_cell_width(self, section_name, thk, bed, vx=None, vy=None, | ||||||||||||||||||||||||||||||||||||||||||||
| dist_to_edge=None, dist_to_grounding_line=None, | ||||||||||||||||||||||||||||||||||||||||||||
| dist_to_coast=None, | ||||||||||||||||||||||||||||||||||||||||||||
| flood_fill_iStart=None, flood_fill_jStart=None): | ||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||
| Set cell widths based on settings in config file to pass to | ||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -238,9 +239,10 @@ def set_cell_width(self, section_name, thk, bed=None, vx=None, vy=None, | |||||||||||||||||||||||||||||||||||||||||||
| following options to be set in the given config section: | ||||||||||||||||||||||||||||||||||||||||||||
| ``levels``, ``x_min``, ``x_max``, ``y_min``, ``y_max``, | ||||||||||||||||||||||||||||||||||||||||||||
| ``min_spac``, ``max_spac``, ``high_log_speed``, ``low_log_speed``, | ||||||||||||||||||||||||||||||||||||||||||||
| ``high_dist``, ``low_dist``, ``high_dist_bed``, ``low_dist_bed``, | ||||||||||||||||||||||||||||||||||||||||||||
| ``high_bed``, ``low_bed``, ``cull_distance``, ``use_speed``, | ||||||||||||||||||||||||||||||||||||||||||||
| ``use_dist_to_edge``, ``use_dist_to_grounding_line``, and ``use_bed``. | ||||||||||||||||||||||||||||||||||||||||||||
| ``high_dist``, ``low_dist``, ``high_dist_coast``, ``low_dist_coast``, | ||||||||||||||||||||||||||||||||||||||||||||
| ``high_dist_bed``, ``low_dist_bed``, ``high_bed``, ``low_bed``, | ||||||||||||||||||||||||||||||||||||||||||||
| ``cull_distance``, ``use_speed``, ``use_dist_to_edge``, | ||||||||||||||||||||||||||||||||||||||||||||
| ``use_dist_to_grounding_line``, ``use_dist_to_coast``, and ``use_bed``. | ||||||||||||||||||||||||||||||||||||||||||||
| See the Land-Ice Framework section of the Users or Developers guide | ||||||||||||||||||||||||||||||||||||||||||||
| for more information about these options and their uses. | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -272,6 +274,11 @@ def set_cell_width(self, section_name, thk, bed=None, vx=None, vy=None, | |||||||||||||||||||||||||||||||||||||||||||
| function. Can be set to ``None`` if | ||||||||||||||||||||||||||||||||||||||||||||
| ``use_dist_to_grounding_line == False`` in config file. | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| dist_to_coast : numpy.ndarray, optional | ||||||||||||||||||||||||||||||||||||||||||||
| Distance from each cell to coast, calculated in separate | ||||||||||||||||||||||||||||||||||||||||||||
| function. Can be set to ``None`` if | ||||||||||||||||||||||||||||||||||||||||||||
| ``use_dist_to_coast == False`` in config file. | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| flood_fill_iStart : int, optional | ||||||||||||||||||||||||||||||||||||||||||||
| x-index location to start flood-fill when using bed topography | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -291,21 +298,19 @@ def set_cell_width(self, section_name, thk, bed=None, vx=None, vy=None, | |||||||||||||||||||||||||||||||||||||||||||
| # Get config inputs for cell spacing functions | ||||||||||||||||||||||||||||||||||||||||||||
| min_spac = section.getfloat('min_spac') | ||||||||||||||||||||||||||||||||||||||||||||
| max_spac = section.getfloat('max_spac') | ||||||||||||||||||||||||||||||||||||||||||||
| high_log_speed = section.getfloat('high_log_speed') | ||||||||||||||||||||||||||||||||||||||||||||
| low_log_speed = section.getfloat('low_log_speed') | ||||||||||||||||||||||||||||||||||||||||||||
| high_dist = section.getfloat('high_dist') | ||||||||||||||||||||||||||||||||||||||||||||
| low_dist = section.getfloat('low_dist') | ||||||||||||||||||||||||||||||||||||||||||||
| high_dist_bed = section.getfloat('high_dist_bed') | ||||||||||||||||||||||||||||||||||||||||||||
| low_dist_bed = section.getfloat('low_dist_bed') | ||||||||||||||||||||||||||||||||||||||||||||
| low_bed = section.getfloat('low_bed') | ||||||||||||||||||||||||||||||||||||||||||||
| high_bed = section.getfloat('high_bed') | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| # convert km to m | ||||||||||||||||||||||||||||||||||||||||||||
| cull_distance = section.getfloat('cull_distance') * 1.e3 | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| land_mask = np.logical_and(thk == 0.0, bed >= 0.) | ||||||||||||||||||||||||||||||||||||||||||||
| ocean_mask = np.logical_and(thk == 0.0, bed < 0.) | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| # Cell spacing function based on union of masks | ||||||||||||||||||||||||||||||||||||||||||||
| if section.get('use_bed') == 'True': | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
303
to
308
|
||||||||||||||||||||||||||||||||||||||||||||
| land_mask = np.logical_and(thk == 0.0, bed >= 0.) | |
| ocean_mask = np.logical_and(thk == 0.0, bed < 0.) | |
| # Cell spacing function based on union of masks | |
| if section.get('use_bed') == 'True': | |
| use_bed = section.get('use_bed') == 'True' | |
| if bed is None: | |
| if use_bed: | |
| raise ValueError( | |
| 'bed must be provided when use_bed is True in ' | |
| f'section "{section_name}".') | |
| land_mask = (thk == 0.0) | |
| ocean_mask = np.zeros_like(thk, dtype=bool) | |
| else: | |
| land_mask = np.logical_and(thk == 0.0, bed >= 0.) | |
| ocean_mask = np.logical_and(thk == 0.0, bed < 0.) | |
| # Cell spacing function based on union of masks | |
| if use_bed: |
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,73 @@ | ||||||||||||
| # config options for high_res_mesh test case | ||||||||||||
| [mesh] | ||||||||||||
|
|
||||||||||||
| # number of levels in the mesh | ||||||||||||
| levels = 10 | ||||||||||||
|
|
||||||||||||
| # Bounds of GIS mesh. If any bound is set | ||||||||||||
| # to None, the mesh will use the full extent | ||||||||||||
| # of the gridded dataset. | ||||||||||||
| x_min = None | ||||||||||||
| x_max = None | ||||||||||||
| y_min = None | ||||||||||||
| y_max = None | ||||||||||||
|
|
||||||||||||
| # distance from ice margin to cull (km). | ||||||||||||
| # Set to a value <= 0 if you do not want | ||||||||||||
| # to cull based on distance from margin. | ||||||||||||
| cull_distance = -100.0 | ||||||||||||
|
|
||||||||||||
| # mesh density parameters | ||||||||||||
| # minimum cell spacing (meters) | ||||||||||||
| min_spac = 1.e3 | ||||||||||||
| # maximum cell spacing (meters) | ||||||||||||
| max_spac = 10.e3 | ||||||||||||
| # log10 of max speed for cell spacing | ||||||||||||
| high_log_speed = 2.5 | ||||||||||||
| # log10 of min speed for cell spacing | ||||||||||||
| low_log_speed = 0.75 | ||||||||||||
| # distance at which cell spacing = max_spac | ||||||||||||
| high_dist = 1.e5 | ||||||||||||
| # distance within which cell spacing = min_spac | ||||||||||||
| low_dist = 1.e4 | ||||||||||||
| # distance at which cell spacing in ocean = max_spac | ||||||||||||
| high_dist_coast = 10.e3 | ||||||||||||
| # distance within which cell spacing in ocean = min_spac | ||||||||||||
| low_dist_coast = 2.e3 | ||||||||||||
| # distance at which bed topography has no effect | ||||||||||||
| high_dist_bed = 1.e5 | ||||||||||||
| # distance within which bed topography has maximum effect | ||||||||||||
| low_dist_bed = 7.5e4 | ||||||||||||
| # Bed elev beneath which cell spacing is minimized | ||||||||||||
| low_bed = 50.0 | ||||||||||||
| # Bed elev above which cell spacing is maximized | ||||||||||||
| high_bed = 100.0 | ||||||||||||
|
|
||||||||||||
| # mesh density functions | ||||||||||||
| use_speed = True | ||||||||||||
| use_dist_to_grounding_line = False | ||||||||||||
| use_dist_to_edge = True | ||||||||||||
| use_dist_to_coast = True | ||||||||||||
| use_bed = True | ||||||||||||
|
|
||||||||||||
| [greenland] | ||||||||||||
| # Whether to interpolate data (controls run_optional_interpolation) | ||||||||||||
| interpolate_data = True | ||||||||||||
| # path to directory containing BedMachine and Measures datasets | ||||||||||||
| # (default value is for Perlmutter) | ||||||||||||
| data_path = /global/cfs/cdirs/fanssie/standard_datasets/GIS_datasets/ | ||||||||||||
|
|
||||||||||||
|
||||||||||||
| # whether to interpolate the input datasets onto the mesh | |
| # set explicitly to preserve the current default behavior | |
| interpolate_data = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring lists
high_log_speed/low_log_speed,high_dist/low_dist,high_dist_coast/low_dist_coast, and bed-related options as always required, but the implementation only reads these when the correspondinguse_*flag is enabled. Please update the docstring to reflect which options are unconditional vs. conditional to avoid misleading config authors.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring does not actually say these are required. I agree the phrasing there is a little vague, but the docstring points to documentation for more information, and I think that's the more appropriate place to add this explanation.