Another attempt... [Fwd: XYT and XYZT grid with only 1 X and 1 Y point in axis]

Hi Folks,

I wondering if this is a bug or a feature.  getGrids recognizes grids with only 1 X and 1 Y in the case below where there is no vertical axis, but reports no grids when there is a vertical axis.  Can somebody explain why?

To be sure, I ran the attached code using the 2.2.09 release.


-------- Original Message --------
Subject: XYT and XYZT grid with only 1 X and 1 Y point in axis
Date: Mon, 08 Aug 2005 11:24:31 -0500
From: Roland Schweitzer <Roland.Schweitzer@xxxxxxxx>
To: netcdf-java <netcdf-java@xxxxxxxxxxxxxxxx>


I am using the Java netCDF library (version 2.2.something -- how to I 
tell which from the jar?) to extract the GeoGrids from the netCDF 
dataset from these two URLs.

Both are degenerate in the sense that there is only one X and one Y in 
the "grid", but none the less in the case of the XYT file the GeoGrids 
are returned successfully.

However in the second case where a similar XY grid is defined, but 
includes a Z axis getGrids() returns an empty list.  I think it should 
be able to return grids (albeit degenerate) just the same as the XYT case.

XYT Grid:

XYZT Grid:


package gov.noaa.pmel.tmap;

import java.util.Iterator;
import java.util.List;

import ucar.nc2.dataset.CoordinateAxis1D;
import ucar.nc2.dataset.NetcdfDataset;
import ucar.nc2.dataset.grid.GeoGrid;
import ucar.nc2.dataset.grid.GridCoordSys;
import ucar.nc2.dataset.grid.GridDataset;
import ucar.nc2.dods.DODSNetcdfFile;

 * @author Roland Schweitzer
public class OneByOneGrid {

     * @param args
    public static void main(String[] args) {
        String[] data = {
""; };

        for (int i = 0; i < data.length; i++) {
            System.out.println("Data set: " + data[i]);
            try {
                String url = DODSNetcdfFile.canonicalURL(data[i]);
                NetcdfDataset ncds = NetcdfDataset.openDataset(url);
                GridDataset gridDs = new GridDataset(ncds);
                List grids = gridDs.getGrids();
                if (grids.size() > 0) {
                    for (Iterator git = grids.iterator(); git.hasNext();) {
                        GeoGrid grid = (GeoGrid);
                        GridCoordSys gcs = grid.getCoordinateSystem();
                        CoordinateAxis1D xAxis = (CoordinateAxis1D) 
                        CoordinateAxis1D yAxis = (CoordinateAxis1D) 
                        if (xAxis != null) {
                        if (yAxis != null) {
                        if (gcs.hasVerticalAxis()) {
                            CoordinateAxis1D zAxis = gcs.getVerticalAxis();
                        if (gcs.hasTimeAxis()) {
                            CoordinateAxis1D tAxis = gcs.getTimeAxis();
                } else {
                    System.out.println("\tNo grids found.");
            } catch (Exception e) {