Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Geotrellis #79

Merged
merged 22 commits into from
Oct 30, 2020
Merged

Upgrade Geotrellis #79

merged 22 commits into from
Oct 30, 2020

Conversation

jterry64
Copy link
Member

@jterry64 jterry64 commented Oct 6, 2020

Updated Geotrellis to latest release, 3.5.0.

The main significant changes this entailed:

  • The polygonal summary API was moved from contrib to the main library. In the new version, CellVisitor was replaced by GridVisitor which works slightly differently. So had to change Summary classes for each analysis to use that API.
  • The GeotiffRasterSource was also moved contrib to a general RasterSource API in the new version. Part of this API is a LayoutTileSource class, which wraps around a GeotiffRasterSource and lets you read a window directly using the LayoutDefinition and a spatial key. Reading windows using the mapTransform extent was now causing weird one-off errors with the window size, so had to switch to using this.
  • Geotrellis got rid of the S3 client wrapper they had before, so had to directly use the S3 API.
  • A lot of the test suites and some of the utils were causing lots of compilations errors with new version, but it didn't look we were using most of them. Some seemed like leftover example code from the original workshop. So I just deleted ones causing errors that weren't used.

Also changed to read using GDAL. This has a few caveats:

  • For some reason, our NBITS=1 rasters were causing a segmentation fault. I talked with Azavea and it looks like this is probably a bug with either geotrellis or GDAL 3, so filed a bug, and for now just using the normal geotiff versions: GDALRasterSource gives segmentation fault when reading rasters with NBITS=1 locationtech/geotrellis#3300
  • This requires some updates from clients I'll include the release notes. Specifically, clients now must submit bootstrap actions to install GDAL, and update some of the spark config options.

val tile = source.synchronized {
source.read(window).get.tile.band(0)
layoutSource.read(windowKey).get.band(0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy found an issue: Usage of get on optional type.

Copy link
Contributor

@thomas-maschler thomas-maschler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me.

Please check if you can update scala to 2.12 as well and also update to the latest hadoop, spark and EMR version.

With geotrellis updated we should be able to get grid of the cropWindow function which was a poor hack anyways
https://github.com/wri/gfw_forest_loss_geotrellis/pull/79/files#diff-6923804677e730eecbd92506b9516a84f0ef44e050a0ec9134e05af8393b175cL257-L278

It was due to this issue locationtech/geotrellis#2918

Just to confirm, can we now use the requester-pays option for S3 reads? I didn't see any config changes.

project/Dependencies.scala Outdated Show resolved Hide resolved
project/Dependencies.scala Outdated Show resolved Hide resolved
project/Dependencies.scala Outdated Show resolved Hide resolved
src/main/scala/org/globalforestwatch/util/Implicits.scala Outdated Show resolved Hide resolved
build.sbt Show resolved Hide resolved
build.sbt Show resolved Hide resolved
build.sbt Outdated Show resolved Hide resolved
@thomas-maschler
Copy link
Contributor

To confirm is the requester pays option handled? If yes how?
The crop window function is still in the Layer.scala package. Eventually we should get rid of it. (see comments above)

@jterry64
Copy link
Member Author

@thomas-maschler oh sorry, somehow lost track of those comments when going back. Will just quickly fix those before merging.

@jterry64 jterry64 merged commit 6618f20 into develop Oct 30, 2020
@thomas-maschler thomas-maschler deleted the feature/UpgradeGeotrellis branch March 11, 2021 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants