Project

General

Profile

spatial correlation

Added by Yousef Albuhaisi over 3 years ago

Hi,
I am trying to calculate the spatial correlation between two nc files. however, when I apply timcor I got nans! what could be the problem? the data are in lat,lon format and I added one time step to be able to apply timcor command.
the files are attached.


Replies (5)

RE: spatial correlation - Added by Guilherme Martins over 3 years ago

Try

cdo setmissval,-999 peat_bogs_0.5deg_1.nc peat_bogs_0.5deg_1_fix.nc

cdo setmissval,-999 ORCHIDEE_2.nc ORCHIDEE_2_fix.nc

And:

cdo timcor peat_bogs_0.5deg_1_fix.nc ORCHIDEE_2_fix.nc out.nc

I saw (using ncdump -h yourfile.nc):

float Band1(time, lat, lon) ;
Band1:long_name = "GDAL Band Number 1" ;
Band1:_FillValue = -3.402823e+38f ;
Band1:missing_value = -3.402823e+38f ;

float CH4_e(time, lat, lon) ;
CH4_e:long_name = "monthly total CH4 flux = flux density from ORCHIDEE * fw_swamps_glwd" ;
CH4_e:units = "g CH4/m2/month" ;
CH4_e:_FillValue = 0.f ;
CH4_e:missing_value = 0.f ;

I suppose your _FillValue and missing_value equal to zero is not a good value to this atributtes.

RE: spatial correlation - Added by Yousef Albuhaisi over 3 years ago

I have tried that, but got nans! will _FillValue and missing_value equal to zero is the problem?
could you please tell me how to fix this?
Many thanks

out.nc (10.4 KB) out.nc

RE: spatial correlation - Added by Guilherme Martins over 3 years ago

Dear Yousef,

I used the commands in bold and that solved my problem.

I only changed the missing_value and _FillValue to -999 in both files and later, I calculate the correlation.

I'm using cdo 1.9.9.

RE: spatial correlation - Added by Guilherme Martins over 3 years ago

Is not a best practice to use 0 like missing_value. In my opnion I must to chage to other value.

RE: spatial correlation - Added by Yousef Albuhaisi over 3 years ago

Dear Guilherme,

Thank you for your help.

I did the same thing you did. using bold lines, it changes both miss_values and fill_values to -999. but unfortunately, it still gives me nan.

regards.

Yousef.

    (1-5/5)