Skip to content

Commit

Permalink
Remove the partitionByZIndex function
Browse files Browse the repository at this point in the history
It hasn't been used/referenced for a long time.
  • Loading branch information
danscales committed Jun 11, 2024
1 parent ffe20a8 commit ec2a171
Showing 1 changed file with 0 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package org.globalforestwatch.summarystats.gfwpro_dashboard

import cats.data.{NonEmptyList, Validated}
import geotrellis.vector.{Feature, Geometry}
import geotrellis.store.index.zcurve.Z2
import org.apache.spark.HashPartitioner
import org.globalforestwatch.features._
import org.globalforestwatch.summarystats._
import org.globalforestwatch.util.{RDDAdapter, SpatialJoinRDD}
Expand All @@ -21,8 +19,6 @@ import scala.collection.JavaConverters._
import java.time.LocalDate
import org.globalforestwatch.util.IntersectGeometry

import scala.reflect.ClassTag

object GfwProDashboardAnalysis extends SummaryAnalysis {

val name = "gfwpro_dashboard"
Expand Down Expand Up @@ -123,26 +119,6 @@ object GfwProDashboardAnalysis extends SummaryAnalysis {
}
}

private def partitionByZIndex[A: ClassTag](rdd: RDD[A])(getGeom: A => Geometry): RDD[A] = {
val hashPartitioner = new HashPartitioner(rdd.getNumPartitions)

rdd
.keyBy({ row =>
val geom = getGeom(row)
Z2(
(geom.getCentroid.getX * 100).toInt,
(geom.getCentroid.getY * 100).toInt
).z
})
.partitionBy(hashPartitioner)
.mapPartitions(
{ iter: Iterator[(Long, A)] =>
for (i <- iter) yield i._2
},
preservesPartitioning = true
)
}

private def fireStats(
featureRDD: RDD[Location[Geometry]],
fireAlertRDD: SpatialRDD[Geometry],
Expand Down

0 comments on commit ec2a171

Please sign in to comment.