Skip to content

Commit

Permalink
Assembly insanity.
Browse files Browse the repository at this point in the history
  • Loading branch information
metasim committed Sep 21, 2021
1 parent 1cd8df4 commit 238fd34
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 3.0.3
version = 3.0.4
runner.dialect = scala212
indent.main = 2
indent.significant = 2
Expand Down
3 changes: 3 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
*
*/

// Leave me an my custom keys alone!
Global / lintUnusedKeysOnLoad := false

addCommandAlias("makeSite", "docs/makeSite")
addCommandAlias("previewSite", "docs/previewSite")
addCommandAlias("ghpagesPushSite", "docs/ghpagesPushSite")
Expand Down
10 changes: 9 additions & 1 deletion project/RFAssemblyPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import scala.util.matching.Regex
* Standard support for creating assembly jars.
*/
object RFAssemblyPlugin extends AutoPlugin {
override def requires = AssemblyPlugin
override def requires = AssemblyPlugin && RFDependenciesPlugin

implicit class RichRegex(val self: Regex) extends AnyVal {
def =~(s: String) = self.pattern.matcher(s).matches
Expand Down Expand Up @@ -64,6 +64,14 @@ object RFAssemblyPlugin extends AutoPlugin {
)
shadePrefixes.map(p => ShadeRule.rename(s"$p.**" -> s"shaded.rasterframes.$p.@1").inAll)
},
assembly / assemblyShadeRules ++= Seq(
ShadeRule.rename("cats.kernel.**" -> s"shaded.rasterframes.cats.kernel.@1")
.inLibrary(RFDependenciesPlugin.autoImport.geotrellis("raster").value)
.inAll,
ShadeRule.rename("cats.kernel.**" -> s"shaded.spire.cats.kernel.@1")
.inLibrary("org.typelevel" %% "spire" % "0.17.0")
.inAll,
),
assembly / assemblyOption :=
(assembly / assemblyOption).value.withIncludeScala(false),
assembly / assemblyJarName := s"${normalizedName.value}-assembly-${version.value}.jar",
Expand Down
6 changes: 6 additions & 0 deletions project/RFProjectPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ object RFProjectPlugin extends AutoPlugin {
email = "[email protected]",
url = url("https://github.com/echeipesh")
),
Developer(
id = "pomadchin",
name = "Grigory Pomadchin",
email = "[email protected]",
url = url("https://github.com/pomadchin")
),
Developer(
id = "bguseman",
name = "Ben Guseman",
Expand Down
2 changes: 1 addition & 1 deletion pyrasterframes/src/main/python/tests/GeoTiffWriterTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def test_unstructured_write_schemaless(self):
from pyrasterframes.rasterfunctions import rf_agg_stats, rf_crs
rf = self.spark.read.raster(self.img_uri)
max = rf.agg(rf_agg_stats('proj_raster').max.alias('max')).first()['max']
crs = rf.select(rf_crs('proj_raster').crsProj4.alias('c')).first()['c']
crs = rf.select(rf_crs('proj_raster').alias('crs')).first()['crs']

dest_file = self._tmpfile()
self.assertTrue(not dest_file.startswith('file://'))
Expand Down
10 changes: 9 additions & 1 deletion pyrasterframes/src/main/python/tests/UDTTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from pyrasterframes.rasterfunctions import *
from pyrasterframes.rf_types import *
from pyspark.sql.functions import *
from pyspark.sql import Row
from pyspark.sql import Row, DataFrame
from pyproj import CRS as pyCRS

from . import TestEnvironment
Expand Down Expand Up @@ -185,3 +185,11 @@ def test_crs_udt_serialization(self):

roundtrip = udt.fromInternal(udt.toInternal(crs))
assert(crs == roundtrip)

def test_extract_from_raster(self):
# should be able to write a projected raster tile column to path like '/data/foo/file.tif'
from pyrasterframes.rasterfunctions import rf_crs
rf = self.spark.read.raster(self.img_uri)
crs: DataFrame = rf.select(rf_crs('proj_raster').alias('crs')).distinct()
assert(crs.schema.fields[0].dataType == CrsUDT())
assert(crs.first()['crs'].proj4_str == '+proj=utm +zone=16 +datum=WGS84 +units=m +no_defs ')

0 comments on commit 238fd34

Please sign in to comment.