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