Hello, Ferrer-eers,
Thanks you all for the reply. I got a solution on Glen Carver's idea,
that is, let Fortran write the script first, and then call Ferret.
I'm running s sea ice ocean coupled model and I want to check the
model result of the first a few steps. Here is the solution:
!-------Begin Fortran Program-----------------------
Program main !Ice Ocean model
include 'iceocean.h'
call model_initial()
do istep = 1, iend
call pom() !Princeton Ocean Model
call Ice() !Sea Ice Model
call output( result_iceocean.nc )
open(10,file='plot.jnl') !Call Ferre plotting
write (10,*) 'use "result_iceocean.nc"'
write (10,*) 'fill/k=1/l=',istep, 'etw' !surface elevation
write (10,*) 'vector/over/l=', istep, 'ua,va' !velocity
write (10,*) 'spawn sleep 2s' !Pause for viewing
close(10) !End call Ferre plotting
call system("ferret -nojnl -script plot.jnl")
enddo !do istep = 1, iend
end !end Program main !Ice Ocean model
!-------End Fortran Program-----------------------
I do not like the Ferret window keep opening and closing, and it also
waste 2 seconds on sleeping (without sleeping you can see nothing),
but it is something better than nothing.
I'm not sure whether or not there is some way Fortran and Ferret can
know each other, interactive communicating will make the Ferret more
powerful.
Cheers
Haoguo
Glenn Carver wrote:
Hi,
You can't make the ferret window stay open when you try to use ferret
like this. Each call to system() in that loop invokes a separate
command for Ferret. You end up with 5 instances of Ferret running.
You would be better off using the loop to write the journal
instructions and then at the end of the program invoke Ferret (or do
it yourself once the fortran code has finished).
e.g.
program main
integer :: istep
open(10,file='myplot.jnl')
do istep = 1, 5
write (10,*) 'fill/k=1,l=',istep,' sst'
end do
call system('ferret -nojnl -script myplot.jnl')
end program
Hope that helps.
Glenn
On 19 Nov 2008, at 4:41pm, 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