spatial correlation

From: Prince K. XAVIER <xavier_at_nyahnyahspammersnyahnyah>
Date: Wed, 30 Aug 2006 12:37:32 +0200

Hi all,
I am having a bit of trouble with escorc (or ndtooned?). I have two
variables, say
noaa --> [latitude | 25] x [longitude | 144] x [step | 298]
merged --> [latitude | 25] x [longitude | 144] x [number | 9] x [step |
298]
The first 118 time points of 'merged' are same as that of 'noaa' for
all the 9 'number' s. However, when I compute the spatial
correlations using
       do nt = 0, 297
         do i = 0, 8
          r(nt,i) =
escorc(ndtooned(merged({lati:latf},{loni:lonf},i,nt)),ndtooned(noaa({lati:latf},{loni:lonf},nt)))
         end do
        end do
I expect the spatial correlations to be 1.0 for the first 118 time
points for all 9 ensemble members, but not so.
I suspect that I am doing something wrong while 'ndtooned' ing. Could
someone point out where I am going wrong? Original script is attached.

Thanks in advance,
Prince

-- 
Prince K. XAVIER		
Laboratoire de Meteorologie Dynamique
Ecole Normale Superieure
24 Rue Lhomond 75231 Paris 
cedex 05 FRANCE
Tel: +33 (0)1 44 32 22 32

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
        nlon = 144
        nlat = 25
        nens = 9 ; No. of ensemble members
        tnoaa = 299 ; time in NOAA OLR
        tmodel = 180 ; Model time steps
        model = "cnrm"
        yrs = ispan(1980,2001,1)

        year = "1981"
        yr = stringtointeger(year)
        
        ; AREA FOR SPATIAL CORRELATIONS
        ;==============================
        lati = -20.
        latf = 30.
        loni = 70.
        lonf = 140.

        f1 = addfile("/rdsk5/jpduvel/DEMETER/netcdf/mai/OLR/noaa/OLR_NOAA_"+year+"05.nc","r")
        olr_noaa = f1->OLRG
        olr_noaa!0 = "step"
        olr_noaa!1 = "latitude"
        olr_noaa!2 = "longitude"
        noaa = olr_noaa(latitude|:,longitude|:,step|:)
        
        f2 = addfile("/rdsk5/jpduvel/DEMETER/netcdf/mai/OLR/"+model+"/OLR_"+model+"_"+year+"05.nc","r")

        olr_cnrm = short2flt(f2->tnlr)
        olr_cnrm = olr_cnrm*-1.0/86400.

        lpflag = yr%4
         if(lpflag.eq.0) then
           tprel = 119
         else
           tprel = 118
        end if

        ; AN ARRAY TO HOLD NOAA OLR CORRESPONDING TO THE 180 DAYS OF HINDCASTS
        ;=============================================================
        noaa_180 = new((/nlat,nlon,tmodel/),"float")
        noaa_180 = olr_noaa(latitude|:,longitude|:,step|tprel:tprel+tmodel-1)

        ; A LONGER ARRAY TO APPEND THE MODEL DATA BDEHIND THE NOAA OLR
        ;=============================================================
        merged = new((/nlat,nlon,nens,tprel+tmodel/),"float")

        ; MERGING THE DATA
        ;=================
         do n = 0, nens-1
          merged(:,:,n,0:tprel-1) = olr_noaa(latitude|:,longitude|:,step|0:tprel-1)
         end do
          merged(:,:,:,tprel:) = olr_cnrm(latitude|:,longitude|:,number|:,step|:)

        ; SPATIAL CORRELATIONS FOR MEMBERS
        ; ==================================
        r = new ((/tprel+tmodel,nens/), typeof(merged))

        do nt = 0, tprel+tmodel-1
         do i = 0, nens-1
          r(nt,i) = escorc(ndtooned(merged({lati:latf},{loni:lonf},i,nt)),ndtooned(noaa({lati:latf},{loni:lonf},nt)))
         end do
        end do

        tmod = ispan(0,tprel+tmodel-1,1)

; write_matrix (r, "9f7.2" , False)

        wks = gsn_open_wks("eps","seas_pred_isomode")
          gsn_define_colormap(wks,"WhBlGrYeRe") ; use the BlWhRe colormap (instead of default colormap)

        res = True
        res_at_gsnDraw = False ; don't draw
          res_at_gsnFrame = False ; don't advance frame
        res_at_xyLineColors = (/12,22,32,42,52,62,72,82,92/) ; change line color
        res_at_xyMonoLineThickness = True
        res_at_xyLineThicknessF = 0.25
        res_at_xyMonoDashPattern = True
        res_at_xyDashPattern = 0
        res_at_vpHeightF = 0.2
        res_at_vpWidthF = 0.6

; res_at_trXMinF = 0 ; Control limits of X
 ; res_at_trXMaxF = 60 ; and Y axes.
  ; res_at_trYMinF = -0.2
   ; res_at_trYMaxF = 1.0
        
        plot = new(3,graphic)

        plot(0) = gsn_csm_xy (wks,tmod,transpose(r),res) ; create plot
        
        ;plot(1) = gsn_csm_xy (wks,tmod,mean_r,res) ; create plot
        ;plot = gsn_csm_xy (wks,x,wts,res) ; create plot

        resP = True ; modify the panel plot
        resP_at_txString = model + year
        gsn_panel(wks,plot,(/2,1/),resP) ; now draw as one plot

end

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Aug 30 2006 - 04:37:32 MDT

This archive was generated by hypermail 2.2.0 : Wed Aug 30 2006 - 07:43:22 MDT