[Thread Prev][Thread Next][Index]

Re: [ferret_users] spatial correlations of GPCC and CRU



Hi,

The time axes may represent the same time steps, but be defined differently.  For instance, one might be in units of days since the start of year 1950 and the other is fractions of years since 1980.  They might even have different calendar definitions.  To make sure the time axes are the same, use Ferret to regrid one to the other.

yes? use GPCC_test_r.nc
yes? use CRU_test.nc

! ( optional, look at the time axes and grids)
yes? show grid precip[d=1]
yes? show axis `precip[d=1],return=taxis`

yes? show grid pre[d=2]
yes? show axis `pre[d=2],return=taxis`


 
yes? let p = precip[d=1,x=35,y=12]
yes? let q = pre[d=2,x=35,y=12,gt=precip[d=1]]

yes? GO variance



On 7/8/2016 12:51 PM, afwande juliet wrote:
Dear All

I want to do spatial and time series correlations for GPCC and CRU

I am trying to follow this post thread http://ferret.pmel.noaa.gov/Ferret/faq/correlations-and-variances
but i get errors highlighted in color.my data are all at same grid and ranges from 1980-2009

yes? use GPCC_test_r.nc
yes? use CRU_test.nc
yes? sh d
     currently SET data sets:
    1> ./GPCC_test_r.nc
 name     title                             I         J         K         L         M         N
 PRECIP   GPCC Monthly total of precipita  1:125     1:111     ...       1:360     ...       ...
 
    2> ./CRU_test.nc  (default)
 name     title                             I         J         K         L         M         N
 PRE      precipitation                    1:125     1:111     ...       1:360     ...       ...
 
yes? let p =precip[d=1,x=35,y=12]
yes? let q =pre[d=2,x=35,y=12]
yes? GO variance
... Variance and Covariance: Instructions:
Use the LET/QUIET command to define the variable(s) P (and Q) as
your variable(s) of interest (e.g. yes? LET/QUIET P = u[x=180,y=0])
The variance of P will be variable P_VAR  (Q --> Q_VAR)
The covariance will be COVAR The correlation will be CORREL.
Type GO VAR_N to obtain n/n+1 statistical correction factor
...
yes? SHOW VAR
 Created by DEFINE VARIABLE:
 >>> Definitions that replace any file variable of same name:
     CORREL = COVAR / (P_VAR_MASK*Q_VAR_MASK)^.5
         "CORRELATION OF P AND Q"
     COVAR = PQ_DSQ[L=@AVE]
         "COVARIANCE OF P AND Q"
     Q_VAR_MASK = Q_DSQ_MASK[L=@AVE]
         "VARIANCE OF Q WHEN P PRESENT"
     P_VAR_MASK = P_DSQ_MASK[L=@AVE]
         "VARIANCE OF P WHEN Q PRESENT"
     Q_VAR = Q_DSQ[L=@AVE]
         "VARIANCE OF Q"
     P_VAR = P_DSQ[L=@AVE]
         "VARIANCE OF P"
     PQ_DSQ = P_DEV_MASK * Q_DEV_MASK
     Q_DSQ_MASK = Q_DEV_MASK*Q_DEV_MASK
     P_DSQ_MASK = P_DEV_MASK*P_DEV_MASK
     Q_DEV_MASK = Q_MASK - Q_AVE_MASK
     P_DEV_MASK = P_MASK - P_AVE_MASK
     Q_AVE_MASK = Q_MASK[L=@AVE]
     P_AVE_MASK = P_MASK[L=@AVE]
     Q_DSQ = Q_DEV * Q_DEV
     P_DSQ = P_DEV * P_DEV
     Q_MASK = Q*MASK_PQ
     P_MASK = P*MASK_PQ
     MASK_PQ = P*Q-P*Q + 1
     Q_DEV = Q - Q_AVE
     P_DEV = P - P_AVE
     Q_AVE = Q[L=@AVE]
     P_AVE = P[L=@AVE]
     Q = PRE[D=2,X=35,Y=12]
     P = PRECIP[D=1,X=35,Y=12]
yes?  list p_var, q_var
             LONGITUDE: 34.8E
             LATITUDE: 12N
 Column  1: P_VAR[T=16-DEC-1979 12:00:16-DEC-2009 00:00] is VARIANCE OF P
 Column  2: Q_VAR[T=01-JAN-1980 00:00:31-DEC-2009 00:00] is VARIANCE OF Q
          P_VAR   Q_VAR
I / *:     5225.  6231.
yes? LIST correl, covar
 *** NOTE: Ambiguous coordinates on T axis: P*Q-P*Q + 1
 *** NOTE: Ambiguous coordinates on T axis: P*Q-P*Q + 1
 *** NOTE: Ambiguous coordinates on T axis: P*Q-P*Q + 1
 *** NOTE: Ambiguous coordinates on T axis: Q*MASK_PQ
 *** NOTE: Ambiguous coordinates on T axis: COVAR / (P_VAR_MASK*Q_VAR_MASK)^.5
 *** NOTE: Ambiguous coordinates on T axis: P_DEV_MASK * Q_DEV_MASK
 **ERROR: illegal limits: Q is not in the range T=15-DEC-2079 12:00:16-DEC-2109 00:00

          Axis extremes are T=01-JAN-1980 00:00:31-DEC-2009 00:00
yes?  list p_var, q_var
             LONGITUDE: 34.8E
             LATITUDE: 12N
 Column  1: P_VAR[T=16-DEC-1979 12:00:16-DEC-2009 00:00] is VARIANCE OF P
 Column  2: Q_VAR[T=01-JAN-1980 00:00:31-DEC-2009 00:00] is VARIANCE OF Q
          P_VAR   Q_VAR
I / *:     5225.  6231.
yes? SHOW VAR p_var
 P_VAR = P_DSQ[L=@AVE]
         "VARIANCE OF P"
yes? SHOW VAR correl
 CORREL = COVAR / (P_VAR_MASK*Q_VAR_MASK)^.5
         "CORRELATION OF P AND Q"
yes? GO var_n
CANCEL MODE VERIFY
 **ERROR: illegal limits: Q is not in the range T=15-DEC-2079 12:00:16-DEC-2109 00:00
          Axis extremes are T=01-JAN-1980 00:00:31-DEC-2009 00:00
IF `nm1 eq 0` then exit/script
Command file, command group, or REPEAT execution aborted
yes? LIST correl
 **ERROR: illegal limits: Q is not in the range T=15-DEC-2079 12:00:16-DEC-2109 00:00
          Axis extremes are T=01-JAN-1980 00:00:31-DEC-2009 00:00
yes? set data GPCC_test_r.nc

yes? set data CRU_test.nc
yes? sh d
     currently SET data sets:
    1> ./GPCC_test_r.nc
 name     title                             I         J         K         L         M         N
 PRECIP   GPCC Monthly total of precipita  1:125     1:111     ...       1:360     ...       ...
 
    2> ./CRU_test.nc  (default)
 name     title                             I         J         K         L         M         N
 PRE      precipitation                    1:125     1:111     ...       1:360     ...       ...
 
yes? LET p = precip[d=1,x=22:54,y=-12:24]
yes? LET q = pre[d=2,x=22:54,y=-12:24]
yes? go variance
... Variance and Covariance: Instructions:
Use the LET/QUIET command to define the variable(s) P (and Q) as
your variable(s) of interest (e.g. yes? LET/QUIET P = u[x=180,y=0])
The variance of P will be variable P_VAR  (Q --> Q_VAR)
The covariance will be COVAR The correlation will be CORREL.
Type GO VAR_N to obtain n/n+1 statistical correction factor
...
yes? go var_n
 *** NOTE: Ambiguous coordinates on T axis: P*Q-P*Q + 1
 *** NOTE: Ambiguous coordinates on T axis: P*Q-P*Q + 1
 *** NOTE: Ambiguous coordinates on T axis: P*Q-P*Q + 1
 **ERROR: illegal limits: Q is not in the range T=15-DEC-2079 12:00:16-DEC-2109 00:00
          Axis extremes are T=01-JAN-1980 00:00:31-DEC-2009 00:00
IF `nm1 eq 0` then exit/script
Command file, c
ommand group, or REPEAT execution aborted
yes? STAT correl
 *** NOTE: Ambiguous coordinates on T axis: Q*MASK_PQ
 *** NOTE: Ambiguous coordinates on T axis: COVAR / (P_VAR_MASK*Q_VAR_MASK)^.5
 *** NOTE: Ambiguous coordinates on T axis: P_DEV_MASK * Q_DEV_MASK
 **ERROR: illegal limits: Q is not in the range T=15-DEC-2079 12:00:16-DEC-2109 00:00

          Axis extremes are T=01-JAN-1980 00:00:31-DEC-2009 00:00
yes?



[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement