Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
cboettig committed Jan 4, 2024
2 parents e9e309b + 85d396a commit 2d1f38b
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
16 changes: 16 additions & 0 deletions _freeze/contents/sst-gdal/execute-results/html.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"hash": "325495f543bbba38088f42cbf3a763ca",
"result": {
"markdown": "---\n---\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\n#remotes::install_github(\"boettiger-lab/earthdatalogin\")\nlibrary(earthdatalogin)\n```\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nedl_netrc()\nurls <- edl_search(short_name = \"MUR-JPL-L4-GLOB-v4.1\",\n temporal = c(\"2019-01-01\", \"2019-01-31\"))\n\n\nvrt <- function(url) {\n prefix <- \"vrt://NETCDF:/vsicurl/\"\n suffix <- \":analysed_sst?a_srs=OGC:CRS84&a_ullr=-180,90,180,-90\"\n paste0(prefix, url, suffix)\n}\n```\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(gdalcubes)\ngdalcubes_options(parallel = parallel::detectCores()*2)\n```\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nurl_dates <- as.Date(gsub(\".*(\\\\d{8})\\\\d{6}.*\", \"\\\\1\", urls), format=\"%Y%m%d\")\ndata_gd <- gdalcubes::stack_cube(vrt(urls), datetime_values = url_dates)\n```\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nextent = list(left=-93, right=-76, bottom=41, top=49,\n t0=\"2019-01-01\", t1=\"2019-01-31\")\n\nbench::bench_time({\n data_gd |> \n gdalcubes::crop(extent) |> \n aggregate_time(dt=\"P1M\", method=\"sd\") |> \n plot(col = viridisLite::viridis(10))\n})\n```\n\n::: {.cell-output-display}\n![](sst-gdal_files/figure-html/unnamed-chunk-6-1.png){width=672}\n:::\n\n::: {.cell-output .cell-output-stdout}\n```\nprocess real \n 9.31s 3.42m \n```\n:::\n:::",
"supporting": [
"sst-gdal_files"
],
"filters": [
"rmarkdown/pagebreak.lua"
],
"includes": {},
"engineDependencies": {},
"preserve": {},
"postProcess": true
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions contents/sst-gdal.qmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
---
---

```{r include=FALSE}
#' ignore sigpipe
#'
#' Avoid SIGPIPE error in scripts using Arrow S3
#' @export
ignore_sigpipe <- function() {
requireNamespace("decor", quietly = TRUE)
cpp11::cpp_source(code = '
#include <csignal>
#include <cpp11.hpp>
[[cpp11::register]] void ignore_sigpipes() {
signal(SIGPIPE, SIG_IGN);
}
')
ignore_sigpipes()
}
ignore_sigpipe()
```

```{r}
#remotes::install_github("boettiger-lab/earthdatalogin")
Expand Down

0 comments on commit 2d1f38b

Please sign in to comment.