Dear members of the NCL community,
Here a script than I am trying to use to compare datasets.
It is a Taylor diagram snipped from ncl example page.
I want know there is no mistake.
Particularly where I am computing pattern correlation and standard deviation normalization.
Regards,
;**********************************
; DIAGRAMME DE TAYLOR
;**********************************
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"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
load "taylor_diagram.ncl"
;load "taylor_metrics_table.ncl"
;**********************************
;**********************************
begin
;************ data reading ***************************************
data0 = addfile("reg_cru_pre.nc", "r") ; CRU
data1 = addfile("pregpcp1998_2007_inter.daily.nc", "r") ;
data2 = addfile("CMAP_precip.mon.mean_inter_1998_2007.nc", "r")
data3 = addfile("precip.mon.total.v301_inter_1998_2007.nc", "r")
data4 = addfile("precip.mon.total.v6_inter_1998_2007.nc", "r")
pre0 = data0->pre
pre1 = data1->data
pre2 = data2->precip
pre3 = 10*data3->precip
pre4 = data4->precip
copy_VarAtts(data3->precip, pre3)
;******************Pattern correlation ************************************
cor1 = dim_avg_n_Wrap(pattern_cor( pre0, pre1, 1.0, 0), 0)
cor2 = dim_avg_n_Wrap(pattern_cor( pre0, pre2, 1.0, 0), 0)
cor3 = dim_avg_n_Wrap(pattern_cor( pre0, pre3, 1.0, 0), 0)
cor4 = dim_avg_n_Wrap(pattern_cor( pre0, pre4, 1.0, 0), 0)
mmd= (/cor1, cor2, cor3, cor4/)
print(mmd)
;****************** Standard deviation **************************
pre0_Std = dim_avg_n_Wrap( dim_stddev_n_Wrap( pre0, (/1,2/)), 0)
pre1_Std = dim_avg_n_Wrap( dim_stddev_n_Wrap( pre1, (/1,2/)), 0)
pre2_Std = dim_avg_n_Wrap( dim_stddev_n_Wrap( pre2, (/1,2/)), 0)
pre3_Std = dim_avg_n_Wrap( dim_stddev_n_Wrap( pre3, (/1,2/)), 0)
pre4_Std = dim_avg_n_Wrap( dim_stddev_n_Wrap( pre4, (/1,2/)), 0)
print(dimsizes(dim_stddev_n_Wrap( pre4, (/1,2/))))
;**************** Standard deviations normalisation *********************
std1 = pre1_Std/pre0_Std
std2 = pre2_Std/pre0_Std
std3 = pre3_Std/pre0_Std
std4 = pre4_Std/pre0_Std
fud = (/std1, std2, std3, std4/)
; Cases [Model]
case = (/ "precipitation" /)
nCase = dimsizes(case )
; variables compared
var = (/ "GPCP", "CMAP", "UDEL", "GPCC"/)
nVar = dimsizes(var)
p_rat = (/std1, std2, std3, std4/)
p_cc = (/cor1, cor2, cor3, cor4/)
;**********************************
; Put the ratios and pattern correlations into
; arrays for plotting
;**********************************
nDataSets = 1 ; number of datasets
npts = dimsizes(p_rat)
ratio = new ((/nCase, nVar/), typeof(p_rat) )
cc = new ((/nCase, nVar/), typeof(p_cc) )
ratio(0,:) = p_rat
cc(0,:) = p_cc
;**********************************************************************************************************************
;***************************** create plot ************************************************
;**********************************************************************************************************************
res = True ; diagram mods desired
res@tiMainString = "precipitation" ; title
res@Colors = (/"blue"/) ; ; marker colors
res@Markers = (/14/) ;,9,2,3,8/) ; marker styles
res@markerTxYOffset = 0.03 ; offset btwn marker & label
res@gsMarkerSizeF = 0.018 ; marker size
res@txFontHeightF = 0.018 ; text size**************taille des lettres et chiffres******
res@stnRad = (/ 0.75, 1.25 /) ; additional standard radii
res@ccRays = (/ 0.6, 0.9 /) ; correllation rays
;res@ccRays_color = "LightGray" ; default is "black"
res@varLabels = var
res@caseLabels = case ; affiche la liste des variables chargées
res@varLabelsYloc = 1.5 ; Move location of variable labels [pour taylor]
;res@varLabelsYloc = 1.65 ; Move location of variable labels [pour taylor2]
;res@varLabelsYloc = 2.04 ; Move location of variable labels [pour taylor1]
res@caseLabelsFontHeightF = 0.10 ; make slight larger [default=0.12 ]
res@varLabelsFontHeightF = 0.01 ; make slight smaller [default=0.013]
res@centerDiffRMS = True ; RMS 'circles'
res@centerDiffRMS_color = "LightGray" ; default is "black"
wks = gsn_open_wks("eps", "pre_tailor_annual")
plot = taylor_diagram(wks, ratio, cc, res)
;**********************************************************************************************************************
;**********************************************************************************************************************
;**********************************************************************************************************************
end
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Mar 18 01:01:33 2014
This archive was generated by hypermail 2.1.8 : Fri Mar 21 2014 - 15:49:21 MDT