Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@mjs2369
Copy link
Contributor

@mjs2369 mjs2369 commented Oct 22, 2025

Description:

Previously, the check_attribute_value_r4/r8 subroutines simply returned if the attribute (i.e FillValue, add_offset, scale_factor) in the given netcdf file was a NaN (ret_spvalR4 /= ret_spvalR4)

if ( nf90_get_att(ncFile, ncVarID, att_string, ret_spvalR4) == NF90_NOERR ) then
if (ret_spvalR4 /= ret_spvalR4) then
return
endif
if (spvalR4 /= ret_spvalR4) then
write(msgstring,*) ' variable attribute, ', trim(att_string), ' in state', spvalR4, &
' does not match ', trim(att_string), ' ', ret_spvalR4, ' in ', trim(filename)
call error_handler(E_ERR, 'check_attribute_value_r4', msgstring, source)
endif
endif

They did not check that the attribute value in the state was also a NaN and therefore matched, which is the purpose of these subroutines

This PR adds an check to see if the attribute value in the state is also a NaN, and if it isn't, errors out with the appropriate message

Fixes issue

Partial fix for issue #970
Updated fix for old, closed issue #323

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Documentation changes needed?

  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.

Tests

Please describe any tests you ran to verify your changes.

Ran ROMS_Rutgers with and without debugging flags (gfort and intel)
When output_priorinf_sd.nc has NaN as the FillValue, it errors out in the new error check

 ERROR FROM:
  source : io_filenames_mod.f90
  routine: check_attribute_value_r4
  message:   variable attribute, _FillValue in state   9.99999993E+36  does not match _FillValue   NaN  in output_priorinf_sd.nc

When output_priorinf_sd.nc does not have NaN as the FillValue, runs successfully as expected

Checklist for merging

  • Updated changelog entry
  • Documentation updated
  • Update conf.py

Checklist for release

  • Merge into main
  • Create release from the main branch with appropriate tag
  • Delete feature-branch

Testing Datasets

  • Dataset needed for testing available upon request
  • Dataset download instructions included
  • No dataset needed

3 member test case at /glade/work/masmith/DART11.14.2/DART/models/ROMS_rutgers/bug_test
This dir has output_priorinf_sd.nc.NAN that uses NaN as FillValue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant