Re: named subscripting

From: Adam Phillips (asphilli AT XXXXXX)
Date: Fri Apr 06 2001 - 14:33:06 MDT


Julie,

There are 2 ways you can do it.

1)
Since you are not reordering the coorinate variables, you do not need to specify
them in your wgt_areaave line:

 indsm = wgt_areaave ( pmask(:, {5:30},{70:90}),a->gw({5:30}), 1.0, 0)
 
2)
But, if you want to go ahead and specify them anyway, you need to be consistent
and include every coordinate variable name:

indsm = wgt_areaave ( pmask(time|:, {lat|5:30},{lon|70:90}), \
a->gw({lat|5:30}), 1.0, 0)

Adam

> X-Authentication-Warning: vegemite.cgd.ucar.edu: jma owned process doing -bs
> Date: Fri, 6 Apr 2001 14:20:15 -0600 (MDT)
> From: Julie Arblaster <jma@cgd.UCAR.EDU>
> To: <ncl-talk@UCAR.EDU>
> Subject: named subscripting
> MIME-Version: 1.0
>
> Hello,
>
> I am using the function wgt_areaave and attempting to
> use named subscripting to isolate a geographical area.
>
> Here is (part of) my script ...
> +++++
> ; MASK PRECIP FIELD
> ntime = 19
> nlat = 64
> nlon = 128
> pmask = new( (/ntime,nlat,nlon/), float)
> pmask!0 = "time"
> pmask!1 = "lat"
> pmask!2 = "lon"
> pmask = mask( (a->PRECC + a->PRECL)*86400000, (a->ORO.ne.0), True)
>
> ; CALCULATE WEIGHTED AREA AVERAGE OVER 5-30N, 70-90E
> indsm = wgt_areaave ( pmask(:, {lat|5:30},{lon|70:90}), \
> a->gw({lat|5:30}), 1.0, 0)
> ; indsm = wgt_areaave ( pmask(:,34:43,26:33), a->gw(34:43), 1.0, 0)
>
> ++++++
>
> But I get the following error,
>
> ++++++
> fatal:syntax error: line 30 before or near lat
> indsm = wgt_areaave ( pmask(:, {lat
> -------------------------------------^
>
> fatal:Error in subscript, normal subscripting is being
> used, make sure named subscripting has not been used
> fatal:Error in subscript, normal subscripting is being
> used, make sure named subscripting has not been used
> fatal:syntax error: function wgt_areaave expects 4
> arguments, got 0
> fatal:Syntax Error in block, block not executed
> ++++++
>
> But an example on the NCL page for wgt_areaave uses
> named subscripting so I am unsure what is wrong. If I
> use standard subscripting like the commented out line,
> it works. But I would like to use the lat/lon values.
>
> thanks for any help.
>
> Julie
>
> --------------------------------------------------------
> Julie Arblaster jma@ucar.edu
> Climate Change Research Section Ph: 303 497 1712
> CGD/NCAR Boulder, Colorado
> --------------------------------------------------------
>

-------------------------------------------------------------
Adam Phillips email: asphilli@ucar.edu
Climate and Global Dynamics Division tel: (303) 497-1726
National Center for Atmospheric Research fax: (303) 497-1333
P.O. Box 3000
Boulder, CO 80307-3000 http://www.cgd.ucar.edu/~asphilli



This archive was generated by hypermail 2b29 : Fri Apr 06 2001 - 15:29:55 MDT