Re: Error: Undefined identifier

From: Mateus Teixeira <mateus.teixeira_at_nyahnyahspammersnyahnyah>
Date: Tue Nov 29 2011 - 12:02:52 MST

Hi Guilherme,

I should to allocate memory before the loop. In other words, you should
create the array tempn before your loops. You're assign values to an array
that doesn't exist. Before the loops, insert the following line:

tempn = new( (/ dim_t, dim_lev, dim_lat, dim_lon /), float )

in which

dim_t, dim_lev, dim_lat and dim_lon are the size of dimensions of your new
array.

Best regards,

Mateus

2011/11/29 Guilherme Martins <jgmsantos@gmail.com>

> Hi users,
>
> I need a help. I did this script below:
>
> 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/contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>
> begin
>
> f = addfile("/home/gui/gui/NCEP-R2-MENSAL/air.mon.mean.nc","r")
>
> temp = short2flt(f->air)
> temp = temp - 273.15
>
> do y = -40,-40
> do x = 270,270
> do t = 0,10-1
> tempn(t,0,{y},{x}) = temp(t,0,{y},{x})
> end do
> end do
> end do
>
> valorp = .25
> n = dimsizes(tempn)
> percentil = round(valorp*n,3)-1
>
> print(tempn(percentil))
>
> end
>
> But I got the error:
>
> fatal:Undefined identifier: (tempn) is undefined, can't continue
> fatal:Execute: Error occurred at or near line 16 in file teste04.ncl
>
> I can't understand when the NCL told me "Undefined identifier".
>
> May anyone help me?
>
> Thanks,
>
> Guilherme.
>
>
> --
> Guilherme Martins
> Homepage: http://guilhermemartins.hd1.com.br/
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>

-- 
Mateus da Silva Teixeira
https://linuxcounter.net/cert/466740.png

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Nov 29 12:03:02 2011

This archive was generated by hypermail 2.1.8 : Wed Nov 30 2011 - 19:52:47 MST