Load libraries:

require(rgdal)
require(rgeos)
require(sp)
require(ggplot2)
require(raster)
library(maps)
library(maptools)
require(devtools)

Make some color ramps:

cramp1<-colorRampPalette(c("white","lightgray","gold","goldenrod1","hotpink","darkorchid1","darkorchid4"))
bluePH<-rgb(18,127,237, alpha=c(0,255), maxColorValue = 255)
orangeAP<-rgb(255,168,0, alpha=c(0,255), maxColorValue = 255)
redGL<-rgb(232,0,0, alpha=c(0,255), maxColorValue = 255)
General overview:

1. import nonbreeding rasters
2. replace NAs with 0s and perform PDFs
3. Add populations together, perform PDF
4. Export resulting raster as GeoTiff
5. Plot 

Load all .tiff files of the nonbreeding probability density functions of each individual Vermivora from working directory and rasterize:

rlist=list.files(getwd(), pattern="tif$", full.names=FALSE)
for(i in rlist) { assign(unlist(strsplit(i,"[.]"))[1], raster(i)) }

Load shapefiles and plot to check:

data(wrld_simpl)

gwNB<-readOGR(dsn=".","gwNB")
## OGR data source with driver: ESRI Shapefile 
## Source: ".", layer: "gwNB"
## with 11 features
## It has 25 fields
## Integer64 fields read as strings:  FID_NBchry FID_Whemis POP2005
bwNB<-readOGR(dsn=".","bwNB")
## OGR data source with driver: ESRI Shapefile 
## Source: ".", layer: "bwNB"
## with 9 features
## It has 14 fields
## Integer64 fields read as strings:  FID_bw_NB_ FID_Whemis POP2005
VermNB<-readOGR(dsn=".","vermNB_D")
## OGR data source with driver: ESRI Shapefile 
## Source: ".", layer: "vermNB_D"
## with 1 features
## It has 1 fields

Plot an example PDF (ILB04) and overlay nonbreeding distribution of Vermivora:

plot(ILB04_ext, col=cramp1(50))
plot(VermNB, add=T)

Check to ensure surface adds to 1 (i.e., probability density function)

cellStats(ILB04_ext, sum)
## [1] 0.07610879

Try plotting DMG03:

plot(DMG03_ext, col=cramp1(50))
lines(VermNB, add=T)

Check sum DMG03’s surface:

cellStats(DMG03_ext, sum)
## [1] 0.1131047

We need to determine the relative probability of the individual warbler being present at one of these cells during the nonbreeding period. To do that, we’ll calculate a probability density function:

First, fix extent of MIB05:

MIB05_ext<-projectRaster(MIB05_ext, MIB02_ext)
extent(MIB05_ext)
## class       : Extent 
## xmin        : -100.1573 
## xmax        : -63.60464 
## ymin        : -1.786311 
## ymax        : 23.75048
MIB05_ext
## class       : RasterLayer 
## dimensions  : 51, 73, 3723  (nrow, ncol, ncell)
## resolution  : 0.5007215, 0.5007215  (x, y)
## extent      : -100.1573, -63.60464, -1.786311, 23.75048  (xmin, xmax, ymin, ymax)
## coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0 
## data source : in memory
## names       : MIB05_ext 
## values      : 0.0001826691, 0.005590735  (min, max)
plot(MIB05_ext, col=cramp1(50))

Create PDFs:

DMG03_ext<-DMG03_ext[[1]]/(cellStats(DMG03_ext[[1]], sum))
ILB04_ext<-ILB04_ext[[1]]/(cellStats(ILB04_ext[[1]], sum))
ILB06_ext<-ILB06_ext[[1]]/(cellStats(ILB06_ext[[1]], sum))
ILB08_ext<-ILB08_ext[[1]]/(cellStats(ILB08_ext[[1]], sum))
ILB18_ext<-ILB18_ext[[1]]/(cellStats(ILB18_ext[[1]], sum))
KYB14_ext<-KYB14_ext[[1]]/(cellStats(KYB14_ext[[1]], sum))
MAB05_ext<-MAB05_ext[[1]]/(cellStats(MAB05_ext[[1]], sum))
MAB06_ext<-MAB06_ext[[1]]/(cellStats(MAB06_ext[[1]], sum))
MAB09_ext<-MAB09_ext[[1]]/(cellStats(MAB09_ext[[1]], sum))
MAB12_ext<-MAB12_ext[[1]]/(cellStats(MAB12_ext[[1]], sum))
MIB02_ext<-MIB02_ext[[1]]/(cellStats(MIB02_ext[[1]], sum))
MIB05_ext<-MIB05_ext[[1]]/(cellStats(MIB05_ext[[1]], sum))
MIB12_ext<-MIB12_ext[[1]]/(cellStats(MIB12_ext[[1]], sum))
MIB14_ext<-MIB14_ext[[1]]/(cellStats(MIB14_ext[[1]], sum))
MIG01_ext<-MIG01_ext[[1]]/(cellStats(MIG01_ext[[1]], sum))
MIH02_ext<-MIH02_ext[[1]]/(cellStats(MIH02_ext[[1]], sum))
NCB01_ext<-NCB01_ext[[1]]/(cellStats(NCB01_ext[[1]], sum))
ONB02_ext<-ONB02_ext[[1]]/(cellStats(ONB02_ext[[1]], sum))
ONB05_ext<-ONB05_ext[[1]]/(cellStats(ONB05_ext[[1]], sum))
ONG03_ext<-ONG03_ext[[1]]/(cellStats(ONG03_ext[[1]], sum))
ONG05_ext<-ONG05_ext[[1]]/(cellStats(ONG05_ext[[1]], sum))
ONG10_ext<-ONG10_ext[[1]]/(cellStats(ONG10_ext[[1]], sum))
PAB01_ext<-PAB01_ext[[1]]/(cellStats(PAB01_ext[[1]], sum))
PAB03_ext<-PAB03_ext[[1]]/(cellStats(PAB03_ext[[1]], sum))
PAB05_ext<-PAB05_ext[[1]]/(cellStats(PAB05_ext[[1]], sum))
PAB07_ext<-PAB07_ext[[1]]/(cellStats(PAB07_ext[[1]], sum))
PAG12_ext<-PAG12_ext[[1]]/(cellStats(PAG12_ext[[1]], sum))
PAH01_ext<-PAH01_ext[[1]]/(cellStats(PAH01_ext[[1]], sum))
PAH06_ext<-PAH06_ext[[1]]/(cellStats(PAH06_ext[[1]], sum))
MN14_ext16<-MN14_ext16[[1]]/(cellStats(MN14_ext16[[1]], sum))
RLG16_ext<-RLG16_ext[[1]]/(cellStats(RLG16_ext[[1]], sum))
MN36_ext16<-MN36_ext16[[1]]/(cellStats(MN36_ext16[[1]], sum))
MN29_ext16<-MN29_ext16[[1]]/(cellStats(MN29_ext16[[1]], sum))
RLG23_ext<-RLG23_ext[[1]]/(cellStats(RLG23_ext[[1]], sum))
RLGF15_ext<-RLGF15_ext[[1]]/(cellStats(RLGF15_ext[[1]], sum))
RMG02_ext<-RMG02_ext[[1]]/(cellStats(RMG02_ext[[1]], sum))
SHG07_ext<-SHG07_ext[[1]]/(cellStats(SHG07_ext[[1]], sum))
SLG12_ext<-SLG12_ext[[1]]/(cellStats(SLG12_ext[[1]], sum))
SLG18_ext<-SLG18_ext[[1]]/(cellStats(SLG18_ext[[1]], sum))
TAG07_ext<-TAG07_ext[[1]]/(cellStats(TAG07_ext[[1]], sum))
TAG09_ext<-TAG09_ext[[1]]/(cellStats(TAG09_ext[[1]], sum))
TAG14_ext<-TAG14_ext[[1]]/(cellStats(TAG14_ext[[1]], sum))
TNB03_ext<-TNB03_ext[[1]]/(cellStats(TNB03_ext[[1]], sum))
TNB09_ext<-TNB09_ext[[1]]/(cellStats(TNB09_ext[[1]], sum))
TNG13_ext<-TNG13_ext[[1]]/(cellStats(TNG13_ext[[1]], sum))
VAG01_ext<-VAG01_ext[[1]]/(cellStats(VAG01_ext[[1]], sum))
VAG02_ext<-VAG02_ext[[1]]/(cellStats(VAG02_ext[[1]], sum))
WIB05_ext<-WIB05_ext[[1]]/(cellStats(WIB05_ext[[1]], sum))
WIB11_ext16<-WIB11_ext16[[1]]/(cellStats(WIB11_ext16[[1]], sum))
WIG01_ext<-WIG01_ext[[1]]/(cellStats(WIG01_ext[[1]], sum))
WIG02_ext<-WIG02_ext[[1]]/(cellStats(WIG02_ext[[1]], sum))
WIH03_ext16<-WIH03_ext16[[1]]/(cellStats(WIH03_ext16[[1]], sum))
WIB11_ext17<-WIB11_ext17[[1]]/(cellStats(WIB11_ext17[[1]], sum))
WIB19_ext<-WIB19_ext[[1]]/(cellStats(WIB19_ext[[1]], sum))
WIH03_ext17<-WIH03_ext17[[1]]/(cellStats(WIH03_ext17[[1]], sum))
MN25_ext<-MN25_ext[[1]]/(cellStats(MN25_ext[[1]], sum))
MN29_ext15<-MN29_ext15[[1]]/(cellStats(MN29_ext15[[1]], sum))
MN36_ext15<-MN36_ext15[[1]]/(cellStats(MN36_ext15[[1]], sum))
PA05_ext<-PA05_ext[[1]]/(cellStats(PA05_ext[[1]], sum))
PA11_ext<-PA11_ext[[1]]/(cellStats(PA11_ext[[1]], sum))
TN13_ext15<-TN13_ext15[[1]]/(cellStats(TN13_ext15[[1]], sum))
MN03_ext<-MN03_ext[[1]]/(cellStats(MN03_ext[[1]], sum))
MN05_ext<-MN05_ext[[1]]/(cellStats(MN05_ext[[1]], sum))
MN06_ext<-MN06_ext[[1]]/(cellStats(MN06_ext[[1]], sum))
MN11_ext<-MN11_ext[[1]]/(cellStats(MN11_ext[[1]], sum))
MN12_ext<-MN12_ext[[1]]/(cellStats(MN12_ext[[1]], sum))
MN14_ext14<-MN14_ext14[[1]]/(cellStats(MN14_ext14[[1]], sum))
MN15_ext<-MN15_ext[[1]]/(cellStats(MN15_ext[[1]], sum))
MN16_ext<-MN16_ext[[1]]/(cellStats(MN16_ext[[1]], sum))
MN20_ext<-MN20_ext[[1]]/(cellStats(MN20_ext[[1]], sum))
TN05_ext<-TN05_ext[[1]]/(cellStats(TN05_ext[[1]], sum))
TN06_ext<-TN06_ext[[1]]/(cellStats(TN06_ext[[1]], sum))
TN09_ext<-TN09_ext[[1]]/(cellStats(TN09_ext[[1]], sum))
TN10_ext<-TN10_ext[[1]]/(cellStats(TN10_ext[[1]], sum))
TN13_ext14<-TN13_ext14[[1]]/(cellStats(TN13_ext14[[1]], sum))
TN16_ext<-TN16_ext[[1]]/(cellStats(TN16_ext[[1]], sum))

Check sum of new pdf surfaces:

cellStats(DMG03_ext,sum)
## [1] 1
cellStats(TN16_ext,sum)
## [1] 1

Replace NAs w 0s

#BWWA
ILB04_ext[is.na(ILB04_ext)]<-0
ILB06_ext[is.na(ILB06_ext)]<-0
ILB08_ext[is.na(ILB08_ext)]<-0
ILB18_ext[is.na(ILB18_ext)]<-0
KYB14_ext[is.na(KYB14_ext)]<-0
MAB05_ext[is.na(MAB05_ext)]<-0
MAB06_ext[is.na(MAB06_ext)]<-0
MAB09_ext[is.na(MAB09_ext)]<-0
MAB12_ext[is.na(MAB12_ext)]<-0
MIB02_ext[is.na(MIB02_ext)]<-0
MIB05_ext[is.na(MIB05_ext)]<-0
MIB12_ext[is.na(MIB12_ext)]<-0
MIB14_ext[is.na(MIB14_ext)]<-0
NCB01_ext[is.na(NCB01_ext)]<-0
ONB02_ext[is.na(ONB02_ext)]<-0
ONB05_ext[is.na(ONB05_ext)]<-0
PAB01_ext[is.na(PAB01_ext)]<-0
PAB03_ext[is.na(PAB03_ext)]<-0
PAB05_ext[is.na(PAB05_ext)]<-0
PAB07_ext[is.na(PAB07_ext)]<-0
TNB03_ext[is.na(TNB03_ext)]<-0
TNB09_ext[is.na(TNB09_ext)]<-0
WIB05_ext[is.na(WIB05_ext)]<-0
WIB11_ext17[is.na(WIB11_ext17)]<-0
WIB11_ext16[is.na(WIB11_ext16)]<-0
WIB19_ext[is.na(WIB19_ext)]<-0

#GWWA
DMG03_ext[is.na(DMG03_ext)]<-0
MIG01_ext[is.na(MIG01_ext)]<-0
ONG03_ext[is.na(ONG03_ext)]<-0
ONG05_ext[is.na(ONG05_ext)]<-0
ONG10_ext[is.na(ONG10_ext)]<-0
PAG12_ext[is.na(PAG12_ext)]<-0
MN14_ext16[is.na(MN14_ext16)]<-0
RLG16_ext[is.na(RLG16_ext)]<-0
MN36_ext16[is.na(MN36_ext16)]<-0
MN29_ext16[is.na(MN29_ext16)]<-0
RLG23_ext[is.na(RLG23_ext)]<-0
RLGF15_ext[is.na(RLGF15_ext)]<-0
RMG02_ext[is.na(RMG02_ext)]<-0
SHG07_ext[is.na(SHG07_ext)]<-0
SLG12_ext[is.na(SLG12_ext)]<-0
SLG18_ext[is.na(SLG18_ext)]<-0
TAG07_ext[is.na(TAG07_ext)]<-0
TAG09_ext[is.na(TAG09_ext)]<-0
TAG14_ext[is.na(TAG14_ext)]<-0
TNG13_ext[is.na(TNG13_ext)]<-0
VAG01_ext[is.na(VAG01_ext)]<-0
VAG02_ext[is.na(VAG02_ext)]<-0
WIG01_ext[is.na(WIG01_ext)]<-0
WIG02_ext[is.na(WIG02_ext)]<-0
MN25_ext[is.na(MN25_ext)]<-0
MN29_ext15[is.na(MN29_ext15)]<-0
MN36_ext15[is.na(MN36_ext15)]<-0
PA05_ext[is.na(PA05_ext)]<-0
PA11_ext[is.na(PA11_ext)]<-0
TN13_ext15[is.na(TN13_ext15)]<-0
MN03_ext[is.na(MN03_ext)]<-0
MN05_ext[is.na(MN05_ext)]<-0
MN06_ext[is.na(MN06_ext)]<-0
MN11_ext[is.na(MN11_ext)]<-0
MN12_ext[is.na(MN12_ext)]<-0
MN14_ext14[is.na(MN14_ext14)]<-0
MN15_ext[is.na(MN15_ext)]<-0
MN16_ext[is.na(MN16_ext)]<-0
MN20_ext[is.na(MN20_ext)]<-0
TN05_ext[is.na(TN05_ext)]<-0
TN06_ext[is.na(TN06_ext)]<-0
TN09_ext[is.na(TN09_ext)]<-0
TN10_ext[is.na(TN10_ext)]<-0
TN13_ext14[is.na(TN13_ext14)]<-0
TN16_ext[is.na(TN16_ext)]<-0

#Hybrids
MIH02_ext[is.na(MIH02_ext)]<-0
PAH01_ext[is.na(PAH01_ext)]<-0
PAH06_ext[is.na(PAH06_ext)]<-0
WIH03_ext16[is.na(WIH03_ext16)]<-0
WIH03_ext17[is.na(WIH03_ext17)]<-0

Average nonbreeding PDFs for individuals with >= 2 years tracking data:

WIB11_avg<-(WIB11_ext16+WIB11_ext17)/2
MN29_avg<-(MN29_ext15+MN29_ext16)/2
TN13_avg<-(TN13_ext14+TN13_ext15)/2
MN14_avg<-(MN14_ext14+MN14_ext16)/2
MN36_avg<-(MN36_ext15+MN36_ext16)/2
WIH03avg_ext<-(WIH03_ext16+WIH03_ext17)/2

Add all blue-winged warbler probability functions together:

BWWA<-(ILB04_ext+ILB06_ext+ILB08_ext+ILB18_ext+KYB14_ext+MAB05_ext+MAB06_ext+MAB09_ext+MAB12_ext+MIB02_ext+MIB05_ext+MIB12_ext+NCB01_ext+ONB02_ext+ONB05_ext+PAB01_ext+PAB03_ext+PAB05_ext+PAB07_ext+TNB03_ext+TNB09_ext+WIB05_ext+WIB11_avg+WIB19_ext)

Create PDF of blue-winged warbler nonbreeding distribution:

BWWA<-BWWA[[1]]/(cellStats(BWWA[[1]], sum))

Repeat process for golden-winged warblers,

GWWA<-(DMG03_ext+MIG01_ext+ONG03_ext+ONG05_ext+ONG10_ext+PAG12_ext+MN14_avg+RLG16_ext+MN36_avg+MN29_avg+RLG23_ext+RLGF15_ext+RMG02_ext+SHG07_ext+SLG12_ext+SLG18_ext+TAG07_ext+TAG09_ext+TAG14_ext+TNG13_ext+VAG01_ext+VAG02_ext+WIG01_ext+WIG02_ext+MN25_ext+PA05_ext+PA11_ext+TN13_avg+MN03_ext+MN05_ext+MN06_ext+MN11_ext+MN12_ext+MN15_ext+MN16_ext+MN20_ext+TN05_ext+TN06_ext+TN09_ext+TN10_ext+TN16_ext)

GWWA<-GWWA[[1]]/(cellStats(GWWA[[1]], sum))

and hybrids:

Hybrids<-(MIH02_ext+PAH01_ext+PAH06_ext+WIH03avg_ext)/4

Look at results: Blue-winged warblers

plot(BWWA, col=cramp1(100)) #, xlim=c(-120, -60), ylim=c(-3,60))
map('world',add=T, col="gray")
lines(bwNB, add=T, col="black", lwd=1)

Golden-winged warblers:

plot(GWWA, col=cramp1(100))
map('world',add=T, col="gray")
lines(gwNB, add=T, col="black", lwd=1)

GWWA<-GWWA[[1]]/(cellStats(GWWA[[1]], sum))

and hybrids:

Hybrids<-(MIH02_ext+PAH01_ext+PAH06_ext+WIH03avg_ext)/4

plot(Hybrids, col=cramp1(100))
map('world',add=T, col="gray")
lines(VermNB, add=T, col="black", lwd=1)

Additional code for grouping individuals into regional populations and visualizing:

####Breaking BWWA into groups####
#Prairie-Hardwoods Bird Conservation Region
PH_BWWA<-(MIB02_ext+MIB05_ext+MIB12_ext+WIB05_ext+WIB11_avg+WIB19_ext)

PH_BWWA<-PH_BWWA[[1]]/(cellStats(PH_BWWA[[1]], sum))

plot(PH_BWWA, col=cramp1(100))#, xlim=c(-120, -60), ylim=c(-3,60))
map('world',add=T, col="gray")
lines(bwNB, add=T, col="black", lwd=1)

#Central Hardwoods BWWA: IL, W TN#
CH_BWWA<-(ILB04_ext+ILB06_ext+ILB08_ext+ILB18_ext+TNB09_ext)

CH_BWWA<-CH_BWWA[[1]]/(cellStats(CH_BWWA[[1]], sum))

plot(CH_BWWA, col=cramp1(100))#, xlim=c(-120, -60), ylim=c(-3,60))
map('world',add=T, col="gray")
lines(bwNB, add=T, col="black", lwd=1)

#Southern Appalachian BWWA: W Tenn, E Tenn, NC, KY#
SA_BWWA<-(KYB14_ext+NCB01_ext+TNB03_ext)

SA_BWWA<-SA_BWWA[[1]]/(cellStats(SA_BWWA[[1]], sum))

plot(SA_BWWA, col=cramp1(100))#, xlim=c(-120, -60), ylim=c(-3,60))
map('world',add=T, col="gray")
lines(bwNB, add=T, col="black", lwd=1)

#Northern Appalachian BWWA: PA, MA, ON#
NA_BWWA<-(MAB05_ext+MAB06_ext+MAB09_ext+MAB12_ext+ONB02_ext+ONB05_ext+PAB01_ext+PAB03_ext+PAB05_ext+PAB07_ext)

NA_BWWA<-NA_BWWA[[1]]/(cellStats(NA_BWWA[[1]], sum))

plot(NA_BWWA, col=cramp1(100))#, xlim=c(-120, -60), ylim=c(-3,60))
map('world',add=T, col="gray")
lines(bwNB, add=T, col="black", lwd=1)

#Appalachian Mountaints BCR GWWA
AM_GWWA<-(PAG12_ext+VAG01_ext+VAG02_ext+PA05_ext+PA11_ext+TN13_avg+TN05_ext+TN06_ext+TN09_ext+TN10_ext+TN16_ext+TNG13_ext)
AM_GWWA<-AM_GWWA[[1]]/(cellStats(AM_GWWA[[1]], sum))

plot(AM_GWWA, col=cramp1(100))#, xlim=c(-120, -60), ylim=c(-3,60))
map('world',add=T, col="gray")
lines(gwNB, add=T, col="black", lwd=1)

#Great Lakes (Boreal Hardwood Transition BCR) GWWA
GL_GWWA<-(DMG03_ext+MIG01_ext+MN14_avg+MN29_avg+MN36_avg+ONG03_ext+ONG05_ext+ONG10_ext+RLG16_ext+RLG23_ext+RLGF15_ext+RMG02_ext+SHG07_ext+SLG12_ext+SLG18_ext+TAG07_ext+TAG09_ext+TAG14_ext+WIG01_ext+WIG02_ext+MN03_ext+MN05_ext+MN06_ext+MN11_ext+MN12_ext+MN15_ext+MN16_ext+MN20_ext+MN25_ext)
GL_GWWA<-GL_GWWA[[1]]/(cellStats(GL_GWWA[[1]], sum))

plot(GL_GWWA, col=cramp1(100))#, xlim=c(-120, -60), ylim=c(-3,60))
map('world',add=T, col="gray")
lines(gwNB, add=T, col="black", lwd=1)

#Western Great Lakes GWWA: MB, MN, WI
WGL_GWWA<-(DMG03_ext+MN14_avg+MN29_avg+MN36_avg+RLG16_ext+RLG23_ext+RLGF15_ext+RMG02_ext+SHG07_ext+SLG12_ext+SLG18_ext+TAG07_ext+TAG09_ext+TAG14_ext+WIG01_ext+WIG02_ext+MN03_ext+MN05_ext+MN06_ext+MN11_ext+MN12_ext+MN15_ext+MN16_ext+MN20_ext+MN25_ext)

WGL_GWWA<-WGL_GWWA[[1]]/(cellStats(WGL_GWWA[[1]], sum))

plot(WGL_GWWA, col=cramp1(100))#, xlim=c(-120, -60), ylim=c(-3,60))
map('world',add=T, col="gray")
lines(VermNB, add=T, col="black", lwd=1)

#Eastern Great Lakes GWWA: MI, ON

EGL_GWWA<-(MIG01_ext+ONG03_ext+ONG05_ext+ONG10_ext)

EGL_GWWA<-EGL_GWWA[[1]]/(cellStats(EGL_GWWA[[1]], sum))

plot(EGL_GWWA, col=cramp1(100))#, xlim=c(-120, -60), ylim=c(-3,60))
map('world',add=T, col="gray")
lines(VermNB, add=T, col="black", lwd=1)

#Northern Appalachian GWWA: PA
NAPP_GWWA<-(PA05_ext+PA11_ext+PAG12_ext)
NAPP_GWWA<-NAPP_GWWA[[1]]/(cellStats(NAPP_GWWA[[1]], sum))

plot(NAPP_GWWA, col=cramp1(100))#, xlim=c(-120, -60), ylim=c(-3,60))
map('world',add=T, col="gray")
lines(VermNB, add=T, col="black", lwd=1)

#Southern Appalachian GWWA: VA, TN#
SAPP_GWWA<-(VAG01_ext+VAG02_ext+TNG13_ext+TN05_ext+TN06_ext+TN09_ext+TN10_ext+TN16_ext+TN13_avg)
SAPP_GWWA<-SAPP_GWWA[[1]]/(cellStats(SAPP_GWWA[[1]], sum))

plot(SAPP_GWWA, col=cramp1(100))#, xlim=c(-120, -60), ylim=c(-3,60))
map('world',add=T, col="gray")
lines(VermNB, add=T, col="black", lwd=1)

devtools::session_info()
##  setting  value                       
##  version  R version 3.3.3 (2017-03-06)
##  system   x86_64, darwin13.4.0        
##  ui       X11                         
##  language (EN)                        
##  collate  en_US.UTF-8                 
##  tz       <NA>                        
##  date     2017-12-28                  
## 
##  package    * version date       source                            
##  assertthat   0.1     2013-12-06 CRAN (R 3.3.0)                    
##  backports    1.0.5   2017-01-18 cran (@1.0.5)                     
##  colorspace   1.3-2   2016-12-14 cran (@1.3-2)                     
##  devtools   * 1.12.0  2016-06-24 CRAN (R 3.3.0)                    
##  digest       0.6.12  2017-01-27 cran (@0.6.12)                    
##  evaluate     0.10    2016-10-11 cran (@0.10)                      
##  foreign      0.8-67  2016-09-13 CRAN (R 3.3.3)                    
##  ggplot2    * 2.2.1   2016-12-30 cran (@2.2.1)                     
##  gtable       0.2.0   2016-02-26 CRAN (R 3.3.0)                    
##  htmltools    0.3.5   2016-03-21 CRAN (R 3.3.0)                    
##  knitr      * 1.15.1  2016-11-22 cran (@1.15.1)                    
##  lattice      0.20-34 2016-09-06 CRAN (R 3.3.3)                    
##  lazyeval     0.2.0   2016-06-12 CRAN (R 3.3.0)                    
##  magrittr     1.5     2014-11-22 CRAN (R 3.3.0)                    
##  maps       * 3.1.1   2016-07-27 CRAN (R 3.3.0)                    
##  maptools   * 0.9-1   2017-02-23 cran (@0.9-1)                     
##  memoise      1.0.0   2016-01-29 CRAN (R 3.3.0)                    
##  munsell      0.4.3   2016-02-13 CRAN (R 3.3.0)                    
##  plyr         1.8.4   2016-06-08 CRAN (R 3.3.0)                    
##  raster     * 2.5-8   2016-06-02 CRAN (R 3.3.0)                    
##  Rcpp         0.12.10 2017-03-19 cran (@0.12.10)                   
##  rgdal      * 1.2-5   2016-12-15 cran (@1.2-5)                     
##  rgeos      * 0.3-22  2017-01-09 CRAN (R 3.3.2)                    
##  rmarkdown  * 1.3     2017-01-19 Github (rstudio/rmarkdown@5b74148)
##  rprojroot    1.2     2017-01-16 cran (@1.2)                       
##  scales       0.4.1   2016-11-09 cran (@0.4.1)                     
##  sp         * 1.2-4   2016-12-22 cran (@1.2-4)                     
##  stringi      1.1.2   2016-10-01 cran (@1.1.2)                     
##  stringr      1.2.0   2017-02-18 cran (@1.2.0)                     
##  tibble       1.2     2016-08-26 cran (@1.2)                       
##  withr        1.0.2   2016-06-20 CRAN (R 3.3.0)                    
##  yaml         2.1.14  2016-11-12 cran (@2.1.14)