[ncl-talk] PDF plot to big and rotated in 90 degrees.

Adam Phillips asphilli at ucar.edu
Thu Aug 20 14:01:12 MDT 2015


Hi Sebastián,
What is the error message that you are getting? Also, right before the
system(cmd) line, can you add the following line:
print(cmd)
and report back to ncl-talk with the resulting output..
Thanks..
Adam



On Wed, Aug 19, 2015 at 9:57 PM, Sebastian Otarola-Bustos <
Sebastian.F.Otarola-Bustos.1 at nd.edu> wrote:

> Hi, The other day I tried the improvement, but it didn't work. Here is
> what I did:
>
>  do it=0,N_times-1
>
>          u300w = fall[it]->UGRD_P0_L100_GLL0({levs},::-1,:)
>          v300w = fall[it]->VGRD_P0_L100_GLL0({levs},::-1,:)
>          hgt300= fall[it]->HGT_P0_L100_GLL0({levs(k)},:,:)
>          hgt300 at units  = "m"
>          tmp300 = fall[it]->TMP_P0_L100_GLL0({levs},::-1,:)
>          lat    = fall[it]->lat_0(::-1)
>          T300=tmp300({levs(k)},:,:)
>          T300=T300-273.15
>          U300=u300w({levs(k)},:,:)
>          V300=v300w({levs(k)},:,:)
>          wks_type            = "png"
>          wks_type at wkWidth    = 1700
>          wks_type at wkHeight   = 1700
>
>          wks = gsn_open_wks(wks_type,"animate"+sprinti("%03i",it))
>
>          mpid    = gsn_csm_map(wks,mpres)
>          hnid  =  gsn_csm_contour(wks,hgt300(:,:),hres)
>          T_300  = gsn_csm_contour(wks,T300,Tres)
>          V_300   =gsn_csm_vector(wks,U300,V300,Vres)
>
>          ;Overlaps maps in order
>          overlay(mpid,hnid)
>          overlay(mpid,T_300)
>          overlay(mpid,V_300)
>
>          maximize_output(wks,True)
>         ;el comando maximize_output hace lo que hacia frame
>          delete(wks)
>          cmd="convert -trim "+ "animate"+sprinti("%03i",it)+".png"
> "animate"+sprinti("%03i",it)+".png"
>        system(cmd)
>  end do
>
>
> It's throwing me error when I tried to use the convert command. I was able
> to use it without problems for one file, but not yet inside a loop.
>
>
> Any help would be really helpful,
>
> All the best,
> Sebastián.
>
>
> On Sat, Aug 8, 2015 at 11:43 AM, Adam Phillips <asphilli at ucar.edu> wrote:
>
>> Hi Sebastián,
>> You need to delete the workstation before you call convert otherwise you
>> will get an error message:
>>
>> do it=0,1
>>     wks = gsn_open_wks(wks_type,"animate"+sprinti("%03i",it))
>> ..........
>>     plot = ..........
>>     delete(wks)
>>     system("convert -trim"animate"+sprinti("%03i",it)+".png"
>> "animate"+sprinti("%03i",it)+".png")
>> end do
>>
>> Hope that helps.. If not let ncl-talk know.
>> Adam
>>
>> On Aug 8, 2015, at 6:58 AM, Sebastian Otarola-Bustos <
>> Sebastian.F.Otarola-Bustos.1 at nd.edu> wrote:
>>
>> Thank you very much, that was really helpful! I think that my trouble is
>> solved. By the way, and only for curiosity, you know if you can use the
>> trim option inside a loop, to get a gif with all images without those blank
>> spaces. Cause I tried  something like this inside a loop, but it didn't
>> work:
>>
>>  wks = gsn_open_wks(wks_type,"animate"+sprinti("%03i",it))
>>
>>  system("convert -trim"animate"+sprinti("%03i",it)+".png"
>> "animate"+sprinti("%03i",it)+".png")
>>
>>
>> All the best,
>>
>> Thank you a lot.
>>
>>
>>
>> On Thu, Aug 6, 2015 at 2:42 PM, Mary Haley <haley at ucar.edu> wrote:
>>
>>> I didn't notice this before, but you can't use the wkWidth and wkHeight
>>> resources with PS or PDF.  These width and height are for pixel sizes,
>>> which apply to the X11 and PNG workstations only.
>>>
>>> If you want an image to be a specific pixel size, then you need to use
>>> "PNG" as the output. With PNG as the output, the image will not be rotated
>>> automatically, so you don't need to set gsnPaperOrientation.
>>>
>>> However, NCL always draws its images to a square, so your image is going
>>> to be the smaller of the two sizes you specified: 1536 x 1536.
>>>
>>> My suggestion is to set the size to 1700 x 1700, and then use
>>> ImageMagick <http://www.imagemagick.org/script/index.php>'s "convert"
>>> to trim the image.
>>>
>>> I've attached a sample script.
>>>
>>> --Mary
>>>
>>>
>>>
>>> On Wed, Aug 5, 2015 at 1:46 PM, Sebastian Otarola-Bustos <
>>> Sebastian.F.Otarola-Bustos.1 at nd.edu> wrote:
>>>
>>>> Hi,
>>>>
>>>> Thank you very much, but it seems that doesn't works. The plot it's too
>>>> big I think.
>>>>
>>>>
>>>> All the best,
>>>> Sebastián.
>>>>
>>>> On Wed, Aug 5, 2015 at 11:19 AM, Mary Haley <haley at ucar.edu> wrote:
>>>>
>>>>> Try setting gsnPaperOrientation with the "mpres" resources and not the
>>>>> workstation resources.
>>>>>
>>>>> I know this doesn't make a lot of sense, but it's when the plot is
>>>>> being created that it needs to know that the paper is oriented one way or
>>>>> another.
>>>>>
>>>>> --Mary
>>>>>
>>>>>
>>>>> On Tue, Aug 4, 2015 at 12:34 AM, Sebastian Otarola-Bustos <
>>>>> Sebastian.F.Otarola-Bustos.1 at nd.edu> wrote:
>>>>>
>>>>>> Hi All, I was doing a gif animation in .png format, and I was able to
>>>>>> set the width and the height, so my plots were ok. But now I'm trying to do
>>>>>> the same with .ps format or .pdf, and I'm having some troubles. It's
>>>>>> rotated, and the command, wks_type at gsnPaperOrientation  = "portrait"
>>>>>>  is not recognized. Any suggestion?
>>>>>> Any help would be really appreciated, below  you can see what I
>>>>>> mentioned to you from my code.
>>>>>>
>>>>>>  wks_type            = "ps"
>>>>>>         ;wks_type at wkWidth    = 1700
>>>>>>         ;wks_type at wkHeight   = 1536
>>>>>>          wks_type at gsnPaperOrientation  = "portrait"
>>>>>>
>>>>>>          wks = gsn_open_wks(wks_type,"animate"+sprinti("%03i",it))
>>>>>>
>>>>>>          mpid    = gsn_csm_map(wks,mpres)
>>>>>>          hnid  =  gsn_csm_contour(wks,hgt300(:,:),hres)
>>>>>>          T_300  = gsn_csm_contour(wks,T300,Tres)
>>>>>>          V_300   =gsn_csm_vector(wks,U300,V300,Vres)
>>>>>>
>>>>>>          ;Overlaps maps in order
>>>>>>          overlay(mpid,hnid)
>>>>>>          overlay(mpid,T_300)
>>>>>>
>>>>>> All the best,
>>>>>> Sebastián.
>>>>>>
>>>>>> _______________________________________________
>>>>>> ncl-talk mailing list
>>>>>> ncl-talk at ucar.edu
>>>>>> List instructions, subscriber options, unsubscribe:
>>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>


-- 
Adam Phillips
Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/   303-497-1726

<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150820/2f0495b4/attachment.html 


More information about the ncl-talk mailing list