Draft
Conversation
This feature allows users of the `regrid` CLI to supply a relative
tolerance for grid spacing checks, e.g.,
```
improver regrid <cubes> --rtol-grid-spacing=4.0e-3
```
Previously, this relative tolerance was hard-coded into a function.
The change in this commit enables users to use the `regrid` CLI with
grids that have minor discrepancies in latitude/longitude spacing.
The new `--rtol-grid-spacing` argument is only used for certain regrid
modes ("nearest-2", "nearest-with-mask-2","bilinear-2", and
"bilinear-with-mask-2").
The new `--rtol-grid-spacing` argument is optional and it takes a
default value. The default value is the hard-coded value that existed
previously. This means that existing systems that uses the `regrid` CLI
will not be affected by this change.
This changeset includes:
* Add `--rtol-grid-spacing` argument to `regrid` CLI
* Update the classes `RegridLandSea` and `RegridWithLandSeaMask` to
have a new attribute, `rtol_grid_spacing`
* Update the `calculate_input_grid_spacing()` function in
`improver/regrid/grid.py` with a new argument, `rtol`, which is the
relative tolerance that will be used when calculating grid spacing.
* Use constants for default grid spacing rtols (rather than magic
numbers)
* Update `calculate_grid_spacing()` function in
`improver/utilities/spatial.py` with more input validation
* Unit and acceptance tests for all of the above
Closes metoppv#2307
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An alternative implementation that avoids the global variables and keeps the values where they are used. Uses None as default in most interfaces to avoid the need for the globals, and then sets the value in
calculate_input_grid_spacingif it receives None.I've not modified any of your tests as they all pass with this set of changes.