给定一个栅格时间序列(相同空间范围内的卫星图像,每个图像都在不同的日期拍摄),如何将日期添加为(地理)Tiff 中每个图层/波段的名称?它可能未指定吗?
以 R 为例:
library(rgdal)
library(raster)
## example data (taken from https://rspatial.org/raster/rs/1-introduction.html#data)
dir.create('/tmp/data', showWarnings = FALSE)
if (!file.exists('/tmp/data/rs/samples.rds')) {
download.file('https://biogeo.ucdavis.edu/data/rspatial/rsdata.zip', dest = '/tmp/data/rsdata.zip')
unzip('/tmp/data/rsdata.zip', exdir='/tmp/data')
}
## just two raster layers
layers <- c("/tmp/data/rs/LC08_044034_20170614_B1.tif", "/tmp/data/rs/LC08_044034_20170614_B2.tif")
lc_stack <- raster::stack(layers)
## set arbitrary timestamps
lc_stack_z <- setZ(lc_stack,c("2019-09-20", "2019-09-21"))
timeseries_rs <- writeRaster(lc_stack_z, "/tmp/data/rs/timeseries-raster.tiff", "GTiff")
gdalinfo
输出如下(无波段名称信息):
[...]
Band 1 Block=1497x1 Type=Float32, ColorInterp=Gray
Min=0.096 Max=0.735
Minimum=0.096, Maximum=0.735, Mean=nan, StdDev=nan
NoData Value=-3.39999999999999996e+38
Metadata:
STATISTICS_MAXIMUM=0.73462820053101
STATISTICS_MEAN=nan
STATISTICS_MINIMUM=0.096417911350727
STATISTICS_STDDEV=nan
Band 2 Block=1497x1 Type=Float32, ColorInterp=Undefined
Min=0.075 Max=0.718
Minimum=0.075, Maximum=0.718, Mean=nan, StdDev=nan
NoData Value=-3.39999999999999996e+38
Metadata:
STATISTICS_MAXIMUM=0.71775615215302
STATISTICS_MEAN=nan
STATISTICS_MINIMUM=0.074839904904366
STATISTICS_STDDEV=nan
有一个Tiff 标签库,但我找不到任何(语义上合适的)标签可以满足我的需要。
是否有一个好的做法如何将图层/波段名称添加到(Geo)Tiff - 最好可以由 QGis 等其他软件解释/读取。