rioxarray icon indicating copy to clipboard operation
rioxarray copied to clipboard

DOC: Add plotting documentation

Open snowman2 opened this issue 4 years ago • 3 comments

Would be good to add tips for common gotchas:

  • Singleband rasters: https://github.com/corteva/rioxarray/issues/175
  • RGB rasters: https://corteva.github.io/rioxarray/stable/examples/COG.html
  • Large rasters: https://gis.stackexchange.com/questions/384577/open-and-plot-a-large-raster-with-python-xarray
  • Preventing spatial_ref = 0 in plot title (#443)

snowman2 avatar Jan 19 '21 17:01 snowman2

@lwasser, any issues if I reference this in plotting docs?

snowman2 avatar Jan 29 '21 20:01 snowman2

@snowman2 no issues what so ever!! We are happy for you to reference any of our lessons!

I've been meaning to mention that we've run into some plotting issues with xarray / rioxarray plotting with RGB images and some image dtypes (floats, etc) as rasterio struggles to convert to INT8 for plotting. We actually implemented bytescale in earthpy given it was deprecated in scipy and have two plotting functions that we've been using to circumvent this issue. At some point i'm happy to either share earthpy with another tool or adjust how we plot. it becomes an issue with multi band data. i'd prefer to use xarray / rioxarray plotting but our wrappers handle the datatype / scaling issue. i'm open to following up on this in a separate discussion as perhaps there is a better way to teach it as well that I don't know about!

lwasser avatar Feb 02 '21 17:02 lwasser

We are happy for you to reference any of our lessons!

Perfect, thanks :+1:

we've run into some plotting issues with xarray / rioxarray plotting with RGB images and some image dtypes (floats, etc) as rasterio struggles to convert to INT8 for plotting

It might be worth a separate issue, but you could post information on it here as well as it might be something that could be dealt with via documentation.

At some point i'm happy to either share earthpy with another tool or adjust how we plot.

Thanks for your offer. Not quite sure about taking on custom plotting code yet. I would prefer to attempt to look into seeing if it could work with currently existing methods first in case there is the opportunity to reduce code.

snowman2 avatar Feb 03 '21 15:02 snowman2