[ncl-install] 【ask for help】A problem about reading data

Dennis Shea shea at ucar.edu
Tue Dec 6 17:23:13 MST 2016


Likely, the file is in a different directory than the NCL script.
By degault, NCL look in the current directory. This means the directory
with the NCL sctipt

ncl 1> data = addfile("precip.mon.mean.nc","r")    ; addfile looks in the
current directory
ncl 2> a = data->precip
ncl 3> printVarSummary(a)

Variable: a
Type: float
Total Size: 14598144 bytes
            3649536 values
Number of Dimensions: 3
Dimensions and sizes:    [time | 352] x [lat | 72] x [lon | 144]
Coordinates:
            time: [101902..112585]
            lat: [88.75..-88.75]
            lon: [1.25..358.75]
Number Of Attributes: 15
  long_name :    Average Monthly Rate of Precipitation
  valid_range :    (  0, 50 )
  units :    mm/day
  [SNIP]
  _FillValue :    -9.96921e+36
===============================================

You can be explicit

diri = "./"                               ; directory containing the input
file
                                             ; diri =
"/dir/where/file/is/located/"
fili  = "precip.mon.mean.nc"
pthi = diri+fil                         ; input path

data = addfile( pthi, "r")
a     = data->precip



On Tue, Dec 6, 2016 at 4:02 PM, 475114511 <475114511 at qq.com> wrote:

> Dear all,
> I met a problem when I read a nc file,
> The first pic is my script,I didn't find any problems.
> Can anyone tell me how to fix this ?
> Thanks so much!
>
>
> _______________________________________________
> ncl-install mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-install
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-install/attachments/20161206/b0e0194f/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8DE40E3 at A540CD03.99434758
Type: application/octet-stream
Size: 174591 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-install/attachments/20161206/b0e0194f/attachment-0002.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 9DEA16DB at D799F221.99434758
Type: application/octet-stream
Size: 334157 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-install/attachments/20161206/b0e0194f/attachment-0003.obj 


More information about the ncl-install mailing list