[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDFJava #HMB-497600]: Reading NDFD Files



Hiya Rob,

Here's some code snippets for using GridDataset getting times for a variable 
and NetcdfFile to get the time.

RObb...

GridDataset gridDataSet = GridDataset.open( fileName );
GridDatatype mt = gridDataSet.findGridDatatype("Minimum_temperature");
List times = ((GeoGrid) mt).getTimes();
for( Object t : times ) {
  System.out.println( t.toString() );
}

or 

NetcdfFile ncf = NetcdfFile.open( fileName );
// time dimension is also a variable      
Variable time = ncf.findVariable("time");
Array data = time.read("0:39");
IndexIterator iter = data.getIndexIterator();
System.out.print("time = ");
while (iter.hasNext()) {
  int val = iter.getIntNext();
  System.out.print(val +" ");
}


Ticket Details
===================
Ticket ID: HMB-497600
Department: Support netCDF Java
Priority: Normal
Status: Open