[Thread Prev][Thread Next][Index]

Re: Go scripts with arbtrary levels



On Wed, 18 Apr 2001, Jordan Dawe wrote:

> I am trying to write a go script that can process datafiles with a
> arbitrary number of levels.  More specifically, I want to be able to issue
> a command like:
> 
> repeat/k=1:n (...)
> 
> Where 'n' is a variable that is calculated in the script.  Is there any
> straightforward way to do this?

Hi Jordan,

You can use the RETURN= specifier to get the size of an axis, and then use
backquotes (``) to evaluate a variable as an argument of the REPEAT
command.  For example, if your variable of interest is called "v":

LET n = `v,RETURN=ksize`
REPEAT/k=1:`n` (...)

or more concisely,

rep/k=1:`v,r=ksize` (...)

Cheers,

Andrew

----------------------------------------------------------------------
Andrew Wittenberg          Program in Atmospheric and Oceanic Sciences
andyw@splash.princeton.edu                        Princeton University
----------------------------------------------------------------------



[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement