[R] Calling R from fortran
Mike.Prager at noaa.gov
Wed Jul 13 01:56:39 CEST 2005
An hour's worth of contour plots (12) should be able to be saved in far
less than 1 Gb, depending on the detail desired.
Here is one way to do your task. There are other, and probably better, ones.
At each time step (5 mins), you could have the Fortran program write a
data file and then write and execute a script file. The script file
would call R as a batch process to make a contour graph and save it (as
PNG perhaps), and then the script would delete the data file. You might
want to have the generated script files omit the "delete" step once per
hour, just in case the R step should fail when you are not around to
observe the failure.
I don't know if R can easily read Fortran unformatted (sometimes called
"binary") data, or how. That would speed up the Fortran I/O and
possibly reduce file size. If you go with formatted output, consider
limiting the number of decimal places you write to save disk space. In
most applications, you won't need great precision for simply making
graphs. Also, for writing large amounts of data, test various block
sizes on the Fortran OPEN statement to get best I/O speed.
Another possibility would be to use a Fortran library (like the free or
inexpensive DISLIN) that can make the contour plots directly, without
simon wrote on 7/12/2005 4:02 PM:
>The following may sound stupid so please forgive my stupidness. I have a
>question which I don't know how to name it so I have to start from the
>beginning. In an attempt to gain better understand how a photochemical
>air qaulity model works, I plotted hourly ozone concentration contour
>from the model's standard output to observe the changes in simulation.
>Because the model actually peroform simulation in time steps of 5
>minutes, it will give a better resoultion if I can plot the ozone
>concentration with time resolution close to the model. However, if I
>modify the model to output data at every time step, it will be
>impossible for the computer to store this much information( the hourly
>standard output is close to 1gb). I was wondering if it is possible to
>modify fortran to call R or something, which can just plot a contour at
>every time step rather than put it as data. I am not sure about how to
>call this act. Also, if this is possible, will output of a contour give
>a smaller file size than data?
>Thanks in advance,
Michael H. Prager, Ph.D.
Population Dynamics Team
NOAA Center for Coastal Habitat and Fisheries Research
NMFS Southeast Fisheries Science Center
Beaufort, North Carolina 28516 USA
More information about the R-help