From: mick spillane <Mick.Spillane@xxxxxxxx>
To: jagadish karmacharya <j_karmacharya@xxxxxxxxx>
Sent: Friday, August 5, 2011 9:13 PM
Subject: Re: [ferret_users] error in calculating correlation coefficient
Hi Jagadish,
Here is something you might try.
def axis/t=1:17:1 tax ; def grid/t=tax grd
let p=hci[d=1,g=grd,gt=@asn]
let q=j4pranom2[d=2,g=grd,gt=@asn]
list p,q
The regridding you did before probably linearly interpolated the one
variable onto the time axis of the other -- hence the change in the
"raw" data. Using the
@asn transformation each original series is transferred one-to-one onto
an axis 1,2,...,17 so "list p,q" should return the values you expect and
you
can then continue with the correlation.
Hope this helps,
Mick
-------
On 8/5/11 12:16 PM, jagadish karmacharya wrote:
> Dear ferret users.
>
> I want to calculate temporal correlation between two datasets. Both datasets are area average values with equal number of time steps but ferret is giving error when I tried to compute correlation between the two. My guess is there is inconsistency in unit of time dimension between the dataset which is causing the problem. But how can I overcome this?
> ==========
> Below is my commands and ferret messages:
>
> use HCIyear17.nc, j4pranom2.nc
> sh d/f
> currently SET data sets:
> 1> ./HCIyear17.nc
> name title I J
> K L
> HCI V850ANOM-V200ANOM 1:1 1:1 1:1 1:17
> on grid GTL1 with -1.000000E+34 for missing data
> X=90.2E:91.2E Y=19.8N:20.8N Z=849.5:850.5
> time range: 15-SEP-1989 21:00 to 15-SEP-2005 21:00
>
> 2> ./j4pranom2.nc (default)
> name title
> I J K L
> J4PRANOM2
>
PRECIP[D=3]-J4PRCLM2 ... ... ... 1:17
> (X=70E:90E@AV4, Y=6.2N:25N@AV4)
> on grid GPA1 with -1.000000E+34 for missing data
> time range: 30-SEP-1989 00:00 to 30-SEP-2005 00:00
>
> let p=hci[d=1]; let q=j4pranom2[d=2]
> go variance
> ...
> list correl
> ...
> **ERROR: illegal limits: Q is not in the range T=04-JAN-1971 03:22:19-SEP-1971 20:22
> Axis extremes are T=31-MAR-1989 12:00:31-MAR-2006 12:00
> =========
>
> Then I found from the mailing archieve that the one variables can be regridded to the
> other grid, with a regridding transformation. I tried that
> and apparently it worked but upon close
inspection I found that during
> transfermation the values differs from the original and one value at
> the edge was flagged as bad so my guess is this will affect the correlation
> computated.This is what I mean: continuing from above
>
> stat j4pranom2
> PRECIP[D=3]-J4PRCLM2
> X=70E:90E@AV4, Y=6.2N:25N@AV4
> X: N/A
> Y: N/A
> Z: N/A
> TIME: 31-MAR-1989 12:00 to 31-MAR-2006 12:00
> DATA SET: ./j4pranom2.nc
> Total # of data points: 17 (1*1*1*17)
> # flagged as bad data: 0
>
Minimum value:
> -1.722
> Maximum value: 4.0644
> Mean value: 0.00030241 (unweighted average)
> Standard deviation: 1.2375
>
> let q=j4pranom2[d=2,gt=p]
> stat q
> J4PRANOM2[D=j4pranom2,GT=P]
> X: N/A
> Y: N/A
> Z: N/A
> TIME: 17-MAR-1989 09:00 to 17-MAR-2006 09:00
> DATA SET: N/A
> Total # of data points: 17
> (1*1*1*17)
> # flagged as bad data: 1
> Minimum value: -1.6715
> Maximum value: 3.8625
> Mean value: -0.0095812 (unweighted
average)
> Standard deviation: 1.2196
>
> ============
>
> I look forward to your advice.
>
> Best regards,
> Jagadish
>
> =====
> Below is the ncdump output of the files:
>
> ncdump -h HCIyear17.nc
>
> netcdf HCIyear17 {
> dimensions:
> LON = 1 ;
> LAT = 1 ;
> LEV2_2 = 1 ;
> TIME = UNLIMITED ; // (17 currently)
> bnds = 2 ;
> variables:
> double LON(LON) ;
> LON:units = "degrees_east"
> ;
> LON:modulo = 360. ;
>
LON:point_spacing = "even" ;
> LON:axis = "X" ;
> double LAT(LAT) ;
> LAT:units = "degrees_north" ;
> LAT:point_spacing = "even" ;
> LAT:axis = "Y" ;
> double LEV2_2(LEV2_2) ;
> LEV2_2:units = "Pa"
> ;
> LEV2_2:point_spacing = "even" ;
> LEV2_2:axis = "Z" ;
> double TIME(TIME) ;
>
TIME:units = "days since 1989-01-01 00:00:00" ;
> TIME:time_origin = "01-JAN-1989 00:00:00" ;
> TIME:axis = "T" ;
> TIME:bounds = "TIME_bnds" ;
> double TIME_bnds(TIME, bnds) ;
> float HCI(TIME,
> LEV2_2, LAT, LON) ;
> HCI:missing_value = -1.e+34f ;
> HCI:_FillValue = -1.e+34f ;
> HCI:long_name = "V850ANOM-V200ANOM" ;
> HCI:history = "From HCI" ;
> // global
attributes:
> :history = "FERRET V6.5 5-Aug-11" ;
> :Conventions = "CF-1.0" ;
>
> ncdump -h j4pranom2.nc
>
> netcdf j4pranom2 {
> dimensions:
> TIME = UNLIMITED ; // (17 currently)
> bnds = 2 ;
> variables:
> double TIME(TIME) ;
> TIME:units = "hours since 1971-01-01 00:00:00" ;
> TIME:time_origin = "01-JAN-1971 00:00:00" ;
> TIME:axis = "T" ;
> TIME:bounds = "TIME_bnds" ;
> double TIME_bnds(TIME, bnds) ;
> float J4PRANOM2(TIME) ;
>
J4PRANOM2:missing_value = -1.e+34f ;
> J4PRANOM2:_FillValue = -1.e+34f
> ;
> J4PRANOM2:long_name = "PRECIP[D=3]-J4PRCLM2" ;
> J4PRANOM2:long_name_mod = "X=70E:90E@AV4, Y=6.2N:25N@AV4" ;
>
> // global attributes:
> :history = "FERRET V6.5 5-Aug-11" ;
> :Conventions = "CF-1.0" ;
> }
>