If multiple input files are given, pandoc will concatenate them all (with blank lines between them) before parsing. -- from Pandoc website
Pandoc command:
pandoc -s input1.md input2.md input3.md -o output.html
| strptime('2008201', format = '%Y%j') | |
| ## or | |
| as.Date('2008201', format = '%Y%j') |
| require(ncdf) | |
| require(raster) | |
| ## Input: a netCDF file | |
| file.nc <- 'rain.nc' | |
| ## Output: a GeoTIFF file | |
| file.tiff <- 'rain.tiff' | |
| ## Import netCDF |
| # Script for question posted on Stack Overflow | |
| # Load relevant libraries | |
| library(ggplot2) | |
| library(raster) | |
| library(gridExtra) | |
| vplayout <- function(x, y) { | |
| viewport(layout.pos.row = x, layout.pos.col = y) | |
| } |
| ## a tiff file | |
| input <- "modis.evi.tif" | |
| output <- "modis.evi.reprojected.tif" | |
| ## GDAL command line for reprojection | |
| proj.cmd.warp <- 'gdalwarp -t_srs \'+proj=latlong +datum=WGS84\' -r near -overwrite' | |
| ## Invoke the system GDAL command | |
| system(command = paste(proj.cmd.warp, input, output, sep = ' ')) |
If multiple input files are given, pandoc will concatenate them all (with blank lines between them) before parsing. -- from Pandoc website
Pandoc command:
pandoc -s input1.md input2.md input3.md -o output.html
| pandoc --bibliography=bibtex.bib --mathjax --parse-raw -s inpud.md -o output.html |
| ## TRMM 3B43 Monthly precipitation does NOT need flip (which 3B42 need) | |
| r.trmm <- raster(nrows = 400, ncols = 1440, xmn = 0, xmx = 360, ymn = | |
| -50, ymx = 50, crs="+proj=longlat +datum=WGS84") | |
| r.trmm[] <- readBin(files.input, 'double', n = 576000, size = 4, | |
| endian = 'big') | |
| ## TRMM 3B42 | |
| ## r.trmm <- flip(rotate(r.trmm), 'y') |
| ## Arthur: Roman Luštrik | |
| ## http://stackoverflow.com/questions/9017070/set-the-color-in-plot-xts | |
| plot.xts2 <- function (x, y = NULL, type = "l", auto.grid = TRUE, major.ticks = "auto", | |
| minor.ticks = TRUE, major.format = TRUE, bar.col = "grey", | |
| candle.col = "white", ann = TRUE, axes = TRUE, col = "black", ...) | |
| { | |
| series.title <- deparse(substitute(x)) | |
| ep <- axTicksByTime(x, major.ticks, format = major.format) | |
| otype <- type |
| ## x: daily rainfall time series | |
| ## lindex: date stamps of the MOD13 VI product time series | |
| ## rindex = lindex + 15 | |
| ## TODO: increase the efficiency by replace the loop use sapply | |
| fun.aggre16d <- function(x, lindex, rindex) { | |
| v.16d.rain <- vector('numeric', length(lindex)) | |
| for (i in 1:length(lindex)) { | |
| v.16d.rain[i] <- sum(x[lindex[i]:rindex[i]], na.rm = T) | |
| } |
| ## Compute the cross-correlation Pearson product-moment correlation coefficient | |
| ## and check the p.value | |
| ## This function is an alternative of the native ccf() function which does not | |
| ## return p.value by default | |
| fun.ccfmax <- function(x) { | |
| a <- x[1:(length(x) / 2)] | |
| b <- x[-(1:(length(x) / 2))] | |
| if (all(is.na(a)) | all(is.na(b))) { | |
| return(c(NA, NA, NA)) |