-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
76 changed files
with
1,489 additions
and
673 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
[ | ||
{ | ||
"jmhVersion" : "1.21", | ||
"benchmark" : "org.locationtech.rasterframes.bench.CellTypeBench.fromRow", | ||
"mode" : "avgt", | ||
"threads" : 1, | ||
"forks" : 1, | ||
"jvm" : "/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre/bin/java", | ||
"jvmArgs" : [ | ||
"-Xmx4g" | ||
], | ||
"jdkVersion" : "1.8.0_171", | ||
"vmName" : "Java HotSpot(TM) 64-Bit Server VM", | ||
"vmVersion" : "25.171-b11", | ||
"warmupIterations" : 8, | ||
"warmupTime" : "10 s", | ||
"warmupBatchSize" : 1, | ||
"measurementIterations" : 5, | ||
"measurementTime" : "10 s", | ||
"measurementBatchSize" : 1, | ||
"primaryMetric" : { | ||
"score" : 2.835836726694286, | ||
"scoreError" : 0.19270422040266105, | ||
"scoreConfidence" : [ | ||
2.643132506291625, | ||
3.028540947096947 | ||
], | ||
"scorePercentiles" : { | ||
"0.0" : 2.795428349144724, | ||
"50.0" : 2.833201108807787, | ||
"90.0" : 2.918007291796378, | ||
"95.0" : 2.918007291796378, | ||
"99.0" : 2.918007291796378, | ||
"99.9" : 2.918007291796378, | ||
"99.99" : 2.918007291796378, | ||
"99.999" : 2.918007291796378, | ||
"99.9999" : 2.918007291796378, | ||
"100.0" : 2.918007291796378 | ||
}, | ||
"scoreUnit" : "us/op", | ||
"rawData" : [ | ||
[ | ||
2.795428349144724, | ||
2.79552918770274, | ||
2.837017696019802, | ||
2.918007291796378, | ||
2.833201108807787 | ||
] | ||
] | ||
}, | ||
"secondaryMetrics" : { | ||
} | ||
}, | ||
{ | ||
"jmhVersion" : "1.21", | ||
"benchmark" : "org.locationtech.rasterframes.bench.CellTypeBench.intoRow", | ||
"mode" : "avgt", | ||
"threads" : 1, | ||
"forks" : 1, | ||
"jvm" : "/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre/bin/java", | ||
"jvmArgs" : [ | ||
"-Xmx4g" | ||
], | ||
"jdkVersion" : "1.8.0_171", | ||
"vmName" : "Java HotSpot(TM) 64-Bit Server VM", | ||
"vmVersion" : "25.171-b11", | ||
"warmupIterations" : 8, | ||
"warmupTime" : "10 s", | ||
"warmupBatchSize" : 1, | ||
"measurementIterations" : 5, | ||
"measurementTime" : "10 s", | ||
"measurementBatchSize" : 1, | ||
"primaryMetric" : { | ||
"score" : 0.35239272354175755, | ||
"scoreError" : 0.007379508933042929, | ||
"scoreConfidence" : [ | ||
0.3450132146087146, | ||
0.3597722324748005 | ||
], | ||
"scorePercentiles" : { | ||
"0.0" : 0.34961161284617265, | ||
"50.0" : 0.3525031701325926, | ||
"90.0" : 0.3550145438728285, | ||
"95.0" : 0.3550145438728285, | ||
"99.0" : 0.3550145438728285, | ||
"99.9" : 0.3550145438728285, | ||
"99.99" : 0.3550145438728285, | ||
"99.999" : 0.3550145438728285, | ||
"99.9999" : 0.3550145438728285, | ||
"100.0" : 0.3550145438728285 | ||
}, | ||
"scoreUnit" : "us/op", | ||
"rawData" : [ | ||
[ | ||
0.3550145438728285, | ||
0.3522314263912252, | ||
0.3525031701325926, | ||
0.34961161284617265, | ||
0.3526028644659687 | ||
] | ||
] | ||
}, | ||
"secondaryMetrics" : { | ||
} | ||
} | ||
] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
[ | ||
{ | ||
"jmhVersion" : "1.21", | ||
"benchmark" : "org.locationtech.rasterframes.bench.CellTypeBench.fromRow", | ||
"mode" : "avgt", | ||
"threads" : 1, | ||
"forks" : 1, | ||
"jvm" : "/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre/bin/java", | ||
"jvmArgs" : [ | ||
"-Xmx4g" | ||
], | ||
"jdkVersion" : "1.8.0_171", | ||
"vmName" : "Java HotSpot(TM) 64-Bit Server VM", | ||
"vmVersion" : "25.171-b11", | ||
"warmupIterations" : 8, | ||
"warmupTime" : "10 s", | ||
"warmupBatchSize" : 1, | ||
"measurementIterations" : 5, | ||
"measurementTime" : "10 s", | ||
"measurementBatchSize" : 1, | ||
"primaryMetric" : { | ||
"score" : 0.09014145135858256, | ||
"scoreError" : 0.002394012003996672, | ||
"scoreConfidence" : [ | ||
0.0877474393545859, | ||
0.09253546336257923 | ||
], | ||
"scorePercentiles" : { | ||
"0.0" : 0.08936698388038906, | ||
"50.0" : 0.08989743516282808, | ||
"90.0" : 0.09083590280173164, | ||
"95.0" : 0.09083590280173164, | ||
"99.0" : 0.09083590280173164, | ||
"99.9" : 0.09083590280173164, | ||
"99.99" : 0.09083590280173164, | ||
"99.999" : 0.09083590280173164, | ||
"99.9999" : 0.09083590280173164, | ||
"100.0" : 0.09083590280173164 | ||
}, | ||
"scoreUnit" : "us/op", | ||
"rawData" : [ | ||
[ | ||
0.08989743516282808, | ||
0.09072300570225225, | ||
0.08988392924571173, | ||
0.09083590280173164, | ||
0.08936698388038906 | ||
] | ||
] | ||
}, | ||
"secondaryMetrics" : { | ||
} | ||
}, | ||
{ | ||
"jmhVersion" : "1.21", | ||
"benchmark" : "org.locationtech.rasterframes.bench.CellTypeBench.intoRow", | ||
"mode" : "avgt", | ||
"threads" : 1, | ||
"forks" : 1, | ||
"jvm" : "/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre/bin/java", | ||
"jvmArgs" : [ | ||
"-Xmx4g" | ||
], | ||
"jdkVersion" : "1.8.0_171", | ||
"vmName" : "Java HotSpot(TM) 64-Bit Server VM", | ||
"vmVersion" : "25.171-b11", | ||
"warmupIterations" : 8, | ||
"warmupTime" : "10 s", | ||
"warmupBatchSize" : 1, | ||
"measurementIterations" : 5, | ||
"measurementTime" : "10 s", | ||
"measurementBatchSize" : 1, | ||
"primaryMetric" : { | ||
"score" : 0.0804223243178353, | ||
"scoreError" : 0.003232629425106684, | ||
"scoreConfidence" : [ | ||
0.07718969489272862, | ||
0.08365495374294199 | ||
], | ||
"scorePercentiles" : { | ||
"0.0" : 0.07979611499160112, | ||
"50.0" : 0.08015109899040546, | ||
"90.0" : 0.08189719727590557, | ||
"95.0" : 0.08189719727590557, | ||
"99.0" : 0.08189719727590557, | ||
"99.9" : 0.08189719727590557, | ||
"99.99" : 0.08189719727590557, | ||
"99.999" : 0.08189719727590557, | ||
"99.9999" : 0.08189719727590557, | ||
"100.0" : 0.08189719727590557 | ||
}, | ||
"scoreUnit" : "us/op", | ||
"rawData" : [ | ||
[ | ||
0.08189719727590557, | ||
0.08020909063591224, | ||
0.07979611499160112, | ||
0.08005811969535213, | ||
0.08015109899040546 | ||
] | ||
] | ||
}, | ||
"secondaryMetrics" : { | ||
} | ||
} | ||
] | ||
|
||
|
52 changes: 52 additions & 0 deletions
52
bench/src/main/scala/org/locationtech/rasterframes/bench/CellTypeBench.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* This software is licensed under the Apache 2 license, quoted below. | ||
* | ||
* Copyright 2019 Astraea, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
* use this file except in compliance with the License. You may obtain a copy of | ||
* the License at | ||
* | ||
* [http://www.apache.org/licenses/LICENSE-2.0] | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations under | ||
* the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
*/ | ||
|
||
package org.locationtech.rasterframes.bench | ||
import java.util.concurrent.TimeUnit | ||
|
||
import geotrellis.raster.{CellType, DoubleUserDefinedNoDataCellType, IntUserDefinedNoDataCellType} | ||
import org.apache.spark.sql.catalyst.InternalRow | ||
import org.locationtech.rasterframes.encoders.CatalystSerializer._ | ||
import org.openjdk.jmh.annotations._ | ||
|
||
@BenchmarkMode(Array(Mode.AverageTime)) | ||
@State(Scope.Benchmark) | ||
@OutputTimeUnit(TimeUnit.MICROSECONDS) | ||
class CellTypeBench { | ||
var row: InternalRow = _ | ||
var ct: CellType = _ | ||
@Setup(Level.Trial) | ||
def setupData(): Unit = { | ||
ct = IntUserDefinedNoDataCellType(scala.util.Random.nextInt()) | ||
val o: CellType = DoubleUserDefinedNoDataCellType(scala.util.Random.nextDouble()) | ||
row = o.toInternalRow | ||
} | ||
|
||
@Benchmark | ||
def fromRow(): CellType = { | ||
row.to[CellType] | ||
} | ||
|
||
@Benchmark | ||
def intoRow(): InternalRow = { | ||
ct.toInternalRow | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
core/src/it/scala/org/locationtech/rasterframes/ref/RasterRefIT.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* This software is licensed under the Apache 2 license, quoted below. | ||
* | ||
* Copyright 2019 Astraea, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
* use this file except in compliance with the License. You may obtain a copy of | ||
* the License at | ||
* | ||
* [http://www.apache.org/licenses/LICENSE-2.0] | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations under | ||
* the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
*/ | ||
|
||
package org.locationtech.rasterframes.ref | ||
|
||
import java.net.URI | ||
|
||
import geotrellis.proj4.LatLng | ||
import geotrellis.vector.Extent | ||
import org.locationtech.rasterframes._ | ||
import org.locationtech.rasterframes.expressions.aggregates.TileRasterizerAggregate | ||
|
||
class RasterRefIT extends TestEnvironment { | ||
describe("practical subregion reads") { | ||
ignore("should construct a natural color composite") { | ||
import spark.implicits._ | ||
def scene(idx: Int) = URI.create(s"https://landsat-pds.s3.us-west-2.amazonaws.com" + | ||
s"/c1/L8/176/039/LC08_L1TP_176039_20190703_20190718_01_T1/LC08_L1TP_176039_20190703_20190718_01_T1_B$idx.TIF") | ||
|
||
val redScene = RasterSource(scene(4)) | ||
// [west, south, east, north] | ||
val area = Extent(31.115, 29.963, 31.148, 29.99).reproject(LatLng, redScene.crs) | ||
|
||
val red = RasterRef(redScene, 0, Some(area), None) | ||
val green = RasterRef(RasterSource(scene(3)), 0, Some(area), None) | ||
val blue = RasterRef(RasterSource(scene(2)), 0, Some(area), None) | ||
|
||
val rf = Seq((red, green, blue)).toDF("red", "green", "blue") | ||
val df = rf.select( | ||
rf_crs($"red"), rf_extent($"red"), rf_tile($"red"), rf_tile($"green"), rf_tile($"blue")) | ||
.toDF | ||
|
||
val raster = TileRasterizerAggregate.collect(df, redScene.crs, None, None) | ||
|
||
forEvery(raster.tile.statisticsDouble) { stats => | ||
stats should be ('defined) | ||
stats.get.dataCells shouldBe > (1000L) | ||
} | ||
|
||
//import geotrellis.raster.io.geotiff.{GeoTiffOptions, MultibandGeoTiff, Tiled} | ||
//import geotrellis.raster.io.geotiff.compression.{DeflateCompression, NoCompression} | ||
//import geotrellis.raster.io.geotiff.tags.codes.ColorSpace | ||
//val tiffOptions = GeoTiffOptions(Tiled, DeflateCompression, ColorSpace.RGB) | ||
//MultibandGeoTiff(raster, raster.crs, tiffOptions).write("target/composite.tif") | ||
} | ||
} | ||
} |
Oops, something went wrong.