[Thread Prev][Thread Next][Index]

Re: [ferret_users] working with data of a month over the years



Hi,
In Ferret, anytime you find yourself using REPEAT loops, it's a good idea to think whether there's a way to define an _expression_ that will do the same thing.  Here's an FAQ that does something similar to what you're trying:

http://ferret.pmel.noaa.gov/FERRET_17sep07/FAQ/analysis/seasonal_masking.html

The example in the FAQ has daily data, as yours is, so you will be able to use the example directly to define a mask for days between 1 and 30.  It looks as if you have a 360-day year, is that correct?  If so, and if the variable in your file were called precip, then
yes? LET year_days = MOD(T[GT=precip], 360)
yes? LET daily_mask = IF year_days LE 30 THEN 1

yes? LET precip1 = precip * daily_mask

This will give you a variable with 30 days of precip data, then 330 days of missing data, and so forth.  Try these commands to see what you've done (choosing some location where your data exists to plot precip1)
yes? PLOT daily_mask
yes? PLOT/x=180/y=0 precip1 

You could use a COMPRESSL function to put all the January data together without the gaps if that would be useful for your analysis:

yes? show function compressL
COMPRESSL(DAT)
    Returns data, compressed along the L axis: Missing points moved to the end
    DAT: variable to compress in L
yes? LET precip_jan = compressL(precip1)
...



Peter Szabo wrote:
Dear Ferreters,

I am using ferret on XP. I have equally spaced daily data in time (30days*
12months* 30years). I would like to eliminate everything but data of january
over the years i order that i could do other things with the january data.

I tried looking it up in the archives and I tried with the following but
have not succeeded yet:
-----------------
repeat/l=1:10800:1 (let precip2=if ((`l` ge 1 and `l` le 30) or (`l` ge 361
and `l` ge 390) or (`l` ge 721 and `l` le 750) or (`l` ge 1081 and `l` le
1110) or....(and so on)....) then precip else precip*0.0)
-----------------
Does anyone can help me?

Peter Szabo
elte

  

[Thread Prev][Thread Next][Index]

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

Privacy Policy | Disclaimer | Accessibility Statement