-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolved #2601 by updating the various read attribute methods so that…
… they take into account the LayerType before reading the attribute Signed-off-by: Jacob Bouffard <jbouffard@azavea.com> Updated the various COG backends so that they use the new attribute methods Signed-off-by: Jacob Bouffard <jbouffard@azavea.com> Created the COGAttributeStoreSpec Signed-off-by: Jacob Bouffard <jbouffard@azavea.com> Created the COGFileAttributeStoreSpec Signed-off-by: Jacob Bouffard <jbouffard@azavea.com> Created the COGHadoopAttributeStoreSpec Signed-off-by: Jacob Bouffard <jbouffard@azavea.com> Created the COGS3AttributeStoreSpec Signed-off-by: Jacob Bouffard <jbouffard@azavea.com> Trying to perform the readKeyIndex method on a COGLayer now throws an UnsupportedOperationException Signed-off-by: Jacob Bouffard <jbouffard@azavea.com>
- Loading branch information
Jacob Bouffard
committed
May 1, 2018
1 parent
4ea9cc1
commit 158028b
Showing
18 changed files
with
206 additions
and
34 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
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
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
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
33 changes: 33 additions & 0 deletions
33
s3/src/test/scala/geotrellis/spark/io/s3/cog/COGS3AttributeStoreSpec.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,33 @@ | ||
/* | ||
* Copyright 2016 Azavea | ||
* | ||
* 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. | ||
*/ | ||
|
||
package geotrellis.spark.io.s3.cog | ||
|
||
import geotrellis.spark._ | ||
import geotrellis.spark.io._ | ||
import geotrellis.spark.io.cog._ | ||
import geotrellis.spark.io.s3._ | ||
import geotrellis.spark.io.s3.testkit._ | ||
|
||
class COGS3AttributeStoreSpec extends COGAttributeStoreSpec { | ||
val bucket = "attribute-store-test-mock-bucket" | ||
val prefix = "catalog" | ||
|
||
lazy val header = S3LayerHeader("geotrellis.spark.SpatialKey", "geotrellis.raster.Tile", bucket, prefix, COGLayerType) | ||
lazy val attributeStore: AttributeStore = new S3AttributeStore(bucket, prefix) { | ||
override val s3Client = new MockS3Client() | ||
} | ||
} |
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
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
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
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
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
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
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
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
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
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
69 changes: 69 additions & 0 deletions
69
spark/src/test/scala/geotrellis/spark/io/cog/COGAttributeStoreSpec.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,69 @@ | ||
/* | ||
* Copyright 2016 Azavea | ||
* | ||
* 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. | ||
*/ | ||
|
||
package geotrellis.spark.io.cog | ||
|
||
import geotrellis.spark._ | ||
import geotrellis.spark.io._ | ||
import geotrellis.spark.io.index._ | ||
import geotrellis.spark.testkit.testfiles.cog._ | ||
import geotrellis.spark.summary._ | ||
import geotrellis.raster.io._ | ||
import geotrellis.raster.histogram._ | ||
import geotrellis.spark.testkit._ | ||
|
||
import org.scalatest._ | ||
import spray.json._ | ||
import spray.json.DefaultJsonProtocol._ | ||
|
||
abstract class COGAttributeStoreSpec | ||
extends FunSpec | ||
with Matchers | ||
with TestEnvironment | ||
with COGTestFiles { | ||
def attributeStore: AttributeStore | ||
def header: LayerHeader | ||
|
||
val cogLayer = COGLayer.fromLayerRDD(spatialCea, zoomLevelCea) | ||
val keyIndexes = cogLayer.metadata.zoomRangeInfos.map { case (z, b) => z -> ZCurveKeyIndexMethod.createIndex(b) }.toMap | ||
val storageMetadata = COGLayerStorageMetadata(cogLayer.metadata, keyIndexes) | ||
|
||
val layerId = LayerId("test-cog-layer", 0) | ||
|
||
it("should write the COGLayerAttributes") { | ||
attributeStore.writeCOGLayerAttributes(layerId, header, storageMetadata) | ||
} | ||
|
||
it("should read the COGLayerAttributes") { | ||
attributeStore.readCOGLayerAttributes[LayerHeader, COGLayerStorageMetadata[SpatialKey]](layerId) | ||
} | ||
|
||
it("should be a COGLayer") { | ||
attributeStore.isCOGLayer(layerId) should be (true) | ||
} | ||
|
||
it("should read the metadata of the catalog") { | ||
attributeStore.readMetadata[COGLayerStorageMetadata[SpatialKey]](layerId) | ||
} | ||
|
||
it("should read the header of the catalog") { | ||
attributeStore.readHeader[LayerHeader](layerId) | ||
} | ||
|
||
it("should read the keyIndexes of the catalog") { | ||
attributeStore.readKeyIndexes[SpatialKey](layerId) | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
spark/src/test/scala/geotrellis/spark/io/file/cog/COGFileAttributeStoreSpec.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,27 @@ | ||
/* | ||
* Copyright 2016 Azavea | ||
* | ||
* 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. | ||
*/ | ||
|
||
package geotrellis.spark.io.file.cog | ||
|
||
import geotrellis.spark._ | ||
import geotrellis.spark.io.{LayerHeader, COGLayerType} | ||
import geotrellis.spark.io.cog._ | ||
import geotrellis.spark.io.file._ | ||
|
||
class COGFileAttributeStoreSpec extends COGAttributeStoreSpec { | ||
lazy val attributeStore = FileAttributeStore(outputLocalPath) | ||
lazy val header = FileLayerHeader("geotrellis.spark.SpatialKey", "geotrellis.raster.Tile", outputLocalPath, COGLayerType) | ||
} |
Oops, something went wrong.