Skip to content

Commit

Permalink
gdal vs fsspec
Browse files Browse the repository at this point in the history
  • Loading branch information
cboettig committed Dec 22, 2023
1 parent 4c60e22 commit 71e1075
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
29 changes: 29 additions & 0 deletions drafts/sst.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
remotes::install_github("boettiger-lab/earthdatalogin")
library(earthdatalogin)
edl_netrc()
urls <- edl_search(short_name = "MUR-JPL-L4-GLOB-v4.1",
temporal = c("2019-01-01", "2019-01-31"))


vrt <- function(url) {
prefix <- "vrt://NETCDF:/vsicurl/"
suffix <- ":analysed_sst?a_srs=OGC:CRS84&a_ullr=-180,90,180,-90"
paste0(prefix, url, suffix)
}


library(gdalcubes)
gdalcubes_options(parallel = parallel::detectCores()*2)
url_dates <- as.Date(gsub(".*(\\d{8})\\d{6}.*", "\\1", urls), format="%Y%m%d")
data_gd <- gdalcubes::stack_cube(vrt(urls), datetime_values = url_dates)



bench::bench_time({
extent = list(left=-93, right=-76, bottom=41, top=49,
t0="2019-01-01", t1="2019-01-31")
data_gd |>
gdalcubes::crop(extent) |>
aggregate_time(dt="P1M", method="sd") |>
plot(col = viridisLite::viridis(10))
})
13 changes: 10 additions & 3 deletions drafts/xarray.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 3,
"id": "8a7eec77-de5d-43bd-af77-b912851d57bc",
"metadata": {},
"outputs": [
Expand All @@ -180,6 +180,13 @@
"/opt/venv/lib/python3.10/site-packages/rioxarray/_io.py:1132: NotGeoreferencedWarning: Dataset has no geotransform, gcps, or rpcs. The identity matrix will be returned.\n",
" warnings.warn(str(rio_warning.message), type(rio_warning.message)) # type: ignore\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"via_gdalvsi took 94.623sec\n"
]
}
],
"source": [
Expand Down Expand Up @@ -212,7 +219,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"id": "21ba6f1d-0915-47d0-a67f-2b0508cc0b38",
"metadata": {},
"outputs": [],
Expand All @@ -224,7 +231,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"id": "f226e390-f84c-4440-8cc1-48b7df6c41d9",
"metadata": {},
"outputs": [
Expand Down

0 comments on commit 71e1075

Please sign in to comment.