Skip to content

Commit

Permalink
test gh
Browse files Browse the repository at this point in the history
  • Loading branch information
ramarty committed Nov 2, 2023
1 parent 0345d8f commit f3d7822
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.1
URL: https://github.com/worldbank/blackmarbler
URL: https://worldbank.github.io/blackmarbler/
BugReports: https://github.com/worldbank/blackmarbler/issues
biocViews:
Imports:
Expand Down
1 change: 1 addition & 0 deletions readme_figures/build_package.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ if(F){

usethis::use_pkgdown()
pkgdown::build_site()
pkgdown::build_site_github_pages()
usethis::use_pkgdown_github_pages()

usethis::use_pkgdown()
Expand Down
45 changes: 45 additions & 0 deletions readme_figures/testing.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,51 @@ library(dplyr)
library(httr)



library(blackmarbler)
library(geodata)
library(sf)
library(ggplot2)

#bearer <- "BEARER-TOKEN"

roi <- gadm(country = "GHA",
level=0,
path = tempdir()) |>
st_as_sf()

r <- bm_extract(roi_sf = roi,
product_id = "VNP46A4",
date = 2017,
bearer = bearer)

r <- r |> mask(roi_sf)

r_df <- rasterToPoints(r, spatial = TRUE) |> as.data.frame()
names(r_df) <- c("value", "x", "y")

## Transform NTL
r_df$value[r_df$value <= 1] <- 0

r_df$value_adj <- log(r_df$value+1)

##### Map
p <- ggplot() +
geom_raster(data = r_df,
aes(x = x, y = y,
fill = value_adj)) +
scale_fill_gradient2(low = "black",
mid = "yellow",
high = "red",
midpoint = 4.5) +
coord_quickmap() +
theme_void() +
theme(legend.position = "none")





bearer <- read.csv("~/Desktop/bearer_bm.csv") %>%
pull(token)

Expand Down

0 comments on commit f3d7822

Please sign in to comment.