geocompx / geocompy

Geocomputation with Python: an open source book and online resource for getting started in this space
https://py.geocompx.org/
Other
260 stars 47 forks source link

Try xarray #192

Closed Robinlovelace closed 11 months ago

michaeldorman commented 11 months ago

Hi @Robinlovelace , thanks for this, it's a good option, however I suggest to use osgeo.gdal for this, such as here: https://stackoverflow.com/questions/47653271/calculating-aspect-slope-in-python3-x-matlab-gradientm-function which is already used in the contour example in chapter 5. Will be happy to hear what you think

michaeldorman commented 11 months ago

Another option could be to go back to the command line gdal_contour for the contour example, and accordingly to use command line gdaldem for the slope and aspect examples. These don't have to be evaluated I guess, we could say that it is for the reader to explore in case they need these and other operations that are easier done using GDAL than in Python.

Robinlovelace commented 11 months ago

Hi @Robinlovelace , thanks for this, it's a good option, however I suggest to use osgeo.gdal for this, such as here: https://stackoverflow.com/questions/47653271/calculating-aspect-slope-in-python3-x-matlab-gradientm-function which is already used in the contour example in chapter 5. Will be happy to hear what you think

Sounds like a good plan :+1:

Robinlovelace commented 11 months ago

gdal_contour and other GDAL options also sound good to me, whichever works best for you. I think there are some bits of this PR that may be worth keeping, notably the de-emphasizing of richdem so feel free to checkout this PR and make additional changes.

Alternatively, I can update this PR so it makes no change to the Python code by lays the foundations for a future change. Would that be useful?

michaeldorman commented 11 months ago

gdal_contour and other GDAL options also sound good to me, whichever works best for you. I think there are some bits of this PR that may be worth keeping, notably the de-emphasizing of richdem so feel free to checkout this PR and make additional changes.

Alternatively, I can update this PR so it makes no change to the Python code by lays the foundations for a future change. Would that be useful?

Sure, thanks! I've merged and then will edit the code parts

Robinlovelace commented 11 months ago

Sounds like a plan and didn't think of that third option which in hindsight was best: merge + edit!