Skip to content

Commit

Permalink
In GDALDataset, lazy compute of band min max for cell type (#3162)
Browse files Browse the repository at this point in the history
* In gdal, lazy compute of band min max for cell type

Reinstates the lazy declaration of this variable as in https://github.com/geotrellis/geotrellis-gdal/pull/40/files#diff-5e19e2811cf054c87ebc2afd642ebaa3R64

Signed-off-by: Jason T. Brown <[email protected]>

* Update changelog with PR link

Signed-off-by: Jason T. Brown <[email protected]>
  • Loading branch information
vpipkt authored and pomadchin committed Dec 9, 2019
1 parent b01b6e2 commit 7a6355d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Preserve NODATA values for double cell types when resampling with Max or Min resampler [#3144](https://github.com/locationtech/geotrellis/pull/3144)
- Update dependency versions for Scala 2.12 cross build [#3132](https://github.com/locationtech/geotrellis/pull/3132)
- Fix eager evaluation of band min-max in `GDALDataset` [#](https://github.com/locationtech/geotrellis/pull/3162)

## [3.1.0] - 2019-10-25

Expand Down
3 changes: 2 additions & 1 deletion gdal/src/main/scala/geotrellis/raster/gdal/GDALDataset.scala
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ case class GDALDataset(token: Long) extends AnyVal {
require(acceptableDatasets contains datasetType)
val nd = noDataValue(datasetType)
val dt = GDALDataType.intToGDALDataType(this.dataType(datasetType))
val mm = {
// This is declared lazy to avoid eval if the by-name param in GDALUtils.dataTypeToCellType is not needed
lazy val mm = {
val minmax = Array.ofDim[Double](2)
val success = Array.ofDim[Int](1)

Expand Down

0 comments on commit 7a6355d

Please sign in to comment.