Codes and STAT Methods Used

use mdt_indian.nc
use hyc_ssh1by4.nc
let hmss=hyc_ssh[l=1:727@ave]
let a=grid_0001[d=1,x=@min,y=@min]
let b=grid_0001[d=1,x=@max,y=@max]
let c=hmss[d=2,x=@min,y=@min]
let d=hmss[d=2,x=@max,y=@max]
list/nohead/format=(4f8.3) a,b,c,d
let nmdt=((grid_0001[d=1]-a)*(d-c)/(b-a))+c
let hyc_cnes_diff=hmss-nmdt
fill/nolab/set hyc_cnes_diff
ppl title "HYCOM MSS -SCALED CNES MDT"
ppl fill
ppl contour/over
go fland 5
STAT-Parameters
 use $1
# WHERE $1=sst_mon_JAN_FEB.nc,sst_mon_MAR_APR.nc etc

!####### To find the bias ##############################

        let sst_bias=sst_hyc_mon-sst_navo_mon
        let mean_diff=sst_bias[l=@ave]
!###### To find the correlation ########################


        let p=sst_hyc_mon
        let q=sst_navo_mon
        go variance

!###### To find standard deviation #####################

        let std_dev_model=p_var^0.5
        let std_dev_navo=q_var^0.5

!###### To find RMSD ####################################
        let square_bias=(sst_bias)^2
        let RMSD=(square_bias[l=@ave])^0.5
        SCATTER_INDEX=(RMSD/q[l=@ave])*100

        save/file=val_$1.nc/append mdiff,covar,correl,std_dev_model,std_dev_navo,RMSD
VARIANCE SCRIPT
\CANCEL MODE VERIFY
! updated 10/93 for Ferret V3.01
! updated 6/99 to handle bad data - SIM

! Description:  define FERRET variables for covariance and correlation

! example:
!   yes? SET DATA coads_climatology
!   yes? LET p = sst[x=180,y=0]; LET q = airt[x=180,y=0]
!   yes? GO variance
!   yes? list p, q

SAY ... Variance and Covariance: Instructions:
SAY Use the LET/QUIET command to define the variable(s) P (and Q) as
SAY your variable(s) of interest (e.g. yes? LET/QUIET P = u[x=180,y=0])
SAY The variance of P will be variable P_VAR  (Q --> Q_VAR)
SAY The covariance will be COVAR The correlation will be CORREL.
SAY Type GO VAR_N to obtain n/n+1 statistical correction factor
SAY ...

! deviations, squared deviations, cross deviations
let/quiet P_AVE = P[L=@ave]
let/quiet Q_AVE = Q[L=@ave]
let/quiet P_DEV = P - P_AVE
let/quiet Q_DEV = Q - Q_AVE
let/quiet MASK_PQ = p*q-p*q + 1         ! always 1 or "missing"
let/quiet P_MASK = P*MASK_PQ
let/quiet Q_MASK = Q*MASK_PQ
let/quiet P_DSQ = P_DEV * P_DEV
let/quiet Q_DSQ = Q_DEV * Q_DEV
let/quiet P_AVE_MASK = P_MASK[l=@ave]
let/quiet Q_AVE_MASK = Q_MASK[l=@ave]
let/quiet P_DEV_MASK = P_MASK - P_AVE_MASK
let/quiet Q_DEV_MASK = Q_MASK - Q_AVE_MASK
let/quiet P_DSQ_MASK = P_DEV_MASK*P_DEV_MASK
let/quiet Q_DSQ_MASK = Q_DEV_MASK*Q_DEV_MASK
let/quiet PQ_DSQ= P_DEV_MASK * Q_DEV_MASK     ! also = P_DEV*Q_DEV

! variances, covariances
let/quiet/title="VARIANCE OF P"          P_VAR = P_DSQ[l=@ave]
let/quiet/title="VARIANCE OF Q"          Q_VAR = Q_DSQ[l=@ave]
let/quiet/title="VARIANCE OF P WHEN Q PRESENT" P_VAR_MASK = P_DSQ_MASK[l=@ave]
let/quiet/title="VARIANCE OF Q WHEN P PRESENT" Q_VAR_MASK = Q_DSQ_MASK[l=@ave]
let/quiet/title="COVARIANCE OF P AND Q"  COVAR = PQ_DSQ[l=@ave]
let/quiet/title="CORRELATION OF P AND Q" CORREL= COVAR / (P_VAR_MASK*Q_VAR_MASK)^.5

SET MODE/LAST VERIFY


HYCOM@INCOIS