Re: How to use wrf_user_getvar command to get variable from files?

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Sun, 9 Nov 2008 06:14:38 -0700 (MST)

Zheng,

Unfortunately, "addfile" and "addfiles" are very different with regard
to what they return. "addfile" returns a file variable, whereas
"addfiles" returns a special "List" variable.

The "wrf_user_getvar" function expects a file variable, and that's why
you are getting the error message about the mismatch on argument 0.

I think your best bet here may be to use the NetCDF operators to first
combine your WRF files into a single file, and then read that single
file in with NCL.

The "ncrcat" operator may be the way to go:

    ncrcat wrfout_d01_* wrfout.nc

Then:

  a1 = addfiles("wrfout.nc","r")

  u = wrf_user_getvar(a1,"ua",it) ; u averaged to mass points
  v = wrf_user_getvar(a1,"va",it) ; v averaged to mass points

I'm hoping some other WRF users will give their suggestions
on dealing with multiple WRF files.

--Mary

On Sat, 8 Nov 2008, Lu Zheng wrote:

> Hi,
>
> I have 100 wrfout files. And I used addfiles and wrf_user_getvar commands
> together. But it give me fatal message:
> *fatal:Argument type mismatch on argument (0) of (wrf_user_getvar) can not
> coerce*
>
> This is a part of my code:
>
> *files = systemfunc("ls ./wrfout_d01_*")
>
> a1 = addfiles(files+".nc","r")
>
> u = wrf_user_getvar(a1,"ua",it) ; u averaged to mass points
> v = wrf_user_getvar(a1,"va",it) ; v averaged to mass points
> *
>
> Any suggestion?
>
> Thanks,
>
> Zheng
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Nov 09 2008 - 06:14:38 MST

This archive was generated by hypermail 2.2.0 : Sun Nov 09 2008 - 06:17:31 MST