bm_raster | R Documentation |
Make a raster of nighttime lights from NASA Black Marble data
bm_raster(
roi_sf,
product_id,
date,
bearer,
variable = NULL,
quality_flag_rm = NULL,
check_all_tiles_exist = TRUE,
interpol_na = FALSE,
output_location_type = "memory",
file_dir = NULL,
file_prefix = NULL,
file_skip_if_exists = TRUE,
file_return_null = FALSE,
h5_dir = NULL,
quiet = FALSE,
...
)
roi_sf |
Region of interest; sf polygon. Must be in the WGS 84 (epsg:4326) coordinate reference system. |
product_id |
One of the following:
|
date |
Date of raster data. Entering one date will produce a
|
bearer |
NASA bearer token. For instructions on how to create a token, see here. |
variable |
Variable to used to create raster (default:
|
quality_flag_rm |
Quality flag values to use to set values to For
For
|
check_all_tiles_exist |
Check whether all Black Marble nighttime light tiles exist for the region of interest. Sometimes not all tiles are available, so the full region of interest may not be covered. If |
interpol_na |
When data for more than one date is downloaded, whether to interpolate |
output_location_type |
Where to produce output; either |
file_dir |
The directory where data should be exported (default: |
file_prefix |
Prefix to add to the file to be saved. The file will be saved as the following: |
file_skip_if_exists |
Whether the function should first check wither the file already exists, and to skip downloading or extracting data if the data for that date if the file already exists (default: |
file_return_null |
Whether to return |
h5_dir |
Black Marble data are originally downloaded as |
quiet |
Suppress output that show downloading progress and other messages. (Default: |
... |
Additional arguments for |
Raster
## Not run:
# Define bearer token
bearer <- "BEARER-TOKEN-HERE"
# sf polygon of Ghana
library(geodata)
roi_sf <- gadm(country = "GHA", level=0, path = tempdir()) %>% st_as_sf()
# Daily data: raster for October 3, 2021
ken_20210205_r <- bm_raster(roi_sf = roi_sf,
product_id = "VNP46A2",
date = "2021-10-03",
bearer = bearer)
# Monthly data: raster for March 2021
ken_202103_r <- bm_raster(roi_sf = roi_sf,
product_id = "VNP46A3",
date = "2021-03-01",
bearer = bearer)
# Annual data: raster for 2021
ken_2021_r <- bm_raster(roi_sf = roi_sf,
product_id = "VNP46A4",
date = 2021,
bearer = bearer)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.