[ncl-talk] Image Resizing Issue

Rick Brownrigg brownrig at ucar.edu
Wed Mar 16 15:48:04 MDT 2016


Hi all,

I certainly appreciate Sudipta's participation here, but this would not
work:

wks = gsn_open_wks(wks_type,"test")
  wks at wkWidth = 2500
  wks at wkHeight = 2500

For various esoteric reasons, the resources have to specified at the time
the workstation is created, and the correct form is (oddly enough), what
Kerwyn originally had:

wks_type = "png"
wks_type at wkWidth = 2500
wks_type at wkHeight = 2500
wks = gsn_open_wks(wks_type, "test")

However, the error messages being reported do not make sense in this
context, and I agree with Sudipta that there must be something else going
on on the script, and perhaps the whole thing could be posted.

Here's a simple script from our examples that demonstrates this:

begin

  a = addfile("$NCARG_ROOT/lib/ncarg/data/cdf/uv300.nc","r")

  u = a->U(0,:,:)


  wks_type = "png"

  wks_type at wkWidth = 2500

  wks_type at wkHeight = 2500

  wks = gsn_open_wks(wks_type,"gsn_xy")

  ;;These do not work; uncomment and comment out the wks_type@ versions
above to demonstrate

  ;wks at wkWidth = 2500

  ;wks at wkHeight = 2500


  res                        = True                        ; plot mods
desired

  res at tiYAxisString          = u at long_name + " "+u at units   ; add units to
title

  res at tiMainString          = "Example of gsn_y"      ; title

  plot=gsn_y(wks,u(:,30),res)


end

Hope this helps...
Rick

On Wed, Mar 16, 2016 at 3:17 PM, sudipta sarkar <sdptsarkar2 at gmail.com>
wrote:

> I am sure you are doing something else wrong in the rest of the code.
> Please post the rest of the code. I just tried this and it works fine. Also
> what version of ncl are you using.
>
>
> On Wed, Mar 16, 2016 at 5:12 PM, Kerwyn Texeira <ktish86 at gmail.com> wrote:
>
>> Sorry again, but when I did exactly that, the same error showed up.  I
>> attached the figure for you to see how small it is.
>>
>> Script;
>>
>> wks_type = "png"
>>   wks = gsn_open_wks(wks_type,"test")
>>   wks at wkWidth = 2500
>>   wks at wkHeight = 2500
>>
>>
>> Error again;
>> warning:wkImageFileName is not a resource in the given object
>> warning:wkImageFormat is not a resource in the given object
>>
>> **Kerwyn
>>
>>
>>
>> On Wed, Mar 16, 2016 at 2:00 PM, sudipta sarkar <sdptsarkar2 at gmail.com>
>> wrote:
>>
>>> See my other email that I sent to the general list. when you do:
>>> wks_type = "png"
>>> then the variable "wks_type" is just a string variable.
>>> Its the variable "wks"  which is initiated as:
>>> wks = gsn_open_wks(wks_type,"test")
>>> that is the resource variable whose width and height can be set,
>>>
>>> Hope its clear now.
>>>
>>>
>>> On Wed, Mar 16, 2016 at 4:56 PM, Kerwyn Texeira <ktish86 at gmail.com>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> I don't thiking that I understand clearly.  When I state wks = True or
>>>> wks = "png" and did as you stated wks.wkWidth = 250 and wks.wkHeight =
>>>> 2500, I got the following errors again;
>>>>
>>>> warning:wkImageFileName is not a resource in the given object
>>>> warning:wkImageFormat is not a resource in the given object
>>>>
>>>> **Kerwyn
>>>>
>>>> On Wed, Mar 16, 2016 at 1:43 PM, sudipta sarkar <sdptsarkar2 at gmail.com>
>>>> wrote:
>>>>
>>>>> You have to first initialize wks as you have done and then do the
>>>>> following:
>>>>> Like wks.wkWidth = 2500
>>>>> Wks.wkHeight =2500
>>>>>
>>>>> On Wednesday, March 16, 2016, Kerwyn Texeira <ktish86 at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I did the following and I got the same error;
>>>>>>
>>>>>> wkWidth = 2500
>>>>>> wkHeight = 2500
>>>>>>
>>>>>> wks = gsn_open_wks("png", "test")
>>>>>>
>>>>>> Error:warning:wkImageFileName is not a resource in the given object
>>>>>> warning:wkImageFormat is not a resource in the given object
>>>>>>
>>>>>>
>>>>>> I'm not sure what is going on.
>>>>>>
>>>>>> **Kerwyn
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Wed, Mar 16, 2016 at 1:28 PM, Sudipta Sarkar <
>>>>>> sdptsarkar2 at gmail.com> wrote:
>>>>>>
>>>>>>> Hi Kerwyn
>>>>>>> "Wks_type" is just a string. You have to resize using the variable
>>>>>>> "wks". That's the one that is the resource variable
>>>>>>>
>>>>>>> Sent from my iPhone
>>>>>>>
>>>>>>> > On Mar 16, 2016, at 4:25 PM, Kerwyn Texeira <ktish86 at gmail.com>
>>>>>>> wrote:
>>>>>>> >
>>>>>>> > Hi nc-talk,
>>>>>>> >
>>>>>>> > I trying to resize my figures in "png" format but I'm having
>>>>>>> issues.  The size of the images are not changing.
>>>>>>> >
>>>>>>> > Script:
>>>>>>> >
>>>>>>> > wks_type = "png"
>>>>>>> > wks_type at wkWidth = 2500
>>>>>>> > wks_type at wkHeight = 2500
>>>>>>> > wks = gsn_open_wks(wks_type, "test")
>>>>>>> >
>>>>>>> > Error: warning:wkImageFileName is not a resource in the given
>>>>>>> object
>>>>>>> >          warning:wkImageFormat is not a resource in the given
>>>>>>> object
>>>>>>> >
>>>>>>> > Does anyone know how I can fix this?
>>>>>>> >
>>>>>>> > Appreciate it much!
>>>>>>> > **Kerwyn
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> > _______________________________________________
>>>>>>> > 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160316/78e394e1/attachment.html 


More information about the ncl-talk mailing list