我可以使用 rasterio 将具有不同 dtype 的 band 附加到 geotiff 吗?
Can I append a band with different dtype to a geotiff using rasterio?
我有一个名为 test.tiff 的 tiff 文件。它有 4 个 dtype uint8 波段。使用这些波段,我计算了 NDVI,现在我想将其保存为 test.tiff 中的第五个波段。只是现在我想把它保存为一个float32。
有没有办法使用栅格来做到这一点?
由于 geoTiff 支持不同波段的不同 dtype,我想应该有办法。但到目前为止,我只能找到有关如何执行此操作的示例。
感谢您的帮助
引用此 GDAL 邮件列表电子邮件:https://lists.osgeo.org/pipermail/gdal-dev/2010-August/025657.html
I should note that in theory the TIFF specification allows a
mix of sample types, but in practice this is not done in the
real world, and libtiff does not support it.
GDAL does support reading mixed band types from a variety
of file formats, but not TIFF. As noted, AddBand() can be used
in a few format cases to create mixed band types though this is
rarely done.
所以创建一个包含不同类型波段的 TIFF 文件似乎有点复杂。
话虽这么说,我发现一个 GIS stackexchange 说可以用 VRT 实现你想要的:https://gis.stackexchange.com/a/207067/154376
我有一个名为 test.tiff 的 tiff 文件。它有 4 个 dtype uint8 波段。使用这些波段,我计算了 NDVI,现在我想将其保存为 test.tiff 中的第五个波段。只是现在我想把它保存为一个float32。
有没有办法使用栅格来做到这一点? 由于 geoTiff 支持不同波段的不同 dtype,我想应该有办法。但到目前为止,我只能找到有关如何执行此操作的示例。
感谢您的帮助
引用此 GDAL 邮件列表电子邮件:https://lists.osgeo.org/pipermail/gdal-dev/2010-August/025657.html
I should note that in theory the TIFF specification allows a mix of sample types, but in practice this is not done in the real world, and libtiff does not support it.
GDAL does support reading mixed band types from a variety of file formats, but not TIFF. As noted, AddBand() can be used in a few format cases to create mixed band types though this is rarely done.
所以创建一个包含不同类型波段的 TIFF 文件似乎有点复杂。
话虽这么说,我发现一个 GIS stackexchange 说可以用 VRT 实现你想要的:https://gis.stackexchange.com/a/207067/154376