I am running into a potentially simple problem that I haven't been
able to crack. Apologies for the attached image, but that is the only
way I can explain what I am trying to do.

I have  2D piddle #0 as shown in the first row, and an irregular
selection poly. The 2D piddle has several areas of actual values
(GOOD) within BAD values. Some of the GOOD values are zero (white
ploys).

I select out from the 2D piddle using the irregular poly as shown in
#1. Using the pnpoly routine that Karl provided a while back, I get
the mask piddle #2 with 1s for the cells within the selection poly,
and 0s for the cells outside.

The 0s in the mask are converted into BAD values as shown in #3.

Then I multiply #0 with #3 to identify the GOOD area that lies within
the irregular poly.

Then I calculate the sum and the count of the cells within the
selected area shown in the bottom row.

My problem is -- my calculations for the area are coming out wrong. I
am testing it using non-PDL routines that I lifted out of the
"Mastering Algorithms With Perl" book, and the area I am calculating
using PDL is wrong.

The reason I say up front that this may be a "potentially simple"
problem is because I am likely doing something stupid, but I can't for
the life of me figure out what.

I have put a package of my test script and data on Dropbox [1], if
someone wants to try it out.
--
Puneet Kishor

[1] http://dl.dropbox.com/u/3526821/pnpoly.zip

<<attachment: test.gif>>

_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to