Skip to content

Commit

Permalink
closes #364
Browse files Browse the repository at this point in the history
  • Loading branch information
rafapereirabr committed Jul 31, 2024
1 parent eeb552d commit 416b1be
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
25 changes: 13 additions & 12 deletions data_prep/R/census_tract_2022.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
library(sf)
library(data.table)
library(dplyr)

library(furrr)

year <- 2022

Expand Down Expand Up @@ -82,7 +82,11 @@ temp_sf <- mutate(temp_sf, across(all_of(char_cols), as.character))

# make all columns as character
num_cols <- all_cols[all_cols %like% 'code_']
temp_sf <- mutate(temp_sf, across(all_of(char_cols), as.numeric))
temp_sf <- mutate(temp_sf, across(all_of(num_cols), as.numeric))

# remove lagoa dos patos e mirim
temp_sf <- subset(temp_sf, code_muni != 430000100000000)
temp_sf <- subset(temp_sf, code_muni != 430000200000000)


# Use UTF-8 encoding
Expand All @@ -94,12 +98,6 @@ gc()



# remove lagoa dos patos e mirim
temp_sf <- subset(temp_sf, code_muni != 430000100000000)
temp_sf <- subset(temp_sf, code_muni != 430000200000000)




# harmonize and save

Expand Down Expand Up @@ -132,10 +130,13 @@ all_states <- unique(temp_sf$code_state)
# Apply function to save the data
gc(reset = T)

tictoc::tic()
future::plan(strategy = 'multisession')
furrr::future_map(.x=all_states, .f=save_state, .progress = T)
tictoc::toc()
# tictoc::tic()
# future::plan(strategy = 'multisession')
# furrr::future_map(.x=all_states,
# .f=save_state,
# .progress = T,
# .options = furrr_options(seed=TRUE))
# tictoc::toc()


tictoc::tic()
Expand Down
6 changes: 6 additions & 0 deletions r-package/prep_data/update_metadata_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,10 @@ piggyback::pb_upload(to_go,
#


f <- list.files('//storage1/geobr/data_gpkg/census_tract/2022', full.names = T)
piggyback::pb_upload(f,
"ipeaGIT/geobr",
"v1.7.0"
#, .token = ttt
)

0 comments on commit 416b1be

Please sign in to comment.