Re: Output PNGs in different sizes

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Mon Jun 18 2012 - 14:04:25 MDT

wkWidth and wkHeight have always been documented as RCG in the HLU documents (meaning settable from a resource file, or during creation, and gettable) but the S is missing, which means that the documented behavior is that these resources cannot be changed after the workstation is open. Whether this is actually necessary with the new Cairo-based workstation, I don't know. We can certainly look into this and it may be possible to remove the restriction.
 -dave

On Jun 18, 2012, at 12:52 PM, Mary Haley wrote:

> Hi Jonas,
>
> I'm not sure if this is a bug or the correct behavior, but you can't change the size of the PNG output after you've already created it with gsn_open_wks.
>
> In other words, using "setvalues" to change the size will never work.
>
> I'll file a ticket on this just in case.
>
> Meanwhile, if you want to get different sizes, you will need to open up a new PNG file with a new call to gsn_open_wks and a different file name.
>
> I've attached a small example.
>
> --Mary
> <png_example.ncl>
> On Jun 18, 2012, at 10:17 AM, Jonas Kaufmann wrote:
>
>> Hello,
>>
>> I am trying to generate PNGs in different sizes from GRIB weather
>> data. The map should always show the same area, but the output PNG
>> files should have different sizes. I know that I can call the output
>> function (like gsn_csm_vector_scalar_map) in a loop, but I am looking
>> to get a better performance than this approach.
>>
>> In the "Animation" examples, I see that I can set some variables
>> afterwards and then simply call draw and frame for the next animation
>> step. However it seems that these options are not available for
>> wkWidth and wkHeight.
>>
>> Here are some snippets of my script:
>>
>> wks_type = "png"
>> wks_type@wkWidth = 256
>> wks_type@wkHeight = 256
>> wks = gsn_open_wks(wks_type,outfile)
>> [...]
>> ;;; first image: 256x256px
>> plot = gsn_csm_vector_scalar_map(wks, wind_u, wind_v, wind_speed, res1)
>> draw(plot)
>> frame(wks)
>>
>> ;;; second image: 512x512px
>> setvalues wks
>> "wkHeight" : 512
>> "wkWidth" : 512
>> end setvalues
>> draw(plot)
>> frame(wks)
>>
>>
>> I get images in my outfile name with "000001", "000002" etc. appended,
>> but they are always the same size, the one that I originally set. Is
>> there a way to change the PNG output size with setvalues? Or is there
>> another way to achieve a better performance for my task than simply
>> calling the gsn_csm_vector_scalar_map method in a loop?
>>
>>
>> Thank you for your help!
>>
>> Best regards
>>
>> Jonas
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jun 18 14:04:33 2012

This archive was generated by hypermail 2.1.8 : Mon Jun 25 2012 - 09:57:23 MDT