R星际错误:DIMS评估代理时不匹配对象的长度
我正在从不适合Rstudio的内存中的全球气候模型中处理一个大数据集,因此我选择通过将其作为恒星代理对象加载并通过块评估它来分析它。
在全日制期间进行空间块的工作正常,例如:
full_dataset <- read_stars(data_path, proxy = T)
data_chunk <- full_dataset[,1,1,] %>%
st_as_stars()
但是,要拿一个时间块(无论是否在整个区域上)在评估步骤中返回错误。例如:
data_chunk <- full_dataset[,,,1] %>%
st_as_stars()
返回错误:
Error in dim(data) <- c(dim(data)[1:2], newdims) :
dims do not match the length of object
在管道之前,子集的代理对象看起来像这样:
> full_dataset[,,,1]
stars_proxy object with 1 attribute in 1 file(s):
$SB_HW_01deg_crop.nc
[1] "[...]/SB_HW_01deg_crop.nc"
dimension(s):
from to offset delta refsys point values x/y
x 1 328 -19.95 0.1 NA NA NULL [x]
y 1 249 64.9 -0.1 NA NA NULL [y]
time_counter 1 1 NA NA udunits NA [687268800,687355200) [(seconds since 1950-01-01 00:00:00)]
我在plot()而不是st_as_stars()中获得相同的错误,以及使用rasterio子集而不是使用[,, 1]时。 该数据集来自最初在Curvilinear坐标中定义的NETCDF文件,我首先使用RSTUDIO外CDO的Remapbil Operator在常规网格上进行了插值。 (因为我发现恒星不支持曲线网格的代理。)完整的数据集具有超过45000个时间步长。直接在终端中使用NCVIEW或NCDUMP时,该文件似乎很好。
我想我在这里使用了错误的星星,但我无法弄清楚问题是什么。我真的不理解基本过程以及错误消息所涉及的内容。数据集很大,但是如果需要,我可以提供。
编辑:我设法增加了内存津贴,并将完整的数据集加载到内存中,而无需浏览代理阶段。一切都很好。似乎问题来自代理评估。不过,仍然不知道这是什么,并且很想能够与代理合作。
I am working on a large dataset from a global climate model that can't fit into RStudio's memory, hence I've chosen to analyze it by loading it as a stars proxy object and evaluating it chunk by chunk.
Taking spatial chunks over the full time period works fine, e.g.:
full_dataset <- read_stars(data_path, proxy = T)
data_chunk <- full_dataset[,1,1,] %>%
st_as_stars()
However, taking a temporal chunk (regardless of whether it's on the full area or not) returns an error at the evaluation step. For example:
data_chunk <- full_dataset[,,,1] %>%
st_as_stars()
returns the error:
Error in dim(data) <- c(dim(data)[1:2], newdims) :
dims do not match the length of object
Before the pipe, the subsetted proxy object looks like that:
> full_dataset[,,,1]
stars_proxy object with 1 attribute in 1 file(s):
$SB_HW_01deg_crop.nc
[1] "[...]/SB_HW_01deg_crop.nc"
dimension(s):
from to offset delta refsys point values x/y
x 1 328 -19.95 0.1 NA NA NULL [x]
y 1 249 64.9 -0.1 NA NA NULL [y]
time_counter 1 1 NA NA udunits NA [687268800,687355200) [(seconds since 1950-01-01 00:00:00)]
I get the same error with plot() instead of st_as_stars() and also when subsetting with rasterIO instead of using [,,,1].
This dataset comes from a NetCDF file originally defined in curvilinear coordinates, which I have first interpolated onto a regular grid using CDO's remapbil operator outside of RStudio. (Because I found out that stars did not support proxies for curvilinear grids.) The full dataset has over 45000 time steps. When using ncview or ncdump directly in the terminal, the file seems fine.
I imagine I'm using stars wrong here somehow but I just can't figure out what the problem is. I don't really understand the underlying process and what the error message is referring to. The dataset is very big but I can provide it if needed.
EDIT: I managed to increase my memory allowance and load the full dataset into memory without going through the proxy phase. Everything works fine that way. It seems the problem comes from the proxy evaluation. Still no clue what it is, though, and would love to be able to work with a proxy instead.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
https://github.com/r-patial.com/r-spatial/stars/stars/sissues/561
包装维护者现在已经解决了此问题。
https://github.com/r-spatial/stars/issues/561
the package maintainer has now solved this issue.