Re: Reading multiple files

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri Sep 30 2011 - 08:05:58 MDT

The 'Spanning Multiple Files' example was created
by wrfhelp [cc'd] here. You should send questions on these
scripts to wrfhelp@ucar.edu. You can cc ncltalk@ucar.edu

---
Still, I looked and I think see the issue.
[1] In the following, variable 'a' is of type "list".
     A 'list can contain variables of the same or different types.
     In this case, each element of 'a' is of type 'file'
    a = addfiles (all_files, "r")    ; a is type 'list'; each element is
[2] Your error message states:
      fatal:Argument type mismatch on argument
            (0) of (wrf_contour) can not coerce
This came from
     contour_slp = wrf_contour(a,wks,slp,opts_slp)
[4] Looking at "wrf_contour"
function wrf_contour(nc_file:file,wks[1]: graphic, data[*][*]:numeric, \
                      opt_args[1]:logical)
The 1st argrment [ argument (0) in NCL-speak] is prototyped as
type 'file': nc_file:file
The wrf_contour subsequently invokes an internal procedure
"_SetMainTitle" which accesses assorted information from the
file attributes.
[5] Solution for this case *may be* to invoke wrf_contour via
     contour_slp = wrf_contour(a(0),wks,slp,opts_slp)
Each element of 'a' is a variable of type 'file'
Good luck
On 9/30/11 7:30 AM, Luis C. Cana Cascallar wrote:
> Hi all,
>
> I'm working with a huge WRF output file of 50 Gb and I've decided to split the=
>
>
>
>   output into smaller files. I'm following the example named 'Spanning Multiple Files'. This is part of the ncl script I'm using: (NCL version is 6.0.0)
>
> ;*******************************************************************************************
> ; load functions and procedures
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
>
> begin
> ;__________________________________________________________________
> ; WRF ARW open one big file
> ;a = addfile("./wrfout_d03_2007-04-09_12_Kessler.nc","r") ; 50 GB!!
> ;__________________________________________________________________
> ; WRF ARW open multiple files
> ; get list of all files and open as "one big file"
>
>   all_files = systemfunc ("ls /Users/lcana/Resultados_Brisas/wrfout*.nc")
>   a = addfiles (all_files, "r")
>
> ; choose how files are combined and read in variable across files
>
>   ListSetType (a, "cat")             ; concatenate or "merge" (default)
>
> ; We generate plots, but what kind do we prefer?
>    type = "x11"
> ;  type = "pdf"
> ;  type = "ps"
> ; type = "png"
> wks = gsn_open_wks(type,"SBF_NoahLSM_USGS_10min_Kessler")
>
> ;---------------------------------------------------------------
> times = wrf_user_list_times(a)                   ; get times in the file
> ntimes = dimsizes(times)              ;   number of times in the file
> ; it = 0                                                 ; only interested in first time
> ;do it = 120, 180, 3                              ; big file, each 10 min D03
> do it = 9, 75, 3                            ; multiple files, each 10 min D03
> res@TimeLabel = times(it)            ; keep some time information
>
> ;---------------------------------------------------------------
> ; Get variables
>
> slp = wrf_user_getvar(a,"slp",it)                        ;Get slp
>    wrf_smooth_2d( slp, 5 )                            ; Smooth slp
>    slp@units = "hPa"   	 			
>
> etc
>
> When I execute this script it begins normally, but after reading some variables, the script crashes:
> . . . .
> (97) 	2007-04-10_22:10:00
> (98)	        2007-04-10_22:20:00
> (99)	       2007-04-10_22:30:00
> (100)	2007-04-10_22:40:00
> (101)	2007-04-10_22:50:00
> (102)	2007-04-10_23:00:00
> (103)	2007-04-10_23:10:00
> (104)	2007-04-10_23:20:00
> (105)	2007-04-10_23:30:00
> (106)	2007-04-10_23:40:00
> (107)	2007-04-10_23:50:00
> fatal:Argument type mismatch on argument (0) of (wrf_contour) can not coerce
> fatal:Execute: Error occurred at or near line 83 in file SBF_con_vientos_10m.ncl
>
> Is this the right way to read multiple files or I'm doing something wrong? I assume that it should be OK as the time list is correct. Attached I send the full script.
>
> Thanks in advance,
>
> Luis Cana
>
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Sep 30 08:06:07 2011

This archive was generated by hypermail 2.1.8 : Sun Oct 09 2011 - 13:05:26 MDT