Ncwms produces an error when handling variables with a time coordinate when
the reference date in the units attribute includes the valid time zone specifications
Z or UTC. This can be checked in the example dataset 1.
The removal of some legacy code fixes the issue.
Ncwms uses org.joda.time.DateTime as the type of time instants.
The conversion from numeric values of time variable coordinates (time axes)
in NetCDF datasets is done by the function CdmUtils.getTimesteps as follows:
When a time axis uses the standard (gregorian) calendar the conversion
is based on the CoordinateAxis1DTime.getCalendarDates method.
Otherwise, the conversion falls back to some legacy code which does not
parse correctly the units attribute. It fails when the time zone of the
reference date is not specified exacty as HH, -HH, HH:MM or -HH:MM
(for example UTC, or Z, or +HH:MM).
It seems that the reasons for this are historical. Probably the netcdf-java
classes did not handle non-standard calendars properly when that code was
written, and custom code based on the org.joda.time.Chronology type
was developed for that cases.
However, it seems that this code has been already included in the netcdf-java
classes, so the non-standard calendars are properly handled by the
CoordinateAxis1DTime.getCalendarDates method, which does not suffer
from the error parsing the reference date.
The proposal consists solely on the removal of that legacy code.
Ncwms produces an error when handling variables with a time coordinate when the reference date in the
units
attribute includes the valid time zone specificationsZ
orUTC
. This can be checked in the example dataset 1. The removal of some legacy code fixes the issue.Ncwms uses
org.joda.time.DateTime
as the type of time instants. The conversion from numeric values of time variable coordinates (time axes) in NetCDF datasets is done by the functionCdmUtils.getTimesteps
as follows:CoordinateAxis1DTime.getCalendarDates
method.HH
,-HH
,HH:MM
or-HH:MM
(for exampleUTC
, orZ
, or+HH:MM
).It seems that the reasons for this are historical. Probably the netcdf-java classes did not handle non-standard calendars properly when that code was written, and custom code based on the
org.joda.time.Chronology
type was developed for that cases.However, it seems that this code has been already included in the netcdf-java classes, so the non-standard calendars are properly handled by the
CoordinateAxis1DTime.getCalendarDates
method, which does not suffer from the error parsing the reference date.The proposal consists solely on the removal of that legacy code.