[Thread Prev][Thread Next][Index]
Re: [ferret_users] defining a variable in a loop
Hi Angélique,
Please remember that Ferret alwyas works on the complete
arrays,
more so with the definition of new variables. With "LET" command, you cannot
specify array indices. Hence a C/fortran style procedure will not work with
Ferret. To do the data extraction in your case, i think the SAMPLEXY external
function is the best solution. Please find the details about SAMPLEXY function
in User Manual, Ch3 Sec2.3.34. (SAMPLEIJ is described in Ch3 Sec2.3.32).
Assuming pt_lon/pt_lat in d=1 is a one dimentioal array along X-axis, the
exact
answer to what you asked is as follows:
let ipts = pt_lon[d=2,i=1:47]
let jpts = pt_lat[d=2,i=1:47]
let T_model = SAMPLEIJ(votemper[d=1,l=8], ipts, jpts)
let S_model = SAMPLEIJ(vosaline[d=1,l=8], ipts, jpts)
Now, assume that the pt_lon/pt_lat in d=2 corresponds to lon and lat of some
observation and votemper/vosaline in d=1 corresponds to some gridded model or
observational fields. In this case, you have to specify X and Y while
defining
the new variable, instead of I and J. The proper method is as follows:
let xpts = pt_lon[d=2,i=1:47]
let ypts = pt_lat[d=2,i=1:47]
let T_model = SAMPLEXY(votemper[d=1,l=8], xpts, ypts)
let S_model = SAMPLEXY(vosaline[d=1,l=8], xpts, ypts)
Please let me know, if you have any questions.
Jaison Kurian
On Tue, 06 Nov 2007 11:01:55 +0100 (CET), melet wrote
> Hi everybody,
>
> I would like to define a variable according a direction in a loop,
> but I can't manage to do that.
>
> I do :
>
> repeat/range=1:47/name=jj \
> (let i_pt=pt_lon[d=2,i=`jj`]; \
> let j_pt=pt_lat[d=2,i=`jj`]; \
> let T_model=votemper[d=1,i=`i_pt`,j=`j_pt`,l=8]; \
> let S_model=vosaline[d=1,i=`i_pt`,j=`j_pt`,l=8])
>
> Of course, my variables "S_model" and "T_model" are overwritten at each
> step, whereas I would like those variables to be defined in the
> i-direction with i being increased in the loop.
>
> I would like to do :
>
> repeat/range=1:47/name=jj \
> (let i_pt=pt_lon[d=2,i=`jj`]; \
> let j_pt=pt_lat[d=2,i=`jj`]; \
> let/i=`jj` T_model=votemper[d=1,i=`i_pt`,j=`j_pt`,l=8]; \
> let/i=`jj` S_model=vosaline[d=1,i=`i_pt`,j=`j_pt`,l=8])
>
> So that T_model and S_model would have 47 components in the i-direction.
> But that doesn't seem to be allowed. How can I do ?
>
> Thanks,
>
> Angélique Melet
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
--
Centre for Atmospheric
and
Oceanic Sciences,
Indian Institute of Science
Bangalore-560 012
India
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce /
NOAA /
OAR /
PMEL /
TMAP
Privacy Policy | Disclaimer | Accessibility Statement