[ncl-talk] unable to open multiple files

Dennis Shea shea at ucar.edu
Sun Nov 22 08:14:32 MST 2015


[1]
Please do *not* use 'addfiles_getVar'. It was created a long time ago
and is kept only for backward compatibility. Note the documentation:
Creates a reference that spans multiple data files and returns
metadata. (deprecated: see and use addfiles)

http://www.ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml
Look at the examples.

[2]
trmm_files    = systemfunc("ls 3B42_daily.20*.nc")
printVarSummary(trmm_files)
nfiles = dimsizes(trmm_files)
print("nfiles="+nfiles)
print("---")

trmm   = addfiles(trmm_files,"r")
print(trmm)                                            ; variable of type 'list'
print("trmm is of type "+typeof(trmm))

ListSetType(trmm,"join")                        ; **your**
specification; default is 'cat'

trmm_rf2011   = trmm[0]->r                    ; [...] is syntax for
variables of type 'list'
                                                               ; [0]
will read the *first file only* from the list
or

trmm_rf2011   = trmm[:]->r                      ; all files
printVarSummary(trmm_rf2011)

----

I speculate you want the default 'cat' rather than 'join'

On Sun, Nov 22, 2015 at 7:46 AM, Geeta Geeta <geetag54 at yahoo.com> wrote:
> Hi
> I have to open 5 TRMM files
> Following is the part of the code.
>
> begin
>   trmm_files    = systemfunc("ls 3B42_daily.20*.nc")
>                   printVarSummary(trmm_files)
>
>   open_trmm     = addfiles(trmm_files,"r")
>                   printVarSummary(open_trmm)
>
>   trmm_rf       = addfiles_GetVar(open_trmm,trmm_files,"r")
>                   printVarSummary(trmm_rf)
>   nfiles        = ListCount(open_trmm)
>                   print(nfiles)
>       ListSetType(open_trmm,"join")
>
>   trmm_rf2011   = open_trmm(0)->r(:,:,:)
>                   printVarSummary(open_trmm(0))
>
> When I execute the script, I get an error....
> NCAR Command Language Version 6.2.1
>  The use of this software is governed by a License Agreement.
>  See http://www.ncl.ucar.edu/ for more details.
> fatal:syntax error: line 29 in file trmm-model-v1.ncl before or near ->r
>   trmm_rf2011   = open_trmm(0)->r
> --------------------------------^
>
> I dont know what's Going wrong.  When the line trmm_rf2011 =
> is executed, NONE of the PRINT statements are EXECUTED.....
>
> Pls suggest???
>
> Geeta.
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>


More information about the ncl-talk mailing list