corteva / rioxarray

geospatial xarray extension powered by rasterio
https://corteva.github.io/rioxarray
Other
526 stars 83 forks source link

clip->crop #21

Closed snowman2 closed 5 years ago

snowman2 commented 5 years ago

crop is probably the better name for clipping/cropping rasters.

snowman2 commented 5 years ago

It seems GEE uses clip. Maybe crop could be an ailias for clip?

djhoese commented 5 years ago

What is GEE? Google Earth Engine? If you are going that route then what about numpy's clip which does something different...kind of?

djhoese commented 5 years ago

Ok just asked @dopplershift and his thought was:

  1. if you don't have the data already then it would be subsetting
  2. if you have the data and want to get a smaller chunk of data then it is cropping (manipulating data)
  3. if you are drawing the data and only want to draw part of it then that is clipping
snowman2 commented 5 years ago

I did a google search with crop raster and I had a mix of crop and clip show up. In QGIS & ArcGIS, they seem to like clip though:

With clip in the rio namespace, I am thinking it shouldn't conflict with the xarray version of clip.

xds = xarray.open_rasterio("???")
xds.clip(...)
xds.rio.clip(...)

Thoughts?

djhoese commented 5 years ago

So the only thing I keep thinking is that all the tools you are talking about that use clipping are also visualizing the data. rioxarray isn't visualizing necessarily. I did some googling of "crop versus clip" and one thing that popped up was photoshop which uses crop as "anything outside this shape is removed" and clip as "anything outside this shape is hidden". Since rioxarray is returning a new object I'm not sure what the best name is for that, especially since it is likely a "view" of the original data.

Clip is fine.

snowman2 commented 5 years ago

Random side note, just saw this: https://gis.stackexchange.com/questions/328128/extract-data-within-a-geometry-shape

snowman2 commented 5 years ago

Also, based on this issue: https://github.com/pydata/xarray/issues/501, I am wondering if there should be an argument or something that only masks the data instead of dropping the outer regions. This is probably what you mean by the difference between clip and crop. However, with others being used to clip, I am concerned it would cause confusion in the transition between GEE, ArcGIS, and QGIS to rioxarray.

snowman2 commented 5 years ago

Closing for now. If you have some other thoughts on the subject, feel free to continue.

snowman2 commented 5 years ago

Just had a chuckle after remembering this discussion and connecting that corteva is an agricultural company ... crop should have been the obvious choice 😂