-
Notifications
You must be signed in to change notification settings - Fork 364
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
Add dynamic ZFactor for slope calculation #3014
Add dynamic ZFactor for slope calculation #3014
Conversation
There was a problem hiding this comment.
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
layer/src/main/scala/geotrellis/layer/mapalgebra/focal/FocalTileLayerCollectionMethods.scala
Outdated
Show resolved
Hide resolved
spark/src/main/scala/geotrellis/spark/mapalgebra/focal/FocalTileLayerRDDMethods.scala
Outdated
Show resolved
Hide resolved
@pomadchin Thanks! I should've resolved the issues you pointed out. Also, thanks for reminding me about the headers. I knew I forgot something... |
There was a problem hiding this comment.
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.
raster/src/main/scala/geotrellis/raster/mapalgebra/focal/Unit.scala
Outdated
Show resolved
Hide resolved
spark/src/main/scala/geotrellis/spark/mapalgebra/focal/FocalOperation.scala
Show resolved
Hide resolved
spark/src/main/scala/geotrellis/spark/mapalgebra/focal/FocalOperation.scala
Show resolved
Hide resolved
unit match { | ||
case Feet => | ||
ZFactorCalculator((lat: Double) => 1 / (LAT_LNG_FEET_AT_EQUATOR * math.cos(math.toRadians(lat)))) | ||
case Meters => | ||
ZFactorCalculator((lat: Double) => 1 / (LAT_LNG_METERS_AT_EQUATOR * math.cos(math.toRadians(lat)))) | ||
} | ||
|
||
def createZFactorCalculator(mappedLats: Map[Double, Double]): ZFactorCalculator = { | ||
def createCalculator(mappedLats: Map[Double, Double]): ZFactorCalculator = { |
There was a problem hiding this comment.
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
raster/src/main/scala/geotrellis/raster/mapalgebra/focal/ZFactorCalculator.scala
Outdated
Show resolved
Hide resolved
raster/src/main/scala/geotrellis/raster/mapalgebra/focal/ZFactorCalculator.scala
Outdated
Show resolved
Hide resolved
I'm 👍 on |
Signed-off-by: Jacob Bouffard <jbouffard@azavea.com>
Signed-off-by: Jacob Bouffard <jbouffard@azavea.com>
…to use the ZFactorCalculator Signed-off-by: Jacob Bouffard <jbouffard@azavea.com>
Signed-off-by: Jacob Bouffard <jbouffard@azavea.com>
Signed-off-by: Jacob Bouffard <jbouffard@azavea.com>
Signed-off-by: Jacob Bouffard <jbouffard@azavea.com>
Signed-off-by: Jacob Bouffard <jbouffard@azavea.com>
…kage object Signed-off-by: Jacob Bouffard <jbouffard@azavea.com>
Signed-off-by: Jacob Bouffard <jbouffard@azavea.com>
Signed-off-by: Jacob Bouffard <jbouffard@azavea.com>
Signed-off-by: Jacob Bouffard <jbouffard@azavea.com>
Signed-off-by: Jacob Bouffard <jbouffard@azavea.com>
Signed-off-by: Jacob Bouffard <jbouffard@azavea.com>
Signed-off-by: Jacob Bouffard <jbouffard@azavea.com>
Signed-off-by: Jacob Bouffard <jbouffard@azavea.com>
…thods Signed-off-by: Jacob Bouffard <jbouffard@azavea.com>
Signed-off-by: Jacob Bouffard <jbouffard@azavea.com>
2cf3f86
to
507c783
Compare
Just created the CQ for squants: https://dev.eclipse.org/ipzilla/show_bug.cgi?id=20340#c0 |
layer/src/main/scala/geotrellis/layer/mapalgebra/focal/CollectionFocalOperation.scala
Outdated
Show resolved
Hide resolved
spark/src/main/scala/geotrellis/spark/mapalgebra/focal/FocalOperation.scala
Outdated
Show resolved
Hide resolved
spark/src/main/scala/geotrellis/spark/mapalgebra/focal/FocalOperation.scala
Show resolved
Hide resolved
Signed-off-by: Jacob Bouffard <jbouffard@azavea.com>
@jbouffard heads up, you attached the artifact jar instead of the source jar on that CQ request. |
Overview
This PR adds the
ZFactor
class as a way of producing the correctzFactor
when calculatingslope
. Before, thezFactor
had a default value of 1. However, this doesn't make sense, as thezFactor
needs to be calculated on a per-tile bases. TheZFactor
class will help by deriving the appropriateZFactor
for each tile depending on its spatial position.Checklist
docs/CHANGELOG.rst
updated, if necessaryCloses #2548