[ncl-talk] climo_3.ncl + loop + conventional subscripts
Dave Allured - NOAA Affiliate
dave.allured at noaa.gov
Fri Oct 25 11:15:15 MDT 2019
1. In your example, please notice that the month loop has a stride of 3.
Therefore it is making plots for only four months: January, April, July,
and October.
If you want all 12 months, remove the stride. Then make sure the array
"plot" is dimensioned 12. I think you can interchangeably use either a 1-D
or 2-D plot array (i.e. 3*4), your choice.
The secondary index "i" is used to write the four plots into positions 0,
1, 2, 3 in the "plot" graphics array. If you are making 12 plots, you do
not really need to use a secondary index.
Panel plotting uses a graphics array containing multiple plots. Please
study basic examples and documentation for making panel plots.
2. That data file has full coordinates. Therefore you can use either
conventional or coordinate subscripting, or mixed, your choice.
I suggest using one of the date functions with coordinate subscripting, to
index the time subset that you want. Something like this:
time_units = f->air&time at units
time1 = cd_inv_calendar (year1, 1, 1, 0, 0, 0, time_units, 0)
time2 = cd_inv_calendar (year2, 12, 31, 23, 0, 0, time_units, 0)
air_subset = f->air({time1:time2},:,:)
Use printVarSummary to ensure that the subset has the dimension sizes that
you expect. Then you can proceed to compute the climatology.
On Fri, Oct 25, 2019 at 10:14 AM zoe jacobs via ncl-talk <ncl-talk at ucar.edu>
wrote:
> Hi all,
> regarding climo_3.ncl (
> https://www.ncl.ucar.edu/Applications/Scripts/climo_3.ncl) ,
> I have 2 questions:
> 1. I need to plot all months on one panel (say 3*4), and cannot understand
> the logic behind the below loop, which used in the climo_3.ncl script :
>
> i = -1 ; Climatologies
> do nmo=0,11,3 ; loop over the months
> i = i+1
> res at gsnCenterString = months(nmo)+":"+time(0)/100 +"-"+ time(ntim-1)/100
> plot(i) = gsn_csm_contour_map(wks,prcClm(nmo,:,:), res) ; create plot
> end do
>
> How does it work??/
>
> 2. I would like to show climotology temperature from 1987- 2015. Data which I am using is air.mon.mean.nc ( https://www.esrl.noaa.gov/psd/data/gridded/data.ghcncams.html) and it is using conventional subscripts. I am not familiar with conventional subscripts. So how can I convert coordinate subscripting to conventional subscripts?!!
>
> Please kindly advice me .
>
> Many thanks in advance,
>
> Best regards,
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20191025/dfcb4446/attachment.html>
More information about the ncl-talk
mailing list