library(bowerbird)
my_source <- bb_source(
name = "Chlorophyll-a concentration in seawater (not log-transformed), generated by as a blended combination of OCI, OCI2, OC2 and OCx algorithms, depending on water class memberships",
id = "ESACCI-OC-L3S-CHLOR_A-MERGED",
description = "European Space Agency Climate Change Initiative composites of merged sensor (MERIS, MODIS Aqua, SeaWiFS LAC & GAC, VIIRS, OLCI) products.",
doc_url = "http://esa-oceancolour-cci.org",
source_url =
c("https://www.oceancolour.org/thredds/catalog/cci/v6.0-release/geographic/monthly/chlor_a/catalog.html",
"https://www.oceancolour.org/thredds/catalog/cci/v6.0-release/geographic/daily/chlor_a/catalog.html",
"https://www.oceancolour.org/thredds/catalog/cci/v6.0-release/geographic/5day/chlor_a/catalog.html",
"https://www.oceancolour.org/thredds/catalog/cci/v6.0-release/geographic/annual/chlor_a/catalog.html"),
citation = "See https://climate.esa.int/en/projects/ocean-colour/,",
license = "ESA CCI, EOCIS, and C3S Data Policy: free and open access. When referencing, please use: Ocean Colour Climate Change Initiative dataset, Version 6.0, European Space Agency, available online at https://climate.esa.int/en/projects/ocean-colour/. We would also appreciate being notified of publications so that we can list them on the project website at https://climate.esa.int/en/projects/ocean-colour/, https://eocis.org/, https://climate.copernicus.eu/",
method = list("bb_handler_thredds", level = 2, accept_download = ".*nc$"),
access_function = "",
data_group = "Ocean colour")
result <- bb_get(my_source, local_file_root = tempdir(), verbose = FALSE, dry_run = TRUE)
files <- do.call(rbind, result$files)
## convert local file to dsn with crs and variable name made explicit
urltodsn <- function(x) {
sprintf("vrt://%s?sd_name=chlor_a&a_srs=EPSG:4326", x)
}
tmpdir <- file.path(Sys.getenv("MYSCRATCH"), "tmp")
if (!file.exists(tmpdir)) dir.create(tmpdir)
## this is what we test for existence on Acacia
files$source <- gsub("https://", "/vsicurl/https://projects.pawsey.org.au/idea-esacci/", gsub("\\.nc$", ".tif", files$url))
## this is what we download,
files$download <- file.path(tmpdir, basename(files$url))
## this is what we read from (local netcdf to convert to COG)
files$dsn <- urltodsn(files$download)
## this is what we write to
files$vsiwrite <- gsub("/vsicurl/https://projects.pawsey.org.au", "/vsis3", files$source)
Created
May 21, 2025 04:40
-
-
Save mdsumner/ec9bacdca76dae8600699cdabc917d8c to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment