Re: position of the value 0 in cnLevels to be represented by white colour.

From: gibies george <gibies_at_nyahnyahspammersnyahnyah>
Date: Wed Mar 09 2011 - 21:39:11 MST

Thank you Mary,

This is exactly what I was looking for.

On 10 March 2011 01:28, Mary Haley <haley@ucar.edu> wrote:

> Gibies,
>
> Instead of using gsnSpreadXXXX, you will probably need to set the
> cnFillColors resource to an array of color indexes, so you can control which
> contour level gets which color index.
>
> If you are setting the contour levels yourself, then you should be able to
> determine what to set cnFillColors to.
>
> If you are letting NCL select the contour levels, then you will need to let
> NCL create the plot, and thn afterwards use "getvalues" to retrieve the
> "cnLevels" resource and construct cnFillColors based on those values.
>
> Something like this:
>
> . . .
> plot = gsn_csm_contour_map(wks,data,res)
>
> ;---Retrieve contour levels
> getvalues plot
> "cnLevels" : levels
> end getvalues
>
> nlevels = dimsizes(levels)
>
> ;---Create array containing fill indexes.
> colors = new(nlevels+1,integer)
> ii = ind(levels.ge.0)
> num_neg = ii(0)
> num_pos = nlevels-num_neg+1
>
> colors(0:num_neg-1) = ispan(2,51,toint(51/(num_neg-1)))
> colors(num_neg:) = ispan(53,103,toint(51/(num_pos-1)))
>
> res@cnFillColors= colors
> plot = gsn_csm_contour_map(wks,data,res)
>
>
>
> You will need to modify this based on whether you have a contour level
> exactly equal to 0 or not.
>
> --Mary
>
>
> On Mar 9, 2011, at 3:51 AM, gibies george wrote:
>
> Thank you Mary for the response.
>
> I am using *gsn_csm_contour_map* with "*ViBlGrWhYeOrRe*" colour-map
>
> I wish to have :
>
> the colours from 1 to 51 ie "*ViBlGr" to be used for negative values.*
> *the colour 52 ie "White" to be used for zero.*
> *the colours from 53 to 103 ie "YeOrRe" to be used for positive values.*
> *
> *
> I tried to manage it using *gsnSpreadColorStart *and *gsnSpreadColorEnd*in the cases when (data_min
> .gt. 0) or (data_max .lt. 0) but I don't know how to handle the case when
> *(**data_min .lt. 0**) .and. (data_max .gt. 0) which i really want. *
>
> I am afraid that I may not get full range of color map while
> using "gsn_contour_shade"
>
>
> On 9 March 2011 03:57, Mary Haley <haley@ucar.edu> wrote:
>
>> Maybe "gsn_contour_shade" is what you're looking for:
>>
>>
>> http://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_contour_shade.shtml
>>
>
>
>
>
>> --Mary
>>
>> On Mar 8, 2011, at 5:47 AM, gibies george wrote:
>>
>> How can I get the position of the value 0 in cnLevels while setting the
>> resources for contour plot ?
>>
>> My requirement is as follows.
>>
>> I would like to get *white to represent the value near to zero* in
>> contour interval irrespective of the data range.
>> ---------
>> ----------
>> -----------
>>
>> gsn_define_colormap(wkspnl,"ViBlGrWhYeOrRe")
>> white = 52
>> data_min = min(data)
>> data_max = max(data)
>>
>> if (data_min .gt. 0) resc@gsnSpreadColorStart = white
>> resc@cnLevelSelectionMode = "ManualLevels" resc@cnMinLevelValF = 0 end if
>> if (data_max .lt. 0) resc@gsnSpreadColorEnd = white
>> resc@cnLevelSelectionMode = "ManualLevels" resc@cnMaxLevelValF = 0 end if
>>
>> if ((data_min .lt. 0) .and. (data_max .gt. 0))
>> *----------*
>> *???????*
>> *----------* end if
>> ----------------------
>> -----------------------
>> ----------------------
>>
>> How can I implement this?
>>
>>
>> --
>> *Gibies George, CSIR-RF,*
>> *Seasonal Scale Prediction Group,
>> Climate and Global Modelling Division,
>> Indian Institute of Tropical Meteorology,
>> Dr. Homi Bhabha Road,
>> NCL (P. O.), Pashan,
>> Pune 411008, India.*
>>
>> *http://sites.google.com/site/gibiesge/*
>>
>> Please Think about the environment. Save paper; Save Trees; and don't
>> print this e-mail unless it is necessary.
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>>
>
>
> --
> *Gibies George, CSIR-RF,*
> *Seasonal Scale Prediction Group,
> Climate and Global Modelling Division,
> Indian Institute of Tropical Meteorology,
> Dr. Homi Bhabha Road,
> NCL (P. O.), Pashan,
> Pune 411008, India.*
>
> *http://sites.google.com/site/gibiesge/*
>
> Please Think about the environment. Save paper; Save Trees; and don't print
> this e-mail unless it is necessary.
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>

-- 
*Gibies George,   CSIR-RF,*
*Seasonal Scale Prediction Group,
Climate and Global Modelling Division,
Indian Institute of Tropical Meteorology,
Dr. Homi Bhabha Road,
NCL (P. O.), Pashan,
Pune 411008, India.*
*http://sites.google.com/site/gibiesge/*
Please Think about the environment. Save paper; Save Trees; and don't print
this e-mail unless it is necessary.
Received on Wed Mar 9 21:39:16 2011

This archive was generated by hypermail 2.1.8 : Thu Mar 10 2011 - 21:44:37 MST