[Thread Prev][Thread Next][Index]

Re: [ferret_users] seting time-constant value to a map

Hi Francois,
If you want to use Ferret to compare the mean value with each monthly value, you do not need to have the mean value at each time step. Ferret will let you subtract the mean (which has no time dependence) from any monthly value.  See "conformability" in the Users Guide, discussed in Ch3 Sec2.2.

Follow along with this example.
yes? use coads_climatology
yes? let sst_ave = sst[L=@ave]

yes? save/file=sst_mean.nc sst_ave

yes? can var/all

yes? use sst_mean.nc
yes? ! Even though sst_ave does not depend on time we can still
     ! subtract it from sst.

     ! The result is the January anomoly.
yes? shade sst[d=1,L=1] - sst_ave[d=2]
If you do want to define a variable with 12 time steps, all containing the same value for all time at each I,J then it would go like this:
yes? use coads_climatology

yes? ! Define a variable which is 0 everywhere,
     ! even where there is missing data
yes? let zero = 0*MISSING(sst,0) 
yes? let sst_ave = sst[L=@ave] + zero

yes? save/file=sst_ave_12.nc sst_ave

DELCLAUX Francois wrote:
I suppose I was not clear in my question.
The aim of my question is to test the consequence of monthly rainfall seasonality on the outputs of
a hydrological model.

So I need  2 datasets:
- one with seasonality, ie12 different values
- one without seasonality, ie 12 identical values, each value being equal to the time average
of the 12 values, so as the sum is the same in the 2 cases.

Consequently, if var1 is the seasonal dataset and is described as
var1(i, j, 1) = val1
var1(i, j, 2) = val2
var1(j, j, 12)= val12

the 2nd dataset will be:
var2(i, j, 1) = var1(i, j, l=@ave)
var2(i, j, 2) = var1(i, j, l=@ave)
var2(i, j, 12) = var1(i, j, l=@ave)
So, for a given (i, j), all the L values of var2 will be identical and equal to the L average.

Then my question is:
how computing var2 from var1 ?


Francois Delclaux

Hi Francois,
To average over all of L, you can define a variable

  yes? let var2 = var1[L=@ave]

Then var2 will depend only on X and Y.

I'm not sure if that is what you wanted.  You can specify limits on the average, for instance var1[L=1:3@ave], or use a transformation, say a smoother. Make sure your X axis is defined as a MODULO axis, so that time wraps around from December to January. Then for instance you might define

  yes? let var3 = var1[L=@SBX:3]

which would replace each value with the average of the times at L-1, L, and L+1.
Or you could do an indefinite integral

  yes? let var4 = var1[L=@IIN]


DELCLAUX Francois wrote:
Hi Ferret Users,

I have a 3D file with variable var1(I, J, L). This a monthly seasonal file where L varies from 1 to 12.

Now I would like to have time contant value for each value of  L i.e. a new variable var2 as follows:
var2(I, J, L) = var1(I, J, L@AVE) for L varying from 1 to 12.

What's the best procedure for getting var2  ?


[Thread Prev][Thread Next][Index]

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

Privacy Policy | Disclaimer | Accessibility Statement