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

+(*)Fix a scaling bug in MOM_horizontal_regridding #123

Merged

Conversation

Hallberg-NOAA
Copy link
Member

Avoids using hard-coded dimensional tolerances in horizontal_regridding and
improves the documentation of the variables and their units in this file.
Without this change, calls to horiz_interp_and_extrap_tracer with a non-unity
conversion factor will exhibit unexpected changes in answers, and may have
wildly inappropriate amounts of smoothing of the interpolated values in arrays
that are initialized from z-space file. However, the defaults are carefully
chosen to avoid changing answers in any cases that do not use rescaling of
tracer concentrations. The specific changes include:

  • Add a new optional argument tr_iter_tol to the horiz_interp_and_extrap_tracer
    routines to set an appropriate dimensional threshold for when the post-fill
    smoothing of tracers should be considered to be adequate.

  • Make the dimensional crit argument to fill_miss_2d non-optional, and fill it
    with appropriate values in calls from the horiz_interp_and_extrap_tracer
    routines when tr_iter_tol is not present. There should never be a hard-coded
    non-zero default for a dimensional variable!

  • Add a new optional scale argument to myStats

  • Eliminate the unused and unnecessary smooth logical argument to
    fill_miss_2d; the same functionality is obtained by setting the num_pass
    argument to 0.

  • Added to comments to document the units or unitlessness of the real
    variables in MOM_horizontal_regridding.F90.

  • Made minor changes to make the duplicated portions of the two
    horiz_interp_and_extrap_tracer similar.

By default, all answers are bitwise identical, but this corrects a subtle bug
with the use of the conversion factor argument in horiz_interp_and_extrap_tracer
calls. There are new optional arguments to publicly visible routines.

  Avoids using hard-coded dimensional tolerances in horizontal_regridding and
improves the documentation of the variables and their units in this file.
Without this change, calls to horiz_interp_and_extrap_tracer with a non-unity
conversion factor will exhibit unexpected changes in answers, and may have
wildly inappropriate amounts of smoothing of the interpolated values in arrays
that are initialized from z-space file.  However, the defaults are carefully
chosen to avoid changing answers in any cases that do not use rescaling of
tracer concentrations.  The specific changes include:

 - Add a new optional argument tr_iter_tol to the horiz_interp_and_extrap_tracer
   routines to set an appropriate dimensional threshold for when the post-fill
   smoothing of tracers should be considered to be adequate.

 - Make the dimensional crit argument to fill_miss_2d non-optional, and fill it
   with appropriate values in calls from the horiz_interp_and_extrap_tracer
   routines when tr_iter_tol is not present.  There should never be a hard-coded
   non-zero default for a dimensional variable!

 - Add a new optional scale argument to myStats

 - Eliminate the unused and unnecessary smooth logical argument to
   fill_miss_2d; the same functionality is obtained by setting the num_pass
   argument to 0.

 - Added to comments to document the units or unitlessness of the real
   variables in MOM_horizontal_regridding.F90.

 - Made minor changes to make the duplicated portions of the two
   horiz_interp_and_extrap_tracer similar.

By default, all answers are bitwise identical, but this corrects a subtle bug
with the use of the conversion factor argument in horiz_interp_and_extrap_tracer
calls.  There are new optional arguments to publicly visible routines.
@Hallberg-NOAA Hallberg-NOAA added bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request labels May 7, 2022
@codecov
Copy link

codecov bot commented May 7, 2022

Codecov Report

Merging #123 (e1bb52c) into dev/gfdl (005c460) will increase coverage by 0.01%.
The diff coverage is 46.58%.

❗ Current head e1bb52c differs from pull request most recent head 6521d65. Consider uploading reports for the commit 6521d65 to get more accurate results

@@             Coverage Diff              @@
##           dev/gfdl     #123      +/-   ##
============================================
+ Coverage     28.77%   28.78%   +0.01%     
============================================
  Files           249      249              
  Lines         72968    72991      +23     
============================================
+ Hits          20995    21010      +15     
- Misses        51973    51981       +8     
Impacted Files Coverage Δ
src/framework/MOM_horizontal_regridding.F90 36.53% <46.58%> (+1.41%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 005c460...6521d65. Read the comment docs.

@marshallward
Copy link
Member

Gaea regression: https://gitlab.gfdl.noaa.gov/ogrp/MOM6/-/pipelines/15453 ✔️

@marshallward marshallward merged commit 0e8acd9 into NOAA-GFDL:dev/gfdl May 10, 2022
@Hallberg-NOAA Hallberg-NOAA deleted the horizontal_regridding_fix branch July 16, 2022 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants