Re: [netcdfgroup] Read NETCDF using Java library

One way to potentially do this would be to dump your NetCDF
files into Apache Solr, which in turn will use Apache Tika
to parse the files (in turn using the NetCDF Java library).
Putting the data into solr will then allow you to easily query
for it (depending on what data you choose to index and the type
of file you have), and dump out the results as CSV (using the
CSV writer).



++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Chris Mattmann, Ph.D.
Chief Architect
Instrument Software and Science Data Systems Section (398)
NASA Jet Propulsion Laboratory Pasadena, CA 91109 USA
Office: 168-519, Mailstop: 168-527
Email: chris.a.mattmann@xxxxxxxx
WWW:  http://sunset.usc.edu/~mattmann/
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adjunct Associate Professor, Computer Science Department
University of Southern California, Los Angeles, CA 90089 USA
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++






-----Original Message-----
From: Jules A <jules0080@xxxxxxxxxxx>
Date: Monday, February 2, 2015 at 9:03 PM
To: "netcdfgroup@xxxxxxxxxxxxxxxx" <netcdfgroup@xxxxxxxxxxxxxxxx>
Subject: [netcdfgroup] Read NETCDF using Java library

>Dear 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.
> 
>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>
> 
>

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