Re: How to calculate dim_avg_n_Wrap over selected latitude and longitude

From: Dave Allured - NOAA Affiliate <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Tue Apr 02 2013 - 14:18:15 MDT

Kamal,

In your first message you showed the same line of code twice. But the
first copy was different from the second, in a very important way:

x = f->prcp(0:30,{36.06:49.44},{-92.64:-67.35-67.35}) ; read first 31 time steps

In this line, please notice that the number -67.35 was pasted TWICE
inside the curly brackets. I do not think you intended to do this.
Notice that with the way the line reads, "-67.35-67.35" is an
expression, not a simple number, and it evaluates to -134.7. If this
is in your actual code, then this will easily explain "Subscript out
of range". HTH.

--Dave

On Tue, Apr 2, 2013 at 12:17 PM, <mmkamal@uwaterloo.ca> wrote:
> Hi,
>
> I am trying to apply the NCL's "dim_avg_n_Wrap" function on a data
> set that contain data points beyond my are of interest.
>
> ; bounds over data present (Input Data)
>
> MinLat = 32.06
> MaxLat = 54.12
> MinLon = -98.22
> MaxLon = -62.84
>
> ; my are of interest
>
> MinLat = 36.06
> MaxLat = 49.44
> MinLon = -92.64
> MaxLon = -67.35
>
> I can use the following code to take average across all lat/lon
>
> =============================================================
>
> 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"
>
> begin
> ;************************************************
> ; Read the file
> ;************************************************
>
> f = addfile("/brosto2/s3/kamal/DAYMET/prcp.sontario.2002.nc","r")
>
> x = f->prcp(0:30,{36.06:49.44},{-92.64:-67.35-67.35}) ; read first 31
> time steps
>
> Rainfall = dim_avg_n_Wrap(x,(/1,2/))
>
> end
> ==========================================================
>
> But I am getting the following error message:
>
> fatal:Subscript out of range, error in subscript #2
> fatal:Execute: Error occurred at or near line 19 in file
> Prcp_Jan_multi_time_labels_3.ncl
> ===========================================================
>
> Where the line 19 is:
>
> x = f->prcp(0:30,{36.06:49.44},{-92.64:-67.35})
>
>
> I have figure out that the problem is the declaration of longitude
> value. Could anyone please help me how can I define the longitude
> values.
>
>
> Thanks
> Kamal
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Apr 2 14:18:40 2013

This archive was generated by hypermail 2.1.8 : Tue Apr 02 2013 - 21:23:48 MDT