>I have a question when I want to get a correlation field
>between PDO and NH precipitation.
>1. I met an error when dealing with rtest of cross correlation ,
> error info : "SLATEC/NCL: DBETAI: P AND/OR Q IS LE ZERO:
> NERR= 2: LEVEL= 2" and codes were listed below :
>
> ccr1 = escorc(pdo({1951:2002}),ann_cru(:,:,{1951:2002}))
> nlat = dimsizes(ccr1(:,1)) ; nlat= 180 for North Hemisphere
> nlon = dimsizes(ccr1(1,:)) ; nlon = 720
^^^^^^^^^^^^^
CRU ... this does not look correct
> print(nlon)
> print(nlat)
> Nx1 = new((/nlat,nlon/),"integer")
> do ilat = 0,nlat-1
> do ilon = 0,nlon-1
> Nx1(ilat,ilon) = num(.not.ismissing(ann_cru(ilat,ilon,{1951:2002})))
> end do
> end do
> prob1 = rtest(ccr1,Nx1,0)
>I believe that it is because Nx1 have many constant
>missing value in ocean area that cause such trouble.
>But I can not find a way to resolve it.
------------------------------------------------------
------------------------------------------------------
Oops! The underlying code computes the degrees of freedom via
df = n-2
When "n" is 0 [as returned by dim_num], then df is -2.
The documentation and wrapper will be changed for the
next release of NCL [a035].
The following is a workaround. Since I think meta
data is useful, I have added some extra stuff.
ccr1 = escorc(pdo({1951:2002}),ann_cru(:,:,{1951:2002}))
copy_VarCoords(ann_cru(:,:,0), ccr1) ; copy lat/lon coord information
ccr1_at_long_name = "r: PDO-CRU"
printVarSummary(ccr1)
printMinMax(ccr1, True) ; contributed.ncl
Nx = dim_num(.not.ismissing(ann_cru(:,:,{1951:2002})))
copy_VarCoords(ccr1, Nx) ; contributed.ncl
Nx_at_long_name = "number of non-missing values"
printVarSummary(Nx)
printMinMax(Nx, True)
dim_ccr1 = dimsizes(ccr1)
nlat = dim_ccr1(0)
mlon = dim_ccr1(1)
prob = new ( dim_ccr1, "float", -999.)
do nl=0,nlat-1
do ml=0,mlon-1
if (Nx(nl,ml).gt.2) then
prob(nl,ml) = rtest(ccr1(nl,ml),Nx(nl,ml),0)
end if
end do
end do
prob_at_long_name = "probability"
copy_VarCoords( ccr1, prob)
printVarSummary(ccr1)
printMinMax(ccr1, True)
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jan 22 2007 - 11:12:33 MST
This archive was generated by hypermail 2.2.0 : Mon Feb 05 2007 - 07:15:45 MST