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

Home » Public Forums » archive » Oh what is wrong with WHERE() ?
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
Oh what is wrong with WHERE() ? [message #48571] Sat, 29 April 2006 07:51
Liberum is currently offline  Liberum
Messages: 48
Registered: September 2005
Member
Hi,
Can someone find the disappearing pixel here? I have been trying and
can't seem to find it.
Two arrays m and p and both are 1215 X 1215 arrays. The code is not
difficult or complex and contains where functions to check the arrays.
The following operations where performed:

print, size(m, /dimensions)
no_data = WHERE(m EQ 5.0 OR m EQ 0.0, cm); finding no data
IF cm GT 0 THEN m[no_data] = 255.0
nodata_m = WHERE(m EQ 255.0, count_m, COMPLEMENT=datam, $


NCOMPLEMENT=ndatam)
print, 'Num pixs with data: ', ndatam
print, 'Num no data pixs: ', count_m
;*************************************
ice = WHERE(m EQ 4.0, ci)
IF ci GT 0 THEN m[ice] = 1.0
cloudy = WHERE(m EQ 3.0, cclo)
IF cclo GT 0 THEN m[cloudy] = 2.0
r = where((m EQ 255.0 OR m EQ 1.0 OR m EQ 2.0),check_m,
COMPLEMENT=comp, NCOMPLEMENT=ncomp)
print, 'check_m: ', check_m
if ncomp gt 0 then stop,m[comp]
;*************************************
print, size(p, /dimensions)
no_data = WHERE(p EQ 5.0 OR p EQ 0.0, cp)
IF cp GT 0 THEN p[no_data] = 255.0
nodata_p = WHERE(p EQ 255.0, count_p, COMPLEMENT=datap,
NCOMPLEMENT=ndatap)
print, 'Num pixs with data: ', ndatap
print, 'Num no data pixs: ', count_p
;**************************************
ice = WHERE(p EQ 4.0, cice)
IF cice GT 0 THEN p[ice] = 1.0
cloudy = WHERE(p EQ 3.0, ccloud)
IF ccloud GT 0 THEN p[cloudy] = 2.0
r = where((p EQ 255.0 OR p EQ 1.0 OR p EQ 2.0), check_p,
COMPLEMENT=compp, NCOMPLEMENT=ncompp)
print, 'check_p: ', check_p
IF ncompp GT 0 THEN stop, p[compp]
;***************************************
;setting all areas where nodata to a common area
IF count_m GE count_p THEN nodata_tot = nodata_m ELSE nodata_tot =
nodata_p
print, count_p
print, count_m
print, N_ELEMENTS(nodata_tot)
m[nodata_tot] = 255.0
p[nodata_tot] = 255.0
; finding the area with real data check
va_data = WHERE(p EQ 255.0, COMPLEMENT=vdatap, NCOMPLEMENT=chp)
va_data = WHERE(m EQ 255.0, COMPLEMENT=vdatam, NCOMPLEMENT=chm)
print, 'chp: ', chp, ' chm: ', chm
//////////////////////////////////////////////////
IDL print out:
1215 1215
Num pixs with data: 32272
Num no data pixs: 1443953
check_m: 1476225
1215 1215
Num pixs with data: 1476183
Num no data pixs: 42
check_p: 1476225
42
1443953
1443953
chp: 32271 chm: 32272
/////////////////////////////

What happened to one pixel??
This was supposed to be a simple check to ensure that the two arrays
are balanced for comparison but this missing pixel eludes me.
Any help would be greatly appreciated!!!

/Sheldon
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: passing IDL string to Fortran90?
Next Topic: Re: Map Projection Knowledge Growing Exponentially

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

Current Time: Wed Oct 08 19:43:11 PDT 2025

Total time taken to generate the page: 0.00411 seconds