# 06: Raster 2 - Reprojection, clipping, spatial aggregation, zonal stats 

UW Geospatial Data Analysis  
CEE467/CEWA567  
David Shean, Eric Gagliano, Quinn Brencher

## Overview
This week, we are going to revisit rasters. We will cover common operations and strategies, including reprojection, clipping, sampling, and zonal statistics.

## Reading and Tutorials
Please take some time to review the following material (especially if you have limited GIS experience), and come with questions on topics that are unclear, so we can discuss together. 


## Raster operations
* Reprojection
  * [rioxarray](https://corteva.github.io/rioxarray/stable/examples/reproject.html)
    * [reproject_match](https://corteva.github.io/rioxarray/stable/examples/reproject_match.html)
  * [rasterio](https://rasterio.readthedocs.io/en/latest/topics/reproject.html)
  * [GDAL](https://gdal.org/programs/gdalwarp.html)

* Clipping / masking
  * [rioxarray](https://corteva.github.io/rioxarray/stable/examples/clip_geom.html)
  * [rasterio](https://rasterio.readthedocs.io/en/latest/topics/masking-by-shapefile.html)

* Resampling / interpolation
  * [Resampling](https://gisgeography.com/raster-resampling/)

* Sampling a raster over polygon area: zonal stats
  * [rasterstats](https://pythonhosted.org/rasterstats/)
  * [zonal stats](https://pythonhosted.org/rasterstats/manual.html#zonal-statistics)

* Rasterization
  * [rasterization](https://pygis.io/docs/e_raster_rasterize.html)
  * [lidar points to pixels](https://www.earthdatascience.org/courses/use-data-open-source-python/data-stories/what-is-lidar-data/lidar-points-to-pixels-raster/)


* full workflow
  * [Nice examples of raster reprojection, clipping, subtraction and export](https://www.earthdatascience.org/courses/use-data-open-source-python/intro-raster-data-python/raster-data-processing/) 

