Skip to content

Instantly share code, notes, and snippets.

@paleolimbot
paleolimbot / # gdal - 2022-11-09_14-53-50.txt
Created November 9, 2022 18:58
gdal on macOS 12 - Homebrew build logs
Homebrew build logs for gdal on macOS 12
Build date: 2022-11-09 14:53:50
@paleolimbot
paleolimbot / mn_pourbaix.R
Created August 16, 2018 18:45
Manganeese 3D pourbaix diagram using PHREEQC and tidyphreeqc
library(tidyverse)
library(gganimate)
library(tidyphreeqc)
phr_use_db_minteq()
theme_set(theme_bw())
library(ggspatial)
result <- phr_run(
phr_solution_list(
pH = seq(3, 13, 0.1),
# .External2 is needed because the 'op' and 'args'
# SEXPs are what need to be passed to GErecordGraphicOperation()
test_point <- function() {
.External2(getNativeSymbolInfo("C_testPoint", "wk"))
}
# Needed for Rcpp to pick up on "C_testPoint"
test_point2 <- function() {
.Call("C_testPoint")
FROM rocker/r-devel:latest
RUN apt update && apt install -y git flex
RUN git clone git://gcc.gnu.org/git/gcc.git gcc11
RUN cd gcc11 && ./contrib/download_prerequisites
RUN mkdir gcc-build && cd gcc-build && ../gcc11/configure -disable-multilib --enable-languages=c,c++,fortran
RUN cd gcc-build && make -j4 && make install
RUN echo 'LD_LIBRARY_PATH="/usr/local/lib64:${R_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH}"' >> /usr/lib/R/etc/ldpaths
RUN mkdir ~/.R && echo 'CXX11=/usr/local/bin/g++' > ~/.R/Makevars && echo 'CXX=/usr/local/bin/g++' >> ~/.R/Makevars && echo 'CC=/usr/local/bin/gcc' >> ~/.R/Makevars
library(tidyverse)
library(argodata) # remotes::install_github("paleolimbot/argodata")
argodata:::use_dev_cache()
urls <- argo_global_prof() %>%
head(100) %>%
argo_url()
dir <- tempfile()
dir.create(dir)
stream_file <- "~/Dropbox/delineatens/dem/streams.shp"
# full read by OGR/sf
system.time(streams_sf <- sf::read_sf(stream_file))
# feature-level summaries by OGR/vapour
system.time(
stream_ext_vapour <-
vapour::vapour_read_extent(dirname(stream_file), layer = "streams")
)
FROM rocker/r-ubuntu:18.04
# RStudio Package Manager cache of June 3, 2020
ENV RSPM https://packagemanager.rstudio.com/all/__linux__/bionic/290
# system dependencies for R packages
RUN apt-get update && apt-get install -y libcurl4-openssl-dev libxml2-dev libssl-dev
# install R package dependencies
RUN Rscript -e "install.packages('remotes')"
poly_df <- read.csv(
url("https://gist.github.com/will-r-chase/ac1c1b3ba96a761a7d8d70af860bf663/raw/97c68537ad35254721ed55b12b696af6e424cd4d/overlapping_polys.csv")
)
# geos approach
poly_geos <- geos::geos_make_polygon(
poly_df$x, poly_df$y,
feature_id = poly_df$id
)
## Emacs, make this -*- mode: sh; -*-
## start with the Docker 'base R' Debian-based image
FROM r-base:latest
## This handle reaches Carl and Dirk
MAINTAINER "Carl Boettiger and Dirk Eddelbuettel" rocker-maintainers@eddelbuettel.com
## Remain current
RUN apt-get update -qq \
# loading in this order causes sf to crash if libgeos links to system GEOS
# remotes::install_github("paleolimbot/libgeos", configure.vars = "USE_SYSTEM_GEOS=YES")
library(libgeos)
library(sf)
nc <- read_sf(system.file("shape/nc.shp", package = "sf"))
nc1 <- nc[1, , drop = FALSE]
st_intersects(nc, nc1)