* update rasterio dependency to `>=1.4.0`
* add `reproject` method for `ImageData` objects (author emmanuelmathot, https://github.com/cogeotiff/rio-tiler/pull/782)
python
from rio_tiler.models import ImageData
img = ImageData(numpy.zeros((3, 256, 256), crs=CRS.from_epsg(4326), dtype="uint8"))
img_3857 = img.reproject("epsg:3857")
* add `indexes` parameter for `XarrayReader` methods. As for Rasterio, the indexes values start at `1`.
python
data = ... DataArray of shape (2, x, y)
before
with XarrayReader(data) as dst:
img = dst.tile(0, 0, 0)
assert img.count == 2
now
with XarrayReader(data) as dst:
Select the first `band` within the data array
img = dst.tile(0, 0, 0, indexes=1)
assert img.count == 1
* better define `band names` for `XarrayReader` objects
* band_name for `2D` dataset is extracted form the first `non-geo` coordinates value
python
data = xarray.DataArray(
numpy.arange(0.0, 33 * 35 * 2).reshape(2, 33, 35),
dims=("time", "y", "x"),
coords={
"x": numpy.arange(-170, 180, 10),
"y": numpy.arange(-80, 85, 5),
"time": [datetime(2022, 1, 1), datetime(2022, 1, 2)],
},
)
da = data[0]
print(da.coords["time"].data)
>> array('2022-01-01T00:00:00.000000000', dtype='datetime64[ns]'))
before
with XarrayReader(data) as dst:
img = dst.info()
print(img.band_descriptions)[0]
>> ("b1", "value")
now
with XarrayReader(data) as dst:
img = dst.info()
print(img.band_descriptions)[0]
>> ("b1", "2022-01-01T00:00:00.000000000")
* default `band_names` is changed to DataArray's name or `array` (when no available coordinates value)
python
data = ... DataArray of shape (x, y)
before
with XarrayReader(data) as dst:
img = dst.info()
print(img.band_descriptions)[0]
>> ("b1", "value")
now
with XarrayReader(data) as dst:
img = dst.info()
print(img.band_descriptions)[0]
>> ("b1", "array")