A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
| ######################################################################################### | |
| # 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 |
| ######################################################################################### | |
| # 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') |
| # ##### 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 |
| 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")) |
| ################################################################################################# | |
| # 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())) |
| ############################################################################################# | |
| # 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 |
| ''' | |
| 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. |