[ncl-talk] Plotting netCDF

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Tue Mar 13 15:12:21 MDT 2018


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> 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/20180313/81d2c6a1/attachment.html>


More information about the ncl-talk mailing list