View clean_gh-pages.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git checkout --orphan gh-pages | |
# preview files to be deleted | |
git rm -rf --dry-run . | |
# actually delete the files | |
git rm -rf . |
View format_rsofun_drivers.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Format and run p-model drivers on Euler | |
#' | |
#' Takes site information for a single | |
#' or multiple sites and grabs all data | |
#' required for a p-model run in rsofun. | |
#' | |
#' Parameter settings are provided as | |
#' arguments, but could be altered after | |
#' the fact if desired. | |
#' |
View aggregate_netcdf.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(terra) | |
library(stringr) | |
#---- static code ---- | |
# read in the original data | |
r <- rast("LPX-Bern_SH1_gpppft.nc") | |
# first subset to only the required years | |
# 1978 - 2020 |
View batch_unzip.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -name '*.zip' -exec sh -c 'unzip {};' |
View reference_blue_marble.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gdal_translate -a_ullr -180 90 180 -90 -a_srs EPSG:4326 world.topo.bathy.200408.3x5400x2700.jpg tmp.tif |
View opt_span_example.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Interpolation using a loess smoother | |
# and optimal span determination | |
library(MODISTools) | |
library(phenocamr) | |
library(tidyverse) | |
VI <- mt_subset( | |
product = "MOD13Q1", | |
lon = -72.1755, |
View download_plumber2.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rvest) | |
# base html url | |
url <- "http://dapds00.nci.org.au/thredds/fileServer/ks32/CLEX_Data/PLUMBER2/v1-0/Flux/" | |
# catalogue | |
html_page = read_html("https://dap.nci.org.au/thredds/remoteCatalogService?catalog=http://dapds00.nci.org.au/thredds/catalog/ks32/CLEX_Data/PLUMBER2/v1-0/Flux/catalog.xml") | |
# grab files from the catalogue | |
files = html_page %>% |
View animation.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# convert pngs to mp4 | |
ffmpeg -r 2 -i tmp/%03d.png -y out.mp4 | |
# convert mp4 to twitter compatible format | |
ffmpeg -i out.mp4 -vf scale=1280:720 -b:v 5000K -minrate 5000K -maxrate 5000K -b:a 128K -r 30 -f mp4 -vcodec libx264 -profile:v high -pix_fmt yuv420p -strict -2 -ac 2 -acodec aac twitter.mp4 |
View waffle_plot.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# data wrangling | |
library(tidyverse) | |
# waffle plot | |
library(waffle) | |
# combining graphs | |
library(patchwork) | |
# text magic |
View downsample_extract_hwsd.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Downsample HWSD data to the scale of 0.5 degree | |
# WFDEI / CRU data | |
library(raster) | |
library(hwsdr) | |
library(tidyverse) | |
# get mu_global at 0.5 degrees from the | |
# ORNL DAAC (which is easier than reading in | |
# that monstrous BIL file) |
NewerOlder