[ncl-talk] Plotting netCDF

Smith, Stuart smit1770 at purdue.edu
Wed Mar 14 08:19:11 MDT 2018


Dave,

 

Thanks for the feedback. I was able to get more data. The runoff data didn’t look useful, so I have attached another variable (precipitation) which had more data over the spatial area, but still missing data (-9999). The variables are:

 

0)      PPT=Precipitation

1)      T = Time

2)      X= Longitude

3)      Y = Latitude

 

In order to calculate spatial averages over time would I read in all dimensions, similar to what you have described below and calculate the average using a function? Thank you for your time.

 

    x = f->runoff(:,:,:)        ; x will be read as a 3-D array

 

Regards,

 

-Stuart

 

From: Dave Allured - NOAA Affiliate [mailto:dave.allured at noaa.gov] 
Sent: Tuesday, March 13, 2018 5:12 PM
To: Smith, Stuart <smit1770 at purdue.edu>
Cc: Ncl-talk <ncl-talk at ucar.edu>
Subject: Re: [ncl-talk] Plotting netCDF

 

Stuart,

 

That is a strange Netcdf file.  It is a time series of 45 x 29 grids, but all grid points are missing values, except for one corner point at (*,0,0).  You can extract the corner point as a 1-D time series, and make a line plot and other 1-D analysis.

 

    x = f->runoff(:,0,0)        ; x will be read as a 1-D array

 

However, you requested how to calculate spatial averages.  That does not make sense if you do not have valid data over multiple grid points.  So either you can just do 1-D plots and analysis, or you need to go back to your data source and get a file with valid data over your desired spatial area.

 

If you get another data file, also please ask the provider to make the _FillValue match the array data type, which is "double" in this case.

 

--Dave

 

 

On Tue, Mar 13, 2018 at 2:20 PM, Smith, Stuart <smit1770 at purdue.edu <mailto:smit1770 at purdue.edu> > wrote:

Good afternoon,

 

I received a netCDF file that has a format I am unfamiliar with and wanted guidance on calculating spatial averages over time. Attached is a copy of the .nc file. The variables are:

0)      Runoff 

1)      T=Time

2)      X= Longitude

3)      Y = Latitude

When defining variables for runoff (ex. Var = fi->runoff ), the output format is the following:

(0,0,0)    0

(0,0,1) -9999

(0,0,2) -9999

(0,0,3) -9999

(0,0,4) -9999

……..

(1,0,0)    0

(1,0,1) -9999

(1,0,2) -9999

 

The next value will not appear until (1,0,0). I wanted to ask how I would plot such data, and calculate averages over the area with the given format?  Thank you for your time.

 

Regards,

 

-Stuart

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180314/0ed60145/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ppt.zip
Type: application/x-zip-compressed
Size: 1578234 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180314/0ed60145/attachment-0001.bin>


More information about the ncl-talk mailing list