carpentries-incubator / geospatial-python

Introduction to Geospatial Raster and Vector Data with Python
https://carpentries-incubator.github.io/geospatial-python/
Other
159 stars 57 forks source link

Episode 2: Reprojecting with Rioxarray #9

Closed rbavery closed 4 years ago

rbavery commented 4 years ago

This is the first draft of episode 2, Reprojecting with Rioxarray (and Rasterio). The episode draft can be viewed here: https://rbavery.github.io/geospatial-python/02-raster-reproject/index.html

I chose to change up the order that's used in the R lesson, since it gets to covering xarray/rioxarray sooner, which I think should be used throughout the lesson. It also simplifies (in a good way I think) the path toward creating a Canopy Height Model by removing the challenges and any use of the hillshade data. Only the surface model and the terrain model for the HARV and SJER sites are used.

The episode uses a new WGS84 projected tif for each forest site. I plan to upload a slimmed down data package compared to the 270Mb zip file distributed by the R lesson, which will only include files used in the lesson. I'll make sure to link that here with the new files I created for this episode.

Curious to here if this introduction of rasterio and rioxarray makes sense. Most folks probably aren't familiar with rioxarray: https://github.com/corteva/rioxarray It's a powerful extension to xarray that makes rasters much easier to work with as xarray DataArrays by providing operations to geospatially reproject, clip, and regrid rasters. I've tested this code and used rioxarray in my own work and have found that it feels more natural for data science than rasterio.

djhoese commented 4 years ago

I saw the mention of the PROJ string for the EPSG code. I'm wondering how teaching these topics is evolving or will evolve since the PROJ C library/project is now deprecating PROJ strings in favor of WKT. In my opinion WKT is not as easy to teach or even read, but I'm not sure if PROJ strings will have a future.

rbavery commented 4 years ago

@djhoese thanks for the heads up, I wasn't aware of this. I've glanced at https://proj.org/faq.html#what-is-the-best-format-for-describing-coordinate-reference-systems and I think it probably makes sense to not reference proj throughout the lesson.

Maybe we should focus on inspecting metadata attributes (transform, linear units, bounds, shape) as they are read in by rasterio/rioxarray? That way we emphasize what the metadata means rather than the minutia of a particular format. Then we can focus on describing EPSG codes and, briefly, WKT. After that, a dropdown tip could explain the Proj format (since it does still show up fairly often and is used in the R geospatial lesson) and that it will be deprecated.

I've only ever had to use/look at proj strings or WKT for images without EPSG codes, which has been rare in my experience (for example, for the current iteration of Landsat Analysis Ready Data). So I might be biased and it might be important to walk folks through the WKT format in more detail, not sure.

djhoese commented 4 years ago

it might be important to walk folks through the WKT format in more detail, not sure.

Then there is the question of what version of WKT :stuck_out_tongue_winking_eye: (WKT2).

I like the idea of going over bounds and shape and other attributes. I don't have time right this second to look at the lessons again (and I've never looked at the R lessons) but I think if students understand what the purpose of the projection/EPSG/WKT/PROJ definition is and how we might be in a different coordinate system than regular lon/lat equirectangular when working with this data that would be a huge step in understanding. Or maybe I'm being too ambitious.

rbavery commented 4 years ago

I think if students understand what the purpose of the projection/EPSG/WKT/PROJ definition is and how we might be in a different coordinate system than regular lon/lat equirectangular when working with this data that would be a huge step in understanding. Or maybe I'm being too ambitious.

I think that's definitely the goal, and thanks for your input @djhoese. I'll see if I can improve the sections where we refer to projection formats to focus on interpreting the same elements of WKT that are present in PROJ strings. I'm going to merge this PR as is since I'll be teaching it soon but reviews/contributions via another PR are very much welcome.