[Thread Prev][Thread Next][Index]

Re: passing numbers to go scripts (probably dumb syntax question)

> I would like to do something like
> yes? repeat/k=1:14 go runmask k
> and in runmask have something like
> yes? let temp = mask[k=k]
> yes? let maskflux = temp * flux
> ...
> where flux and mask have the same lat-lon grid and flux is also a
> function of time
> this is to produce integrals over  defined but irregular regions
> stored in mask, mask is defined as multi-level and we loop over
> levels.  
> the mask[k=k] seems to cause a problem like
>  **ERROR: command syntax: K
> while just
> yes? go runmask 1
> causes no problem.
> This suggests I'm misunderstanding how to pass a number rather than  a
> string through to a go script or at least that's what it sounds like..
> Very likely this is a dumb piece of syntax on my part but I confess
> I'm not seeing it ... any pointers gratefully received.
> Peter Rayner

You need to evaluate the expression "K" as arguments are passed as strings
in ferret. The way to do this in this case is to use backward quotes

yes? repeat/k=1:14 go runmask `k`

should do the trick. See chapter 3.3 on embedded expressions.

Russ Fiedler


[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement