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) |
View equi2polar.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
#!/bin/bash | |
# convert equirectangular 2 fisheye | |
files=`ls *.jpg` | |
for i in $files; | |
do | |
noext=`echo $i | cut -d'.' -f1` | |
echo $noext |
View format_phenor_data.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
# required libraries | |
library(phenor) | |
# where to store the data | |
out_dir <- "data-raw/" | |
# sites to process, stored in a csv file | |
# with columns site, veg_type, roi (check for extra spaces | |
# which can mess with name formatting) | |
sites <- read.table("data/sites.csv", sep = ",", header = TRUE) |
View crop_and_animate.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
#!/bin/bash | |
# crop section of images | |
mogrify -crop 2770x2304+3560+296 *.jpg | |
# compile into animated gif | |
convert -delay 100 -loop 0 -depth 8 -resize '640x' -quality 75% *.jpg anim.gif |
View MODIS_arctic_sites_download.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
# download NDVI time series | |
library(MODISTools) | |
df <- data.frame( | |
site_name = | |
c("US-Bes", | |
"US-Atq", | |
"US-Ivo", | |
"US-ICt", | |
"DK-ZaH", |
NewerOlder