-
Notifications
You must be signed in to change notification settings - Fork 28
Add "method" keyword argument to make_regridder_* routines in gcpy/regrid.py #362
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
Conversation
gcpy/regrid.py - Added the "method" keyword argument in the routines listed below with default value = "conservative". Pass the value from the method keyword argument to xe.Regridder instead of using the hardwired string "conservative" - make_regridder_L2L - make_regridder_C2L - make_regridder_S2S - make_regridder_L2S - Apply fixes suggested by Pylint - Trimmed trailing whitespace gcpy/file_regrid.py - Apply fixes suggested by Pylint - Trimmed trailing whitespace CHANGELOG.md - Updated accordingly Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
# ============================================================== | ||
for var in dset.data_vars.keys(): | ||
if var == "DELP_DRY" or var == "DELPDRY": | ||
if var in ("DELP_DRY", "DELPDRY"): |
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.
This was a fix suggested by Pylint
"currently not supported. Please use the offline regridding\n" + \ | ||
"method described in the Regridding section of gcpy.readthedocs.io." | ||
raise RuntimeError(msg) | ||
msg = "Regridding to or from cubed-sphere stretched grids is\n" + \ |
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 extra indentation was suggested by Pylint
1, cmpminlon_ind:cmpmaxlon_ind + 1].squeeze() | ||
return new_data | ||
elif cmpgridtype == "cs": | ||
if cmpgridtype == "cs": |
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.
Changing elif -> if after a return statement was suggested by Pylint.
# %%%% Renaming from the common format %%%% | ||
# Reverse rename | ||
ds = rename_existing(ds, | ||
ds = rename_existing(ds, |
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.
Trimmed trailing whitespace here
1, cmpminlon_ind:cmpmaxlon_ind + 1].squeeze() | ||
return new_data | ||
elif cmpgridtype == "ll": | ||
if cmpgridtype == "ll": |
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.
Changing elif -> if after a return statement was suggested by Pylint.
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.
Looks good. Thanks @yantosca!
Name and Institution (Required)
Name: Bob Yantosca
Institution: Harvard + GCST
Describe the update
This is the companion PR to #361 by @nicodgomez. We have now added the
method
keyword argument (with default valueconservative
) to the following routines ingcpy/regrid.py
:make_regridder_L2L
make_regridder_C2L
make_regridder_S2S
make_regridder_L2S
This will allow the value of
method
passed to these routines to be in turn passed to thexesmf.Regridder
function.Also, some minor fixes suggested by the Pylint linter were applied to
gcpy/file_regrid.py
andgcpy/regrid.py
.Expected changes
Using
file_regrid.py
such to regrid lat-lon files to a different lat-lon grid, such as:will no longer result in the
TypeError
described by @nicodgomez in #361.Related Github Issue