Description Usage Arguments Details Value Examples
Given a countryCode
, yearMonth
and preferred processing
methods cropMaskMethod
and extractMethod
, this function
will first check if the data already exists in the cache. First it
will check if the data file exists and if it does not it will create
a dataframe of the country data containing only the administrative
properties and move to processing. If the data file exists it will
check to see if the particular year month already exists. If it
exists, it will exit with a message. If it does not exist, it will
load the country data file and move on to processing.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | processNLCountry(
ctryCode,
admLevel,
nlType,
configName = pkgOptions(paste0("configName_", nlType)),
extension,
multiTileStrategy = pkgOptions("multiTileStrategy"),
multiTileMergeFun = pkgOptions("multiTileMergeFun"),
removeGasFlaresMethod = pkgOptions(paste0("removeGasFlaresMethod_", nlType)),
nlPeriod,
nlStats = pkgOptions("nlStats"),
downloadMethod = pkgOptions("downloadMethod"),
cropMaskMethod = pkgOptions("cropMaskMethod"),
extractMethod = pkgOptions("extractMethod"),
gadmVersion = pkgOptions("gadmVersion"),
gadmPolyType = pkgOptions("gadmPolyType"),
custPolyPath = NULL
)
|
ctryCode |
|
admLevel |
|
nlType |
|
configName |
character the config shortname of raster being processed |
extension |
character the extension of raster being processed |
multiTileStrategy |
character How to handle multiple tiles per nlPeriod |
multiTileMergeFun |
character The function to use to merge tiles |
removeGasFlaresMethod |
character The method to use to perform gas flare removal or NULL to disable |
nlPeriod |
|
nlStats |
the statistics to calculate. If not provided will calculate
the stats specified in |
downloadMethod |
The method used to download polygons and rasters |
cropMaskMethod |
|
extractMethod |
("rast" or "gdal") Whether to use rasterize or gdal-based functions to crop and mask the country rasters |
gadmVersion |
The GADM version to use |
gadmPolyType |
The format of polygons to download from GADM |
custPolyPath |
Alternative to GADM. A path to a custom shapefile zip |
Processing consists of:
Reading in the country polygon in ESRI Shapefile format
Reading in the tiles that the particular country intersects with and then clipping the tile(s) to the country boundary
Extract the data from the clipped raster and compute various statistics at the lowest admin level in the country.
Finally, these stats are appended to the data frame and written to the data file.
NOTE: processNLCountry()
assumes that all inputs are available
and will not attempt to download them. It should ideally be called
from the function processNlData()
which does all the
preparation for processing. processNlData()
which can process
multiple countries and time periods will download all the required
tiles and polygons prior to calling processNlCountry
.
getCtryNlData
can also be used with the option
ignoreMissing=FALSE
which will call processNlData
in the background.
None
1 2 3 4 5 6 | #calculate only the sum of monthly VIIRS radiances for Dec 2014 using gdal
#for both cropMask and extraction for KEN
## Not run:
Rnightlights:::processNLCountry("KEN", "KEN_adm2", "VIIRS.M", "201412", "gdal", "gdal", "sum")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.