# NOT RUN {
#read the Kenya polygon downloaded from GADM and load the lowest admin level (ward)
# }
# NOT RUN {
ctryPoly <- rgdal::readOGR(Rnightlights:::getPolyFnamePath(ctryCode="KEN"),
Rnightlights:::getCtryShpLowestLyrName(ctryCode="KEN"))
# the VIIRS nightlight raster cropped earlier to the country outline
ctryRastCropped <- raster::raster(Rnightlights:::getCtryRasterOutputFname(ctryCode="KEN",
nlType="VIIRS", nlPeriod="201401"))
#calculate the sum of radiances for the wards in Kenya
sumAvgRadRast <- Rnightlights:::fnAggRadRast(ctryPoly=ctryPoly,
ctryRastCropped=ctryRastCropped, nlType="VIIRS", nlStats=c("sum","mean"))
# }
Run the code above in your browser using DataLab