Due to the current gap in continued funding from the U.S. National Science Foundation (NSF), the NSF Unidata Program Center has temporarily paused most operations. See NSF Unidata Pause in Most Operations for details.
Hi Jules: You need to open the file with NetcdfDataset.openDataset(), and pull the Coordinate System information out. That assumes that the file follows the CF or some other convention that the library knows how to parse. See: http://www.unidata.ucar.edu/software/thredds/current/netcdf-java/tutorial/NetcdfDataset.html John On Mon, Feb 2, 2015 at 10:18 PM, Jules A <jules0080@xxxxxxxxxxx> wrote: > Dear NetCDF Java Group, > > Apologies for the cross posting realised this group existed after posting > in the NETCDF group. > > I'm having troubles accessing data from a NetCDF file. My aim is to > access the data and write to a CSV file in the following format: > > Latitude Longitude Date1 Date2 Date 3 > <-- MIN_SFC values --> > > I have been able to iterate through the MIN_SFC Variable, I was going to > save to a dictionary or hash table then realised I don't know which date it > belongs to or Lat/long and vise versa. I've only been able to get data for > that variable. > > > Dimensions: > time = 7 // the date field how to convert to a date? > latitude = 292 > longitude =341 > > Variables: > float MIN_SFC (time=7, latitude = 292, longitude = 341) > > I've looked through the online resources, please post a comment or link. > I found the ReadNetCDF example useful however it was for version 1.0 and > had quite a few deprecated methods. > > Thanks! > > <code> > > > > List<Variable> variableList = ncfile.getVariables(); > > Array data; > > > *for*(*int* j = 0; j < variableList.size(); j++){ > > > > Variable r = variableList.get(j); > > System.*out*.println(r.getFullName()); > > System.*out*.println(r.getDatasetLocation()); > > System.*out*.println(r.getNameAndDimensions()); > > System.*out*.println(r.getDataType()); > > System.*out*.println(r.getElementSize()); > > > > System.*out*.println("-------------") > > > > data = r.read(); > > > > *int*[] shape = data.getShape(); > > > Index index = data.getIndex(); > > *for* (*int* u=0; u<shape[0]; u++) { > > *for* (*int* x=0; x<shape[1]; x++) { > > *double* dval = data.getDouble(index.set(u,x)); > > } > > } > > } > > </code> > > > _______________________________________________ > netcdf-java mailing list > netcdf-java@xxxxxxxxxxxxxxxx > For list information or to unsubscribe, visit: > http://www.unidata.ucar.edu/mailing_lists/ >
netcdf-java
archives: