├── .gitattributes ├── .gitignore ├── README.md ├── data ├── howto-download-ivalo-data.mp4 ├── howto-osm-id.mp4 └── ivalo │ ├── README.md │ └── ivalo.nc ├── environment.yaml ├── rem-in-xarray-tutorial.ipynb └── requirements.txt /.gitattributes: -------------------------------------------------------------------------------- 1 | *.nc filter=lfs diff=lfs merge=lfs -text 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | cache 2 | .ipynb_checkpoints 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![](https://i.imgur.com/bYXzIWY.png) 2 | # Relative Elevation Model 3 | Tutorial on creating a [relative elevation model](https://ngmdb.usgs.gov/Info/dmt/docs/DMT16_Coe.pdf) in Python using [xarray](https://xarray.pydata.org/) and [datashader](https://datashader.org/). 4 | 5 | Based on [*Creating REMs in QGIS with the IDW Method*](https://dancoecarto.com/creating-rems-in-qgis-the-idw-method) by [Dan Coe](https://twitter.com/geo_coe). 6 | 7 | 8 | # Try it out 9 | 10 |

11 | 💧 Binder 💧 Colab 💧 nbviewer 💧 12 |

13 | 14 | # Run locally 15 | 16 | ### Conda 17 | ```bash 18 | conda env create -f environment.yaml 19 | conda activate rem-tutorial 20 | jupyter notebook 21 | ``` 22 | 23 | ### venv 24 | ```bash 25 | python -m venv rem-tutorial 26 | source rem-tutorial/bin/activate 27 | pip install -r requirements.txt 28 | jupyter notebook 29 | ``` 30 | 31 | ### Downloading the sample data 32 | If you have [git-lfs](https://git-lfs.github.com/) installed, the sample data gets cloned with this repository automatically. 33 | 34 | Alternatively, you can follow [the video](https://nbviewer.org/github/DahnJ/REM-xarray/blob/master/rem-in-xarray-tutorial.ipynb#VIDEO:-How-to-download-data-from-NLS) on downloading the original raster data. 35 | 36 | On Debian, Git LFS can be installed by 37 | ```bash 38 | curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash 39 | apt-get install git-lfs 40 | git lfs install 41 | ``` 42 | 43 | # Examples 44 | 45 | ![](https://i.imgur.com/MFagpMt.jpg) 46 | ![](https://i.imgur.com/jRXcHVi.jpg) 47 | ![](https://i.imgur.com/2XcHIZW.jpg) 48 | 49 | 50 | # REMs in other languages/tools 51 | - [QGIS](https://dancoecarto.com/creating-rems-in-qgis-the-idw-method) by [Dan Coe](https://twitter.com/geo_coe) 52 | - [Google Earth Engine](https://twitter.com/KelMarkert/status/1509714680364748801) by [Kel Markert](https://twitter.com/KelMarkert) 53 | - [RiverREM](https://github.com/klarrieu/RiverREM), a Python package for producing REMs automatically, by [Kenneth Larrieu](https://github.com/klarrieu) 54 | -------------------------------------------------------------------------------- /data/howto-download-ivalo-data.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DahnJ/REM-xarray/de82ee6e5995d774743f5c276c3c1512281a518b/data/howto-download-ivalo-data.mp4 -------------------------------------------------------------------------------- /data/howto-osm-id.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DahnJ/REM-xarray/de82ee6e5995d774743f5c276c3c1512281a518b/data/howto-osm-id.mp4 -------------------------------------------------------------------------------- /data/ivalo/README.md: -------------------------------------------------------------------------------- 1 | Data from [National Land Survey of Finland](https://www.maanmittauslaitos.fi/en), distributed under [National Land Survey open data Attribution CC 4.0 licence](https://www.maanmittauslaitos.fi/en/opendata-licence-cc40). -------------------------------------------------------------------------------- /data/ivalo/ivalo.nc: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:112ba22d63c69120d4d6eeae4a1b9e32a2540c262d8ec95a32948aae43798448 3 | size 144098584 4 | -------------------------------------------------------------------------------- /environment.yaml: -------------------------------------------------------------------------------- 1 | name: rem-tutorial 2 | channels: 3 | - conda-forge 4 | dependencies: 5 | - python=3.8 6 | - datashader 7 | - geopandas 8 | - matplotlib 9 | - notebook 10 | - numpy 11 | - osmnx 12 | - pandas 13 | - rioxarray 14 | - scipy 15 | - shapely 16 | - xarray-spatial 17 | - xarray 18 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | # This file may be used to create an environment using: 2 | # $ conda create --name --file 3 | 4 | datashader 5 | geopandas 6 | matplotlib 7 | notebook 8 | numpy 9 | osmnx 10 | pandas 11 | rioxarray 12 | scipy 13 | shapely 14 | xarray-spatial 15 | xarray 16 | --------------------------------------------------------------------------------