[ncl-talk] copying resources from one set to another --> ?
Barry Lynn
barry.h.lynn at gmail.com
Tue Nov 7 17:56:37 MST 2017
Mary: thank you for clarifying the issue of using := and =. It's a big
help to know this!
Barry
On Wed, Nov 8, 2017 at 1:03 AM, Mary Haley <haley at ucar.edu> wrote:
> Barry,
>
> Since variables are not overwritten unless you do a ":=", you can do this
> kind of thing:
>
> opts_xy = True
> opts_xy at xxxx = ....
> opts_xy at yyyy = ....
> opts_xy at zzzz = ....
>
> opts_rad = opts_xy
> opts_rad = set_res1_list()
>
> and opts_rad will have the resources from both opts_xy and set_res1_list.
>
> Try this program to verify it:
>
> function set_res1_list()
> begin
> res = True
> res at gsnMaximize = True
> res at xyLineColor = "red"
> res at xyLineThicknessF = 2.0
> return(res)
> end
>
> begin
> opts_xy = True
> opts_xy at gsnDraw = False
> opts_xy at gsnFrame = False
>
> opts_rad = opts_xy
> print("==================================================")
> print("First time")
> print(opts_rad)
>
> opts_rad = set_res1_list()
> print("==================================================")
> print("Second time")
> print(opts_rad)
> end
>
>
>
>
>
>
> On Tue, Nov 7, 2017 at 10:32 AM, Barry Lynn <barry.h.lynn at gmail.com>
> wrote:
>
>> Thanks for your suggestion. I will try to explain more clearly.
>>
>> I have:
>>
>> opts_xy = True
>>
>> and various resources.
>>
>> I then have opts_rad = opts_xy
>>
>> and various resources.
>>
>> This works fine.
>>
>>
>> However, I want to use a subroutine of resources (to simplify the code
>> structure) instead of placing resources in the main program.
>>
>> So, in my original code I have:
>>
>> opts_rad = set_res1_list()
>>
>> However, I really want to set opts_rad = opts_xy and then add the
>> resources in res1_list.
>>
>> I don't know how to include the opts_rad = opts_xy with the resources
>> from set_res_list() at the same time.
>>
>> Barry
>>
>>
>> Barry
>>
>>
>>
>>
>>
>>
>>
>> On Tue, Nov 7, 2017 at 7:07 PM, Guido Cioni <guidocioni at gmail.com> wrote:
>>
>>> Barry,
>>> I honestly don't understand the problem.
>>> Why would just copying the resource over not work? :)
>>>
>>> if you set
>>>
>>> res=True
>>> res at ...
>>> res at ....
>>>
>>> and then assign
>>>
>>> res2=res
>>>
>>> res2 will be True and have all the resources that you define for res.
>>>
>>> Am I missing something?
>>>
>>> If you instead want to set "just one resource" why not just assign it
>>> without having to copy the ones that you do not want to use?
>>>
>>>
>>>
>>> On 7. Nov 2017, at 18:04, Barry Lynn <barry.h.lynn at gmail.com> wrote:
>>>
>>> Hi:
>>>
>>> Thank you, but not the attributes, but the resources.
>>>
>>> I have "subroutines" that define resources for a variable.
>>>
>>> However, before using one of them (the appropriate one), I want to set
>>> the variable equal to other resources first.
>>>
>>> For instance:
>>>
>>> zdr_res = opts_xy
>>>
>>> Then add to opts_xy the resources in res1, for instance.
>>>
>>> undef("set_res1_list")
>>>
>>> function set_res1_list()
>>>
>>> begin
>>>
>>> res = True ; I assume this would need to be commented
>>> out.
>>>
>>> various resources...
>>>
>>> end
>>>
>>> On Tue, Nov 7, 2017 at 6:48 PM, Adam Phillips <asphilli at ucar.edu> wrote:
>>>
>>>> Hi Barry,
>>>> If all you want to do is to copy attributes from one array to another,
>>>> I think copy_VarAtts would work:
>>>> https://www.ncl.ucar.edu/Document/Functions/Contributed/copy
>>>> _VarAtts.shtml
>>>> Adam
>>>>
>>>> On Tue, Nov 7, 2017 at 4:56 AM, Barry Lynn <barry.h.lynn at gmail.com>
>>>> wrote:
>>>>
>>>>> Hello:
>>>>>
>>>>> I can't seem to find how to do this.
>>>>>
>>>>> I have this ncl line:
>>>>>
>>>>> opts_zdr = set_res2_list()
>>>>>
>>>>> I also have opts_xy.
>>>>>
>>>>> When making vertical cross sections I need to set opts_zdr = opts_xy
>>>>>
>>>>> and then add in the resources of res2_lis.
>>>>>
>>>>> I am not sure how to add them in, rather than "set" them.
>>>>>
>>>>> Thanks,
>>>>>
>>>>>
>>>>> Barry
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Barry H. Lynn, Ph.D
>>>>> Senior Lecturer,
>>>>> The Institute of the Earth Science,
>>>>> The Hebrew University of Jerusalem,
>>>>> Givat Ram, Jerusalem 91904, Israel
>>>>> Tel: 972 547 231 170
>>>>> Fax: (972)-25662581
>>>>>
>>>>> C.E.O, Weather It Is, LTD
>>>>> Weather and Climate Focus
>>>>> http://weather-it-is.com
>>>>> Jerusalem, Israel
>>>>> Local: 02 930 9525
>>>>> Cell: 054 7 231 170
>>>>> Int-IS: x972 2 930 9525
>>>>> US 914 432 3108 <(914)%20432-3108>
>>>>>
>>>>> _______________________________________________
>>>>> 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 <(303)%20497-1726>
>>>>
>>>> <http://www.cgd.ucar.edu/staff/asphilli>
>>>>
>>>
>>>
>>>
>>> --
>>> Barry H. Lynn, Ph.D
>>> Senior Lecturer,
>>> The Institute of the Earth Science,
>>> The Hebrew University of Jerusalem,
>>> Givat Ram, Jerusalem 91904, Israel
>>> Tel: 972 547 231 170
>>> Fax: (972)-25662581
>>>
>>> C.E.O, Weather It Is, LTD
>>> Weather and Climate Focus
>>> http://weather-it-is.com
>>> Jerusalem, Israel
>>> Local: 02 930 9525
>>> Cell: 054 7 231 170
>>> Int-IS: x972 2 930 9525
>>> US 914 432 3108 <(914)%20432-3108>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>>
>>> Guido Cioni
>>> http://guidocioni.altervista.org
>>>
>>>
>>
>>
>> --
>> Barry H. Lynn, Ph.D
>> Senior Lecturer,
>> The Institute of the Earth Science,
>> The Hebrew University of Jerusalem,
>> Givat Ram, Jerusalem 91904, Israel
>> Tel: 972 547 231 170
>> Fax: (972)-25662581
>>
>> C.E.O, Weather It Is, LTD
>> Weather and Climate Focus
>> http://weather-it-is.com
>> Jerusalem, Israel
>> Local: 02 930 9525
>> Cell: 054 7 231 170
>> Int-IS: x972 2 930 9525
>> US 914 432 3108 <(914)%20432-3108>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
--
Barry H. Lynn, Ph.D
Senior Lecturer,
The Institute of the Earth Science,
The Hebrew University of Jerusalem,
Givat Ram, Jerusalem 91904, Israel
Tel: 972 547 231 170
Fax: (972)-25662581
C.E.O, Weather It Is, LTD
Weather and Climate Focus
http://weather-it-is.com
Jerusalem, Israel
Local: 02 930 9525
Cell: 054 7 231 170
Int-IS: x972 2 930 9525
US 914 432 3108
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171108/ad69dba0/attachment-0001.html>
More information about the ncl-talk
mailing list