I'm trying to read a stars_proxy object in as stars with st_as_stars , and it is failing with
GDAL Error 5: NETCDF:"path/to/file/MYD11A1.061_1km_aid0001.nc":lon: Access window out of range in RasterIO(). Requested (0,0) of size 1671x1567 on raster of 1671x1.
The proxy object shows the correct dimensions, here x = 1671 and y = 1567, but for some reason the conversion loses y.
I originally encountered this cropping very large files, but I seem to be able to replicate it with something smaller that reads in fine with proxy = FALSE but fails with proxy = TRUE in the example below.
This issue does not happen with all netcdfs I've tried, but I have had it happen with several from different sources. So it might be a netcdf issue, but seems to be a fairly common one.
I have tried a few versions of stars because I've read this specific file in successfully before, and it seems to work for 0.5-05 and below but not for 0.5-6 and above.
library(stars)
download.file("https://raw.githubusercontent.com/galenholt/example/main/MYD11A1.061_1km_aid0001.nc",
destfile = 'MYD11A1.061_1km_aid0001.nc',
method = 'curl')
# Works without proxy
t_np <- read_stars("MYD11A1.061_1km_aid0001.nc", sub = "LST_Day_1km", proxy = FALSE)
# Fails with proxy first
t_proxy <- read_stars("MYD11A1.061_1km_aid0001.nc", sub = "LST_Day_1km", proxy = TRUE)
t_p <- st_as_stars(t_proxy)
# But the proxy can see the right values in y
t_proxy
# Can read the proxy in for the first value in y
t1 <- st_as_stars(t_proxy[, 1:10, 1,])
# But not others
t2 <- st_as_stars(t_proxy[, 1:10, 2,])
sessionInfo() is
R version 4.3.3 (2024-02-29 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 11 x64 (build 22631)
I'm trying to read a stars_proxy object in as stars with
st_as_stars
, and it is failing withThe proxy object shows the correct dimensions, here x = 1671 and y = 1567, but for some reason the conversion loses y.
I originally encountered this cropping very large files, but I seem to be able to replicate it with something smaller that reads in fine with
proxy = FALSE
but fails withproxy = TRUE
in the example below.This issue does not happen with all netcdfs I've tried, but I have had it happen with several from different sources. So it might be a netcdf issue, but seems to be a fairly common one.
I have tried a few versions of stars because I've read this specific file in successfully before, and it seems to work for 0.5-05 and below but not for 0.5-6 and above.
sessionInfo()
isThank you