[Dart-dev] DART/branches Revision: 11329

dart at ucar.edu dart at ucar.edu
Wed Mar 15 10:47:53 MDT 2017


nancy at ucar.edu
2017-03-15 10:47:52 -0600 (Wed, 15 Mar 2017)
379
ncview 2.1.7 crashes if the time variable has the calendar
attribute of 'no_calendar' and has a 'units' of days since
0000-01-01.  our solution for now is to remove the units
for the no_calendar case (it remains for gregorian calendars).

this behaves differently for different versions of ncview
(or possibly different versions of udunits/udunits2) so be
careful when testing.




Modified: DART/branches/rma_trunk/assimilation_code/modules/io/dart_time_io_mod.f90
===================================================================
--- DART/branches/rma_trunk/assimilation_code/modules/io/dart_time_io_mod.f90	2017-03-15 16:35:23 UTC (rev 11328)
+++ DART/branches/rma_trunk/assimilation_code/modules/io/dart_time_io_mod.f90	2017-03-15 16:47:52 UTC (rev 11329)
@@ -240,8 +240,15 @@
       ios = nf90_put_att(ncid, VarID, "calendar", "no_calendar")
       call nc_check(ios, "write_model_time", "calendar long_name")
 
-      ios = nf90_put_att(ncid, VarID, "units", "days since 0000-01-01 00:00:00")
-      call nc_check(ios, "write_model_time", "units long_name")
+      ! version 2.1.7 of ncview crashes if there is a 'days since' units attribute.
+      ! it doesn't recognize 'no_calendar', tries to use the standard calendar,
+      ! and then flips out when the year is 0000.  our solution for now is to
+      ! remove the units attribute for no_calendar.  this behaves differently in 
+      ! different versions of ncview (e.g 2.1.1 is fine), so be careful testing.  
+      ! this code also appears in single_file_io_mod.f90 - we need to consolidate 
+      ! it in a single location - but until then, updates need to be made both places.
+      !ios = nf90_put_att(ncid, VarID, "units", "days since 0000-01-01 00:00:00")
+      !call nc_check(ios, "write_model_time", "units long_name")
 
    else if (dart_calendar == 'GREGORIAN') then
       ios = nf90_put_att(ncid, VarID, "calendar", "gregorian")

Modified: DART/branches/rma_trunk/assimilation_code/modules/io/single_file_io_mod.f90
===================================================================
--- DART/branches/rma_trunk/assimilation_code/modules/io/single_file_io_mod.f90	2017-03-15 16:35:23 UTC (rev 11328)
+++ DART/branches/rma_trunk/assimilation_code/modules/io/single_file_io_mod.f90	2017-03-15 16:47:52 UTC (rev 11329)
@@ -996,9 +996,17 @@
 case default
    call nc_check(nf90_put_att(my_ncid, TimeVarID, "calendar", "no_calendar" ), &
               'nc_write_calendar_atts', 'put_att calendar '//trim(ncFileID%fname))
-   call nc_check(nf90_put_att(my_ncid, TimeVarID, "units", &
-              'days since 0000-01-01 00:00:00'), &
-              'nc_write_calendar_atts', 'put_att units '//trim(ncFileID%fname))
+
+   ! version 2.1.7 of ncview crashes if there is a 'days since' units attribute.
+   ! it doesn't recognize 'no_calendar', tries to use the standard calendar,
+   ! and then flips out when the year is 0000.  our solution for now is to
+   ! remove the units attribute for no_calendar.  this behaves differently in 
+   ! different versions of ncview (e.g 2.1.1 is fine), so be careful testing.  
+   ! this code also appears in dart_time_io_mod.f90 - we need to consolidate 
+   ! it in a single location - but until then, updates need to be made both places.
+   !call nc_check(nf90_put_att(my_ncid, TimeVarID, "units", &
+   !           'days since 0000-01-01 00:00:00'), &
+   !           'nc_write_calendar_atts', 'put_att units '//trim(ncFileID%fname))
 end select
 
 end function nc_write_calendar_atts


More information about the Dart-dev mailing list