[netcdf-java] Fwd: NetCDF-Java NcML bug: Can't read time variable in doubly-aggregated dataset

  • To: netcdf-java@xxxxxxxxxxxxxxxx
  • Subject: [netcdf-java] Fwd: NetCDF-Java NcML bug: Can't read time variable in doubly-aggregated dataset
  • From: Christian Ward-Garrison <cwardgar@xxxxxxxx>
  • Date: Fri, 02 Apr 2010 01:02:55 -0600
I originally sent this bug report directly to John but I'm cross-posting here so that the community can comment if it wishes.

-------- Original Message --------
Subject: NetCDF-Java NcML bug: Can't read time variable in doubly-aggregated dataset
Date:   Mon, 29 Mar 2010 16:55:46 -0600
From:   Christian Ward-Garrison <cwardgar@xxxxxxxx>
To:     caron@xxxxxxxxxxxxxxxx


Hi John,

Here's a bug I encountered that has me totally baffled:

<netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2";>
    <aggregation dimName="ensemble" type="joinNew">
        <variableAgg name="P" />
        <variableAgg name="T" />
        <netcdf coordValue="1">
            <aggregation dimName="time" type="joinExisting">
                <netcdf location="jan.nc" />
                <netcdf location="feb.nc" />
            </aggregation>
        </netcdf>
    </aggregation>
</netcdf>

The files "jan.nc" and "feb.nc" are the same ones from the NcML
tutorial. You can load this NcML into NJ and everything seems fine,
until you try to read from the "time" variable:

File ncmlFile = new File("C:/Documents and 
Settings/cwardgar/Desktop/NcML/test.ncml");
NetcdfDataset dataset = NetcdfDataset.openDataset(ncmlFile.getAbsolutePath());
System.out.println(dataset.readSection("time"));

Exception in thread "main" java.lang.NullPointerException
        at 
ucar.nc2.ncml.AggregationOuterDimension$CacheVar.read(AggregationOuterDimension.java:885)
        at 
ucar.nc2.ncml.AggregationOuterDimension.read(AggregationOuterDimension.java:280)
        at ucar.nc2.dataset.VariableDS._read(VariableDS.java:470)
        at ucar.nc2.dataset.VariableDS._read(VariableDS.java:492)
        at ucar.nc2.Variable.read(Variable.java:809)
        at ucar.nc2.NetcdfFile.readSection(NetcdfFile.java:1887)
        at gov.usgs.shodan.Mlar.aggNcml(Mlar.java:49)
        at gov.usgs.shodan.Mlar.main(Mlar.java:26)

What's so curious about this error is that it only occurs for the "time"
variable--all other variables read fine. Also, if you declare "time" as
one of the variables to receive the new "ensemble" dimension, you can
suddenly read read from it with no problem! Strange, no?

Regards,
Christian Ward-Garrison

  • 2010 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: