[Thread Prev][Thread Next][Index]

Re: [ferret_users] Climatology over multiple data sets with differing time axes



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
CANCEL DATA climatological_axes

USE file1.nc  ! to get the xyz grid used just below
DEFINE SYMBOL tauu_units = `tauu,RETURN=units`  ! used at the end

! initialize the sum of climatologies

LET mean_0 = 0* (T[GT=month_irreg] + X[GX=tauu] + Y[GY=tauu] + z[gz=tauu])
DEFINE symbol mean_clim = mean_0

CANCEL DATA/ALL

! keep a count of terms in the average
LET count = 0

! loop over datasets, creating a variable with each climatological mean,
! and making a symbol ($mean_clim) that is the sum of these variables

REPEAT/RANGE=1:22/NAME=m \
(DEFINE symbol mm = `m`; \
GO add_model.jnl; \
LET count = `count+1`)

LET/UNITS="($tauu_units)"/TITLE="output title for the variable" \
  mean_clim = ($mean_clim)/count

SAVE/CLOBBER/FILE=mean_save.nc mean_clim
EXIT

! ------------

! add_model.jnl

USE file($mm).nc
LET ll = l[gt=tauu]
LET lim($mm) = ll[l=@max]
LET low($mm) = MAX(1,`ll[l=@max] - 1200`)
LET tauu_ltr($mm) = tauu[d=($mm),l=`low($mm)`:`lim($mm)`]


! Compute climatology over the last 100 years
LET uvg_tauu($mm) = tauu_ltr($mm)[gt=month_irreg@mod]

DEFINE SYMBOL mean_clim = ($mean_clim) + uvg_tauu($mm)

pause  ! this lets you watch the script in action.
! --- end of add_model.jnl



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/



[Thread Prev][Thread Next][Index]

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

Privacy Policy | Disclaimer | Accessibility Statement