[Thread Prev][Thread Next][Index]

Re: [ferret_users] recursive variable definition



Hi Frederic,
The RESHAPE function puts the data in the first argument onto the GRID of the second argument, so it's not useful for assigning data to a single location on an axis.

You can just add a variable whose value is 0, but which has the specific time, to a variable that has other dimensions, x, y, and/or z. This is called time-stamping, and is easily used to write a new file containing a time series formed by appending each time step to the file. It should go something like this in your example (details will be different about opening files etc.):

yes? DEFINE AXIS/CALENDAR=360_day/T="15-JAN-1998":"15-DEC-2001":30/UNITS=days tax

  yes? LET ai = T[GT=tax]

  yes? REPEAT/RANGE=1:48/NAME=m ( \
    USE file`m`.nc; \
    LET a = concentration[x=@din,y=@din]+ ai[L=`m`]; \
    SAVE/APPEND/FILE=all.nc a; \
    CANCEL DATA/ALL )

Search the archives for "timestamp" to find more discussions of this, and also look up "conformability" in the index to the Users Guide :
http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/variables-xpressions/XPRESSIONS#_VPID_90

Ansley

Frederic Cyr wrote:
Hi everyone,

I know this may be a beginner question, but I can't find my answer in the
archives.

I simply want t build a time series of monthly ice extend after computing it
from different files.

This is how I work:

yes? DEFINE AXIS/CALENDAR=360_day/T="15-JAN-1998":"15-DEC-2001":30/UNITS=days
tax
yes? let ai=l[gl=tax]	! new variable

Then I want to open different file, computing the result and put the value into
de "vector" ai. This is in a repeat loop:

yes? SET DATA ($fic)
yes? let A=concentration[x=@din, y=@din] ! computing the total extent
yes? let ai = if l eq ii then RESHAPE(A,ai) else ai  !here I want to put the
value of "A" in "ai" at the indice "ii"

Of course I get an error because of the recursive definition of ai...but I dont
kno how I can manage to get rid of it!

Thank you very Much
Fred






[Thread Prev][Thread Next][Index]

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

Privacy Policy | Disclaimer | Accessibility Statement