# NOT RUN {
#long running examples which may require large downloads
# }
# NOT RUN {
#Example 1: process monthly VIIRS nightlights for all countries at the
lowest admin level and for all nlPeriods available e.g. to create a
local cache or repo
processNlData() #process VIIRS nightlights for all countries and all periods
#Example 2: process monthly VIIRS nightlights for all countries in 2014 only
nlPeriods <- getAllNlPeriods("VIIRS.M") #get a list of all nightlight periods to present-day
nlPeriods <- nlPeriods[grep("^2014", nlPeriods)] #filter only periods in 2014
processNlData(nlTypes="VIIRS.M", nlPeriods=nlPeriods)
#Example 3: process OLS nightlights for countries KEN & RWA from 1992
# to 2000
cCodes <- c("KEN", "RWA")
nlPeriods <- getAllNlPeriods("VIIRS.M")
nlPeriods <- nlRange("1992", "2000", "OLS.Y")
processNlData(ctryCodes=cCodes, nlPeriods=nlPeriods)
#Example 4: process VIIRS nightlights for countries KEN & RWA in 2014 Oct to 2014 Dec only
processNlData(ctryCodes=c("KEN", "RWA"), nlTypes="VIIRS.M",
nlPeriods=c("201410", "201411", "201412"))
#Example 5: process all nightlights, all countries, all stats in one thread
processNlData()
#Example 6: process all VIIRS monthly nightlights, all countries, all stats with each
# year in a separate thread. Create a separate R script for each year as follows:
library(Rnightlights)
nlPeriods <- getAllNlPeriods("VIIRS.M")
nlPeriods_2014 <- nlPeriods[grep("^2014", nlPeriods)]
processNlData(nlPeriods=nlPeriods_2014)
#Run the script from the command line as:
#R CMD BATCH script_name_2014.R
# }
Run the code above in your browser using DataLab