Comments (8)
It's not about the age, but about how GDAL was built: linked against libnetcdf, or not. If not, the netcdf driver is missing and you get errors of this type.
from stars.
I could add a message at startup time of stars
when the netcdf driver is missing.
from stars.
The same failure occurs with examples:
The error most likely occurred in:
> ### Name: mdim
> ### Title: Read or write data using GDAL's multidimensional array API
> ### Aliases: mdim read_mdim write_mdim
>
> ### ** Examples
>
> set.seed(135)
> m = matrix(runif(10), 2, 5)
> names(dim(m)) = c("stations", "time")
> times = as.Date("2022-05-01") + 1:5
> pts = st_as_sfc(c("POINT(0 1)", "POINT(3 5)"))
> s = st_as_stars(list(Precipitation = m)) |>
+ st_set_dimensions(1, values = pts) |>
+ st_set_dimensions(2, values = times)
> nc = tempfile(fileext=".nc")
> if (compareVersion(sf_extSoftVersion()["GDAL"], "3.4.0") > -1) {
+ write_mdim(s, nc)
+ # try ncdump on the generated file
+ print(read_mdim(nc))
+ }
Error: cannot open driver
from stars.
I'm seeing
Sys.setenv(TZ="")
library(stars)
# Loading required package: abind
# Loading required package: sf
# Linking to GEOS 3.12.1, GDAL 3.8.4, PROJ 9.3.1; sf_use_s2() is TRUE
m = matrix(1:4,2)
s = st_as_stars(m)
s = st_set_dimensions(s, st_dimensions(s), xy = NULL)
sfc = st_sfc(st_point(0:1), st_point(3:2))
s = st_set_dimensions(s, 1, sfc) |> st_set_crs(4326)
tm = as.POSIXct("2023-03-04 12:35") + c(0, 3600)
s = st_set_dimensions(s, 2, tm)
f = tempfile(fileext = ".nc")
write_mdim(s, f, as_float = FALSE)
# Warning messages:
# 1: In CPL_write_mdim(file, driver, dimx, cdl, wkt, xy, root_group_options, :
# GDAL Error 6: SetIndexingVariable() not implemented
# 2: In CPL_write_mdim(file, driver, dimx, cdl, wkt, xy, root_group_options, :
# GDAL Error 6: SetIndexingVariable() not implemented
read_mdim(f)
# stars object with 2 dimensions and 1 attribute
# attribute(s):
# Min. 1st Qu. Median Mean 3rd Qu. Max.
# A1 1 1.75 2.5 2.5 3.25 4
# dimension(s):
# from to offset delta refsys point
# X1 1 2 NA NA WGS 84 TRUE
# X2 1 2 2023-03-04 12:35:00 UTC 1 hours POSIXct NA
# values
# X1 POINT (0 1), POINT (3 2)
# X2 NULL
Is this a GDAL version issue?
from stars.
@edzer Perhaps 3.9.0 is not too old? https://ports.macports.org/port/gdal
from stars.
@edzer I am building GDAL now with netcdf support enabled. Once confirmed tests pass then, I will close both issues as resolved.
P. S. Perhaps it is worth adding a note about this requirement though. Currently nothing is said about GDAL being linked to netcdf: https://cran.r-project.org/web/packages/stars/index.html
sf
is also silent: https://cran.r-project.org/web/packages/sf/index.html
So how one is supposed to know it is necessary?
from stars.
I could add a message at startup time of
stars
when the netcdf driver is missing.
That will be helpful, I think.
from stars.
@edzer Files are now found, but specifically mdim
example and test still fail for me, though differently:
* checking examples ...sh: line 1: 70105 Segmentation fault LANGUAGE=en _R_CHECK_INTERNALS2_=1 '/opt/local/Library/Frameworks/R.framework/Resources/bin/R' --vanilla --encoding=UTF-8 > 'stars-Ex.Rout' 2>&1 < 'stars-Ex.R'
ERROR
Running examples in ‘stars-Ex.R’ failed
The error most likely occurred in:
> ### Name: mdim
> ### Title: Read or write data using GDAL's multidimensional array API
> ### Aliases: mdim read_mdim write_mdim
>
> ### ** Examples
>
> set.seed(135)
> m = matrix(runif(10), 2, 5)
> names(dim(m)) = c("stations", "time")
> times = as.Date("2022-05-01") + 1:5
> pts = st_as_sfc(c("POINT(0 1)", "POINT(3 5)"))
> s = st_as_stars(list(Precipitation = m)) |>
+ st_set_dimensions(1, values = pts) |>
+ st_set_dimensions(2, values = times)
> nc = tempfile(fileext=".nc")
> if (compareVersion(sf_extSoftVersion()["GDAL"], "3.4.0") > -1) {
+ write_mdim(s, nc)
+ # try ncdump on the generated file
+ print(read_mdim(nc))
+ }
Warning in CPL_write_mdim(file, driver, dimx, cdl, wkt, xy, root_group_options, :
GDAL Error 6: SetIndexingVariable() not implemented
Warning in CPL_write_mdim(file, driver, dimx, cdl, wkt, xy, root_group_options, :
GDAL Error 6: SetIndexingVariable() not implemented
*** caught segfault ***
address 0xc0000000, cause 'memory not mapped'
Traceback:
1: CPL_write_mdim(file, driver, dimx, cdl, wkt, xy, root_group_options, options, as_float)
2: gdal_write_mdim(filename, driver, c(dim(x), attr(cdl, "dims")), cdl, wkt, xy, root_group_options = root_group_options, options = options, as_float = as_float)
3: write_mdim(s, nc)
An irrecoverable exception occurred. R is aborting now ...
Running ‘mdim.R’/opt/local/Library/Frameworks/R.framework/Resources/bin/BATCH: line 60: 70383 Segmentation fault ${R_HOME}/bin/R -f ${in} ${opts} ${R_BATCH_OPTIONS} > ${out} 2>&1
ERROR
Running the tests in ‘tests/mdim.R’ failed.
Last 13 lines of output:
> sfc = st_sfc(st_point(0:1), st_point(3:2))
> s = st_set_dimensions(s, 1, sfc) |> st_set_crs(4326)
> tm = as.POSIXct("2023-03-04 12:35") + c(0, 3600)
> s = st_set_dimensions(s, 2, tm)
> f = tempfile(fileext = ".nc")
> write_mdim(s, f, as_float = FALSE)
*** caught segfault ***
address 0xc0000000, cause 'memory not mapped'
Traceback:
1: CPL_write_mdim(file, driver, dimx, cdl, wkt, xy, root_group_options, options, as_float)
2: gdal_write_mdim(filename, driver, c(dim(x), attr(cdl, "dims")), cdl, wkt, xy, root_group_options = root_group_options, options = options, as_float = as_float)
3: write_mdim(s, f, as_float = FALSE)
An irrecoverable exception occurred. R is aborting now ...
* DONE
Status: 2 ERRORs, 1 WARNING, 2 NOTEs
See
‘/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_R_R-stars/R-stars/work/stars/stars.Rcheck/00check.log’
for details.
But it looks like it is using R BATCH
, which is known to be broken for w/e reason: https://trac.macports.org/ticket/67059
All other tests now pass (with GDAL +netcdf
).
from stars.
Related Issues (20)
- Issues with particular file: North American Land Cover (NALC) Dataset HOT 5
- Additional nest in dimension while reading HDF5 file and terra workaround solution HOT 7
- GDAL Access window out of range on read-in of stars_proxy HOT 2
- aggregate.stars mean by time (by = "2 days") HOT 2
- netcdf dimensions get messed up if they are out of order and if axis attributes are available HOT 12
- starsdata not available, stars fails revdeps. HOT 7
- issue using `st_cells()` on a cropped image HOT 3
- workflow recommendations for simple spatial mean computations HOT 5
- An error occurred while using the st_get_dimension_values function to obtain the time HOT 1
- `mutate.stars` fails on attributes with spaces in its name HOT 1
- A better (efficient) way to convert a list to stars object with time dimension having only one value HOT 2
- Some tests cannot find files from `stars/nc` directory HOT 3
- Croping a stars object takes 16.89 hours while terra takes 0.16 seconds HOT 3
- Extracting to sf now gives "Error in make_intervals(x$start[i], x$end[i]) : length(start) > 0 is not TRUE" HOT 5
- Update failed for stars... same error for leafem, leafgl, and rgee installation. HOT 9
- Error file not found after st_warp() HOT 7
- Writing error as netcdf HOT 3
- Dimensions error when filtering HOT 3
- write_mdim() error "Error: NA value in which_dims: logic error" , but replacing values works?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stars.