Re: how to plot figure using the average -

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri Aug 09 2013 - 08:53:31 MDT

Hi Debora,

"avg" returns a scalar value that is the average of your whole array.

"dim_avg" will give you an average across the rightmost dimension, for all of your leftmost dimensions.

For example, if you have a 3D array that is dimensioned nlev x nlat x nlon, then:

   xavg = dim_avg(x)
 
will return an nlev x nlat array, where every nlev,nlat point is the average of that point's value across all the longitudes.

If dim_avg is the function you want, then as a quick test, try using "dim_avg_Wrap" instead of "dim_avg".
"dim_avg_Wrap" will add back in any metadata and coordinate arrays, and hopefully get rid of that error message.

The calling arguments are exactly the same:

  xavg = dim_avg_Wrap(x)

You have to be sure to load

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

at the top of your script after the load for gsn_code.ncl and gsn_csm.ncl.

If you want to average across any dimension other than the rightmost dimension, then see
dim_avg_n_Wrap, which allows you to indicate which dimension to average across:

http://www.ncl.ucar.edu/Document/Functions/Contributed/dim_avg_n_Wrap.shtml

--Mary

On Aug 9, 2013, at 8:21 AM, Debora Alvim wrote:

>
>
> Dear NCL,
>
> I made a figure with data to each month, now I need to average for 3 months. I have doubt if I use dim_avg or only avg.
> I get to print the values both when using dim_avg or avg in the screen, but I can not plot the charts because I doubt this part of my script "plot(0) = gsn_csm_contour_map_ce(wks,w,res)", I don't know the syntax for "w" variable
>
>
> Appear the following message when try run my script in ncl
>
> fatal:(lat) is not a dimension name in variable (w), could not determine dimension number
> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 110 in file precconv1999_2000_media.ncl
>
> The script is attached.
>
> Thank you,
> Débora Alvim.
>
> <precconv1999_2000_media.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 Fri Aug 9 08:53:40 2013

This archive was generated by hypermail 2.1.8 : Wed Aug 14 2013 - 18:35:09 MDT