This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
>To: address@hidden >From: David Han <address@hidden> >Subject: Re: 20020910: netCDF-to-XML Dump Utility? >Organization: NASA/GSFC >Keywords: xml ncml Hi David, > Are there any utilities out there that extracts the contents of a > netCDF file into a XML file? If not, do you have any plans for > developing such an utility? It'd nice if such an capability is > available through the ncdump utility. Yes, although the early effort at this, ncxdump, used a proposed XML representation for netCDF that we have since revised. The latest version of an XML representation is called "NcML": http://www.scd.ucar.edu/vets/luca/netcdf/ That web page includes links to the following web application: http://www.scd.ucar.edu/vets/luca/netcdf/extract_metadata.htm that lets you specify a URL for netCDF data and returns its XML representation. Source for the application is available: Date: Fri, 06 Sep 2002 07:29:16 -0600 From: Luca Cinquini <address@hidden> Subject: Re: regarding netcdf extraction and sample code o If your netcdf files are local to the machine you will be running the extraction program, extracting the metadata should be really simple. Just download the jar file ncx.jar from the web page at http://www.scd.ucar.edu/vets/luca/netcdf/index.html (which also contains the javadoc) and for example use the included java class NcxCrawler, which extracts all the metadata from a directory tree of netcdf files. For example: java ucar.ncx.NcxCrawler -indir:/home/luca/test/input -inext:nc -outdir:/home/luca/test/output -outext:.xml -outtree:true (of course ncx.jar must be in the classpath). If instead your files are only retrievable by network, you might want to start from the class ucar.ncx.Ncx which accepts a URL as input. The source code for all classes is included in ncx.jar. Note also that you will also need in the classpath the java netcdf library (downloadble from http://www.unidata.ucar.edu/packages/netcdf-java/ ) and the standard XML java packages for DOM and SAX (and optionally JDOM). Please let us know of any problems and/or suggestions, since this software (and the NcML specification) is only in beta version and we would like to make it useful to the community. --Russ P.S. If you send support questions like this to "address@hidden" instead of directly to me, they will be routed to someone who can answer them even if I am away from my email.