NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Re: [netcdfgroup] How to dump netCDF to JSON?

If your data fits into xarray it can be fairly simple to do in python:
https://gist.github.com/kwilcox/c41834297b1a3b732cae3ee16621f6d0

Pedro and Walter - Thank you for the reading material on more
generic/robust approaches!

On Fri, Oct 14, 2016 at 12:53 AM Pedro Vicente <
pedro.vicente@xxxxxxxxxxxxxxxxxx> wrote:

> Hi Charlie !
>
>
> So, I am doing that exact same thing.
>
> I wrote
>
> 1) The specification to convert netCDF/HDF5 to "a" JSON format (note the
> "a"
> here)
>
> 2) I wrote the parsing of the JSON format using an open source C JSON
> library (janson).
>
> http://www.digip.org/jansson/
>
> 3) left to do: the actual C code of reading/writing netCDF/HDF5 to JSON and
> vice-versa (the straightforward part).
>
> The "a" above means that JSON is not really a format in the sense of netCDF
> but really a format that allows to define formats , for a lack of a better
> explanation.
>
> This means that anyone that writes this tool has to write code that write
> in
> a particular JSON representation , only valid for that tool.
>
> Like you , I searched and there was not a good one, so I wrote one.
>
> The first criteria was that it had to be obvious for anyone looking at the
> JSON text file, that that was indeed a netCDF/HDF5 file: hierarchy clearly
> show, metadata and data
> clearly shown
>
> My first look  was HDF5-JSON
>
> http://hdf5-json.readthedocs.io/en/latest/
>
> but the format seemed like a  mess to look at
>
> example
>
> http://hdf5-json.readthedocs.io/en/latest/examples/nullspace_dset.html
>
>
> and the reader is written in Python
>
> @John Readey
>
> (why Phyton? HDF5 developer tools should be all about writing in C/C++)
>
>
>
> The specification is here
>
> http://www.space-research.org/
>
> Click on menu
> "Code blog",
> then
> "netCDF/HDF5 to JSON and vice-versa"
>
>
> In the process I learned all about JSON and it is a neat format to
> represent
> data  .
>
> In particular, it allows nested structures and arrays, which suits
> perfectly
> for netCDF
>
> here are two nested groups
>
> {
>  "group_name1":
>  {
>   "group_name2": "group"
>  }
> }
>
> a dataset
>
> {
>  "dset1" : ["dataset", "STAR_INT32", 2, [3, 4], [1, 2, 3, 4, 5, 6, 7, 8, 9,
> 10, 11, 12]]
> }
>
>
>
> This is still under development,
>
> I would like to make this some kind of "official" netCDF/HDF5 JSON format
> for the community, so I encourage anyone to read the specification
>
> direct link
>
> http://www.space-research.org/blog/star_json.html
>
> If you see any flaw in the design or antything in the design that you would
> like to have change please let me know now
>
> At the moment it only (intentionally) uses common generic features of both
> netCDF and HDF5, which are the numeric atomic types and strings.
>
> Enjoy
>
>
> ----------------------
> Pedro Vicente
> pedro.vicente@xxxxxxxxxxxxxxxxxx
> http://www.space-research.org/
>
>
>
>
> ----- Original Message -----
> From: "Charlie Zender" <zender@xxxxxxx>
> To: "netCDF Mail List" <netcdfgroup@xxxxxxxxxxxxxxxx>
> Sent: Thursday, October 13, 2016 11:10 PM
> Subject: [netcdfgroup] How to dump netCDF to JSON?
>
>
> > Hello netCDFers,
> >
> > A project I am working on wants to convert netCDF files to JSON.
> > The requirements are to dump an arbitrary netCDF-extended file
> > (with groups but without funky vlen/compound types) to JSON.
> > The first few solutions that we googled (ncdump-json, netcdf2json.py)
> > do not satisfy these requirements. What is the most robust and easy
> > command-line tool (not web-service) that dumps netCDF to JSON?
> > Ideally it would be somewhat configurable like ncdump -h/-x or
> > ncks --cdl/--xml.
> >
> > Charlie
> > --
> > Charlie Zender, Earth System Sci. & Computer Sci.
> > University of California, Irvine 949-891-2429 <(949)%20891-2429> )'(
> >
> > _______________________________________________
> > NOTE: All exchanges posted to Unidata maintained email lists are
> > recorded in the Unidata inquiry tracking system and made publicly
> > available through the web.  Users who post to any of the lists we
> > maintain are reminded to remove any personal information that they
> > do not want to be made public.
> >
> >
> > netcdfgroup mailing list
> > netcdfgroup@xxxxxxxxxxxxxxxx
> > For list information or to unsubscribe,  visit:
> > http://www.unidata.ucar.edu/mailing_lists/
>
> _______________________________________________
> NOTE: All exchanges posted to Unidata maintained email lists are
> recorded in the Unidata inquiry tracking system and made publicly
> available through the web.  Users who post to any of the lists we
> maintain are reminded to remove any personal information that they
> do not want to be made public.
>
>
> netcdfgroup mailing list
> netcdfgroup@xxxxxxxxxxxxxxxx
> For list information or to unsubscribe,  visit:
> http://www.unidata.ucar.edu/mailing_lists/
>
  • 2016 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: