Skip to content

Instantly share code, notes, and snippets.

@hakimabdi
hakimabdi / GIMMS3g_LAI_FPAR_Binary2Geotiff.r
Last active January 30, 2021 15:23
This code ingests binary GIMMS FAPAR and LAI data and converts them to GeoTIFFs. The data was produced by the Climate and Vegetation Research Group of Boston University. The GIMMS data are available from: http://cliveg.bu.edu/modismisr/lai3g-fpar3g.html
#########################################################################################
# This code ingests binary GIMMS FAPAR and LAI data and converts them to GeoTIFFs.
# The data was produced by the Climate and Vegetation Research Group of Boston University.
# The GIMMS data are available from: http://cliveg.bu.edu/modismisr/lai3g-fpar3g.html
# title : GIMMS3g_LAI_FPAR_Binary2Geotiff.r
# purpose : Converts binary GIMMS FAPAR/LAI to GeoTIFFs
# author : Abdulhakim Abdi (@HakimAbdi)
# input : Binary 8-bit unsigned integer with ieee-be byte order
# output : Georeferenced TIFF, ArcGIS-ready files
@hakimabdi
hakimabdi / ManhattanLST.r
Last active January 30, 2021 15:23
Converts Landsat ETM+ thermal imagery to degrees Celsius. See associated blog post here: http://www.hakimabdi.com/20111030/estimating-land-surface-temperature-from-landsat-thermal-imagery/
#########################################################################################
# title : ManhattanLST.R
# purpose : Converts Landsat ETM+ thermal imagery to degrees Celsius
# author : Abdulhakim Abdi (@HakimAbdi)
# input : Landsat TM / ETM+ band 6
# output : Land surface temperature map in degrees Celsius
#########################################################################################
# Install and load the required packages
install.packages(c("rgdal" "sp", "raster"), repos='http://cran.r-project.org')
@andyreagan
andyreagan / Philanhtropy-dist-testing.ipynb
Created October 8, 2013 02:44
Fitting data to a power law, computing statistics and testing against other distributions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sloria
sloria / bobp-python.md
Last active March 3, 2025 16:09
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@dfalster
dfalster / Glopnet.R
Last active February 10, 2023 09:02
Simple example of reproducible research, using global leaf traits database
library(xlsx)
library(smatr)
# get data, from publication Wright et al 2004. DOI: [10.1038/nature02403](http://doi.org/10.1038/nature02403)
download.file("http://www.nature.com/nature/journal/v428/n6985/extref/nature02403-s2.xls", "wright-2004.xls")
dat.Wright <- read.xlsx2("wright-2004.xls", sheetIndex=1, startRow=11, stringsAsFactors=FALSE, check.names=TRUE)
## Clean data
dat.Wright <- dat.Wright[names(dat.Wright) != " "] # Drop blank columns
for(v in c("log.LMA","log.LL"))
@hakimabdi
hakimabdi / pload
Last active January 30, 2021 15:23
This function is for the installation and loading of R packages.. If an R package is not installed, the function will install it using the Austrian CRAN mirror (you can change that), and if a package is already installed, it will be loaded.
#################################################################################################
# title : pload.R
# purpose : Install and load uninstalled packages, or load installed ones.
# author : Abdulhakim Abdi (@HakimAbdi)
# input : Package name in quotes
# output : Installation and loading of uninstalled packages, or loading of installed ones.
#################################################################################################
pload <- function(x){
if(x %in% rownames(installed.packages()))
@hakimabdi
hakimabdi / gridcorts
Last active July 16, 2023 04:57
This function correlates time series data to produce correlation and significance grids based on the chosen method.
#############################################################################################
# title : Gridded Correlation of Time Series Raster Data (Gridcorts)
# purpose : Pixelwise time series correlation and significance based on Pearson's r,
# : Spearman's rho or Kendall's tau
# author : Abdulhakim Abdi (@HakimAbdi)
# input : Raster brick comprising two time series of equal number of layers
# output : Raster object of pixelwise correlation, significance or both (i.e. brick)
# : based on the chosen method
# update : Minor based suggestion from Tao Xiong of Northeast Normal University in China.
# data : Test data: https://1drv.ms/u/s!AsHsKb_qtbkwgvoQuHnPaFazPr_XnA?e=fJ9fue
@vmonaco
vmonaco / cmu_powerlaw.py
Last active February 21, 2020 14:19
CMU keystroke power law
'''
Created on May 26, 2015
@author: vinnie, [email protected]
Power-law results from:
"DATA FORENSIC TECHNIQUES USING BENFORD’S LAW AND ZIPF’S LAW FOR KEYSTROKE
DYNAMICS", Aamo Iorliam, Anthony T.S. Ho, Norman Poh, Santosh Tirunagari,
and Patrick Bours. IWBF 2015.
@jqtrde
jqtrde / modern-geospatial-python.md
Last active August 1, 2023 14:50
Modern remote sensing image processing with Python