Skip to content

Commit

Permalink
readme fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ramarty committed Apr 26, 2024
1 parent cc330e7 commit bd49e69
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ library(sf)
library(terra)
library(ggplot2)
library(tidyterra)
library(lubridate)

#### Define NASA bearer token
bearer <- "BEARER-TOKEN-HERE"
Expand Down Expand Up @@ -146,18 +147,19 @@ r <- bm_raster(roi_sf = roi_sf,
bearer = bearer)

#### Prep data
r <- r |> terraLLmask(roi_sf)
r <- r |> terra::mask(roi_sf)

## Distribution is skewed, so log
r[] <- log(r[] + 1)

##### Map
p <- ggplot() +
ggplot() +
geom_spatraster(data = r) +
scale_fill_gradient2(low = "black",
mid = "yellow",
high = "red",
midpoint = 4.5) +
midpoint = 4.5,
na.value = "transparent") +
labs(title = "Nighttime Lights: October 2021") +
coord_sf() +
theme_void() +
Expand Down
3 changes: 2 additions & 1 deletion readme_figures/testing.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ df <- bm_extract(roi_sf = roi_sf,
date = 2018:2020,
bearer = bearer,
h5_dir = "~/Desktop/h5_tmp",
interpol_na = T,
output_location_type = "file",
file_dir = "~/Desktop/ntl_tmp",
file_return_null = F,
aggregation_fun = c("mean", "sum"))

bm_r <- terra::approximate(r,
Expand Down

0 comments on commit bd49e69

Please sign in to comment.