[Thread Prev][Thread Next][Index]

Re: PPL CLSPLT Was: Re: [ferret_users] Puzzling metafile error with Fprint

Hi Glenn and all,

If you run Ferret with SET MODE META, make one plot, and then close Ferret, then the metafile is properly closed. Issuing PPL CLSPLT closes a plot file and starts a new one, so that you can make further plots. I'm not aware that PPL CLSPLT is needed if you're just going to exit Ferret -- if anybody has a counter-example, I would like to see it, as that would really be a bug. Now, the Ferret executable we have available for the Mac is older and perhaps there is some different behavior with it. We're working on a new Ferret build on the Mac, and this is something we'll certainly test when we get that running!

But in general, if you make one plot, and give PPL CLSPLT and/or CANCEL MODE META commands before exiting Ferret, and compare the metafile.plt file with a file created by just exiting Ferret, you'll see that there will be a couple of extra lines near the end of the metafile.plt file, which are

 81     6    61
 82     0

Metafiles contain codes (the first column) with arguments (later columns).The codes indicate calls to colors, line types, and other graphics primitive calls. In the translating program gksm2ps, which Fprint runs, the codes 81 and 82 are NOT used.

If you SET MODE META, and run a script to draw a plot, and then exit Ferret with control-c or by killing the process, then you will have an incomplete metafile, and plot elements may be missing.


Glenn Carver wrote:
On 26 Feb 2009, at 1:19am, William S. Kessler wrote:

No, PPL CLSPLT is NOT the same as CAN MODE META.

Once MODE META is set, it remains in force, writing all plot commands to metafiles.

PPL CLSPLT closes a particular metafile. With MODE META remaining set, additional plotting will write to subsequent metafiles (with filenames metafile.plt.~1~, etc).

CAN MODE META turns off the writing to metafiles, but each individual metafile must still be closed with PPL CLSPLT to be complete. Sometimes the metafiles will be valid anyway, but you may notice the final bits of the plot missing from the output of Fprint. Other times, an error such as you report will result.

This was news to me. I have always understood that you only need to use PPLT CLSPLT when you want to invoke gksm2ps on a metafile whilst ferret is still running and you want to keep producing metafiles. The documentation says just this. I'm slightly alarmed now that there is a possibility for missing output and this isn't mentioned in the documentation on the use of MODE META. I've not noticed but then neither have I been expecting ferret to do this.

So what happens in the case that I SET MODE META, produce a metafile, then quit ferret without CAN MODE META or PPLT CLSPLT? (which I suspect Paul might be doing too).

I have always use SET MODE META, write plot, CAN MODE META sequences to write multiple files during a ferret session, assuming that CAN MODE META did the same thing as PPL CLSPLT. But you seem to be saying this isn't the case?

Since CAN MODE META would imply (to me at least) that all writing to metafiles has finished surely CAN MODE META should do PPL CLSPLT? I'd be interested to know what reasons there might be for not doing so!

  Thanks,   Glenn

By the way, on Macs, BOTH commands must be given after a plot, otherwise Ferret crashes. Subsequent plots must be restarted with SET MODE META again.

Billy K

On Feb 25, 2009, at 5:07 PM, Paul Young wrote:

Apologies, forgot to add those lines in my example script (I guess PPL CLSPLT is the same as CAN MODE META) - I had indeed used those.

...So, my original error still stands. Further info -

A suggestion that someone emailed was to use a different symbol (e.g. plot/vs/sym=2). This produces a viable postscript, but then I can't get the effect I want. My script has worked fine with the standard map before (i.e. fill my_var), so I guess it's something going on with the fact that I am using map projections....?

I have also tried using mp_line.jnl:

let lon = x[gx=my_var1[d=1]] + 0*y[gy=my_var1[d=1]]
let lat = 0*x[gx=my_var1[d=1]] + y[gy=my_var1[d=1]]
let maskx = lon*signif
let masky = lat*signif
go mp_line plot/vs/over/sym=dot/nolab xsequence(maskx) ysequence(masky)

but this didn't work either (memory failure, but I think the above must be wrong).


On Feb 25, 2009, at 5:41 PM, William S. Kessler wrote:

You need to start the metafile with SET MODE META before making the plot, and then close the metafile with PPL CLSPLT after finishing your plot. BK

On Feb 25, 2009, at 2:59 PM, Paul Young wrote:

Hi all,

I'm having a problem generating a postscript file using Fprint. I get the following error:

GKSM item 12121226 is undefined
ggetgksm()  163 Metafile item is invalid
greadgksm()  162 No item is left in GKS Metafile input

which I have not had any luck finding on these forums or via google.

Essentially, the problem seems to be related to my "shading" certain areas of a fill/ plot with plot/vs. Here's a sketch of what I am doing:

use my_data1.nc     !Time series of (e.g.) winter averages
use my_data2.nc

let variance1 = my_var1[d=1,t=@var]  !Standard deviation calculation
let sd1 = variance1^0.5

let delta = my_var2[d=2,t=@ave] - my_var1[d=1,t=@ave]
let signif = if abs(delta) gt sd1 then 1 else 0

set region/x=0:360/y=-90:-20              !Define SH region

set grid delta
go mp_stereographic_south 0 -40
fill/noaxes/nolab/lev=(-80)(-40,40,10)(80)/y=-90:-20/set delta, x_page, y_page
ppl title "1981to1986 - 1979to1980: Dec-May Avg"
ppl fill
go mp_land

plot/vs/over/sym=dot/nolab  x_page*signif, y_page*signif

Removing the plot/vs removes the error, so I guess this is where things are going awry.

Btw, I tried using the polymark.jnl script to shade the data, but it just shaded a ring around the south pole - don't think I've got the command quite right:

go polymark poly/pal=black/over xsequence(x_page), xsequence(y_page), xsequence(signif), circle, 0.2

As usual, thanks for any help,


Paul Young

Chemistry and Climate Processes
Chemical Sciences Division
NOAA Earth System Research Laboratory
325 Broadway R/CSD8
Boulder CO 80305-3328

Tel:   +1 303-497-4711
Fax:   +1 303-497-5686
Email: paul.j.young@xxxxxxxx
Web:   http://www.esrl.noaa.gov/csd/

[Thread Prev][Thread Next][Index]

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

Privacy Policy | Disclaimer | Accessibility Statement