[ncl-talk] unable to open multiple files

Geeta Geeta geetag54 at yahoo.com
Tue Nov 24 08:39:47 MST 2015


thanks Dennis for your reply. 
I used ls only in the systemfunc .
My data is of different years. hence I wanted to see if the files are being in the right order in which I wanted (2011, 2013,2014 and 2015). Hence I wanted the date of each file too. 
I have modified the script slightly to include that. It is like this. 
 ntrmm         = dimsizes(trmm)
;                  print(ntrmm)

;   do   i       = 0,  ntr mm-1,1
;                 print(i)
      trmm0      = trmm[0]->r(0,:,:)
     trmmdate0   = trmm[0]->time
                  print(trmmdate0)

the output looks like this. 
ariable: trmm0
Type: float
Total Size: 2304000 bytes
            576000 values
Number of Dimensions: 2
Dimensions and sizes:    [latitude | 400] x [longitude | 1440]
Coordinates: 
            latitude: [-49.875..49.875]
            longitude: [0.125..359.875]
Number Of Attributes: 8
  time :       0
  long_name :    daily (0Z-21Z) rainfall total
  units :    mm
  grid_name :    grid-1
  grid_type :    linear
  level_description :    Earth surface
  _FillValue :    -9999.9
  coordinates :    time latitude longitude


Variable: trmmdate0
Type: double
Total Size: 8 bytes
            1 values
Number of Dimensions: 1
Dimensions and sizes:    [time | 1]
Coordinates: 
            time: [   0..   0]
Number Of Attributes: 1
  units :    hours since 2011-04-22 00:00:00Z
(0)       0


I have 5 of TRMM files. I tried read the trmm using the do loop, But unsuccessful. this is what I have done now for this

18   trmmf     = systemfunc("ls 3B42_daily.20*.nc")     ; TRMM RF 22 May 2013
     19   trmma     = addfiles(trmmf,"r")     ; TRMM RF 22 May 2013
     20   trmms     = trmma[0]
     21 
     22   wrff     = systemfunc("ls wrfout_d03_20*_00:00:00") ; model rainfall
     23   wrfa     = addfiles(wrff,"r")
     24   wrfs     = wrfa[0]
     25 
     26 ;  a = addfile("3B42_daily.2013.05.22.7.nc","r")     ; TRMM RF 22 May 2013
     27 
     28 ;  f = addfile("wrfout_d03_2013-05-21_00:00:00","r") ; model rainfall
     29 
     30 ; Plotting TRMM rainfall
     31   var   = 0
     32 
     33    plot    = new(10,graphic)
     34  wks       = gsn_open_wks("ps","trmm_model")
     35              gsn_define_colormap(wks,"prcp_2")
     36 
     37 ;  print(a)
     38   do n = 0, 4
     39      trmms= trmma[n]
     40      wrfs  = wrfa[n]
     41 
     42    rf = trmms->r(0,:,:)

             rainc28  = wrfs->RAINC(28,:,:)
     57    rainnc28 = wrfs->RAINNC(28,:,:)
     58    rainc4   = wrfs->RAINC(4,:,:)
     59    rainnc4  = wrfs->RAINNC(4,:,:)
     60 ;61     latitude      = wrfs->XLAT(0,:,0)
     62     longitude     = wrfs->XLONG(0,0,:)
     63 ;    times_in_file = wrfs->Times
     64 ;      init        = times_in_file(:,0)
     65 ;                    print(init)



I get an error at the LINE 40. 
(0)    latitude
(1)    longitude
warning:_NclIRemovePrimitive: First parameter is a missing value, returning missing values
warning:_NclIRemovePrimitive: First parameter is a missing value, returning missing values
(0)    latitude
(1)    longitude
warning:_NclIRemovePrimitive: First parameter is a missing value, returning missing values
warning:_NclIRemovePrimitive: First parameter is a missing value, returning missing values
(0)    latitude
(1)    longitude
warning:_NclIRemovePrimitive: First parameter is a missing value, returning missing values
warning:_NclIRemovePrimitive: First parameter is a missing value, returning missing values
fatal:ListSelect: Index out of range
fatal:["Execute.c":8578]:Execute: Error occurred at or near line 40 in file trmm-model-

Dont know what's going wrong. 

 Geeta. 


    On Tuesday, 24 November 2015 12:31 AM, Dennis Shea <shea at ucar.edu> wrote:
 

 Please do not start a new thread. Use the 'reply all' to keep all
emails together

====

[1]
Note what I suggested

      trmm_files    = systemfunc("ls 3B42_daily.20*.nc")

I did *not* use

    trmm_files    = systemfunc("ls -l 3B42_daily.20*.nc")

the '-l' returns much more information than just the file names.

===

[2]
Had you informed ncl-talk that you wanted data for 2011 and the file names are

3B42_daily.2011.04.22.7.nc  3B42_daily.2014.06.05.7.nc
3B42_daily.2013.05.22.7.nc  3B42_daily.2015.04.23.7.nc
3B42_daily.2014.06.02.7.nc

Then

    trmm_files    = systemfunc("ls 3B42_daily.2011*.nc")

 would have been suggested. Note: no  '-l'

[3]
I did *not* use
    nfiles        = ListCount(trmm)
but this should return the same as
    nfiles = dimsizes(trmm_files)

[4]

re:  "In the printVarSummary, I dont get the time info of each file...."

trmm_rf2011  = trmm[0]->r
                  printVarSummary(trmm_rf2011)
  trmm_rf2013  = trmm[1]->r
                  printVarSummary(trmm_rf2013)
  trmm_rf2014a  = trmm[2]->r
                  printVarSummary(trmm_rf2014a)
  trmm_rf2014b  = trmm[3]->r
                  printVarSummary(trmm_rf2014b)
  trmm_rf2015  = trmm[4]->r
                  printVarSummary(trmm_rf2015)


Since you did not include any output from 'printVarSummary', how is
ncl-talk supposed to answer the question.

On Sun, Nov 22, 2015 at 10:46 AM, Geeta Geeta <geetag54 at yahoo.com> wrote:
> thanks Dennis.
> I want to know if "join" will add the data???.
> Now I have kept the default option as "cat" only.
> But I am facing small problem.
> when I use "ls -l" below
>
> trmm_files    = systemfunc("ls -l 3B42_daily.20*.nc")    ; with ls -l
> printVarSummary is not shown.
>                  printVarSummary(trmm_files)
>
> I dont get the output.
>
> Following are the data files.
> aditya at agniilap:~/geeta/ncl/TS_rain$ ls 3B42*
> 3B42_daily.2011.04.22.7.nc  3B42_daily.2014.06.05.7.nc
> 3B42_daily.2013.05.22.7.nc  3B42_daily.2015.04.23.7.nc
> 3B42_daily.2014.06.02.7.nc
>
>
> Can I also get the time info for each file printed for me so that I know
> that the variable trmm_rf2011 has ONLY 2011 data???
>
>  trmm_files    = systemfunc("ls 3B42_daily.20*.nc")
>  date_files    = systemfunc("ncdump -h 3B42_daily.20*.nc")
>                  printVarSummary(trmm_files)
>                  printVarSummary(date_files)
>
>  trmm          = addfiles(trmm_files,"r")
>                  printVarSummary(trmm)
>
>  nfiles        = ListCount(trmm)
>                  print(nfiles)
>      ListSetType(trmm,"cat")
>
>  trmm_rf2011  = trmm[0]->r
>                  printVarSummary(trmm_rf2011)
>  trmm_rf2013  = trmm[1]->r
>                  printVarSummary(trmm_rf2013)
>  trmm_rf2014a  = trmm[2]->r
>                  printVarSummary(trmm_rf2014a)
>  trmm_rf2014b  = trmm[3]->r
>                  printVarSummary(trmm_rf2014b)
>  trmm_rf2015  = trmm[4]->r
>                  printVarSummary(trmm_rf2015)
>
>
> In the printVarSummary, I dont get the time info of each file....
>
>
> Geeta.
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>


  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151124/3a5547a2/attachment.html 


More information about the ncl-talk mailing list