首页 > 解决方案 > 带有值的星对象缺少图层

问题描述

如果我尝试使用stars::包从内存中加载 tif 文件,则此对象中没有包含这些值的层。

这是我正在寻找的一个例子:

r <- raster::raster(ncol=10, nrow=10)
raster::values(r) <- c(1:90,1:10)
r_stars <- stars::st_as_stars(r)
r_stars

具有 2 个维度和 1 个属性的星星对象

属性):

分钟。第一曲。中位数平均第三曲。最大限度。

第 1 层 15.75 40.5 41.5 65.25 90

方面):

从到偏移 delta refsys 点值 x/y

x 1 10 -180 36 +proj=longlat +datum=WGS8... NA NULL [x]

y 1 10 90 -18 +proj=longlat +datum=WGS8... NA NULL [y]

在 r_stars 中有一个包含所有值的“层”。但是,如果我使用函数从内存中加载 tif 文件,read_stars()则输出如下所示:

r_stars <- read_stars("data/dem/dem/1.tif")

r_stars

1 个文件中具有 1 个属性的 stars_proxy 对象:

$1.tif

[1] "[...]/1.tif"

方面):

从到偏移 delta refsys 点值 x/y

x 1 14400 95 0.000277778 WGS 84 FALSE NULL [x]

y 1 9360 29.6001 -0.000277778 WGS 84 FALSE NULL [y]

缺少“层”。我实际上对如何使用来自星星对象的值一无所知。是否有需要在read_stars()-function 中指定的参数?

最好的问候,斯滕

标签: r-stars

解决方案


推荐阅读