From 4d8a7e69ec80f7fb7849f68c63bb1475b0a63a1a Mon Sep 17 00:00:00 2001 From: Benjamin Gunn Date: Fri, 1 Apr 2022 15:48:57 -0600 Subject: [PATCH 1/5] Bug fix - Fixes issue if FillValue is NaN Fixes #323 --- assimilation_code/modules/io/io_filenames_mod.f90 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/assimilation_code/modules/io/io_filenames_mod.f90 b/assimilation_code/modules/io/io_filenames_mod.f90 index 7ce75698fa..bc40a60309 100644 --- a/assimilation_code/modules/io/io_filenames_mod.f90 +++ b/assimilation_code/modules/io/io_filenames_mod.f90 @@ -717,6 +717,9 @@ subroutine check_attribute_value_r4(ncFile, filename, ncVarID, att_string, spval real(r4) :: ret_spvalR4 if ( nf90_get_att(ncFile, ncVarID, att_string, ret_spvalR4) == NF90_NOERR ) then + if (isnan(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) @@ -742,6 +745,9 @@ subroutine check_attribute_value_r8(ncFile, filename, ncVarID, att_string, spval real(r8) :: ret_spvalR8 if ( nf90_get_att(ncFile, ncVarID, att_string, ret_spvalR8) == NF90_NOERR ) then + if (isnan(ret_spvalR8)) then + return + endif if (spvalR8 /= ret_spvalR8) then write(msgstring,*) ' variable attribute, ', trim(att_string), ' in state', spvalR8, & ' does not match ', trim(att_string), ' ', ret_spvalR8, ' in ', trim(filename) From 82ad1b12c831b8f6722e206d37134b7626326dc1 Mon Sep 17 00:00:00 2001 From: Benjamin-Gunn <74316054+Benjamin-Gunn@users.noreply.github.com> Date: Tue, 5 Apr 2022 12:06:49 -0600 Subject: [PATCH 2/5] Update assimilation_code/modules/io/io_filenames_mod.f90 Co-authored-by: hkershaw-brown <20047007+hkershaw-brown@users.noreply.github.com> --- assimilation_code/modules/io/io_filenames_mod.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assimilation_code/modules/io/io_filenames_mod.f90 b/assimilation_code/modules/io/io_filenames_mod.f90 index bc40a60309..7301d509a6 100644 --- a/assimilation_code/modules/io/io_filenames_mod.f90 +++ b/assimilation_code/modules/io/io_filenames_mod.f90 @@ -717,7 +717,7 @@ subroutine check_attribute_value_r4(ncFile, filename, ncVarID, att_string, spval real(r4) :: ret_spvalR4 if ( nf90_get_att(ncFile, ncVarID, att_string, ret_spvalR4) == NF90_NOERR ) then - if (isnan(ret_spvalR4)) then + if (ret_spvalR4 /= ret_spvalR4) then return endif if (spvalR4 /= ret_spvalR4) then From 793da80ef145deb7983ee3c41a1a498d12ab9e1a Mon Sep 17 00:00:00 2001 From: Benjamin-Gunn <74316054+Benjamin-Gunn@users.noreply.github.com> Date: Tue, 5 Apr 2022 12:06:59 -0600 Subject: [PATCH 3/5] Update assimilation_code/modules/io/io_filenames_mod.f90 Co-authored-by: hkershaw-brown <20047007+hkershaw-brown@users.noreply.github.com> --- assimilation_code/modules/io/io_filenames_mod.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assimilation_code/modules/io/io_filenames_mod.f90 b/assimilation_code/modules/io/io_filenames_mod.f90 index 7301d509a6..c91bafac17 100644 --- a/assimilation_code/modules/io/io_filenames_mod.f90 +++ b/assimilation_code/modules/io/io_filenames_mod.f90 @@ -745,7 +745,7 @@ subroutine check_attribute_value_r8(ncFile, filename, ncVarID, att_string, spval real(r8) :: ret_spvalR8 if ( nf90_get_att(ncFile, ncVarID, att_string, ret_spvalR8) == NF90_NOERR ) then - if (isnan(ret_spvalR8)) then + if (ret_spvalR8 /= ret_spvalR8) then return endif if (spvalR8 /= ret_spvalR8) then From 52a7056372a8a9cc921b22840ad8d0927bd74021 Mon Sep 17 00:00:00 2001 From: Helen Kershaw Date: Tue, 5 Apr 2022 13:01:05 -0600 Subject: [PATCH 4/5] Kieee flag for pgi/nvfortran for NaN tests See #176 for discussion --- build_templates/mkmf.template.pgi.linux | 4 ++-- build_templates/mkmf.template.pgi.osx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build_templates/mkmf.template.pgi.linux b/build_templates/mkmf.template.pgi.linux index 730ce9cf83..df2e002773 100644 --- a/build_templates/mkmf.template.pgi.linux +++ b/build_templates/mkmf.template.pgi.linux @@ -87,13 +87,13 @@ LD = pgf90 INCS = -I$(NETCDF)/include LIBS = -L$(NETCDF)/lib -lnetcdff -lnetcdf -FFLAGS = -O -Mbackslash $(INCS) +FFLAGS = -O -Mbackslash -Kieee $(INCS) LDFLAGS = $(FFLAGS) $(LIBS) # for development or debugging, use this for flags: # FFLAGS = -g -gopt -Mbounds -Mchkfpstk -Mchkptr -Mchkstk -Mpgicoff \ # -Mdclchk -Meh_frame -traceback -Minform=inform \ -# -Mflushz -Ktrap=fp -pc 64 -Mbackslash $(INCS) +# -Mflushz -Ktrap=fp -pc 64 -Mbackslash -Kieee $(INCS) # # $URL$ diff --git a/build_templates/mkmf.template.pgi.osx b/build_templates/mkmf.template.pgi.osx index 4cb33f2d92..77791720eb 100644 --- a/build_templates/mkmf.template.pgi.osx +++ b/build_templates/mkmf.template.pgi.osx @@ -68,11 +68,11 @@ LD = pgf90 INCS = -I$(NETCDF)/include LIBS = -L$(NETCDF)/lib -lnetcdff -lnetcdf -FFLAGS = -O -Mbackslash $(INCS) +FFLAGS = -O -Mbackslash -Kieee $(INCS) LDFLAGS = $(FFLAGS) $(LIBS) # for development or debugging, use this for flags: -#FFLAGS = -g -Mbackslash -Ktrap=fp -pc 64 $(INCS) +#FFLAGS = -g -Mbackslash -Kieee -Ktrap=fp -pc 64 $(INCS) # # $URL$ From f5e1983301dc1720b1fe15bc7612571397d38c7e Mon Sep 17 00:00:00 2001 From: Helen Kershaw Date: Tue, 5 Apr 2022 13:03:04 -0600 Subject: [PATCH 5/5] bump version and changelog for release --- CHANGELOG.rst | 4 ++++ conf.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 10c0af119c..cf2e558e0e 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -22,6 +22,10 @@ individual files. The changes are now listed with the most recent at the top. +**April 5 2022 :: Bug-fix for NetCDF variables with NaN attributes. Tag: v9.16.2** + +- Fix for checking attributes of NetCDF variables that have a NaN as the missing or _FillValue. + **April 1 2022 :: Per-obs-type localization for 3D Cartesian location_mod. Tag: v9.16.1** - Optional per-obs-type localization for 3D Cartesian location diff --git a/conf.py b/conf.py index db800e96cc..ca2e659a17 100644 --- a/conf.py +++ b/conf.py @@ -21,7 +21,7 @@ author = 'Data Assimilation Research Section' # The full version, including alpha/beta/rc tags -release = '9.16.1' +release = '9.16.2' master_doc = 'README' # -- General configuration ---------------------------------------------------