[ncl-talk] How to set the time to get the composite map?

Mary Haley haley at ucar.edu
Mon Nov 12 08:38:06 MST 2018


Dear Atul Saini,

If you are new to NCL, I suggest looking at the NCL User Guide which has an
excellent step-by-step guide for NCL, with a focus on creating graphics:

http://www.ncl.ucar.edu/Document/Manuals/NCL_User_Guide/

One way to do this is to first reshape the temperature array to an NTIM x 5
x NLAT x NLON array, where NTIM is the total number of years divided by
five. Once you do this, you can use dim_avg_n to average across the
rightmost three dimensions of the new array, effectively giving you the
average for every 5 years:

  filename = "chamba_tmean_fldmean.nc"
  a = addfile(filename,"r")

  temp  = a->t
  dims  = dimsizes(temp)
  ntim  = dims(0)
  nlat  = dims(1)
  nlon  = dims(1)
  ntim5 = ntim/5
;

; Reshape temperature array so we can easily average groupings of
; five years at a time.

;

  temp_5year_avg = dim_avg_n(reshape(temp,(/ntim5,5,nlat,nlon/)),(/1,2,3/))

The temp_5year_avg array will be a one-dimensional array of ntim5 (8)
elements that you can easily plot. See attached script and image.

Note that your "t" variable on the file has no units, and it appears to
have a funny character as part of the long_name. You probably should try to
fix these when creating the plot.

--Mary


On Sat, Nov 10, 2018 at 2:10 AM, Atul Saini <atulsainimail at gmail.com> wrote:

> Sir/Ma'am,
>                    I have the mean temperature file containing the data
> for MAMJJA season. This file contains the seasonal average (MAMJJA) data of
> each year from 1975 to 2014. I can easily plot the XY plot using it but the
> problem is how to make the average of 1975 to 1979, 1980 to 1985 and so on.
> I want to make the pentad map as explained in the previous sentence.
>
> Please help in making the average of five years to plot the map, which
> will represent the composite of five years.
>
> The data file is attached herewith this mail.
>
> Regards,
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181112/e7e8f68d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: chamba.png
Type: image/png
Size: 50111 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181112/e7e8f68d/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plot_chamba.ncl
Type: application/octet-stream
Size: 1370 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181112/e7e8f68d/attachment.obj>


More information about the ncl-talk mailing list