# NOT RUN {
#long running examples which may require large downloads
# }
# NOT RUN {
#Example 1: process VIIRS nightlights for all countries and all periods available e.g. to create
#a local cache or repo
processNlData() #process VIIRS nightlights for all countries and all periods
#Example 2: process nightlights for all countries in 2012 only
nlPeriods <- getAllNlPeriods("VIIRS") #get a list of all nightlight periods to present-day
nlPeriods <- nlPeriods[grep("^2014", nlPeriods)] #filter only periods in 2014
processNlData(nlPeriods=nlPeriods)
#Example 3: process VIIRS nightlights for countries KEN & RWA in 2014 Jan to 2014 May only
cCodes <- c("KEN", "RWA")
nlPeriods <- getAllNlPeriods("VIIRS")
nlPeriods <- nlPeriods[grep("^20140[1-5]", nlPeriods)]
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"), nlPeriods=c("201410", "201411", "201412"))
#Example 5: process all nightlights, all countries, all stats in one thread
processNlData()
#Example 6: process all 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 <- getAllNlYears("VIIRS")
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