Re: Variable (time) is undefined

From: zhifeng yang <yangzf01_at_nyahnyahspammersnyahnyah>
Date: Sat Jan 18 2014 - 15:15:25 MST

Hi Mark

No problem.

Thank you
Zhifeng (Bruce) Yang
Homepage : http://zyang01.com/

On Jan 18, 2014, at 3:55 PM, Mark Chan <cym263@yahoo.com> wrote:

> Dear Zhifeng,
>
> Thanks a lot. It helps!
>
> Mark
>
>
> On Saturday, January 18, 2014 8:12 PM, zhifeng yang <yangzf01@gmail.com> wrote:
> Hi Mark
>
> time is only a variable dimension name in wrfot_ file, like attribute. You can not just it while you read the variable.
> If you want to read the whole variable, you can simply use T(:, :, :, :). If you want to use dimension name while reading the variable, you can use T(time|:, long|:, lat|:, level|:).
>
> If you just want to extract some dimension of variable, you can use T(0:2, :, :, :).
>
> Actually there is one variable in wrfout_ file, called “Times”, It has 2-Dimension. The first dimension is how many times you have in the wrfout_ file. The second dimension is the character length of “Times”, usually it has 19 characters. So that means Times’ dimension is like (:, 19).
>
> For your case, you need to read out how many time you have in the wrfout_ file. Then you can specify which time you want to read out.
>
>
> Thank you
> Zhifeng (Bruce) Yang
> Homepage : http://zyang01.com/
>
> On Jan 18, 2014, at 12:30 PM, Mark Chan <cym263@yahoo.com> wrote:
>
>> Dear NCL users,
>>
>> Below is a ncl script, which runs some errors.
>>
>> --------ncl script--------------------------
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>> 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/csm/shea_util.ncl"
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
>>
>> nc_file = systemfunc("ls -1 wrfout_d01_*") + ".nc"
>> a = addfiles(nc_file,"r")
>> T = nc_file->T(time,:,:,:)
>> th = T + 300.
>> P = nc_file->P(time,:,:,:)
>> PB = nc_file->PB(time,:,:,:)
>> p = ( P + PB )
>> tk = wrf_tk( p , th )
>> QVAPOR = nc_file->QVAPOR(time,:,:,:)
>> PH = nc_file->PH(time,:,:,:)
>> PHB = nc_file->PHB(time,:,:,:)
>> var = ( PH + PHB ) / 9.81
>> dim = dimsizes(var)
>> z = 0.5 * ( var(0:dim(0)-2,:,:) + var(1:dim(0)-1,:,:) )
>> slp = wrf_slp( z, tk, p, QVAPOR )
>>
>>
>> The error messages are as in the below. Can one give a suggestion?
>>
>> Thanks a lot!
>> Mark
>>
>> ============Error message==============================================
>> Copyright (C) 1995-2013 - All Rights Reserved
>> University Corporation for Atmospheric Research
>> NCAR Command Language Version 6.1.2
>> The use of this software is governed by a License Agreement.
>> See http://www.ncl.ucar.edu/ for more details.
>> fatal:Variable (time) is undefined
>> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 12 in file slp3.ncl
>>
>> fatal:Variable (T) is undefined
>> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 13 in file slp3.ncl
>>
>> fatal:Variable (time) is undefined
>> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 15 in file slp3.ncl
>>
>> fatal:Variable (time) is undefined
>> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 16 in file slp3.ncl
>>
>> fatal:Variable (P) is undefined
>> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 17 in file slp3.ncl
>>
>> fatal:Variable (p) is undefined
>> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 19 in file slp3.ncl
>>
>> fatal:Variable (time) is undefined
>> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 21 in file slp3.ncl
>>
>> fatal:Variable (time) is undefined
>> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 22 in file slp3.ncl
>>
>> fatal:Variable (time) is undefined
>> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 23 in file slp3.ncl
>>
>> fatal:Variable (PH) is undefined
>> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 24 in file slp3.ncl
>>
>> fatal:Variable (var) is undefined
>> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 25 in file slp3.ncl
>>
>> fatal:Undefined identifier: (var) is undefined, can't continue
>> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 26 in file slp3.ncl
>>
>> fatal:Variable (z) is undefined
>> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 28 in file slp3.ncl
>>
>> _______________________________________________
>> 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 Sat Jan 18 15:15:39 2014

This archive was generated by hypermail 2.1.8 : Sun Jan 19 2014 - 21:56:35 MST