Material for the 'Working with Geospatial Hydrologic Data for Watershed Analyses in R and Python Using Web Services' ICRW8 Workshop
For working with R, you can use RStudio and you will need the following libraries installed:
library(remotes)
library(sf)
library(lwgeom)
library(ggplot2)
library(jsonlite)
library(httr)
library(data.table)
library(dplyr)
library(readr)
library(knitr)
library(rnaturalearth)
library(stringr)
library(osmdata)
library(mapview)
library(dataRetrieval)
library(terra)
library(raster)
library(stars)
library(remotes)
library(elevatr)
remotes::install_github("mhweber/awra2020spatial")
library(awra2020spatial)
remotes::install_github("mhweber/Rspatialworkshop")
library(Rspatialworkshop)
remotes::install_github("mikejohnson51/AOI")
#hydroloom
remotes::install_github("DOI-USGS/nhdplusTools@2cb81da"
library(hydroloom)
library(AOI)
library(terrainr)
#StreamCatTools
remotes::install_github("USEPA/StreamCatTools")
library(StreamCatTools)
#nwmTools
remotes::install_github("mikejohnson51/nwmTools")
library(nwmTools)
library(cowplot)
# zonal
# remotes::install_github("NOAA-OWP/zonal")
library(zonal)
For running Python notebooks you can use a combination of Miniforge or Mambaforge and Jupyter Lab or other IDE.
After installingminiforge
or mambaforge
you can create a Python environment as follows:
git clone https://github.com/mhweber/ICRW8_Geospatial_Workshop && \
cd ICRW8_Geospatial_Workshop && \
conda env create -f environment.yml
or
git clone https://github.com/mhweber/ICRW8_Geospatial_Workshop && \
cd ICRW8_Geospatial_Workshop && \
mamba env create -f environment.yml
Now a new environment called icrw8
is created that can be loaded from your IDE.
You can also use the Binder service by clicking on the Binder badge above to launch a Jupyter Lab instance with all the required Python libraries installed.
Here is a list of some useful geospatial tools and resources:
- Hydroinformatics in R: Extensive Notes and exercises for a course on data analysis techniques in hydrology using the programming language R
- Spatial Data Science by Edzar Pebesma and Roger Bivand
- Geocomputation with R
- r-spatial: Suite of fundamental packages for working with spatial data in R
- Working with Geospatial Hydrologic Data Using Web Services (R)
- Accessing REST API (JSON data) using httr and jsonlite
- Datashader: Accurately render even the largest data
- GeoPandas
- HyRiver: a suite of Python packages that provides a unified API for retrieving geospatial/temporal data from various web services
- leafmap: A Python package for geospatial analysis and interactive mapping in a Jupyter environment
- Python Foundation for Spatial Analysis
- Python for Geographic Data Analysis
- gdptools A Python package for grid- or polygon-polygon area-weighted interpolation statistics
- Intro to Python GIS
- xarray: An open-source project and Python package that makes working with labeled multi-dimensional arrays simple, efficient, and fun!
- rioxarray: Rasterio xarray extension.
- GeoPandas: An open-source project to make working with geospatial data in python easier.
- OSMnx: A Python package that lets you download and analyze geospatial data from OpenStreetMap.
- Xarray Spatial: Implements common raster analysis functions using
numba
and provides an easy-to-install, easy-to-extend codebase for raster analysis.