Skip to content

Add dynamic ZFactor for slope calculation - #3014

Merged
pomadchin merged 18 commits into
locationtech:masterfrom
jbouffard:feature/zfactor-calculator-con
Jul 19, 2019
Merged

pomadchin merged 18 commits into
locationtech:masterfrom
jbouffard:feature/zfactor-calculator-con

Conversation

@jbouffard

@jbouffard jbouffard commented Jul 8, 2019 •

Copy link
Copy Markdown
Contributor

Overview

This PR adds the ZFactor class as a way of producing the correct zFactor when calculating slope. Before, the zFactor had a default value of 1. However, this doesn't make sense, as the zFactor needs to be calculated on a per-tile bases. The ZFactor class will help by deriving the appropriate ZFactor for each tile depending on its spatial position.

Checklist

  • docs/CHANGELOG.rst updated, if necessary
  • New user API has useful Scaladoc strings
  • Unit tests added for bug-fix or new feature

Closes #2548

@pomadchin pomadchin left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A nice ZFactor port! Some code style questions remaining and there are no headers generated for new files. See https://github.com/sbt/sbt-header#creating-headers

Comment thread docs/CHANGELOG.rst Outdated
@jbouffard

Copy link
Copy Markdown
Contributor Author

@pomadchin Thanks! I should've resolved the issues you pointed out. Also, thanks for reminding me about the headers. I knew I forgot something...

@echeipesh echeipesh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Lots of comments about naming. I feel now that this code is being lifted from geopyspark-backend where there was no user interaction its important to reconsider the naming decisions since this is going to be the front and center API for GT scala.

Comment thread raster/src/main/scala/geotrellis/raster/mapalgebra/focal/Unit.scala Outdated
}

def createZFactorCalculator(mappedLats: Map[Double, Double]): ZFactorCalculator = {
def createCalculator(mappedLats: Map[Double, Double]): ZFactorCalculator = {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A little pedantic but I still think worth pointing out words like create are generally filler words in function names. Constructors create an object, functions return a value. Unless there is a special significance to the fact that you're getting a new instance, if it has surprisingly high resource requirement for instance, they are unnecessary.

createCalculator is more meaningful as interpolateFromTable - given that interpolation is the critical thing that it does.

createLatLngCalculator is as meaningful and shorter as forLatLng giving you the following full path ZFactorCalculator.forLatLng

Comment thread raster/src/main/scala/geotrellis/raster/mapalgebra/focal/ZFactorCalculator.scala Outdated
Comment thread raster/src/main/scala/geotrellis/raster/mapalgebra/focal/ZFactorCalculator.scala Outdated
@echeipesh

Copy link
Copy Markdown
Contributor

I'm 👍 on squants after realizing there still isn't a standard Java units library.
Just checked, it needs CQ added: https://github.com/locationtech/geotrellis/blob/master/docs/CQ.rst

jbouffard added 17 commits July 10, 2019 10:44
Signed-off-by: Jacob Bouffard <[email protected]>
…to use the ZFactorCalculator

Signed-off-by: Jacob Bouffard <[email protected]>
Signed-off-by: Jacob Bouffard <[email protected]>
Signed-off-by: Jacob Bouffard <[email protected]>
Signed-off-by: Jacob Bouffard <[email protected]>
Signed-off-by: Jacob Bouffard <[email protected]>
Signed-off-by: Jacob Bouffard <[email protected]>
Signed-off-by: Jacob Bouffard <[email protected]>
Signed-off-by: Jacob Bouffard <[email protected]>
@jbouffard
jbouffard force-pushed the feature/zfactor-calculator-con branch from 2cf3f86 to 507c783 Compare July 10, 2019 14:45
@jbouffard

Copy link
Copy Markdown
Contributor Author

Just created the CQ for squants: https://dev.eclipse.org/ipzilla/show_bug.cgi?id=20340#c0

Comment thread spark/src/main/scala/geotrellis/spark/mapalgebra/focal/FocalOperation.scala Outdated
Signed-off-by: Jacob Bouffard <[email protected]>
@echeipesh echeipesh changed the title ZFactorCalculator Add dynamic ZFactor for slope calculation Jul 10, 2019
@echeipesh

Copy link
Copy Markdown
Contributor

@jbouffard heads up, you attached the artifact jar instead of the source jar on that CQ request.

@pomadchin
pomadchin merged commit c6f424d into locationtech:master Jul 19, 2019
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.

Create a Method That Calculates ZFactor

3 participants