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

Home » Public Forums » archive » Re: FSC_contour & NaN
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: FSC_contour & NaN [message #74466] Wed, 19 January 2011 17:40 Go to next message
kisCA is currently offline  kisCA
Messages: 78
Registered: January 2011
Member
Ok thamks for your help

Cheers
Re: FSC_contour & NaN [message #74467 is a reply to message #74466] Wed, 19 January 2011 16:39 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
kisCA writes:

> Any idea ?

Well, I'm almost embarrassed to suggest it once again,
but you might want to look at your data with Histoplot,
to get an idea of the data distribution. Then, you might
select your contour levels based on what you find there.
You can partition your data into the appropriate
irregularly sized bins using the method outlined in this
article:

http://www.idlcoyote.com/code_tips/partition.html

That might give you better color separation in your contour
plot. But I would still encourage you to use an image under
the contour plot lines. I think contouring with a bunch of
NaNs is a lost cause.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: FSC_contour & NaN [message #74468 is a reply to message #74467] Wed, 19 January 2011 16:07 Go to previous messageGo to next message
kisCA is currently offline  kisCA
Messages: 78
Registered: January 2011
Member
On Jan 19, 3:31 pm, David Fanning <n...@dfanning.com> wrote:

> It's called Directions in Barry Lopez's book Desert Notes.

I think I will read this one as soon I finished mine :-)

For my contours, I tried different ways with by increasing 'nb' in :
levels= nb
step = (Max(data,/nan) - Min(data,/nan)) / levels
userLevels = IndGen(levels) * step + Min(data,/nan)
pos = [0.1, 0.1, 0.9, 0.75]
LoadCT, 33, NColors=levels, Bottom=1
FSC_Contour, data,time2,Zint/1000, Levels=userLevels, /
Fill,C_Colors=Indgen(levels)+1, Position=pos

But I can't have the color gradient I obtain with 'TVImage,scaledData'
at least a difference of blue and a bit of red.

I also tried to manage my data by multiply it to have values above 0 --
> only high value appear in red, others are blue,

also calculate a deviation value which is in percent (between -100 and
100), I have more blank than expected...

The worst is when I simply do a 'Contour, data' I can see the contour
but in white. The problem is with the fill...

Any idea ?

Thanks
Re: FSC_contour & NaN [message #74469 is a reply to message #74468] Wed, 19 January 2011 15:31 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
kisCA writes:

> By the way I tried the code you send above again but with 'TVImage,
> scaledData' and not 'TVImage, data' and I can see the picture I
> want.

I have spent day after dreary day the past couple of weeks
fixing typos in my book. (The members of this newsgroup are
INCREDIBLE proofreaders, by the way!) I think of books as being
maps, directions. And I don't get to this stage without
recalling my favorite story in my favorite book of all time.
It's called Directions in Barry Lopez's book Desert Notes.
It starts out this way.

I would like to tell you how to get there so that you
may see all this for yourself. But first a warning: you
may already have come across a set of detailed instructions,
a map with every bush and stone clearly marked, the
meandering courses of dry rivers and other geographical
features noted, with dotted line put down to represent
the very faintest of trails. [...] Your confidence in
these finely etched maps is understandable, for at first
glance, they seem excellent, the best a man is capable
of; but your confidence is misplaced. Throw them out.
They are the wrong sort of map. They are too thin. They
are not the sort of map that can be followed by a man who
knows what he is doing. The coyote, even the crow, would
regard them with suspicion.

I know, now, why that is. The brain and the fingers are
apparently run by two completely different centers in
the body. Either that, or Coyote has gotten into my head
in an even bigger way than I imagined. :-(

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: FSC_contour & NaN [message #74470 is a reply to message #74469] Wed, 19 January 2011 15:09 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
kisCA writes:

> Thanks to be concerned about my problem. I like to search also by
> myself and not to be dependent on your knowledge, even if it's really
> amazing :-)
>
> By the way I tried the code you send above again but with 'TVImage,
> scaledData' and not 'TVImage, data' and I can see the picture I
> want...And it's really nicer than with matlab :-)

Well, you see, I was trying to test if you were
really reading what I was writing. :-)

Cheers,

David

P.S. "Nicer than Matlab." Imagine that!

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: FSC_contour & NaN [message #74471 is a reply to message #74470] Wed, 19 January 2011 14:51 Go to previous messageGo to next message
kisCA is currently offline  kisCA
Messages: 78
Registered: January 2011
Member
Thanks to be concerned about my problem. I like to search also by
myself and not to be dependent on your knowledge, even if it's really
amazing :-)

By the way I tried the code you send above again but with 'TVImage,
scaledData' and not 'TVImage, data' and I can see the picture I
want...And it's really nicer than with matlab :-)

I think I am messing again with the contours I am trying to draw... I
will try again, with the tips you sent me before and also with
http://www.dfanning.com/tips/contour_hole.html

Also, I can sent you a copy of the data.

Will let you know

Cheers
Re: FSC_contour & NaN [message #74473 is a reply to message #74471] Wed, 19 January 2011 13:19 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
kisCA writes:

> If I follow you well, the problem here is that I missed to much real
> values in my dataset to draw some contours ? And the ones I got are
> too low ?

The problem is that I don't have the faintest idea what
your problem is. I don't have any code to look at, I don't
have any data. I'm just making more or less intelligent guesses
from experience.

Have you looked at a histogram distribution of your data?
Did anything suggest itself to you? Would you like to
share that insight with us?

If MatLab does a good job of it, then I suppose whatever
the problem is can be corrected. But, not by me, and not
out of thin air. :-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: FSC_contour & NaN [message #74474 is a reply to message #74473] Wed, 19 January 2011 13:08 Go to previous messageGo to next message
kisCA is currently offline  kisCA
Messages: 78
Registered: January 2011
Member
I have tried with matlab to draw it, it worked well...so I hope there
will be a way to make it with IDL...will try to figure it out!
Re: FSC_contour & NaN [message #74475 is a reply to message #74474] Wed, 19 January 2011 13:01 Go to previous messageGo to next message
kisCA is currently offline  kisCA
Messages: 78
Registered: January 2011
Member
On Jan 19, 12:11 pm, David Fanning <n...@dfanning.com> wrote:

> I suspect that most of your data is a single, low,
> value, which is why you are getting a solid color
> contour and image. That's why I suggested Histoplot.
> It might be useful to you to see the distribution
> of values in your data. It might suggest better ways
> to handle it.

If I follow you well, the problem here is that I missed to much real
values in my dataset to draw some contours ? And the ones I got are
too low ?

Cheers
Re: FSC_contour & NaN [message #74476 is a reply to message #74475] Wed, 19 January 2011 12:11 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
kisCA writes:

> I had already watch my data by printing it '.txt'.
> I got values from 0 to 1e-5 and the density is between 500 and 1000
>
> What did you suggested with that ?

I suspect that most of your data is a single, low,
value, which is why you are getting a solid color
contour and image. That's why I suggested Histoplot.
It might be useful to you to see the distribution
of values in your data. It might suggest better ways
to handle it.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: FSC_contour & NaN [message #74477 is a reply to message #74476] Wed, 19 January 2011 11:57 Go to previous messageGo to next message
kisCA is currently offline  kisCA
Messages: 78
Registered: January 2011
Member
On Jan 19, 11:11 am, David Fanning <n...@dfanning.com> wrote:

> I have suspected from the beginning of this conversation
> that you are making some assumption about your data that
> is incorrect. I suspect it even more now. Try doing a
> Histoplot on the data. Does that provide any insight?


I had already watch my data by printing it '.txt'.
I got values from 0 to 1e-5 and the density is between 500 and 1000

What did you suggested with that ?
Re: FSC_contour & NaN [message #74479 is a reply to message #74477] Wed, 19 January 2011 11:11 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
kisCA writes:

> I got a blue window that pop up with that, is it normal?

I have suspected from the beginning of this conversation
that you are making some assumption about your data that
is incorrect. I suspect it even more now. Try doing a
Histoplot on the data. Does that provide any insight?

>> P.S. I'll put you down for a copy from the first printing
>> run. :-)
>
> Yes please, and if it may be autographed...

I will go bankrupt sending personal autographed copies
to everyone who is helping me with the editing. But, I
will sneak one in for you. :-)

> PS: Is there a way to change font_size in FSC_Contour because it
> doesn't respect the 'font_size' command i put in device?

I am not sure what you are doing. The character size in
FSC_Contour can be set either with the CHARSIZE keyword,
or by setting the !P.Charsize system variable.

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: FSC_contour & NaN [message #74481 is a reply to message #74479] Wed, 19 January 2011 11:03 Go to previous messageGo to next message
kisCA is currently offline  kisCA
Messages: 78
Registered: January 2011
Member
On Jan 19, 10:26 am, David Fanning <n...@dfanning.com> wrote:
>   missing = Where(data EQ -999.99, count)
>   IF count GT 0 THEN data[missing] = !Values.F_NAN
>   scaledData = BytScl(data, Top=253, /NAN)
>   LoadCT, 33, NColors=254
>   TVLCT, FSC_Color('white', /Triple), 254
>   IF count GT 0 THEN scaledData[missing] = 254
>   TVImage, data

I got a blue window that pop up with that, is it normal?

> P.S. I'll put you down for a copy from the first printing
> run. :-)

Yes please, and if it may be autographed...

PS: Is there a way to change font_size in FSC_Contour because it
doesn't respect the 'font_size' command i put in device?
Re: FSC_contour & NaN [message #74482 is a reply to message #74481] Wed, 19 January 2011 10:26 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
kisCA writes:

> I will try that one but don't really know how to make the NaN the
> color I want.
> What if I use a missing value instead of NaNs (like -999.99) ?

missing = Where(data EQ -999.99, count)
IF count GT 0 THEN data[missing] = !Values.F_NAN
scaledData = BytScl(data, Top=253, /NAN)
LoadCT, 33, NColors=254
TVLCT, FSC_Color('white', /Triple), 254
IF count GT 0 THEN scaledData[missing] = 254
TVImage, data

Cheers,

David

P.S. I'll put you down for a copy from the first printing
run. :-)

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: FSC_contour & NaN [message #74483 is a reply to message #74482] Wed, 19 January 2011 10:08 Go to previous messageGo to next message
kisCA is currently offline  kisCA
Messages: 78
Registered: January 2011
Member
On Jan 19, 9:55 am, David Fanning <n...@dfanning.com> wrote:
> You need my new book. :-)

Sure !

>
> In a contour plot, this is difficult. (Where exactly
> do you draw the contour if there are no "numbers"
> to contour?)

Agree...

> I think what I would do is lay down
> an image (where you can make the NaN indices whatever
> color you like), and add the contour lines over
> the top of the image.

I will try that one but don't really know how to make the NaN the
color I want.
What if I use a missing value instead of NaNs (like -999.99) ?

Cheers
Re: FSC_contour & NaN [message #74484 is a reply to message #74483] Wed, 19 January 2011 09:55 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
kisCA writes:

>> yes, it's probably normal, the way you called
>> the function. :-)
>
> :-) Is there a way to make the NaNs appear in white?

You need my new book. :-)

In a contour plot, this is difficult. (Where exactly
do you draw the contour if there are no "numbers"
to contour?) I think what I would do is lay down
an image (where you can make the NaN indices whatever
color you like), and add the contour lines over
the top of the image.

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: FSC_contour & NaN [message #74485 is a reply to message #74484] Wed, 19 January 2011 09:36 Go to previous messageGo to next message
kisCA is currently offline  kisCA
Messages: 78
Registered: January 2011
Member
On Jan 18, 8:08 pm, David Fanning <n...@dfanning.com> wrote:
> yes, it's probably normal, the way you called
> the function. :-)

:-) Is there a way to make the NaNs appear in white?
Re: FSC_contour & NaN [message #74496 is a reply to message #74485] Tue, 18 January 2011 20:08 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
kisCA writes:

> Here I come back with contours...
>
> I have an array with NaNs. When I tried to plot it wih FSC_contour or
> contour while loading the blue-red colorbar, my whole plot is fill
> with some blue. No red for maximum values ... Is that normal?

Are you asking for a guess, or what? I'd guess,
yes, it's probably normal, the way you called
the function. :-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: FSC_contour & NaN [message #74546 is a reply to message #74467] Thu, 20 January 2011 14:48 Go to previous message
kisCA is currently offline  kisCA
Messages: 78
Registered: January 2011
Member
On Jan 19, 4:39 pm, David Fanning <n...@dfanning.com> wrote:

I would still encourage you to use an image under
> the contour plot lines. I think contouring with a bunch of
> NaNs is a lost cause.
>
I don't really understand why you were trying to say here, could you
please develop a bit more?

I watched my data properly and there is only 8% of my dataset which
are NaN, I didn't expected it could too much...

Also, does BytScl work as well when you got negative data ?

Thanks
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Blanking all 5x5 windows with less than X 'on' pixels in them
Next Topic: Re: Line plot missing data points?

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

Current Time: Wed Oct 08 15:48:37 PDT 2025

Total time taken to generate the page: 0.00777 seconds