<sec:sectionA>
Code is enclosed within #+begin_src/#+end_src
blocks.
x <- 1:10
\part{My First Part} | |
\label{part:part1} | |
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam nec | |
lacus nec dui semper aliquet sit amet in leo. Integer volutpat eu diam | |
sed iaculis. | |
\chapter{My First Chapter} | |
\label{cha:cha1} |
<sec:sectionA>
Code is enclosed within #+begin_src/#+end_src
blocks.
x <- 1:10
## devtools::install_github('meteo', 'oscarperpinan') | |
library(meteo) | |
Sys.setenv(TZ='UTC') | |
st <- data.frame(name=c('Almeria','Granada','Huelva','Malaga','Caceres'), | |
elev=c(42, 702, 38, 29, 448)) | |
coordinates(st) <- cbind(c(-2.46, -3.60, -6.94, -4.42, -6.37), |
library(sp) | |
library(ggmap) | |
## latticeExtra must be loaded after ggmap because both ggplot2 and | |
## latticeExtra define a 'layer' function. We need the definition from | |
## latticeExtra. | |
library(latticeExtra) | |
## We only need maptools to get an example | |
library(maptools) | |
SIDS <- readShapePoly(system.file("shapes/sids.shp", package="maptools")[1], | |
IDvar="FIPSNO", |
library(sp) | |
library(rgdal) | |
setwd(tempdir()) | |
download.file('https://raw.github.com/oscarperpinan/solar/gh-pages/data/SIAR.csv', 'siar.csv', method='wget') | |
siar <- read.csv('siar.csv') | |
summary(siar) | |
siarSP <- SpatialPointsDataFrame(siar[,c(6, 7)], siar[,-c(6,7)]) | |
writeOGR(siarSP, 'siar.geojson', 'siarSP', driver='GeoJSON') |
library(solaR) | |
## Download data from NREL (see help(calcG0)) | |
NRELurl <- 'http://goo.gl/fFEBN' | |
dat <- read.table(NRELurl, header=TRUE, sep=',') | |
names(dat) <- c('date', 'hour', 'G0', 'B', 'D0', 'Ta') | |
##B is direct normal. We need direct horizontal. | |
dat$B0 <- dat$G0-dat$D0 |
library(solaR) | |
## Monthly averages of daily values (Wh/m2) | |
G0dm <- c(2.766,3.491,4.494,5.912,6.989,7.742,7.919,7.027,5.369,3.562,2.814,2.179)*1000; | |
Ta <- c(10, 14.1, 15.6, 17.2, 19.3, 21.2, 28.4, 29.9, 24.3, 18.2, 17.2, 15.2) | |
g0 <- calcG0(lat=37.2, modeRad='aguiar', dataRad=G0dm) | |
xyplot(g0) |
library(raster) | |
library(rasterVis) | |
library(maptools) ## for readShapeLines | |
library(colorspace) ## for terrain_hcl | |
## Get data from GADM and DIVA-GIS | |
setwd(tempdir()) | |
download.file('http://www.gadm.org/data/shp/ETH_adm.zip', 'ETH_adm.zip') | |
unzip('ETH_adm.zip', exdir='.') | |
download.file('http://www.diva-gis.org/data/msk_alt/ETH_msk_alt.zip', 'ETH_msk_alt.zip') |