On python 3.6 I have a netCDF file that contains global precipitation data with the variables: lat, lon, time, and precip. My ultimate goal is to plot the precip data on a scatter plot and create a trend-line. However I am new to python and am having trouble converting the data in the netCDF file to a format that I can read and easily plot on a scatter plot. Any ideas on how I would go about doing this would be much appreciated. Thank you!
-
1Scipy can read netCDF. DocumentationJerry Zhao– Jerry Zhao2017-05-31 22:03:45 +00:00Commented May 31, 2017 at 22:03
-
I haven't tested recent version of SciPy, but unidata module is better imo, see @ ImportanceOfBeingErnest answerkakk11– kakk112017-06-01 11:18:29 +00:00Commented Jun 1, 2017 at 11:18
Add a comment
|
1 Answer
As also stated in this question's answers, there is
- a netCDF4 module for python: http://unidata.github.io/netcdf4-python/ which can be used to load the data
- a scipy submodule to to load NetCDF data: https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.io.netcdf.netcdf_file.html
How easy or hard it is to directly use the data is then dependend on the data itself. But at least in the scipy case the returned variables are numpy arrays and may directly be plotted if the data is numeric.