diff --git a/inst/zarr/sic_daily_sample.zarr.zip b/inst/zarr/sic_daily_sample.zarr.zip new file mode 100644 index 00000000..3ac4840a Binary files /dev/null and b/inst/zarr/sic_daily_sample.zarr.zip differ diff --git a/inst/zarr/sic_daily_sample.zarr/.zattrs b/inst/zarr/sic_daily_sample.zarr/.zattrs deleted file mode 100644 index 52725337..00000000 --- a/inst/zarr/sic_daily_sample.zarr/.zattrs +++ /dev/null @@ -1,27 +0,0 @@ -{ - "Conventions": "CF-1.4", - "bulletin_date": "1993-01-06 00:00:00", - "bulletin_type": "operational", - "comment": "CMEMS product", - "copernicus_marine_client_version": "0.10.6", - "domain_name": "GL12", - "easting": "longitude", - "field_date": "1993-01-01 00:00:00", - "field_julian_date": 15706.0, - "field_type": "mean", - "forecast_range": "2-day_forecast", - "forecast_type": "hindcast", - "history": "2017/04/06 14:05:19 MERCATOR OCEAN Netcdf creation", - "institution": "MERCATOR OCEAN", - "julian_day_unit": "days since 1950-01-01 00:00:00", - "latitude_max": 90.0, - "latitude_min": -80.0, - "longitude_max": 179.9166717529297, - "longitude_min": -180.0, - "northing": "latitude", - "references": "http://www.mercator-ocean.fr", - "source": "MERCATOR GLORYS12V1", - "title": "daily mean fields from Global Ocean Physics Analysis and Forecast updated Daily", - "z_max": 5727.9169921875, - "z_min": 0.49402499198913574 -} \ No newline at end of file diff --git a/inst/zarr/sic_daily_sample.zarr/.zgroup b/inst/zarr/sic_daily_sample.zarr/.zgroup deleted file mode 100644 index 3b7daf22..00000000 --- a/inst/zarr/sic_daily_sample.zarr/.zgroup +++ /dev/null @@ -1,3 +0,0 @@ -{ - "zarr_format": 2 -} \ No newline at end of file diff --git a/inst/zarr/sic_daily_sample.zarr/.zmetadata b/inst/zarr/sic_daily_sample.zarr/.zmetadata deleted file mode 100644 index ac06261a..00000000 --- a/inst/zarr/sic_daily_sample.zarr/.zmetadata +++ /dev/null @@ -1,170 +0,0 @@ -{ - "metadata": { - ".zattrs": { - "Conventions": "CF-1.4", - "bulletin_date": "1993-01-06 00:00:00", - "bulletin_type": "operational", - "comment": "CMEMS product", - "copernicus_marine_client_version": "0.10.6", - "domain_name": "GL12", - "easting": "longitude", - "field_date": "1993-01-01 00:00:00", - "field_julian_date": 15706.0, - "field_type": "mean", - "forecast_range": "2-day_forecast", - "forecast_type": "hindcast", - "history": "2017/04/06 14:05:19 MERCATOR OCEAN Netcdf creation", - "institution": "MERCATOR OCEAN", - "julian_day_unit": "days since 1950-01-01 00:00:00", - "latitude_max": 90.0, - "latitude_min": -80.0, - "longitude_max": 179.9166717529297, - "longitude_min": -180.0, - "northing": "latitude", - "references": "http://www.mercator-ocean.fr", - "source": "MERCATOR GLORYS12V1", - "title": "daily mean fields from Global Ocean Physics Analysis and Forecast updated Daily", - "z_max": 5727.9169921875, - "z_min": 0.49402499198913574 - }, - ".zgroup": { - "zarr_format": 2 - }, - "latitude/.zarray": { - "chunks": [ - 2041 - ], - "compressor": { - "blocksize": 0, - "clevel": 5, - "cname": "lz4", - "id": "blosc", - "shuffle": 1 - }, - "dtype": " library(stars) -Loading required package: abind -Loading required package: sf -Linking to GEOS 3.11.1, GDAL 3.6.4, PROJ 9.1.1; sf_use_s2() is TRUE +> suppressPackageStartupMessages(library(stars)) > m = matrix(1:121, 11, 11) > m [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] @@ -119,4 +116,4 @@ X2 1 5 1 2 FALSE [y] > > proc.time() user system elapsed - 1.176 0.639 1.002 + 0.857 1.321 0.676 diff --git a/tests/mdim.R b/tests/mdim.R index 32e6a434..dad50adb 100644 --- a/tests/mdim.R +++ b/tests/mdim.R @@ -10,25 +10,25 @@ 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") -# 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)) +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)) - # print(read_mdim(system.file("zarr/sic_daily_sample.zarr/", package = "stars"))) +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)) +# if (.Platform$OS.type == "unix") { +# print(read_mdim(paste0("/vsizip/", (system.file("zarr/sic_daily_sample.zarr.zip", package = "stars")))) # } diff --git a/tests/mdim.Rout.save b/tests/mdim.Rout.save index e227aa7a..ee0ff69e 100644 --- a/tests/mdim.Rout.save +++ b/tests/mdim.Rout.save @@ -41,15 +41,14 @@ X2 1 2 2023-03-04 12:35:00 UTC 1 hours POSIXct FALSE 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) +> 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 -> s2 = read_mdim(f) -> print(s2) +> s2 = read_mdim(f) +> print(s2) stars object with 2 dimensions and 1 attribute attribute(s): Min. 1st Qu. Median Mean 3rd Qu. Max. @@ -61,9 +60,9 @@ X2 1 2 2023-03-04 12:35:00 UTC 1 hours POSIXct NA values X1 POINT (0 1), POINT (3 2) X2 NULL -> print(all.equal(s, s2, check.attributes = FALSE)) +> print(all.equal(s, s2, check.attributes = FALSE)) [1] TRUE -> print(all.equal(s, s2)) +> print(all.equal(s, s2)) [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 > >" @@ -71,11 +70,11 @@ X2 NULL [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 >" > -> 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) +> 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) stars object with 2 dimensions and 1 attribute attribute(s): Min. 1st Qu. Median Mean 3rd Qu. Max. @@ -84,8 +83,8 @@ 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 -> sd = st_set_dimensions(sd, 1, sfc) -> print(sd) +> sd = st_set_dimensions(sd, 1, sfc) +> print(sd) stars object with 2 dimensions and 1 attribute attribute(s): Min. 1st Qu. Median Mean 3rd Qu. Max. @@ -94,15 +93,15 @@ 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 -> f = tempfile(fileext = ".nc") -> write_mdim(sd, f) +> f = tempfile(fileext = ".nc") +> write_mdim(sd, f) 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 -> sd2 = read_mdim(f) -> print(sd2) +> sd2 = read_mdim(f) +> print(sd2) stars object with 2 dimensions and 1 attribute attribute(s): Min. 1st Qu. Median Mean 3rd Qu. Max. @@ -111,13 +110,14 @@ 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 -> print(all.equal(sd, sd2, check.attributes = FALSE)) +> print(all.equal(sd, sd2, check.attributes = FALSE)) [1] TRUE -> print(all.equal(sd, sd2)) +> print(all.equal(sd, sd2)) [1] "Attributes: < Component \"dimensions\": Component \"X2\": Component \"point\": 'is.NA' value mismatch: 1 in current 0 in target >" -> # print(read_mdim(system.file("zarr/sic_daily_sample.zarr/", package = "stars"))) +> # if (.Platform$OS.type == "unix") { +> # print(read_mdim(paste0("/vsizip/", (system.file("zarr/sic_daily_sample.zarr.zip", package = "stars")))) > # } > > proc.time() user system elapsed - 0.941 1.328 0.838 + 0.868 1.330 0.699 diff --git a/tests/testthat.Rout.save b/tests/testthat.Rout.save index 05e4d744..f841d2d2 100644 --- a/tests/testthat.Rout.save +++ b/tests/testthat.Rout.save @@ -1,5 +1,5 @@ -R version 4.3.1 (2023-06-16) -- "Beagle Scouts" +R version 4.3.2 (2023-10-31) -- "Eye Holes" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) @@ -24,11 +24,11 @@ Type 'q()' to quit R. [ FAIL 0 | WARN 1 | SKIP 4 | PASS 76 ] ══ Skipped tests (4) ═══════════════════════════════════════════════════════════ -• On CRAN (4): 'test_ncdf.R:1:1', 'test_ncproxy.R:1:1', 'test_osm.R:4:3', - 'test_rectilinear.R:89:3' +• On CRAN (4): 'test-OpenStreetMap.R:2:3', 'test-ncdf.R:1:1', + 'test-ncproxy.R:1:1', 'test-rectilinear.R:89:3' [ FAIL 0 | WARN 1 | SKIP 4 | PASS 76 ] > > proc.time() user system elapsed - 7.247 0.892 7.305 + 5.544 1.440 5.561