Skip to content
Snippets Groups Projects
Commit 79a0a366 authored by Simon, Wolfram's avatar Simon, Wolfram
Browse files

NAL global file: SPAM_GGS_all_global_recspread_area_ratio.csv (27.03.2021)

> No NA's > Only the **ratio of harvested area** for disaggregation. Like this, there is more consistency with the presence of nuts/veggies in adm1 zones. Otherwise, it happened that there is area but no production vice versa. Then you divide by 0 = inf.
> No inf values: The inf values came from the division of P/H=Y calculation. The P was in all cases very low so I decided to simply recode them to 0. Then Yields would be also 0.
> rounding fixed > 1 decimal like in the original dataset so we do not lose the level of detail.
> Yield conversion (production in mt) checked and correct.
> Aggregation to adm1 checked and correct.
parent f9d5c04d
Branches
No related tags found
No related merge requests found
...@@ -870,7 +870,7 @@ dat_har_prod <- do.call("rbind", lst.har) # merging all tech types ...@@ -870,7 +870,7 @@ dat_har_prod <- do.call("rbind", lst.har) # merging all tech types
# har_dat <- read_csv(here::here("Input_data", "Core_data", "harvestedarea_all_rec_tech_adm1.csv"))#, locale = locale(encoding = "LATIN2")) # har_dat <- read_csv(here::here("Input_data", "Core_data", "harvestedarea_all_rec_tech_adm1.csv"))#, locale = locale(encoding = "LATIN2"))
# Final global transformed SPAM2010 dataset. This df is in lign with GGS adm1 units. # Final global transformed SPAM2010 dataset. This df is in lign with GGS adm1 units.
SPAM_GGS_all = rbind(dat_prd_prod, dat_har_prod, dat_phy_prod) SPAM_GGS_all = rbind(dat_prd_area, dat_har_area, dat_phy_area)
# Changing format and calculating yields # Changing format and calculating yields
dat_spam_global = SPAM_GGS_all %>% dat_spam_global = SPAM_GGS_all %>%
...@@ -882,8 +882,9 @@ dat_spam_global = SPAM_GGS_all %>% ...@@ -882,8 +882,9 @@ dat_spam_global = SPAM_GGS_all %>%
mutate(Y = round((P*1000/H),1))%>% #checked for result. We are transforming mt to kg when multiplying Production by 1000 to get unit kg/ha for yields mutate(Y = round((P*1000/H),1))%>% #checked for result. We are transforming mt to kg when multiplying Production by 1000 to get unit kg/ha for yields
mutate_at(vars(Y), ~replace(., is.nan(.), 0)) %>% mutate_at(vars(Y), ~replace(., is.nan(.), 0)) %>%
mutate(P = ifelse(is.infinite(Y), 0, P)) %>% #If Yields show inf values P is changed to 0. mutate(P = ifelse(is.infinite(Y), 0, P)) %>% #If Yields show inf values P is changed to 0.
mutate(Y = ifelse(is.infinite(Y),0, Y)) #inf values in Y column are changed to 0's mutate(Y = ifelse(is.infinite(Y),0, Y)) %>% #inf values in Y column are changed to 0's
write.csv(dat_spam_global, here::here("Input_data", "Core_data", "SPAM_GGS_all_global_recspread_harvrationly.csv")) mutate_at(7:8, round, 1) #H and A had rounding errors.
write.csv(dat_spam_global, here::here("Input_data", "Core_data", "SPAM_GGS_all_global_recspread_area_ratio.csv")) #Final global dataset aggregated to adm1 level and disaggregating tnuts and three veggies
# Subsetting EU ----------------------------------------------------------- # Subsetting EU -----------------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment