Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Koen Hufkens khufkens

🎯
Focusing
View GitHub Profile
@khufkens
khufkens / novelty_cliff.R
Created Nov 24, 2020
Novelty Cliff XKCD graph
View novelty_cliff.R
library(tidyverse)
library(extrafont)
### Set up the trial dataset
data <- NULL
data$x <- c(1:50, 60, 68)
data$y <- c(1:50, -50, -100)
data$xaxis <- -1.5
data$yaxis <- 0
@khufkens
khufkens / MODIS_arctic_sites_download.R
Last active Aug 21, 2020
MODIS arctic sites data request
View MODIS_arctic_sites_download.R
# download NDVI time series
library(MODISTools)
df <- data.frame(
site_name =
c("US-Bes",
"US-Atq",
"US-Ivo",
"US-ICt",
"DK-ZaH",
@khufkens
khufkens / orient_images.sh
Created Nov 19, 2019
Line to run on all images before CV processing
View orient_images.sh
# aligns virtual orientation with physical orientation
mogrify -auto-orient *.png
@khufkens
khufkens / montage.sh
Last active Jun 19, 2020
Montage of example numbers for zooniverse project
View montage.sh
montage *.png -bordercolor White -border 5x5 -colorspace Gray -gravity center -tile 7x -geometry +10+0 ~/montage.jpg
@khufkens
khufkens / ghent_air_quality_vmm.R
Created Jun 12, 2019
Ghent air quality study VMM rehash
View ghent_air_quality_vmm.R
# Ghent air pollution analysis
# parametric t-tests
# non-parametric Mann-Whitney U test
# download and collate the data
pdf_data <- paste0(pdftools::pdf_text("https://klimaat.stad.gent/sites/default/files/nota_circulatieplangent_3.pdf")[2],
collapse = " ")
# some regular expression moving about
subset <- gsub(',', ".", pdf_data)
@khufkens
khufkens / cold_front_geopotential_transect.R
Last active Apr 19, 2019
Cold front transect along geopotential heights
View cold_front_geopotential_transect.R
# Before you start install all the referenced packages below
# including the development release of ecmwfr you will also
# need the rnaturalearthdata in addition to the normal package
# To run the code copy and paste segments as this is still
# rough around the edges and requires user interaction to
# set your CDS API key.
# load libraries
if(!require(devtools)){install.packages("devtools")}
devtools::install_github("khufkens/ecmwfr")
@khufkens
khufkens / essential_climate_variables_animation.R
Last active Apr 3, 2020
Downloads and animates CDS essential climate variables
View essential_climate_variables_animation.R
# Before you start install all the referenced packages below
# including the development release of ecmwfr you will also
# need the rnaturalearthdata in addition to the normal package
# To run the code copy and paste segments as this is still
# rough around the edges and requires user interaction to
# set your CDS API key.
# load libraries
if(!require(devtools)){install.packages("devtools")}
devtools::install_github("khufkens/ecmwfr")
@khufkens
khufkens / essential_climate_variable_plot.R
Last active Apr 12, 2019
Downloads and plots essential climate variable resembling the ECWMF plot
View essential_climate_variable_plot.R
# Before you start install all the referenced packages below
# including the development release of ecmwfr you will also
# need the rnaturalearthdata in addition to the normal package
# To run the code copy and paste segments as this is still
# rough around the edges and requires user interaction to
# set your CDS API key.
# load libraries
if(!require(devtools)){install.packages("devtools")}
devtools::install_github("khufkens/ecmwfr")
@khufkens
khufkens / modify_pdf_exif_data.sh
Last active Dec 23, 2019
Correct PDF author / title meta-data
View modify_pdf_exif_data.sh
#!/bin/bash
# Insert PDF meta-data into exif header
# for pdf files with format author - year - title.pdf.
# This allows e-readers to query meta-data for proper
# display and sorting of authors and titles
# (note: relies on exiftool)
for filename in *.pdf; do
noext=`echo "${filename%.*}"`
@khufkens
khufkens / el_nino_precip_analysis.r
Created May 10, 2018
CHIRP drought / precipitation differences between the Amazon and Congo Basin during the 2015 El Nino
View el_nino_precip_analysis.r
# map El Nino drought in the Amazon and Africa
library(raster)
library(tidyverse)
library(maps)
library(RColorBrewer)
# set colour theme
colours = brewer.pal(11,"RdBu")
# download CHIRP data
You can’t perform that action at this time.