Regression - ENSO 3.4 time series vs Spatial Field
Added by Sarah O'Keefe about 9 years ago
Hi - Does anyone know if cdo can do this? I want to look at the relationship between a time series and a 3D (lat,lon,time) field. Thanks! Sarah.
Replies (3)
RE: Regression - ENSO 3.4 time series vs Spatial Field - Added by Ralf Mueller about 9 years ago
hi Sarah!
Do you want to correlate the time series? you could use the enlarge operator. I uploaded some sample input and ouput files. you can check the commands in the history attribute of the files.
| timeSeries.nc (4.11 KB) timeSeries.nc | input | ||
| enlargedTimeSeries.nc (52.3 KB) enlargedTimeSeries.nc | output |
RE: Regression - ENSO 3.4 time series vs Spatial Field - Added by Cary Lynch over 8 years ago
Hello!
Similar question. I want to perform a least square regression between a 1-D time series and a 3-D field. I want the regression coefficients and y-int from this function, if possible. Has the original question been answered?
RE: Regression - ENSO 3.4 time series vs Spatial Field - Added by Karin Meier-Fleischer over 8 years ago
Hi Cary,
yes, the original question was answered, see reply 1. 
The answer to you is the same as for the original question - use the enlarge operator to enlarge the 1D time series to the size of the data file to be compared or to compute the trend.
Using Ralf's test data:
cdo -C -enlarge,r10x10 timeSeries.nc enlargedTimeSeries.nc
cdo -trend enlargedTimeSeries.nc afile.nc bfile.nc
cdo info afile.nc
-1 : Date Time Level Gridsize Miss : Minimum Mean Maximum : Parameter ID
1 : 2124-12-26 04:00:00 0 100 0 : 1.4678 1.4678 1.4678 : 255
cdo info: Processed 100 values from 1 variable over 1 timestep ( 0.00s )
[~/CDO/Support/enlarge] > cdo info bfile.nc
-1 : Date Time Level Gridsize Miss : Minimum Mean Maximum : Parameter ID
1 : 2124-12-26 04:00:00 0 100 0 : 0.0028344 0.0028344 0.0028344 : 255
cdo info: Processed 100 values from 1 variable over 1 timestep ( 0.00s )
ncdump -h afile.nc
netcdf afile {
dimensions:
lon = 10 ;
lat = 10 ;
lev = 1 ;
time = UNLIMITED ; // (1 currently)
variables:
float lon(lon) ;
lon:standard_name = "longitude" ;
lon:long_name = "longitude" ;
lon:units = "degrees_east" ;
lon:axis = "X" ;
float lat(lat) ;
lat:standard_name = "latitude" ;
lat:long_name = "latitude" ;
lat:units = "degrees_north" ;
lat:axis = "Y" ;
double lev(lev) ;
lev:long_name = "generic" ;
lev:units = "level" ;
lev:axis = "Z" ;
double time(time) ;
time:standard_name = "time" ;
time:units = "day as %Y%m%d.%f" ;
time:calendar = "proleptic_gregorian" ;
time:axis = "T" ;
double hight(time, lev, lat, lon) ;
hight:standard_name = "hi_acc" ;
hight:long_name = "ice thickness" ;
hight:units = "m" ;
hight:code = 255 ;
ncdump -h bfile.nc
netcdf bfile {
dimensions:
lon = 10 ;
lat = 10 ;
lev = 1 ;
time = UNLIMITED ; // (1 currently)
variables:
float lon(lon) ;
lon:standard_name = "longitude" ;
lon:long_name = "longitude" ;
lon:units = "degrees_east" ;
lon:axis = "X" ;
float lat(lat) ;
lat:standard_name = "latitude" ;
lat:long_name = "latitude" ;
lat:units = "degrees_north" ;
lat:axis = "Y" ;
double lev(lev) ;
lev:long_name = "generic" ;
lev:units = "level" ;
lev:axis = "Z" ;
double time(time) ;
time:standard_name = "time" ;
time:units = "day as %Y%m%d.%f" ;
time:calendar = "proleptic_gregorian" ;
time:axis = "T" ;
double hight(time, lev, lat, lon) ;
hight:standard_name = "hi_acc" ;
hight:long_name = "ice thickness" ;
hight:units = "m" ;
hight:code = 255 ;
-Karin