tds icon indicating copy to clipboard operation
tds copied to clipboard

How to convert netCDF to JSON

Open geek-hmh opened this issue 9 years ago • 5 comments

Who can tell me how to convert netCDF to JSON for this program?thank you

geek-hmh avatar Oct 17 '16 02:10 geek-hmh

We don't support direct conversion of a NetCDF dataset to JSON. However, we do support the representation of NetCDF metadata as NcML. Once you have that, there are many tools online that will convert XML to JSON.

cwardgar avatar Oct 17 '16 20:10 cwardgar

There was some discussion on the netCDF mailing list about this topic:

http://www.unidata.ucar.edu/mailing_lists/archives/netcdfgroup/2016/msg00245.html

As @cwardgar said, we do not currently return JSON from netCDF-Java or the THREDDS Data Server. However, we are considering this - specifically, we are considering support for CoverageJSON.

What is your particular use case for JSON, @geek-hmh?

lesserwhirls avatar Oct 18 '16 16:10 lesserwhirls

I second this one. Adding JSON output to THREDDS could be a powerful combo with it's existing web GIS capabilities.

My Current Use Case: "On Click" loading of data from a point in browser-based code. As it stands now, the process is:

  1. Get point coordinates
  2. Parse X/Y array output from TDS
  3. Identify grid for coordinate
  4. Parse variable output from TDS for appropriate X/Y location
  5. Do the calculations/display you want to do

I could see the parsing quickly cascading into something a developer would want to avoid in larger datasets. Frankly, my current use case might be to use a server side script to work directly with the netCDF file instead of trying to work with the existing services. The desired process might be:

  1. Get point coordinates
  2. Receive X/Y data in JSON
  3. Identify grid for coordinate
  4. Receive variable output from TDS for grid point
  5. Do the calculations/display you want to do

Even cooler would be the ability to send a coordinate and TDS identify the appropriate grid.

At this time we use in-house server side code to handle this type of work. But I've been experimenting with the TDS WMS capabilities and it'd be pretty awesome if it was a one-stop-shop for bringing netCDF data into the browser. (Sorry for the necro!)

WEP11 avatar Feb 06 '20 21:02 WEP11

Please! A python netCDF to JSON library would do so much to increase data availability.

jonaraphael avatar Apr 02 '20 13:04 jonaraphael