Re: PDF error

From: <brownrig_at_nyahnyahspammersnyahnyah>
Date: Sun Nov 28 2010 - 20:57:45 MST

Hi Mateus,

I think this is expected behavior, and indeed, consistent with any
programming language that employs buffered I/O. Specifically, a
buffer's worth of data is not written to file until i) the buffer is
full, or ii) something causes the file to be closed; typically files
are closed automatically when a program terminates, or closed
programmatically by an explicit close statement/function/command (NCL
does not have a "gsn_wks_close()", but deleting the workstation
variable accomplishes the same thing).

Does that make sense? I'll take a look at the docs on
gsn_wks_open() to see if this can be made more evident.

Nice write-up by the way; it really pointed straight at the issue.

Rick

On Sun, 28 Nov 2010 14:51:55 -0200
  Mateus Teixeira <mateus.teixeira@gmail.com> wrote:
> Dear NCL users,
>
> I'm using an simple example of NCL for plotting a contour map into a
>PDF
> file. The script is below
>
> *load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> begin
> c = addfile("Download/uv300.nc","r")
> u = c->U(1,:,:)
> wks = gsn_open_wks("pdf","campo1")
> plot1 = gsn_csm_contour_map_ce(wks,u,False)
> end
> *
> When I put this script into a file, it works perfectly, generating a
>PDF
> file. But, when using NCL in interactive mode and typing each of
>these
> lines, and not leaving NCL's interactive environment, I can't open
>the PDF
> file.
>
> Using the diff command to see if there are differences between these
>two PDF
> files I saw that the file generated with the script had 45
>additional lines,
> given below
>
> * 1 0 obj
> <<
> /Type /Pages
> /Kids [
> 16 0 R
> ]
> /Count 1
>>>
> endobj
> 18 0 obj
> <<
> /Type /Catalog
> /Pages 1 0 R
>>>
> endobj
> xref
> 0 19
> 0000000000 65535 f
> 0000468705 00000 n
> 0000000015 00000 n
> 0000000072 00000 n
> 0000000147 00000 n
> 0000000227 00000 n
> 0000000310 00000 n
> 0000000397 00000 n
> 0000000474 00000 n
> 0000000550 00000 n
> 0000000628 00000 n
> 0000000710 00000 n
> 0000000783 00000 n
> 0000000861 00000 n
> 0000000942 00000 n
> 0000001027 00000 n
> 0000001099 00000 n
> 0000001594 00000 n
> 0000468775 00000 n
> trailer
> <<
> /Size 19
> /Root 18 0 R
>>>
> startxref
> 468829
> %%EOF*
>
> The PDF file generated from inside NCL's interactive mode only will
>have
> these same lines when I quit NCL or delete the workstation variable.
>
> I would like to know if it is a correct functioning of NCL. If so, I
>would
> like to suggest this information being included in gsn_open_wks
> documentation, once an user may think some script he/she's typing
>inside NCL
> is wrong.
>
>
> Best regards,
>
>
> --
> Mateus da Silva Teixeira
> Registered Linux User #466740 (http://counter.li.org/)

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Nov 28 20:57:51 2010

This archive was generated by hypermail 2.1.8 : Tue Nov 30 2010 - 08:26:08 MST