satellogic / telluric

telluric is a Python library to manage vector and raster geospatial data in an interactive and easy way
MIT License
87 stars 18 forks source link

resize and similar methods should conserve raster mutability #304

Closed AmitAronovitch closed 3 years ago

AmitAronovitch commented 3 years ago

Expected behavior and actual behavior

When working with MutableGeoRaster, one could expect that "transformation methods" such as resize()would also yield mutable rasters (it is also the more common usecase, since if you are building a raster yourself, and then resizing it, chances are that you might be interested in applying more transformations).

It seems that this (and other similar methods) call copy_with, which supports user-specified mutability but defaults to immutable. The suggested behavior for this function is that if user does not specify explicitly the mutability, then the default should be the mutability of the raster being copied, rather than False. This should result in the suggested behavior for the other functions as well.

Steps to reproduce the problem

rs = tl.GeoRaster2.open("https://github.com/mapbox/rasterio/raw/master/tests/data/rgb_deflate.tif", mutable=True, lazy_load=False)
type(type(rs.resize(0.7))

rerurns telluric.georaster.GeoRaster2

Expected result: telluric.georaster.MutableGeoRaster

Operating system and installation details

virtualenv on Ubuntu 21.04 (Python 3.9) pip 21.1.2 telluric 0.13.9