Skip to content

Commit 539865c

Browse files
committed
Update Python bindings and test
Signed-off-by: Jason T. Brown <jason@astraea.earth>
1 parent 4589fe1 commit 539865c

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

pyrasterframes/src/main/python/tests/RasterFunctionsTests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ def test_aggregations(self):
136136
def test_agg_approx_quantiles(self):
137137
agg = self.rf.agg(rf_agg_approx_quantiles('tile', [0.1, 0.5, 0.9, 0.98]))
138138
result = agg.first()[0]
139-
# expected result from computing in external python process
140-
assert_allclose(result, np.array([7412., 7638., 7671., 7675.]))
139+
# expected result from computing in external python process; c.f. scala tests
140+
assert_allclose(result, np.array([7963., 10068., 12160., 14366.]))
141141

142142
def test_sql(self):
143143

pyrasterframes/src/main/scala/org/locationtech/rasterframes/py/PyRFContext.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,13 @@ class PyRFContext(implicit sparkSession: SparkSession) extends RasterFunctions
191191

192192
def rf_local_unequal_int(col: Column, scalar: Int): Column = rf_local_unequal[Int](col, scalar)
193193

194+
// other function support
195+
/** py4j friendly version of this function */
196+
def rf_agg_approx_quantiles(tile: Column, probabilities: java.util.List[Double], relativeError: Double): TypedColumn[Any, Seq[Double]] = {
197+
import scala.collection.JavaConverters._
198+
rf_agg_approx_quantiles(tile, probabilities.asScala, relativeError)
199+
}
200+
194201
def _make_crs_literal(crsText: String): Column = {
195202
rasterframes.encoders.serialized_literal[CRS](LazyCRS(crsText))
196203
}

0 commit comments

Comments
 (0)