[Thread Prev][Thread Next][Index]

Re: Re: [ferret_users] Embed Ferret in Fortran program



It is probably easier using shell scripting if the only thing you want to do is to loop over a few time steps:

#!/bin/bash

for istep in {1..5}; do
ferret -nojnl -script plot $istep
done

It, however, cannot keep you in the same plotting window because each time you start a new ferret session. Alternatively you can use REPEAT command in a single session to overlay multiple plots on one window/viewport.

D.

On Nov 19, 2008 1:29pm, Ansley Manke <ansley.b.manke@xxxxxxxx> wrote:
> Hi -
>
> You can pass arguments to Ferret when you're running it with -script, for instance,
>
>
>
>   ferret -nojnl -script plot.jnl 5
>
>
>
> Then plot.jnl needs to get that argument, and use it in the commands. In the script, argument 1 is $1, as follows,
>
>
>
>
>
>   !----Begin plot.jnl------------------------------------
>
>     use "coads_climatology"
>
>     fill/k=1/l=$1 sst
>
>
>
> When running Ferret from your fortran program, this might require writing the ferret call to a string variable, so that you can write the value of istep to that string. I have not tested this but there must be a way to send that string into the CALL SYSTEM command.
>
>
>
>
>
> Ansley
>
>
>
>
>
> Haoguo Hu wrote:
>
>
> Dear Ferret-eers,
>
>
>
> I try to embed Ferret in Fortran program when debugging, here is an example:
>
>
>
> !----Begin Fortran program----------------------------
>
>        program main  !Fortran call Ferret
>
>    integer istep
>
>           do istep = 1,5
>
>         !----------
>
>             call system("ferret -nojnl -script plot.jnl")
>
>           enddo
>
>        end
>
> !----End Fortran program-------------------------------
>
>
>
>
>
> plot.jnl
>
> !----Begin plot.jnl------------------------------------
>
>  use "coads_climatology"
>
>  fill/k=1/l=1 sst
>
>  spawn sleep 10s  !pause for viewing and changing the L=2,3,..
>
> !----End plot.jnl--------------------------------------
>
>
>
> I can change the "L=1,2,3,.." in plot.jnl manually.
>
> The questions are:
>
> 1. How to make "L=istep" happen automatically?
>
> 2. How to let the Ferret window open only once and the plotting keep going with "istep"?
>
>
>
>
>
> Thanks
>
>
>
>
>
> HH
>
>
[Thread Prev][Thread Next][Index]

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

Privacy Policy | Disclaimer | Accessibility Statement