You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-3Lines changed: 1 addition & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -276,19 +276,17 @@ Both functions take the following arguments:
276
276
* For `product_id``"VNP46A2"`, uses `Gap_Filled_DNB_BRDF-Corrected_NTL`.
277
277
* For `product_id`s `"VNP46A3"` and `"VNP46A4"`, uses `NearNadir_Composite_Snow_Free`.
278
278
279
-
***quality_flag_rm:** Quality flag values to use to set values to `NA`. Each pixel has a quality flag value, where low quality values can be removed. Values are set to `NA` for each value in ther `quality_flag_rm` vector. (Default: `c(255)`).
279
+
***quality_flag_rm:** Quality flag values to use to set values to `NA`. Each pixel has a quality flag value, where low quality values can be removed. Values are set to `NA` for each value in ther `quality_flag_rm` vector. (Default: `NULL`).
280
280
281
281
* For `VNP46A1` and `VNP46A2` (daily data):
282
282
*`0`: High-quality, Persistent nighttime lights
283
283
*`1`: High-quality, Ephemeral nighttime Lights
284
284
*`2`: Poor-quality, Outlier, potential cloud contamination, or other issues
285
-
*`255`: No retrieval, Fill value (masked out on ingestion)
286
285
287
286
* For `VNP46A3` and `VNP46A4` (monthly and annual data):
288
287
*`0`: Good-quality, The number of observations used for the composite is larger than 3
289
288
*`1`: Poor-quality, The number of observations used for the composite is less than or equal to 3
290
289
*`2`: Gap filled NTL based on historical data
291
-
*`255`: Fill value
292
290
293
291
***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 `TRUE`, skips cases where not all tiles are available. (Default: `TRUE`).
294
292
***interpol_na:** When data for more than one date is downloaded, whether to interpolate `NA` values in rasters using the [`raster::approxNA`](https://www.rdocumentation.org/packages/raster/versions/3.6-26/topics/approxNA) function. Additional arguments for the [`raster::approxNA`](https://www.rdocumentation.org/packages/raster/versions/3.6-26/topics/approxNA) function can also be passed into `bm_raster`/`bm_extract` (eg, `method`, `rule`, `f`, `ties`, `z`, `NA_rule`). (Default: `FALSE`).
Below shows an example examining quality for daily data (`VNP46A2`).
76
76
77
-
#### Nighttime Lights <aname="daily-ntl"></a>
77
+
#### Gap filled nighttime lights <aname="daily-ntl-gap"></a>
78
78
79
-
We download data for January 1st, 2023. When the `variable` parameter is not specified, `bm_raster` creates a raster using the `Gap_Filled_DNB_BRDF-Corrected_NTL` variable for daily data.
79
+
We download data for January 1st, 2023. When the `variable` parameter is not specified, `bm_raster` creates a raster using the `Gap_Filled_DNB_BRDF-Corrected_NTL` variable for daily data. This variable "gap fills" poor quality observations (ie, pixels with cloud cover) using data from previous days.
#### Non gap filled nighttime lights <aname="daily-ntl-nongap"></a>
157
+
158
+
Instead of using gap-filled data, we could also just use nighttime light values from the date selected using the `DNB_BRDF-Corrected_NTL` variable.
159
+
160
+
```{r, results='hide'}
161
+
ntl_r <- bm_raster(roi_sf = roi_sf,
162
+
product_id = "VNP46A2",
163
+
date = "2023-01-01",
164
+
bearer = bearer,
165
+
variable = "DNB_BRDF-Corrected_NTL")
88
166
```
89
167
90
168
<details>
@@ -118,7 +196,7 @@ ggplot() +
118
196
```{r, ntl_daily_r_map, echo=FALSE}
119
197
```
120
198
121
-
We notice that a number of observations are missing, that are poor quality and are not gap-filled. To understand the extent of missing date, we can use the following code to determine (1) the total number of pixels that cover Switzerland, (2) the total number of non-`NA` nighttime light pixels, and (3) the proportion of non-`NA` pixels.
199
+
We notice that a number of observations are missing. To understand the extent of missing date, we can use the following code to determine (1) the total number of pixels that cover Switzerland, (2) the total number of non-`NA` nighttime light pixels, and (3) the proportion of non-`NA` pixels.
#### Nighttime lights for good quality observations, without gap filling <aname="daily-nogap"></a>
272
-
273
-
By default, the `bm_raster` function uses the `Gap_Filled_DNB_BRDF-Corrected_NTL` variable for daily data. Gap filling indicates that some poor quality pixels use data from a previous date; the `Latest_High_Quality_Retrieval` indicates the date the nighttime lights value came from.
Instead of using `Gap_Filled_DNB_BRDF-Corrected_NTL`, we could ignore gap filled observations---using the `DNB_BRDF-Corrected_NTL` variable. Here, we also remove poor quality pixels.
Below shows an example examining quality for monthly data (`VNP46A3`). The same approach can be used for annual data (`VNP46A4`); the variables are the same for both monthly and annual data.
@@ -488,15 +486,15 @@ ggplot() +
488
486
489
487
#### Nighttime lights for good quality observations <aname="ma-ntl_gq"></a>
490
488
491
-
The `quality_flag_rm` parameter determines which pixels are set to `NA` based on the quality indicator. By default, no pixels are filtered out (except for those that are assigned a "fill value" by BlackMarble, which are always removed). However, if we also want to remove poor quality pixels, we can adjust the `quality_flag_rm` parameter.
489
+
The `quality_flag_rm` parameter determines which pixels are set to `NA` based on the quality indicator. By default, no pixels are filtered out (except for those that are assigned a "fill value" by BlackMarble, which are always removed). However, if we also want to remove poor quality pixels and remove pixels that are gap filled, we can adjust the `quality_flag_rm` parameter.
492
490
493
491
```{r, results='hide'}
494
492
ntl_good_qual_r <- bm_raster(roi_sf = roi_sf,
495
493
product_id = "VNP46A3",
496
494
date = "2023-01-01",
497
495
bearer = bearer,
498
496
variable = "NearNadir_Composite_Snow_Free",
499
-
quality_flag_rm = 1)
497
+
quality_flag_rm = c(1,2)) # 1 = poor quality; 2 = gap filled based on historical data
0 commit comments