# [ncl-talk] correlation between jjas averaged SST and rainfall

Rashed Mahmood rashidcomsis at gmail.com
Tue Dec 18 05:28:51 MST 2018

```Hi Sujata,
I think the way you calculated JJAS anomaly mean using running average
should also work to calculate JJAS means. An alternative approach is given
below. This assumes that your data time series starts at January and end at
December. Let's us say sst is the variable name then:

nyear    = 30
nmon     = 12
months   =
(/"jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"/)
jjas_ids = ind(months.eq."jun" .or. months.eq."jul" .or.
months.eq."aug".or. months.eq."sep")

LAT        = sst&lat
LON        = sst&lon
NLAT       = dimsizes(LAT)
NLON       = dimsizes(LON)
mean_dat   = new((/nyear,nmon,NLAT,MLON/),typeof(sst),sst at _FillValue)
mean_dat!0 = "time"
mean_dat!1 = "lat"
mean_dat!2 = "lon"
mean_dat&time = ispan(0,nyear-1,1)
modis_aod&lat = LAT
modis_aod&lon = LON

do n=0,nyears-1
tmp_varb         = sst(n*nmon:(n+1)*nmon-1,:,:)
mean_dat(n,:,:)  = dim_avg_n_Wrap(tmp_varb(jjas_ids,:,:),0)
delete(tmp_varb)
end do

jjas_clim           = dim_avg_n_Wrap(mean_dat,0)
jjas_anom         = mean_dat
jjas_anom         = mean_dat at _FillValue
do n=0,nyears-1
jjas_anom(n,:,:)  = mean_dat(n,:,:)-jjas_clim
end do

This is untested and quickly typed response so there may be typos, please
check carefully.
hope that helps,

Cheers,
Rashed
Postdoc Fellow, Department of Atmospheric Science,
China University of Geosciences, Wuhan, China.

On Tue, Dec 18, 2018 at 1:40 AM Sujata Mandke <amin at tropmet.res.in> wrote:

> Dear NCL users,
>
> Greetings!
> I am sorry to disturb you all in your
> busy work schedules.
>
>  I want to plot correlation at each grid point between
> June-September (JJAS) averaged SST anomaly and JJAS
> averaged rainfall anomaly, based on 30 years period.
> Input SST and rainfall data are monthly mean.
>
> I have calculated monthly climatology using “clmMonTLL”
> and then monthly anomaly using “calcMonAnomTLL”.
> Further, averaged monthly anomaly of JJAS months
> using “runave_n_Wrap”, creating JJAS averaged anomalies
> for 30 years period.  Finally plotted correlation map
> using JJAS averaged anomalies of SST and rainfall.
>
> However, i understand that averaging monthly anomalies
> of June to September months to calculate JJAS averaged
> anomaly is not correct mathematically, because it may
> cancel out positive and negative anomalies resulting
> in wrong JJAS averaged anomaly.  Since NCL has function
> for calculating monthly climatology and monthly anomaly,
> so i have calculated JJAS anomaly in this way.
>
> The correct mathematical method is to estimate
> JJAS averaged SST for 30 years period and then
> calculate JJAS averaged climatology from these
> 30 years JJAS averaged SST and then calculate
> JJAS averaged anomaly.
> I do not know how to perform these steps in NCL.
>
> I had extensively searched NCL-talk archives but
> did not find the answer to my problem.
>
> I am using NCL version 6.4.0 on linux machine.
>
> Any suggestion would be of great help.
> With best regards
> Dr. Sujata Mandke
> scientist, IITM,PUNE, INDIA
> _______________________________________________
> 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/20181218/96ebf3e1/attachment.html>
```