Description Usage Arguments Value Examples
Calculate stats on the radiance of the pixels in a nightlight raster
that fall within a polygon and its subpolygons using the raster
package. Given a country polygon with subpolygons representing lower
admin levels, it will crop and mask the raster to each subpolygon and
calculate the total radiance for the polygon and return a vector of total
radiances that matches the subpolygons
1 2 | fnAggRadRast(ctryPoly, ctryRastCropped, nlType, configName, nlStats,
custPolyPath = NULL)
|
ctryPoly |
The polygon of the admin level/region of interest. In general is a country polygon with sub-regions usually the lowest known admin level as given by the GADM polygons. |
ctryRastCropped |
The raster containing nightlight radiances to sum. Usually will have already be cropped to the country outline |
nlType |
Character vector The nlType to process |
configName |
character the type of raster being processed |
nlStats |
The statistics to calculate |
custPolyPath |
Alternative to GADM. A path to a custom shapefile zip |
data.frame of polygon attributes and the calculated stats, one column per nlStat
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #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"))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.