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 indexing bugs in get_field_nc #334

Merged

Commits on Mar 11, 2023

  1. *Fix indexing bugs in get_field_nc

      Fixed two horizontal indexing bugs in get_field_nc, where the difference
    between the array starting index (always 1 in this subroutine) and the values
    in the handle argument were not being taken into account when the array was
    being passed in with only its computational domain.  Also initialized the
    internal unlim_index array in get_netcdf_fields to fix a problem with using an
    uninitialized array that was being flagged when run in debug mode.  With this
    commit, the model is once again reproducing the expected answers when rescaling
    is applied for vertical distances or time.  All answers are bitwise identical
    in cases that were working before.
    
      This commit addresses the issue at github.com/NOAA-GFDL/issues/333, which
    can be closed once this commit is merged into dev/gfdl.
    Hallberg-NOAA committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    17cc7d3 View commit details
    Browse the repository at this point in the history

Commits on Mar 13, 2023

  1. Refactor of get_field_nc index fixes (#8)

    This patch addresses some of the proposed changes to `get_field_nc`.
    
    * `WARNING` is removed from `use MOM_error_handler` since it is unused.
    
    * Zero initialization of `values_c` by `source=` has been removed.
    
      This initialization serves no purpose, since every value will be
      filled by the netCDF read statement.
    
    * `values_c` indexing is now 1-based
    
      `values` has ambiguous shape, so it can follow no natural indexing.
      Although `values_c` always resides on the compute domain, the transfer
      to `values` may feel unintuitive.  Allocating from the 1 index
      identifies this as an explicit transfer of 1-based indices.
    
    * Computation of the data domain indices were moved to the actual
      transfer of `values_c` to `values`.
    
    * A comment was added to explain the initial "magic value" of
      `unlim_index`.
    
    (It has also been suggested that the zero initialization of the intent(out)
    `values` array should be removed, even when it has halos that would not be set
    here.  However, this was deemed beyond the scope of this bug-fix PR, so this
    commit was edited during merging to restore the initialization of `values` to
    exactly what was there on the dev/gfdl branch before this PR, leaving this
    particular change to be addressed with a later PR as necessary. - R. Hallberg)
    
    Stylistic changes consistent with the existing file have also been
    imposed:
    
    * `values_nc` renamed to `values_c`
    
      Previous suffix indicated some special netCDF property of this field,
      when it's just the compute subdomain of the field's values.
    
    * Comments have been truncated for readability
    
    * Column width is restricted to 80
    
    * Composite statements (semicolons) have been removed
    marshallward authored and Hallberg-NOAA committed Mar 13, 2023
    Configuration menu
    Copy the full SHA
    e0fcbc7 View commit details
    Browse the repository at this point in the history

Commits on Mar 14, 2023

  1. +Make values arg to get_field_nc intent inout

      Made the values argument to MOM_read_data_2d and get_field_nc intent inout to
    preserve the previous values of this array in any halos it might have, and
    removed a line initializing the halos of this array to 0.  Also added some
    missing comments describing arguments to these routines  and changed the
    existing comments describing the arguments to get_field_nc to use doxygen
    syntax.  All answers in test cases are bitwise identical.
    Hallberg-NOAA committed Mar 14, 2023
    Configuration menu
    Copy the full SHA
    daea32f View commit details
    Browse the repository at this point in the history