Skip to content

Commit d73e255

Browse files
committed
Fix mistakes in merge with develop
Signed-off-by: Jason T. Brown <[email protected]>
1 parent b267216 commit d73e255

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

core/src/main/scala/org/locationtech/rasterframes/functions/AggregateFunctions.scala

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ trait AggregateFunctions {
5151
/** Compute the cellwise/local count of NoData cells for all Tiles in a column. */
5252
def rf_agg_local_no_data_cells(tile: Column): TypedColumn[Any, Tile] = LocalCountAggregate.LocalNoDataCellsUDAF(tile)
5353

54-
/** Compute the full column aggregate floating point histogram. */
54+
/** Compute the approximate aggregate floating point histogram using a streaming algorithm, with the default of 80 buckets. */
5555
def rf_agg_approx_histogram(tile: Column): TypedColumn[Any, CellHistogram] = HistogramAggregate(tile)
5656

5757
/** Compute the approximate aggregate floating point histogram using a streaming algorithm, with the given number of buckets. */
@@ -60,6 +60,23 @@ trait AggregateFunctions {
6060
HistogramAggregate(col, numBuckets)
6161
}
6262

63+
/**
64+
* Calculates the approximate quantiles of a tile column of a DataFrame.
65+
* @param tile tile column to extract cells from.
66+
* @param probabilities a list of quantile probabilities
67+
* Each number must belong to [0, 1].
68+
* For example 0 is the minimum, 0.5 is the median, 1 is the maximum.
69+
* @param relativeError The relative target precision to achieve (greater than or equal to 0).
70+
* @return the approximate quantiles at the given probabilities of each column
71+
*/
72+
def rf_agg_approx_quantiles(
73+
tile: Column,
74+
probabilities: Seq[Double],
75+
relativeError: Double = 0.00001): TypedColumn[Any, Seq[Double]] = {
76+
require(probabilities.nonEmpty, "at least one quantile probability is required")
77+
ApproxCellQuantilesAggregate(tile, probabilities, relativeError)
78+
}
79+
6380
/** Compute the full column aggregate floating point statistics. */
6481
def rf_agg_stats(tile: Column): TypedColumn[Any, CellStatistics] = CellStatsAggregate(tile)
6582

core/src/test/scala/org/locationtech/rasterframes/RasterFramesStatsSpec.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
package org.locationtech.rasterframes
2323

24+
import org.locationtech.rasterframes.RasterFunctions
2425
import org.apache.spark.sql.functions.{col, explode}
2526

2627
class RasterFramesStatsSpec extends TestEnvironment with TestData {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
class RasterFunctions(TestEnvironment):
3939

4040
def setUp(self):
41+
import sys
4142
if not sys.warnoptions:
4243
import warnings
4344
warnings.simplefilter("ignore")

0 commit comments

Comments
 (0)