Re: eps files

From: Mateus da Silva Teixeira <mtex2k3_at_nyahnyahspammersnyahnyah>
Date: Wed, 04 Apr 2007 08:51:33 -0300

Fred,

I have attached the EPS file and the script the generate it. The
graphical portion of the script is very simple, as you may see.
Also, I have used the tool 'eps2eps' to convert the EPS file from NCL to
another EPS file and compared both files. See below the differences in
the headers:

EPS file from NCL (boxplotGrupos.eps) :
%!PS-Adobe-2.0 EPSF-2.0
%%Creator: NCAR GKS
%%CreationDate: Sep 17 2006 15:49:43
%%BoundingBox: (atend)
%%DocumentFonts: (atend)
%%EndComments
%%BeginProlog

EPS file converted with 'eps2eps' (boxplotGrupos2.eps) :
%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 469 559
%%HiResBoundingBox: 0.000000 0.000000 468.499927 558.499927
%.........................................
%%Creator: GNU Ghostscript 707 (epswrite)
%%CreationDate: 2007/04/04 08:44:07
%%DocumentData: Clean7Bit
%%LanguageLevel: 2
%%EndComments
%%BeginProlog

I'm using NCAR Command Language Version 4.2.0.a034 and eps2png 2.5 in a
machine:
Linux beagle.dea.inpe.br 2.6.17-1.2142_FC4 #1 Tue Jul 11 22:41:14 EDT
2006 i686 athlon i386 GNU/Linux

Mateus

Fred Clare escreveu:
>
> On Apr 3, 2007, at 8:03 PM, Mateus da Silva Teixeira wrote:
>
> Mateus,
>
>> Fred Clare escreveu:
>>>
>>> On Apr 3, 2007, at 7:39 PM, Mateus da Silva Teixeira wrote:
>>>
>>>> Dear NCL users,
>>>>
>>>> The Mini Graphics Manual says that EPS workstation contains a
>>>> bounding box.
>>>> However, when I generate an EPS file and try to convert it to PNG,
>>>> this tool gives an error message:
>>>>
>>>> $ eps2png -png -output teste.png boxplotGrupos.eps
>>>> No bounding box in boxplotGrupos.eps
>>>> -g must be followed by <width>x<height>
>>>> Problem creating teste.png for boxplotGrupos.eps
>>>>
>>>> And any PNG file is created.
>>>> Is the Graphics Manual wrong? Or am I doing something wrong?
>>>
>>> You should be getting a bounding box. Are you using
>>> gsn_open_wks with a first argument of "eps?"
>>
>> Yes, I'm using 'eps' as the first argument of gsn_open_wks!
>
> I just ran an example that uses "eps" and indeed the output
> PostScript contained a bounding box. Could you please send
> me your output file? Also, what version of NCL are you using?
> If your source is fairly simple, it might be helpful for me to have
> that too.
>
> Fred Clare
>
>
>>> Currently the recommended way to do this is to create a
>>> regular .ps file, then use "ps2epsi" to generate the eps
>>> file, and then use "convert" on that.
>>
>> Ok! I also use 'convert' to directly convert the EPS file to PNG.
>> But I wanted to know why eps2png gives this error, since the manual
>> says that there is a bounding box!
>>
>>>
>>> We have an *experimental* png driver that may work for you
>>> (it uses the X11 rasterizer). To give it a try, use "png" as the
>>> first argument to gsn_open_wks. This driver is not currently
>>> supported, so use are your own risk.
>>
>> It would be good having such a driver in the future.
>> I used 'png' as argument for gsn_open_wks now, but the result is bad.
>> The quality of the graphic is poor!
>>
>> Thanks
>> Mateus
>>
>>
>>>
>>> Fred Clare
>>>
>>>
>>>>
>>>> Thanks
>>>> Mateus
>>>>
>>>> _______________________________________________
>>>> 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
>
>

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"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/myscripts/MyFuncs.ncl"

begin
    ; parâmetros p/ análise
    anoi = 1960
    anof = 2004
    nmes = 12
    ndia = 31
    deltaAno = anof-anoi+1
    
    ; arquivos de entrada
    ; estes arquivos devem conter as estações (linhas)
    ; na mesma ordem.
    repo = "sul/"
    arqGrupos = "membros_Sul.txt"
    arqDados = "ncl4cluster_Sul.dat"
    arqEstInfo = "estacoesProntas_Sul.txt"

    ; informações dos arquivos
    dadosDias = numAsciiCol(repo+arqDados)
    dadosEsta = numAsciiRow(repo+arqDados)
    nEstacoes = numAsciiRow(repo+arqEstInfo)
    nEstCols = numAsciiCol(repo+arqEstInfo)

    ; coordenada de tempo
    ; as datas da coordenada indica o número de dias desde
    ; 01 Jan 1960, às 00. O atributo de unidade é especialmente
    ; útil para a obtenção da data em formato mais
    ; 'amigável'.
    time = fspan(0,dadosDias-1,dadosDias)
    time_at_units = "days since "+sprinti("%4i",anoi)+"-01-01 00:00:00"

    ; lendo dados
    grupos = asciiread(repo+arqGrupos,-1,"integer")
    estacoes = asciiread(repo+arqEstInfo,(/nEstacoes,nEstCols/),"float")
    dados = asciiread(repo+arqDados,(/dadosEsta,dadosDias/),"float")
    dados@_FillValue = -999.9

    ; total de grupos
    maxGrupos = max(grupos)
    print("Nro de grupos encontrados: "+maxGrupos)

    seriesGrupos = new((/maxGrupos,dadosDias/),float,-999.9)
    
    ; loop que varre os grupos
    do i=1,maxGrupos
       ; nro de membros do i-ésimo grupo e os respectivos dados
       nroMembros = num(grupos.eq.i)
       idxMembros = ind(grupos.eq.i)
       dadosMembros = dados(idxMembros,:)
       dadosMembros!0 = "estacoes"
       dadosMembros!1 = "time"
       dadosMembros&time = time

       ; média de todas as estações
       seriesGrupos(i-1,:) = dim_avg_Wrap(dadosMembros(time|:,estacoes|:))

       delete(nroMembros) ; necessário pois são recalculados a cada
       delete(idxMembros) ; iteração do loop externo
       delete(dadosMembros) ;
    end do

    seriesGrupos!0 = "grupos"
    seriesGrupos!1 = "time"
    seriesGrupos&grupos = ispan(1,maxGrupos,1)
    seriesGrupos&time = time

    ; preparando informações para o boxplot
    dataBoxPlot = new((/maxGrupos,5/),float)
    dataBoxPlot(:,0) = dim_min(seriesGrupos)
    dataBoxPlot(:,4) = dim_max(seriesGrupos)
    do i=0,maxGrupos-1
       dataBoxPlot(i,1) = quantile(seriesGrupos(i,:),0.25)
       dataBoxPlot(i,2) = quantile(seriesGrupos(i,:),0.5)
       dataBoxPlot(i,3) = quantile(seriesGrupos(i,:),0.75)
    end do
    posX = (/-50.,-25.,0.,25.,50./)

    ; abrindo workstation
    wks = gsn_open_wks("eps",repo+"boxplotGrupos")

    ; recursos gráficos
    analisa = True
    analisa_at_tmXBLabels = (/"Grp 1","Grp 2"," Grp 3","Grp 4","Grp 5"/)
    
    plot = boxplot(wks,posX,dataBoxPlot,False,analisa,False)
    
    draw(plot) ; obrigatórios p/ bloxplot
    frame(wks)
end

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Wed Apr 04 2007 - 05:51:33 MDT

This archive was generated by hypermail 2.2.0 : Wed Apr 11 2007 - 08:36:47 MDT