comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » cgContour and NaN values
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: cgContour and NaN values [message #86124 is a reply to message #86119] Wed, 09 October 2013 01:44 Go to previous messageGo to previous message
limiqt is currently offline  limiqt
Messages: 27
Registered: October 2013
Junior Member
Thanks Andy.

The code works (i think) changing the NaN to -999. and by explicitly defining the color table. It does not work using NaN. It does not work following the color table as in the example I mentioned (http://www....)

mindata=Min(datax)
maxdata=Max(datax)
data=cgScaleVector(datax, mindata, maxdata)
;print, mindata
;print, maxdata

;cgwindow
ncolors = 8
;cgLoadCT,0
TVLCT, cgColor(['blu8', 'blu6', 'blu4', 'blu2', 'red2', 'red4','red6', 'red8', 'white'], /Triple), 1
clevels=[-1,-0.75, -0.5, -0.25, 0, 0.25, 0.5, 0.75, 1]
colors = Bindgen(ncolors+1) + 1B
cgContour, data, lons, lats, Levels=clevels, C_Colors=colors, /Fill, $
Position=[0.125, 0.125, 0.925, 0.8];, /AddCmd
cgColorbar, NColors=ncolors, Range=[-1,1], Divisions=ncolors, $
Bottom=1, Ticklen=0.001;, /AddCmd



On Tuesday, October 8, 2013 2:55:47 PM UTC-4, AMS wrote:
> With the caveat that I haven't tested, this, I spot your code specifies missing=!Values.F_Nan . I'd either change that to -999, or else leave your missing values as !values.f_nan . I'd try that.
>
>
>
> Andy
>
>
>
> On Tuesday, October 8, 2013 1:58:09 PM UTC-4, Lim wrote:
>
>> Dear all,
>
>>
>
>> I am having some trouble using contour with data which has NaN values. My valid range of data is -1 to 1. I have also change the NaN to -999. In that case the -999 appear as the same color as -1. I would like that the NaN values appear as white. Please, Could you tell me what I am doing wrong? (I am following a example I found at http://www.idlcoyote.com/graphics_tips/contourcolors.php but Im sure i missed somthing)
>
>>
>
>>
>
>>
>
>> my data is [192,145]
>
>>
>
>>
>
>>
>
>> data
>
>>
>
>> minval=-1.
>
>>
>
>> maxval=1.
>
>>
>
>> data=cgScaleVector(data, minval, maxval, /NaN)
>
>>
>
>>
>
>>
>
>> cgwindow
>
>>
>
>> ncontours = 10
>
>>
>
>> cgLoadCT, 22, /Brewer, /Reverse, NColors=ncontours
>
>>
>
>> clevels = cgScaleVector(Findgen(ncontours+1), minval, maxval, /NaN)
>
>>
>
>> colors = Bindgen(ncontours+1) + 1B
>
>>
>
>> cgContour, data, lons, lats, Levels=clevels, C_Colors=colors, /Fill, missing=!Values.F_Nan, Position=[0.125, 0.125, 0.925, 0.8], /AddCmd
>
>>
>
>> cgColorbar, NColors=ncontours, Range=[minval,maxval], Divisions=10, $
>
>>
>
>> Bottom=1, Ticklen=0.001, /AddCmd
>
>>
>
>>
>
>>
>
>> Thanks
>
>>
>
>> Lim.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: scopes
Next Topic: Yet another user with poly_fit problems

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 04:11:54 PDT 2025

Total time taken to generate the page: 0.25981 seconds