[Thread Prev][Thread Next][Index]
Re: how to assign (spawn) arguments in batch
Hi Hector Manzo,
From the error messages, it seems that the problem is with
the syntax. In your case, at a time 'cont' will have only one value. Let it
be 300..like
[user@machine]$ echo 300 > cont
In ferret..
yes? let lo = "`{spawn:"more cont"}`" ! note the change in syntax
yes? define axis/t=`lo`:`lo`:1 tiempo ! note the change in syntax
yes? list t[gt=tiempo]
VARIABLE : T
axis TIEMPO
T : 300
300.0
Regarding grave accents :
Ferret supports numerical expressions that may be embedded anywhere
within a command line. These expressions are evaluated immediately by
Ferret-before the command itself is parsed and executed. Immediate
mode expressions are enclosed in grave accents.
For more details refer user manual :
Ch3 Sec3. EMBEDDED EXPRESSIONS
Ch7 Sec5. USE WITH EMBEDDED EXPRESSIONS
Ch1 Sec4. COMMAND SYNTAX
Andrew Wittenberg detailed the usage of "spawn" in one of his earlier
mail :
http://ferret.pmel.noaa.gov/Ferret/Mail_Archives/fu_2003/msg01166.html
You can also use linux commads like "head", "tail" or "cat" instead of
"more".
Hope this helps
With Regards
Jaison
On 10 Jun 2004, Hector
Manzo wrote:
> Hi!
> I am trying to do some loop with shell scripting and passing arguments!
> to ferret by means of a counter. The intention is to vary time axis and
> create a XYT cdf file from xy individual files. Following my scripts:
> ====================0===============
> #!/bin/sh
> for (( i = $1; i <= $2; i++ ))
> do
> .
> .
> "some stuff"
> .
> .
> grd2xyz sst.grd -R210/285/-5/33 -ZBLa -V > salida
> awk '{if ($1 == "NaN") print -999; else print $1}' salida > dato
> echo $i > cont
>
> ferret << eof
> let lo = '{spawn:"more cont"}'
> list lo
> go junta.jnl
> eof
> done
> exit
> =============0=========
> !ferret answers with errors!
> ==============0===========
> NOAA/PMEL TMAP
> FERRET v5.60
> Linux(g77) 2.4.20 - 04/08/04
> 9-Jun-04 15:50
>
> yes? let lo = '{spawn:"more cont"}'
> ls: FER_DIR/ext_func/libs/: No such file or directory
> yes? list lo
> **ERROR: variable unknown or not in data set: '{spawn:"more cont"}'
> yes? go junta.jnl
> use sst_2004.cdf
> define axis/x=210:284.95:0.05 lon
> Replacing definition of axis LON
> *** NOTE: grid used by data set sst_2004
> *** NOTE: Redefinition may alter apparent contents of data set
> define axis/y=-5:32.95:0.05 lat
> define axis/t=lo:lo:1 tiempo
> **ERROR: command syntax: lo
> define axis/t=lo:lo:1 tiempo
> Command file, command group, or REPEAT execution aborted
> yes?
>
>
> ===============0=================
> junta.jnl contains:
>
> use sst_2004.cdf
> define axis/x=210:284.95:0.05 lon
> define axis/y=-5:32.95:0.05 lat
> define axis/t=lo:lo:1 tiempo
> define grid/X=lon/Y=lat/T=tiempo rejilla
> file/var=sst/grid=rejilla dato
> save/append/file=sst_2004.cdf sst
> cancel data dato
> exit
>
> ==================0=====================
>
>
> ext_func.libs error message seems not to be fatal, I have done ok work
> with this
> message.
>
> I appreciate your help
>
> Hector Manzo
>
>
>
>
>
>
>
--
___________________________________________________
Jaison Kurian
Centre for Atmospheric and Oceanic Sciences
Indian Institute of Science
B A N G A L O R E 560 012
Ph: +91-80-3942505
+91-80-3600450
Fax:+91-80-3600865
___________________________________________________
[Thread Prev][Thread Next][Index]
Dept of Commerce /
NOAA /
OAR /
PMEL /
TMAP
Contact Us | Privacy Policy | Disclaimer | Accessibility Statement