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

[netCDFJava #SBB-665470]: xml to netcdf



Ghansham,

If you are using NetCDF-4, you may have any number of unlimited time 
dimensions.  Thus, in your example below, you should be able to create a single 
NetCDF-4 file with three sets of lat/lon dimensions, three time dimensions, and 
your data.  More on NetCDF dimensions here in this documentation:

http://www.unidata.ucar.edu/software/netcdf/docs/netcdf/Dimensions.html

Regards,
  Lansing Madry
  Unidata
  Boulder, Colorado

> Another query related to point datasets that came to my mind when you
> talked about rosetta. I have 3 ascii files that have satellite derived
> winds data from 3 channels (ir, wv and vis). The locations of observations
> in three files are disjoint. Can we write all of them into a single nc
> file. There will be three different sets of lat/ lon variables for
> respective channels. And you can expect 3 different sets of time varianles
> as number of observations will vary for each channel. I hope I am clear in
> communicating. I eant them in single file as they from the same time
> imagery.
> Ghansham
> 
> address@hidden>  wrote:
> > Hi Ghansham,
> >
> > In NcML, you can use the <values> tag inside a variable to set the
> values. If
> > you want to point the NcML to an external dataset, you will need to write
> an
> > IOSP to enable netCDF-Java to read the file.
> >
> > netCDF has a utility called ncgen, which creates a netCDF file from a CDL
> file:
> >
> >
> > http://www.unidata.ucar.edu/software/netcdf/docs/ncgen-man-1.html
> >
> > CDL files are not xml, but they are simple none-the-less:
> >
> > http://www.unidata.ucar.edu/software/netcdf/docs/ncgen-man-1.html#EXAMPLES
> >
> > You would still need to write a program to read in your ascii or binary
> data to write
> > the CDL file, but at that point you might as well just write out a netCDF
> object using
> > the netCDF C or Java API.
> >
> > Sean
> >
> > PS: Rosetta is a very new project that is still in active development. It
> can currently
> > convert ASCII data from station baseed sites into  CF 1.6 compliant
> netCDF files, but
> > this is certainly only the first step for the project.
> >
> >> Can you put up a sample program along with dataset. Here are a few things
> >> to consider. NcML always refers to a dataset. Can it refer to binary data
> >> on disk and read it to create a variable within the file. I hope I am not
> >> confusing you. I have set of binary and ascii files which I want to write
> >> into netcdf-4 using ncml. I am afraid if that is possible. Rosetta is
> >> trying to do it for CSV files. I will send you a sample xml file what I
> >> take as input to write hdf-5 file.
> >>
> >> Long time back hdf5 used to have a utility called h5gen which used to
> take
> >> xml input to generate hdf5. But they have discontinued it. God knows  the
> >> reason. They are switching from XML to JSON based approach as that is too
> >> portable and very hot topic as far as web is concerned.
> >> FYI, JSON  has a new incarnation for binary data in the form BSON (binary
> >> JSON). http://bsonspec.org/
> >>
> >>
> >>
> >>
> >> regards
> >> Ghansham
> >>
> >>
> >> address@hidden> wrote:
> >>
> >> > Greetings Ghansham,
> >> >
> >> > Yes, you can convert NcML to a netCDF file using netCDF-Java. See
> >> >
> >> > http://www.unidata.ucar.edu/software/netcdf/ncml/
> >> >
> >> > for more details (look for "Using NcML to create a NetCDF-3 file").
> >> > The link above uses ucar.nc2.FileWriter, which is deprecated, but
> >> > should still work if you are looking for something quick.
> >> >
> >> > That said, I would recommend using
> >> >
> >> > ucar.nc2.FileWriter2
> >> >
> >> > (
> >> >
> www.unidata.ucar.edu/software/netcdf-java/v4.3/javadoc/ucar/nc2/FileWriter2.html
> >> > )
> >> >
> >> > and, if you have the C library of netCDF installed, you can directly
> write
> >> > out a
> >> > netCDF-4 file, thus skipping the conversion using NCO.
> >> >
> >> > See the first link for more info on the structure of NcML.
> >> >
> >> > Cheers,
> >> >
> >> > Sean
> >> >
> >> > > R/Sir
> >> > >
> >> > >
> >> > > Is there a way to convert raw data to netcdf using XML.
> >> > >
> >> > > I read somewhere:
> >> > >
> >> > >
> >> >
> http://hdf-forum.184993.n3.nabble.com/h5gen-or-any-h5dump-generated-XML-to-HDF5-td3719793.html
> >> > >
> >> > > See post by H. Joe Lee....
> >> > > It states something like this:
> >> > > Create NcML file (a variant of XML) and use NetCDF-Java to generate
> an
> >> > > NetCDF-3  file [1].
> >> > > Then convert the NetCDF-3 to NetCDF-4 using NCO  [2].
> >> > >
> >> > > The converted NetCDF-4 file is HDF5 file.
> >> > > You got the HDF5 from XML (NcML).
> >> > >
> >> > >
> >> > >
> >> > > Ghansham
> >> > >
> >> > >
> >> >
> >> > Ticket Details
> >> > ===================
> >> > Ticket ID: SBB-665470
> >> > Department: Support netCDF Java
> >> > Priority: Normal
> >> > Status: Open
> >> >
> >> >
> >>
> >>
> >
> > Ticket Details
> > ===================
> > Ticket ID: SBB-665470
> > Department: Support netCDF Java
> > Priority: Normal
> > Status: Open
> >
> >
> 
> 


Ticket Details
===================
Ticket ID: SBB-665470
Department: Support netCDF Java
Priority: Normal
Status: Open