How to convert netCDF to JSON
Who can tell me how to convert netCDF to JSON for this program?thank you
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.
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?
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:
- Get point coordinates
- Parse X/Y array output from TDS
- Identify grid for coordinate
- Parse variable output from TDS for appropriate X/Y location
- 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:
- Get point coordinates
- Receive X/Y data in JSON
- Identify grid for coordinate
- Receive variable output from TDS for grid point
- 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!)
Please! A python netCDF to JSON library would do so much to increase data availability.