Re: using different colormap in panel plot

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu, 29 Mar 2007 09:26:47 -0600 (MDT)

On Thu, 29 Mar 2007, [BE] Ufuk Utku Turuncoglu wrote:

> Hi,
>
> I think, the solution is not fit my problem. I have a panel plot which has
> four figure and i want to use a one color map (for example gui_default) for
> three of them and other color map (for example BlWhRe) for forth one that has
> different cnMinLevelValF, cnMaxLevelValF, cnLevelSpacingF parameters form
> panel plot.

You can only have one color map per page, so in order to use multiple
color maps for plots on a page, you will need to create one big color
map that contains the two color maps you want.

I've attached the code for "Ngl.define_colormap" and
"Ngl.merge_colormaps" which are not yet available in PyNGL. You can
use these to merge the two color maps you want. Then, you will need to
use the cnFillColors resource to indicate what colors you want to use
for the first three color maps, and then that resource again for the
second set of color maps.

For a complicated example on how to use merge_colormaps, see
"multi_plot.py" at:

    http://www.pyngl.ucar.edu/Examples/gallery.shtml

> An other question, is it possible to copy the content of the Ngl.Resources
> instance. I try to copy the one resource to other but i think that two of
> them is linked together and if i change one parameter from resource it
> affects other one. I am using following sample commands,
>
> res = Ngl.Resources()
> res.sfMissingValueV = 1.E20
> res.sfYArray = lat3[ymin:ymax]
> res.sfXArray = lon3[xmin:xmax]
> res.tfDoNDCOverlay = False
> ......
>
> res2 = Ngl.Resources()
> res2 = res
> res.sfMissingValueV = 0
>
> so, after that if i change any parameter in res2 it affects res1. is there
> any easy way to copy content of the Resources instance to other?

"Ngl.Resources()" is a very basic Python class, and hence if you copy
it to another variable and make changes to that second variable, you
will affect the first variable.

Try using copy.copy():

res2 = copy.copy(res1)

--Mary

> Thanks for your help.
> Best regards,
>
> Ufuk Utku Turuncoglu
>
> Mary Haley wrote:
>>
>> On Wed, 28 Mar 2007, [BE] Ufuk Utku Turuncoglu wrote:
>>
>>> Hi,
>>>
>>> I want to use different color map in panel plot. I think it will be
>>> possible in 1.2.0 version of the PyNGL using Ngl.define_colormap command.
>>> But as you know, it has not released yet. How can i plot this kind of
>>> figure. Any suggestion will be helpful.
>>>
>>> best regards,
>>>
>>> Ufuk Utku Turuncoglu
>>> Istanbul Technical University
>>> Informatics Institute
>>
>> Dear Ufuk,
>>
>> You can define a different color map using the "older" method, and
>> that is by defining it as part of a resource list to the "open_wks"
>> function:
>>
>> wkres = Ngl.Resources()
>> wkres.wkColorMap = "rainbow"
>> wks_type = "ps"
>> wks = Ngl.open_wks(wks_type,"panel",wkres)
>>
>> We hope to release a new version of PyNGL and PyNIO once we get
>> a version of NCL out the door. NCL is another related software
>> project that we develop, and we are in the process of testing a new
>> GRIB2 reader in it. When this is done, we will focus on PyNGL/PyNIO
>> and get a GRIB2 reader released in PyNIO.
>>
>> --Mary
>
>

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

Received on Thu Mar 29 2007 - 09:26:47 MDT

This archive was generated by hypermail 2.2.0 : Sun Apr 01 2007 - 11:53:12 MDT