Re: (no subject)

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue, 4 Aug 2009 10:09:58 -0600 (MDT)

On Tue, 4 Aug 2009, sima sima wrote:

> Hi Dear

> I write an ncl script until open 2 different wrfout files and read T
> variable both of them, then draw it on a xy plot,it failed :
>
> Copyright (C) 1995-2009 - All Rights Reserved
> University Corporation for Atmospheric Research
> NCAR Command Language Version 5.1.1
> The use of this software is governed by a License Agreement.
> See http://www.ncl.ucar..edu/ for more details.
>fatal:Variable (T) is undefined
>fatal:Execute: Error occurred at or near line 17 in file sima.nc
>
>There is the program fallow:
>
>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/WRF_contributed.ncl"
>
>begin
> f1 = addfile("wrfout_d04_2008-04-01_00:00:00.nc", "r")
> f2 = addfile ("/home/hamzelou/hamzehlou/WRF/run/wrfout_d04_2000-04-01_00:00:00.nc", "r")
> Times = f1->Times ; Times is of type character
> Time = WRF_Times2Udunits_c(Times, 0) ; convert to "hours since"
> ntim = dimsizes(Time)
>
> Times2 = f2->Times ; Times is of type character
> Time2 = WRF_Times2Udunits_c(Times, 0) ; convert to "hours since"
>
> y1 = f1->T(:,1,42,49) ; (Time, south_north, west_east)
> y2 = f2->T(:,1,42,49) ; (Time, bottom_top, south_north, west_east)

Hi Sima,

The error message is telling you what the problem is, and on what
line:

   fatal:Variable (T) is undefined
   fatal:Execute: Error occurred at or near line 17 in file sima.nc

You are trying to access a variable called "T" on the file
"wrfout_d04_2008-04-01_00:00:00.nc" and this file apparently doesn't
have a variable called "T".

To see what variables are on the files, after "addfile" you can add:
add the lines:

    print(getfilevarnames(f1))
    print(getfilevarnames(f2))

To see everything that's on the file (except the actual data values),
you can also just do:

    print(f1)
    print(f2)

If you are trying to retrieve particular variables off a wrfout file,
I recommend looking at the special "wrf_user_getvar" function:

http://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_user_getvar.shtml

> y = (/y1,y2/) line17
> wks = gsn_open_wks("x11" ,"temp") ; ps,pdf,x11,ncgm,eps
>
> res = True ; plot mods desired
> Time_at_long_name = Time_at_units
> res_at_xyLineColors = (/"green", "red"/)
> plot = gsn_csm_xy(wks,Time,y,res)
>end line23

>I try to
>y = new (/y1,y2/)
>but it faild again:
> Copyright (C) 1995-2009 - All Rights Reserved
> University Corporation for Atmospheric Research
> NCAR Command Language Version 5.1..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 17 in file sima.nc before or near (/
> y = new(/
>-----------^

This is incorrect syntax. Please see the "new" documentation:

   http://www.ncl.ucar.edu/Document/Functions/Built-in/new.shtml

To combine y1 and y2 into one variable (I'm assuming they are the same
size and same type):

    y = (/y1,y2/)

--Mary

>fatal:Syntax Error in block, block not executed
>fatal:error at line 23 in file sima.nc
>
>Please help me
>
>Sima
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Aug 04 2009 - 10:09:58 MDT

This archive was generated by hypermail 2.2.0 : Wed Aug 05 2009 - 20:36:03 MDT