Hi Neil, You need a way to compute and keep variables that define the index values for last 100 years of each dataset. If you had just a few datasets, you could define, say, let ll_a = l[gt=tauu,d=1] let lim_a = ll_a[l=@max] let tauu_ltr_a = tauu[d=1,l=`lim_a-1200`:`lim_a`] let ll_b = l[gt=tauu,d=2] let lim_b = ll_b[l=@max] let tauu_ltr_b = tauu[d=2,l=`lim_b-1200`:`lim_b`] ... and then operate on those separate variables. That gets cumbersome with lots of datasets, but Ferret symbols and a REPEAT loop can do this. Here's a script showing this, leaving out the issue of the regridding you're doing in X,Y,Z. You'll need to define more variables to do that step - or do that regridding at the end before saving the data. USE climatological_axes On 9/1/2010 10:18 AM, Neil Swart wrote: Hi Ferreters, I'm looking at surface wind stress from 20 models. Each models wind-stress is in a different file, but all have the same name (tauu). Unfortunately, the length, starting point and end point of the time axis is different for each model. What I want to do is to use the LAST 100 years of monthly output from each model to produce a single, averaged monthly climatology. I can produce the climatologies, using all times for each model, but have not been successful in limiting the calculation to only the last 100 years from each model. Does anyone have any suggestions on how to best achieve selecting the last 100 years from each model, even though the calendar dates maybe different? I have tried several things, like defining a new variable, but this fails, since each data set has a different length of time axis: let ll = l[gt=tauu] let lim = ll[l=@max] let tauu_ltr = tauu[l=`lim-1200`:`lim`] Many thanks, Neil Swart My jnl script look something like: use file1.nc use file2.nc . . . ! Regrid the winds onto the uvic_escm x,y,z DEFINE GRID/X=GHO1/Y=GHO1/Z=GHO1 comg let uvg_grd = tauu[Gxyz=comg]*lmask[G=comg] ! Compute climatologies over the last 100 years of the pinctrl runs use climatological_axes let uvg_tauu = uvg_grd[gt=month_noleap@asn] let mean_clim = (uvg_tauu[d=3] + uvg_tauu[d=4] + uvg_tauu[d=5] + uvg_tauu[d=6] + uvg_tauu[d=7] + uvg_tauu[d=8] + uvg_tauu[d=9] + uvg_tauu[d=10]\ + uvg_tauu[d=11] + uvg_tauu[d=12] + uvg_tauu[d=13] + uvg_tauu[d=14] + uvg_tauu[d=15] + uvg_tauu[d=16] + uvg_tauu[d=17] + uvg_tauu[d=18]\ + uvg_tauu[d=19]*-1 + uvg_tauu[d=20]*-1 + uvg_tauu[d=21]*-1 + uvg_tauu[d=22]*-1 )/20 --------------------------------------------------- Neil Swart Climate Modelling Group School of Earth and Ocean Sciences University of Victoria Victoria, BC Canada http://climate.uvic.ca/ |