Skip to content

Instantly share code, notes, and snippets.


Carl Boettiger cboettig

View GitHub Profile
View col_versions.R
# 2017 monthly
x <- tempfile("col")
download.file("", file.path(x, ""))
unzip(file.path(x, ""), exdir = x)
taxa <- readr::read_tsv(file.path(x, "taxa.txt"), guess_max=1e6, quote="", col_types = readr::cols(.default = "c"))
taxa %>% filter(specificEpithet == "sapiens", taxonomicStatus == "accepted name", genus=="Homo")
cboettig /
Last active Jun 4, 2021
ppo puzzle
import numpy as np
import stable_baselines3 as sb3
from stable_baselines3.common.env_util import make_vec_env
from torch import nn as nn
import os
import gym
import gym_fishing
seed = 24

Reproducibility problems

Install precise dependencies indicated:

pip install -r requirements.txt

Download the cached agent (alternately, skip this and re-train agent by uncommenting the learn and save steps above):

View forecast-eml.xml
<?xml version="1.0" encoding="UTF-8"?>
<eml:eml xmlns:eml="" xmlns:xsi="" xmlns:stmml="" packageId="hash://sha256/0feec451332bc465a03fb15a0351fd34bf896e8221226cdfe6bd812bfa6f5dec" system="hash-uri" xsi:schemaLocation="">
<title>NEON Carabid Species Richness and Abundance Forecast</title>
<creator id="">
cboettig / as_efi.R
Last active Mar 16, 2021
Format fable timeseries, fbl_ts, to EFI flat-file format
View as_efi.R
## Helper functions to turn a fable timeseries, which uses a special "distribution" column,
## into a flat-file format. efi_statistic_format uses a 'statistic' column (indicating either mean or sd),
## while efi_ensemble_format uses an 'ensemble' column, drawing `n` times from the distribution.
efi_statistic_format <- function(df){
## determine variable name
var <- attributes(df)$dist
## Normal distribution: use distribution mean and variance
df %>%
dplyr::mutate(sd = sqrt( distributional::variance( .data[[var]] ) ) ) %>%
dplyr::rename(mean = .mean) %>%
View noaa_stack.R
download_noaa <- function(siteID,
interval = "6hr",
date = Sys.Date()-2,
cycle = "00",
dir = file.path(neon_dir(), "noaa")){
dir.create(dir, FALSE, TRUE)
prefix <- paste("noaa", paste0("NOAAGEFS_", interval),
cboettig / tidync-noaa.Rmd
Created Mar 3, 2021
access EFI NOAA data
View tidync-noaa.Rmd
```{r setup}
Today's (2021-03-03) 16-day forecast made for ABBY NEON site at 6h-intervals: (other intervals and older forecasts also possible)
download.file("", "~/")
cboettig / forecast-eml-debug.Rmd
Last active Feb 3, 2021
View forecast-eml-debug.Rmd
title: "Example metadata for a Lotka-Volterra population growth forecast"
output: rmarkdown::html_document
vignette: >
%\VignetteIndexEntry{Logistic Growth Simulation}
#### Code {.tabset}
View Bug Report.Rmd
title: "bug report"
output: github_document
stopifnot(file.exists("Bug Report.Rmd"))
cboettig / prov.json
Created Aug 31, 2020
DCAT2 Provenance (JSON-LD)
View prov.json
"@context": {
"dcat": "",
"prov": "",
"dct": "",
"id": "@id",
"type": "@type",
"identifier": "dct:identifier",
"title": "dct:title",
"description": "dct:description",