RE: [ncl-talk] Problem Closing a META/NCGM File

From: Lunde, Bruce N CIV NAVOCEANO, NP1 <bruce.lunde_at_nyahnyahspammersnyahnyah>
Date: Fri, 17 Aug 2007 13:33:07 -0500

Thank you Mary and Dave,

The use of "exit" in my program was causing the problem with my
meta file not being closed properly. I have verified this and
found that the following suggestions do result in the meta file
being closed properly:

* If "exit" is used, insert "delete(wks)" prior to the "exit"
  statement.

* Replace the "exit" statement by "quit" will result in the
  script being stopped and the meta file being closed properly.

Bruce

> -----Original Message-----
> From: Mary Haley [mailto:haley_at_ucar.edu]
> Sent: Friday, August 17, 2007 10:12
> To: Lunde, Bruce N CIV NAVOCEANO, NP1
> Cc: ncl-talk_at_ucar.edu
> Subject: Re: Problem Closing a META/NCGM File
>
>
> Hi Bruce,
>
> It looks like you are doing the right thing, calling "frame(wks)"
> after you finish drawing your plots.
>
> Is the NCL script quitting suddenly for any reason? This might
> cause the NCGM to be corrupt.
>
> If you can send the NCGM to me as an email attachment, we'll take
> a look at it and see what's missing from it.
>
> As a test, can you try calling:
>
> delete(wks)
>
> outside the final do loop? This should cause the NCGM file to get
> closed properly. You shouldn't have to do this normally, but at least
> it might tide you over until we figure out what's going on.
>
> --Mary
>
>
> On Fri, 17 Aug 2007, Lunde, Bruce N CIV NAVOCEANO, NP1 wrote:
>
> >
> > Hello,
> >
> > I am making an NCGM plot file. The plots in the file seem
> to be fine.
> > I am putting two plots on one page, before advancing the frame.
> >
> > However, when I display the multiplot file with "idt", it complains
> > when I get to the end of the file. Thus I cannot loop, or
> go backwards,
> > etc.
> >
> > "idt" says "FATAL - Premature end of metafile".
> >
> > I was hoping for a general idea of what to look for, with regards
> > to closing the meta file properly.
> >
> > Thanks, Bruce
> >
> > ........................................
> >
> > The output messages in the IDT window are:
> > Messages upon loading file:
> > Display(0): Can't find any spooled devices for printing
> > Display(0): 10
> >
> > Message when getting to the last frame in file (or trying to
> > go beyond it, back to the beginning):
> > Display(0): Error - ictrans: FATAL - Premature end of metafile
> >
> > ........................................
> >
> > My basic code is outlined below. I can rework it later to be
> > functional without my data, but I was hoping maybe there is
> > something obvious you can point me to:
> >
> >
> > load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> > load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> > load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" ;..
> > flt2string()
> >
> > plot_type = "ncgm"
> > plot_prefix = "PLOT_OBS"
> >
> > begin
> > ...
> > ...
> >
> > do d = 1,1
> > ...
> > ...
> >
> > if( tmp .gt. 0 )then
> > ...
> > ...
> >
> ;-------------------------------------------------------------
> ----------
> > --------
> > ;-- START OF PLOTTING
> > ----------------------------------------------------------
> >
> ;-------------------------------------------------------------
> ----------
> > --------
> >
> > ;-- Open figure.
> >
> > wks = gsn_open_wks(plot_type,plot_prefix)
> >
> > ;-- Loop over profiles.
> >
> > do l = 1,numiprf
> > ...
> > ...
> > res = True
> > res_at_gsnFrame = False
> >
> > ;-- Create main plot at bottom of view area.
> >
> > res_at_vpHeightF = 0.5 ; Default = 0.6
> > res_at_vpYF = 0.6 ; Default = 0.8
> >
> > res_at_xyLineThicknesses = (/2.0,2.0,2.0,2.0,2.0,2.0/)
> > res_at_xyLineColors =
> (/"red","blue","cyan","black","gray","gray"/)
> > res_at_xyDashPattern = 0 ; Make curves all solid
> > res_at_xyMarkLineMode = "Lines" ; Markers *and* lines
> > res_at_trYReverse = True
> >
> > data = new( (/6,dimsizes(z)/), float )
> > data(0,:) = a ; anl
> > data(1,:) = b ; bkg
> > data(2,:) = c ; clm
> *********************************
> > data(3,:) = o ; val == observation *** ADD MARKERS LATER
> TO THIS ***
> > data(4,:) = b-e ;
> *********************************
> > data(5,:) = b+e
> >
> > plot = gsn_csm_xy (wks,data,z,res) ; create plot
> >
> > ...
> > ...
> >
> > ;-- Create second plot at top of view area.
> >
> > res_at_tiMainString = title
> > res_at_trXMinF = 20.0
> > res_at_trXMaxF = 35.0
> > res_at_trYMinF = 0.0
> > res_at_trYMaxF = 150.0
> > res_at_vpHeightF = 0.2 ; Default = 0.6
> > res_at_vpYF = 0.9 ; Default = 0.8
> >
> > plot = gsn_csm_xy (wks,data,z,res) ; create plot
> >
> > frame(wks)
> >
> > ;-- Prepare variables for next data plot (dimensions may be
> different).
> >
> > delete(res)
> >
> > delete(z)
> > delete(o)
> > delete(b)
> > delete(c)
> > delete(a)
> > delete(e)
> > delete(data)
> > delete(data2plot)
> >
> > end do ; END do l = 1,numiprf
> > end if ; END if( tmp .gt. 0 )then
> > end do ; END do d = 1,8
> >
> > end
> > ...
> > ...
> > exit
> >
> > =====
> > Bruce Lunde
> > Bruce.Lunde_at_navy.mil
> > 228-688-5843
> > Code NP1
> > Naval Oceanographic Office
> > Stennis Space Center, MS
> > =====
> > _______________________________________________
> > ncl-talk mailing list
> > ncl-talk_at_ucar.edu
> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> >
>
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Aug 17 2007 - 12:33:07 MDT

This archive was generated by hypermail 2.2.0 : Mon Aug 20 2007 - 09:30:37 MDT