This file contains hidden or 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
| #define function to calculate area between the curves | |
| area.between.curves <- function(yAxis1, yAxis2, xAxis) | |
| { | |
| d <- c(yAxis2 - yAxis1)[-1] | |
| d <- d * diff(xAxis) | |
| neg <- sum(abs(d[which(d < 0)])) | |
| pos <- sum(d[which(d > 0)]) |
This file contains hidden or 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
| <html><head> | |
| <meta http-equiv="Content-type" content="text/html; charset=UTF-8"> | |
| <style> | |
| html, body { background-color: white; } | |
| table { border-collapse:collapse; border:none; } | |
| caption { font-weight: bold; text-align:left; } | |
| td { } | |
| .thead { border-top: double; text-align:center; font-style:normal; font-weight:bold; padding:0.2cm; } | |
| .tdata { padding:0.2cm; text-align:left; vertical-align:top; } | |
| .arc { background-color:#f2f2f2; } |
This file contains hidden or 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
| # Martin Jung - 2018 | |
| # Function to check for installed packages and install them if they are not installed | |
| install <- function(packages){ | |
| new.packages <- packages[!(packages %in% installed.packages()[, "Package"])] | |
| if (length(new.packages)) | |
| install.packages(new.packages, dependencies = TRUE) | |
| sapply(packages, require, character.only = TRUE) | |
| } |
This file contains hidden or 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
| # -*- coding: utf-8 -*- | |
| """ | |
| Created on Thu May 17 12:12:49 2018 | |
| @author: Martin Jung | |
| @email: M.jung@sussex.ac.uk | |
| Idea: | |
| Set up a xarray-dask environment to be run on landsat stacks | |
| Calculate pixelwise mann-kendal tests and retain sign. slopes |
This file contains hidden or 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
| # -*- coding: utf-8 -*- | |
| """ | |
| Created on Thu May 24 13:43:36 2018 | |
| @author: mj291 | |
| """ | |
| # Defaults defaults | |
| import numpy as np | |
| import matplotlib.pyplot as plt |
This file contains hidden or 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
| # -*- coding: utf-8 -*- | |
| """ | |
| Created on Tue Nov 17 14:23:27 2015 | |
| @title: Creating netCDF container for all files | |
| @author: Martin Jung | |
| """ | |
| from __future__ import print_function # make sure print behaves the same in 2.7 and 3.x | |
| import netCDF4 as nc |
This file contains hidden or 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
| https://lpdaac.usgs.gov/sites/default/files/public/elearning/GeoTIFF_MaskingPlottingAppEEARS_GeoTIFF_TS.html |
This file contains hidden or 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
| # Source: | |
| # https://github.com/soskuthy/gamm_intro/blob/master/gamm_hacks.r | |
| post.sim.gamm <- function (mod, newdat, n=10000, exclude=NULL) { | |
| lp.full <- predict(mod, newdata=newdat, type = "lpmatrix", exclude=exclude) | |
| coefs.full <- coef(mod) | |
| vc.full <- vcov(mod) | |
| sim.full <- mvrnorm(n, mu = coefs.full, Sigma = vc.full) | |
| fits.full <- lp.full %*% t(sim.full) | |
| } |
This file contains hidden or 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
| ################################################################################ | |
| # | |
| # ikashnitsky.github.io 2017-06-30 | |
| # Produce an RGB coded map of pop structures at NUTS-3 level | |
| # Ilya Kashnitsky, ilya.kashnitsky@gmail.com | |
| # | |
| ################################################################################ | |
| # Erase all objects in memory | |
| rm(list = ls(all = TRUE)) |
This file contains hidden or 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 from http://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/population-distribution-demography/geostat | |
| # Originally seen at http://spatial.ly/2014/08/population-lines/ | |
| # So, this blew up on both Reddit and Twitter. Two bugs fixed (southern Spain was a mess, | |
| # and some countries where missing -- measure twice, submit once, damnit), and two silly superflous lines removed after | |
| # @hadleywickham pointed that out. Also, switched from geom_segment to geom_line. | |
| # The result of the code below can be seen at http://imgur.com/ob8c8ph | |
| library(tidyverse) |