From e1cf6ab5ceb2775884694af1ebbca3d80343f341 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 22 Jul 2024 22:49:57 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .pre-commit-config.yaml | 2 +- LICENSE | 2 +- .../ntl-analysis/01_clean_data/02_extract_to_polygons.R | 4 ++-- notebooks/ntl-analysis/02_analysis/map_ntl_annual.R | 4 ++-- notebooks/ntl-analysis/02_analysis/percent_change_adm.R | 2 +- notebooks/ntl-analysis/02_analysis/pixel_map_change.R | 6 +++--- notebooks/ntl-analysis/02_analysis/pixel_percent_change.R | 6 +++--- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1a5a89e..26bccfe 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -36,4 +36,4 @@ repos: types_or: [python, pyi, jupyter] args: [--fix] - id: ruff-format - types_or: [python, pyi, jupyter] \ No newline at end of file + types_or: [python, pyi, jupyter] diff --git a/LICENSE b/LICENSE index dbdb0fa..d0a1fa1 100644 --- a/LICENSE +++ b/LICENSE @@ -370,4 +370,4 @@ Exhibit B - "Incompatible With Secondary Licenses" Notice --------------------------------------------------------- This Source Code Form is "Incompatible With Secondary Licenses", as - defined by the Mozilla Public License, v. 2.0. \ No newline at end of file + defined by the Mozilla Public License, v. 2.0. diff --git a/notebooks/ntl-analysis/01_clean_data/02_extract_to_polygons.R b/notebooks/ntl-analysis/01_clean_data/02_extract_to_polygons.R index 1cf820e..56ea5b8 100644 --- a/notebooks/ntl-analysis/01_clean_data/02_extract_to_polygons.R +++ b/notebooks/ntl-analysis/01_clean_data/02_extract_to_polygons.R @@ -52,13 +52,13 @@ for(roi_name in c("cadaster", "lbn_adm0", "lbn_adm1", "lbn_adm2", "lbn_adm3", "l if(year >= 2012){ bm_r <- raster(file.path(ntl_dir, "ntl-rasters", "blackmarble", "annual", paste0("VNP46A4_NearNadir_Composite_Snow_Free_qflag255_1_t",year,".tif"))) - + if(year <= 2022){ viirs_r_r <- raster(file.path(ntl_dir, "ntl-rasters", "viirs", "annual", paste0("LBN_viirs_mean_",year,".tif"))) } else{ viirs_r_r <- raster() } - + } else{ bm_r <- raster() viirs_r_r <- raster() diff --git a/notebooks/ntl-analysis/02_analysis/map_ntl_annual.R b/notebooks/ntl-analysis/02_analysis/map_ntl_annual.R index 9ba4a75..244c5b5 100644 --- a/notebooks/ntl-analysis/02_analysis/map_ntl_annual.R +++ b/notebooks/ntl-analysis/02_analysis/map_ntl_annual.R @@ -3,9 +3,9 @@ #for(year_i in c(2019, 2022)){ # Load data -------------------------------------------------------------------- -r_mean_19 <- raster(file.path(ntl_dir, "ntl-rasters", "blackmarble", "annual", +r_mean_19 <- raster(file.path(ntl_dir, "ntl-rasters", "blackmarble", "annual", "VNP46A4_NearNadir_Composite_Snow_Free_qflag255_1_t2019.tif")) -r_mean_22 <- raster(file.path(ntl_dir, "ntl-rasters", "blackmarble", "annual", +r_mean_22 <- raster(file.path(ntl_dir, "ntl-rasters", "blackmarble", "annual", "VNP46A4_NearNadir_Composite_Snow_Free_qflag255_1_t2023.tif")) roi_sp <- read_sf(file.path(admin_bnd_dir, "lbn_adm_cdr_20200810", "lbn_admbnda_adm0_cdr_20200810.shp")) %>% diff --git a/notebooks/ntl-analysis/02_analysis/percent_change_adm.R b/notebooks/ntl-analysis/02_analysis/percent_change_adm.R index 26e82c9..a19657e 100644 --- a/notebooks/ntl-analysis/02_analysis/percent_change_adm.R +++ b/notebooks/ntl-analysis/02_analysis/percent_change_adm.R @@ -54,7 +54,7 @@ for(roi_name in c("lbn_adm1", "lbn_adm2", "lbn_adm3", "lbn_adm4")){ roi_sf$pc22[roi_sf$pc22 > 100] <- 100 roi_sf$pc22[is.na(roi_sf$pc22)] <- 0 - + # Map -------------------------------------------------------------------------- city_df <- data.frame(lat = 33.898316, lon = 35.505696, name = "Beirut") diff --git a/notebooks/ntl-analysis/02_analysis/pixel_map_change.R b/notebooks/ntl-analysis/02_analysis/pixel_map_change.R index 776716c..f76b686 100644 --- a/notebooks/ntl-analysis/02_analysis/pixel_map_change.R +++ b/notebooks/ntl-analysis/02_analysis/pixel_map_change.R @@ -3,9 +3,9 @@ # Load data -------------------------------------------------------------------- roi_sf <- read_sf(file.path(admin_bnd_dir, "lbn_adm_cdr_20200810", "lbn_admbnda_adm0_cdr_20200810.shp")) -r12 <- raster(file.path(ntl_dir, "ntl-rasters", "blackmarble", "annual", - "VNP46A4_NearNadir_Composite_Snow_Free_qflag255_1_t2012.tif")) -r22 <- raster(file.path(ntl_dir, "ntl-rasters", "blackmarble", "annual", +r12 <- raster(file.path(ntl_dir, "ntl-rasters", "blackmarble", "annual", + "VNP46A4_NearNadir_Composite_Snow_Free_qflag255_1_t2012.tif")) +r22 <- raster(file.path(ntl_dir, "ntl-rasters", "blackmarble", "annual", "VNP46A4_NearNadir_Composite_Snow_Free_qflag255_1_t2023.tif")) r12 <- r12 %>% crop(roi_sf) %>% mask(roi_sf) diff --git a/notebooks/ntl-analysis/02_analysis/pixel_percent_change.R b/notebooks/ntl-analysis/02_analysis/pixel_percent_change.R index 620972b..5275a1c 100644 --- a/notebooks/ntl-analysis/02_analysis/pixel_percent_change.R +++ b/notebooks/ntl-analysis/02_analysis/pixel_percent_change.R @@ -3,9 +3,9 @@ # Load data -------------------------------------------------------------------- roi_sf <- read_sf(file.path(admin_bnd_dir, "lbn_adm_cdr_20200810", "lbn_admbnda_adm0_cdr_20200810.shp")) -r12 <- raster(file.path(ntl_dir, "ntl-rasters", "blackmarble", "annual", - "VNP46A4_NearNadir_Composite_Snow_Free_qflag255_1_t2012.tif")) -r22 <- raster(file.path(ntl_dir, "ntl-rasters", "blackmarble", "annual", +r12 <- raster(file.path(ntl_dir, "ntl-rasters", "blackmarble", "annual", + "VNP46A4_NearNadir_Composite_Snow_Free_qflag255_1_t2012.tif")) +r22 <- raster(file.path(ntl_dir, "ntl-rasters", "blackmarble", "annual", "VNP46A4_NearNadir_Composite_Snow_Free_qflag255_1_t2023.tif")) r12 <- r12 %>% crop(roi_sf) %>% mask(roi_sf)