R Under development (unstable) (2023-08-09 r84924 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > Sys.setenv(TZ="") > suppressPackageStartupMessages(library(stars)) > matrix(1:4,2) [,1] [,2] [1,] 1 3 [2,] 2 4 > 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)) 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 CET 1 hours POSIXct FALSE values X1 POINT (0 1), POINT (3 2) X2 NULL > f = tempfile(fileext = ".nc") > if (compareVersion(sf_extSoftVersion()["GDAL"], "3.4.0") > -1) { + write_mdim(s, f, as_float = FALSE) + s2 = read_mdim(f) + print(s2) + print(all.equal(s, s2, check.attributes = FALSE)) + print(all.equal(s, s2)) + + st_crs(sfc) = st_crs(s2) + st_crs(s) = st_crs(s2) + tm = as.Date("2023-02-25") + 0:1 + sd = st_set_dimensions(s, 2, tm) + print(sd) + sd = st_set_dimensions(sd, 1, sfc) + print(sd) + f = tempfile(fileext = ".nc") + write_mdim(sd, f) + sd2 = read_mdim(f) + print(sd2) + print(all.equal(sd, sd2, check.attributes = FALSE)) + print(all.equal(sd, sd2)) + } 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 11:35:00 UTC 1 hours POSIXct NA values X1 POINT (0 1), POINT (3 2) X2 NULL [1] TRUE [1] "Attributes: < Component \"dimensions\": Component \"X1\": Component \"refsys\": Component \"input\": 1 string mismatch >" [2] "Attributes: < Component \"dimensions\": Component \"X1\": Component \"refsys\": Component \"wkt\": 1 string mismatch >" [3] "Attributes: < Component \"dimensions\": Component \"X1\": Component \"values\": Attributes: < Component \"crs\": Component \"input\": 1 string mismatch > >" [4] "Attributes: < Component \"dimensions\": Component \"X1\": Component \"values\": Attributes: < Component \"crs\": Component \"wkt\": 1 string mismatch > >" [5] "Attributes: < Component \"dimensions\": Component \"X2\": Component \"offset\": 'tzone' attributes are inconsistent ('' and 'UTC') >" [6] "Attributes: < Component \"dimensions\": Component \"X2\": Component \"point\": 'is.NA' value mismatch: 1 in current 0 in target >" 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 values X1 1 2 NA NA WGS 84 TRUE POINT (0 1), POINT (3 2) X2 1 2 2023-02-25 1 days Date FALSE NULL 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 values X1 1 2 NA NA WGS 84 TRUE POINT (0 1), POINT (3 2) X2 1 2 2023-02-25 1 days Date FALSE NULL 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 values X1 1 2 NA NA WGS 84 TRUE POINT (0 1), POINT (3 2) X2 1 2 2023-02-25 1 days Date NA NULL [1] TRUE [1] "Attributes: < Component \"dimensions\": Component \"X2\": Component \"point\": 'is.NA' value mismatch: 1 in current 0 in target >" 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 3: In CPL_write_mdim(file, driver, dimx, cdl, wkt, xy, root_group_options, : GDAL Error 6: SetIndexingVariable() not implemented 4: In CPL_write_mdim(file, driver, dimx, cdl, wkt, xy, root_group_options, : GDAL Error 6: SetIndexingVariable() not implemented > > proc.time() user system elapsed 0.89 0.18 1.06