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

[IDV #JKM-822210]: metadata extraction



Hi Annie,

I've attached a simple example java class that will open a netCDF file
(be sure to change the location in the .java file!) and dump out the
metadata to the screen.

Let me know if you have any questions!

Cheers,

Sean

> Hey Sean,
> 
> One more thing.  Do you have a really basic example of using NCdumpW in a
> java script?  I'm sort of a java beginner. I have no problems using the
> .jar file at the command line, however when it comes to writing a basic
> scipt to open an .nc file and print the contents (using NCdump), I'm stuck.
> I've looked through the unidata website, but again, most examples require
> a pretty good knowledge of java syntax... which I am just learning.
> 
> Any help is much appreciated.
> 
> Annie
> 
> 
> On Thu, Mar 27, 2014 at 10:56 AM, Annie Burgess <address@hidden>wrote:
> 
> > Bingo!  Thanks Sean!
> >
> >
> > address@hidden> wrote:
> >
> >> Greetings Annie,
> >>
> >> You can use netCDF-Java to dump out an xml representation of the metadata
> >> in NcML. If you have the toolsUI jar (or netcdfAll), you can do the
> >> following to see
> >> an example:
> >>
> >> java -classpath toolsUI.jar ucar.nc2.NCdumpW /path/to/file -ncml
> >>
> >> If you would like output that more closely matches that of ncdump from the
> >> C netcdf library, simply omit the -ncml flag. If either of these looks
> >> good,
> >> then you can use the ucar.nc2.NCdumpW class. See the NCdumpW javadoc here:
> >>
> >>
> >> http://www.unidata.ucar.edu/software/thredds/current/netcdf-java/v4.3/javadocAll/ucar/nc2/NCdumpW.html
> >>
> >> Cheers!
> >>
> >> Sean
> >>
> >> > Annie,
> >> >
> >> > We'll give you a more complete answer on Monday. IDV staff is on Spring
> >> Break.
> >> >
> >> > In the meantime please peruse:
> >> >
> >> >
> >> http://www.unidata.ucar.edu/software/thredds/current/netcdf-java/documentation.htm
> >> >
> >> > You can probably find examples of what you are trying to achieve
> >> therein.
> >> >
> >> > Best,
> >> >
> >> > Unidata IDV Support
> >> >
> >> >
> >> > > Greetings,
> >> > >
> >> > > My name is Annie Burgess, I'm working on an open source project to
> >> extract
> >> > > the metadata from netcdf files.  I've been using IDV to explore
> >> several
> >> > > NetCDF datasets and thought I might ask if someone at Unidata could
> >> point
> >> > > me to the java code that extracts the metadata from a NetCDF file, as
> >> it
> >> > > does under Data/Edit/Properties/Metadata (example attached).  I
> >> assume this
> >> > > metadata code is hidden in one of the IDV .jar files - I've just had
> >> no
> >> > > luck finding it!
> >> > >
> >> > > I appreciate any insight you can give.
> >> > >
> >> > > Best, ,
> >> > > Annie
> >> > >
> >> > > --
> >>
> >
> 
> --
> ------------------------------------------------------------------------------------------
> Ann Bryant Burgess, PhD
> 
> University of Southern California
> Postdoctoral Fellow
> Los Angeles, CA
> 
> Alaska Science Center/USGS
> Anchorage, AK
> 
> Cell:  (585) 738-7549
> Office:  (907) 786-7059
> Fax:  (907) 786-7150
> E-mail: address@hidden
> Office Address: 4210 University Dr., Anchorage, AK 99508-4626
> -------------------------------------------------------------------------------------------
> 
> 


Ticket Details
===================
Ticket ID: JKM-822210
Department: Support netCDF Java
Priority: Normal
Status: Open

Attachment: ncdumpwExample.java
Description: Binary data