Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add examples for filtering to keep last returns or specified return v…

…alues
  • Loading branch information...
commit 428c60fc32227e523c1e0623fb2b12265bd43a24 1 parent 2508504
Howard Butler hobu authored
30 test/data/plang/predicate-keep-last-return.xml
View
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<Pipeline version="1.0">
+ <Writer type="drivers.las.writer">
+ <Option name="filename">
+ out2.las
+ </Option>
+ <Filter type="filters.predicate">
+ <Option name="module">anything</Option>
+ <Option name="function">filter</Option>
+ <Option name="source">
+import numpy as np
+
+def filter(ins,outs):
+ ret = ins['ReturnNumber']
+ ret_no = ins['NumberOfReturns']
+
+ # Use the first test for our base array.
+ rets = np.equal(ret, ret_no)
+
+ outs['Mask'] = rets
+ return True
+ </Option>
+ <Reader type="drivers.las.reader">
+ <Option name="filename">
+ ../autzen.las
+ </Option>
+ </Reader>
+ </Filter>
+ </Writer>
+</Pipeline>
37 test/data/plang/predicate-keep-specified-returns.xml
View
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<Pipeline version="1.0">
+ <Writer type="drivers.las.writer">
+ <Option name="filename">
+ out2.las
+ </Option>
+ <Filter type="filters.predicate">
+ <Option name="module">anything</Option>
+ <Option name="function">filter</Option>
+ <Option name="source">
+import numpy as np
+
+def filter(ins,outs):
+ ret = ins['ReturnNumber']
+
+ keep_ret = [0, 1,2]
+
+ # Use the first test for our base array.
+ keep = np.equal(ret, keep_ret[0])
+
+ # For 1:n, test each predicate and join back
+ # to our existing predicate array
+ for k in range(1, len(keep_ret)):
+ t = np.equal(ret, keep_ret[k])
+ keep = keep + t
+
+ outs['Mask'] = keep
+ return True
+ </Option>
+ <Reader type="drivers.las.reader">
+ <Option name="filename">
+ ../autzen.las
+ </Option>
+ </Reader>
+ </Filter>
+ </Writer>
+</Pipeline>
Please sign in to comment.
Something went wrong with that request. Please try again.