[Thread Prev][Thread Next][Index]

Re: [ferret_users] Calculations between different time axis

Hi -
If the time axes are in different years, then the kind of regridding suggested above won't work. You will get all missing data as the result.
use "model_output_year_1.nc"
use "model_output_year_2.nc"

! This will show the ranges of all the axes for the datasets:
show grid var[d=1]
show grid var[d=2]
If the time axes for the two variables show different years, then you need to do something different.  Some model output might have some kind of generic time which doesn't refer to years, and in that case what Paul suggested would work.

 Regridding generally requires the same region of time (or space).  Say the data are in 2001 and 2002. The regridding
LET var_yr2_new_t = var_yr2[gt=var_yr1]
is saying "take all the data from 2002 that is in 2001 and put it onto the 2001 time axis, then take the difference." There is no data in var_yr2 that is in 2001, so the result will be all missing. (What  you can do with this regridding syntax is regrid say, a monthly time axis to a daily time axis for the same time ranges, or a regularly-spaced axis to an irregularly spaced one.)

If the time axes for the two years have the same number of points, say if they're both daily axes, then you could use the @ASN regridding transformation to just copy the data from one time axis to the other axis.  Using Paul's example:
use "model_output_year_1.nc"
use "model_output_year_2.nc"

let var_yr1 = var[d=1]
let var_yr2 = var[d=2]

! This will just plop the 2002 data onto the 2001 axis, point by point.
let var_yr2_new_t = var_yr2[gt=var_yr1@ASN]  

!Plot differences, which will be labeled as if they are all in 2001.
fill/z=1000/l=1 var_yr1 - var_yr2_new_t

! or a time series of the difference,
let diff_var  = var_yr1 - var_yr2_new_t
plot/k=1 diff_var[x=300:320@ave,y=0:30@ave]
It would be more accurate to define a time axis that has no calendar information, and use @ASN to regrid both years to that.  If it were daily data, define a time axis but without the /T0= qualifier that tells Ferret what year and date the time coordinates relate to.
DEFINE AXIS/T=1:365:1/UNITS=days tdays
LET var_yr1_compare = var_yr1[gt=tdays@ASN]
LET var_yr2_compare = var_yr2[gt=tdays@ASN]

LET var_diff = var_yr2_compare - var_yr1_compare

Another possibility is to regrid both variables to a climatological axis.  There is lots of documentation about climatologies in the Users Guide, and also these two FAQ's which talk about particular examples with climatologies. The first uses monthly climatologies, the second shows how to define a daily climatological axis.

Paul Young wrote:
Hi Paulo,

You need to re-grid the data to a common time axis. The simplest way is to re-grid the data from year 2 onto the year 1 time axis. I'll illustrate with a hypothetical ferret session:

use "model_output_year_1.nc"
use "model_output_year_2.nc"

let var_yr1 = var[d=1]
let var_yr2 = var[d=2]
let var_yr2_new_t = var_yr[gt=var_yr1]

!Plot differences
fill/z=1000/l=1 var_yr1 - var_yr2_new_t

Take a look at the ferret documentation on re-gridding - ferret makes it quite straightforward for all kinds of re-gridding operations.




On Aug 11, 2009, at 1:11 PM, Paulo Santiago wrote:

Hi Ferreters,

I would like to calculate the differences between data with different time axis.

The data are results from the same model (same xyz grid) for different years.

I believe there's a simple and elegant way to do this task with Ferret, but I can't imagine how.

Thanks in advance.

Paulo Santiago

[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement