Skip to content

Commit 3444453

Browse files
committed
IT regression fixes.
1 parent 5953f0f commit 3444453

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

core/src/main/scala/org/locationtech/rasterframes/expressions/aggregates/ProjectedLayerMetadataAggregate.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ class ProjectedLayerMetadataAggregate(destCRS: CRS, destDims: TileDimensions) ex
7777
import org.locationtech.rasterframes.encoders.CatalystSerializer._
7878
val buf = buffer.to[BufferRecord]
7979

80+
if (buf.isEmpty) {
81+
throw new IllegalArgumentException("Can not collect metadata from empty data frame.")
82+
}
83+
8084
val re = RasterExtent(buf.extent, buf.cellSize)
8185
val layout = LayoutDefinition(re, destDims.cols, destDims.rows)
8286

@@ -152,6 +156,8 @@ object ProjectedLayerMetadataAggregate {
152156
buffer(i) = encoded(i)
153157
}
154158
}
159+
160+
def isEmpty: Boolean = extent == null || cellType == null || cellSize == null
155161
}
156162

157163
private[expressions]

core/src/main/scala/org/locationtech/rasterframes/expressions/generators/ExplodeTiles.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import geotrellis.raster._
2525
import org.apache.spark.sql._
2626
import org.apache.spark.sql.catalyst.InternalRow
2727
import org.apache.spark.sql.catalyst.expressions.codegen.{BufferHolder, CodegenFallback, UnsafeRowWriter}
28-
import org.apache.spark.sql.catalyst.expressions.{Expression, Generator, GenericInternalRow, UnsafeRow}
28+
import org.apache.spark.sql.catalyst.expressions.{Expression, Generator, UnsafeRow}
2929
import org.apache.spark.sql.types._
3030
import org.locationtech.rasterframes._
3131
import org.locationtech.rasterframes.expressions.DynamicExtractors

experimental/src/it/scala/org/locationtech/rasterframes/experimental/datasource/awspds/L8CatalogRelationTest.scala

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,13 @@ class L8CatalogRelationTest extends TestEnvironment {
108108
stats.mean shouldBe > (10000.0)
109109
}
110110

111-
ignore("should construct an RGB composite") {
112-
val aoi = Extent(31.115, 29.963, 31.148, 29.99)
111+
it("should construct an RGB composite") {
112+
val aoiLL = Extent(31.115, 29.963, 31.148, 29.99)
113+
113114
val scene = catalog
114115
.where(
115116
to_date($"acquisition_date") === to_date(lit("2019-07-03")) &&
116-
st_intersects(st_geometry($"bounds_wgs84"), geomLit(aoi.jtsGeom))
117+
st_intersects(st_geometry($"bounds_wgs84"), geomLit(aoiLL.jtsGeom))
117118
)
118119
.orderBy("cloud_cover_pct")
119120
.limit(1)
@@ -122,19 +123,13 @@ class L8CatalogRelationTest extends TestEnvironment {
122123
.fromCatalog(scene, "B4", "B3", "B2")
123124
.withTileDimensions(256, 256)
124125
.load()
125-
.where(st_contains(rf_geometry($"B4"), st_reproject(geomLit(aoi.jtsGeom), lit("EPSG:4326"), rf_crs($"B4"))))
126-
126+
.limit(1)
127127

128128
noException should be thrownBy {
129-
val raster = TileRasterizerAggregate(df, LatLng, Some(aoi), None)
130-
println(raster)
129+
val raster = TileRasterizerAggregate.collect(df, LatLng, Some(aoiLL), None)
130+
raster.tile.bandCount should be (3)
131+
raster.extent.area > 0
131132
}
132-
133-
// import geotrellis.raster.io.geotiff.{GeoTiffOptions, MultibandGeoTiff, Tiled}
134-
// import geotrellis.raster.io.geotiff.compression.{DeflateCompression}
135-
// import geotrellis.raster.io.geotiff.tags.codes.ColorSpace
136-
// val tiffOptions = GeoTiffOptions(Tiled, DeflateCompression, ColorSpace.RGB)
137-
// MultibandGeoTiff(raster, raster.crs, tiffOptions).write("target/composite.tif")
138133
}
139134
}
140135
}

0 commit comments

Comments
 (0)