We just migrated to NetCDF-Java 4.2 and encountered a bunch
of unit test failures with files using the following format for
time:
<?xml version="1.0" encoding="UTF-8"?>
<dimension name="time" length="2" />
<dimension name="lat" length="3" />
<dimension name="lon" length="4" />
<dimension name="height" length="5" />
<attribute name="title" value="testSimpleTZYXGrid
Data" />
<attribute name="Conventions" value="CF-1.4" />
<variable name="rh" shape="time height lat lon"
type="int">
<attribute name="long_name" value="relative
humidity" />
<attribute name="units" value="percent" />
<attribute
name="coordinates" value="lat lon" />
<values start="10" increment="5" />
</variable>
<variable name="time" shape="time" type="int">
<attribute
name="units" value="hours" />
<values start="1" increment="1" />
</variable>
<variable name="lat" shape="lat" type="float">
<attribute name="units" value="degrees_north" />
<values
start="40" increment="1" />
</variable>
<variable name="lon" shape="lon" type="float">
<attribute name="units" value="degrees_east" />
<values start="-90" increment="1" />
</variable>
<variable name="height" shape="height"
type="float">
<attribute name="units" value="meters" />
<attribute
name="positive" value="up"/>
<values start="1" increment="1" />
</variable>
</netcdf>
It looks like we need to append something like " since
0001-01-01 00:00:00" to get this to work. I had to dig through
the source as the failure was silent. An exception was thrown
from line 151 of CoordinateAxis1DTime.java and then caught and
effectively ignored on line 411 of GridCoordSys.java. I think
the root cause of the issue is that the DateUnit constructor
doesn't throw an error with "hours" as a unit even tho
subsequent instance method calls will fail.
Looks like the CF spec says a reference time is required, so
I guess this is more of an error handling/notification issue...