Skip to content

Names in the raster #125

@maelle

Description

@maelle

@annakrystalli please ignore #122 for now as I've stumbled upon an issue with how we find which band to apply a correction to.

It made me wonder whether emodnet.wcs should fix the names in the raster so that the names could be useful:

library(emodnet.wcs)
#> Loading ISO 19139 XML schemas...
#> Loading ISO 19115-3 XML schemas...
#> Loading ISO 19139 codelists...
wcs <- emdn_init_wcs_client(service = "biology")
#> ✔ WCS client created succesfully
#> ℹ Service: <https://geo.vliz.be/geoserver/Emodnetbio/wcs>
#> ℹ Service: "2.0.1"
coverage_id <- "Emodnetbio__cal_fin_19582016_L1_err"
# Subset using a bounding box
cov <- emdn_get_coverage(wcs,
  coverage_id = coverage_id,
  bbox = c(
    xmin = 0, ymin = 40,
    xmax = 5, ymax = 45
  )
)
#> Loading required package: sf
#> Linking to GEOS 3.12.2, GDAL 3.10.3, PROJ 9.4.1; sf_use_s2() is FALSE
#> No encoding supplied: defaulting to UTF-8.
#> ── Downloading coverage "Emodnetbio__cal_fin_19582016_L1_err" ──────────────────
#> <GMLEnvelope>
#> ....|-- lowerCorner: 40 0 "1958-02-16T01:00:00"
#> ....|-- upperCorner: 45 5 "2016-11-16T01:00:00"
#> ✔ Coverage "Emodnetbio__cal_fin_19582016_L1_err" downloaded succesfully as a
#>        terra <SpatRaster>
cov
#> class       : SpatRaster 
#> size        : 50, 50, 2  (nrow, ncol, nlyr)
#> resolution  : 0.1, 0.1  (x, y)
#> extent      : 0.05, 5.05, 39.95, 44.95  (xmin, xmax, ymin, ymax)
#> coord. ref. : lon/lat WGS 84 (EPSG:4326) 
#> source      : Emodnetbio__cal_fin_19582016_L1_err_2016-11-16T01_00_00_40,0,45,5.tif 
#> names       : Emodnetbio__cal~_00_40,0,45,5_1, Emodnetbio__cal~_00_40,0,45,5_2
names(cov)
#> [1] "Emodnetbio__cal_fin_19582016_L1_err_2016-11-16T01_00_00_40,0,45,5_1"
#> [2] "Emodnetbio__cal_fin_19582016_L1_err_2016-11-16T01_00_00_40,0,45,5_2"

# should emodnet.wcs set those names to rangesubset values?

cov2 <- emdn_get_coverage(wcs,
  coverage_id = coverage_id,
  bbox = c(
    xmin = 0, ymin = 40,
    xmax = 5, ymax = 45
  ),
  time = c(
    "2012-11-16T01:00:00",
    "2016-05-16T02:00:00"
  )
)
#> ── Downloading coverage "Emodnetbio__cal_fin_19582016_L1_err" ──────────────────
#> <GMLEnvelope>
#> ....|-- lowerCorner: 40 0 "1958-02-16T01:00:00"
#> ....|-- upperCorner: 45 5 "2016-11-16T01:00:00"<GMLEnvelope>
#> ....|-- lowerCorner: 40 0 "1958-02-16T01:00:00"
#> ....|-- upperCorner: 45 5 "2016-11-16T01:00:00"
#> ✔ Coverage "Emodnetbio__cal_fin_19582016_L1_err" downloaded succesfully as a
#>        terra <SpatRaster> Stack
cov2
#> class       : SpatRaster 
#> size        : 50, 50, 4  (nrow, ncol, nlyr)
#> resolution  : 0.1, 0.1  (x, y)
#> extent      : 0.05, 5.05, 39.95, 44.95  (xmin, xmax, ymin, ymax)
#> coord. ref. : lon/lat WGS 84 (EPSG:4326) 
#> sources     : Emodnetbio__cal_fin_19582016_L1_err_2012-11-16T01_00_00_40,0,45,5.tif  (2 layers) 
#>               Emodnetbio__cal_fin_19582016_L1_err_2016-05-16T02_00_00_40,0,45,5.tif  (2 layers) 
#> names       : Emodnet~,45,5_1, Emodnet~,45,5_2, Emodnet~,45,5_1, Emodnet~,45,5_2
names(cov2)
#> [1] "Emodnetbio__cal_fin_19582016_L1_err_2012-11-16T01_00_00_40,0,45,5_1"
#> [2] "Emodnetbio__cal_fin_19582016_L1_err_2012-11-16T01_00_00_40,0,45,5_2"
#> [3] "Emodnetbio__cal_fin_19582016_L1_err_2016-05-16T02_00_00_40,0,45,5_1"
#> [4] "Emodnetbio__cal_fin_19582016_L1_err_2016-05-16T02_00_00_40,0,45,5_2"

# should emodnet.wcs set those names to
# time1 - band 1
# time1 - band 2
# time2 - band 1
# time1 - band 2

Created on 2026-01-09 with reprex v2.1.1

So currently we have these not useful names, wouldn't it be nice if looking at the names of the SpatRaster, one knew which time/depth/band they corresponded to?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions