Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added primary and secondary other land adjustment to BII disaggregattion #415

Merged
merged 11 commits into from
Jul 27, 2022
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### changed
- **scripts** output/extra/disaggregation_BII.R adjusted BII output for primary and secondary other land
- **59_som** Now calculates soil C for fallow
- **inputs** updated non-food initial prices, MACCs curves, and removed suitability threshold of 0.1 in all_marginal setting
- **inputs** updated non-food initial prices, MACCs curves, and removed suitability threshold of 0.1 in all_marginal setting

### added
- **scripts* added output scripts for FSEC FSDP runs
Expand Down
17 changes: 14 additions & 3 deletions scripts/output/extra/disaggregation_BII.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ mapping <- readRDS(map_file)
bii_lr <- BII(gdx, file = NULL, level = "cell", mode = "auto", landClass = "all",
bii_coeff = NULL, side_layers = NULL)

# add BII values for primary other land (BII = 1)
bii_lr <- mbind(
bii_lr[,,"other", invert=TRUE],
setNames(bii_lr[,,"other"], c("primother.forested", "primother.nonforested")),
setNames(bii_lr[,,"other"], c("secdother.forested", "secdother.nonforested"))
)
bii_lr[,,c("primother.forested", "primother.nonforested")] <- 1

# Load input data
land_ini_lr <- readGDX(gdx, "f10_land", "f_land", format = "first_found")[, "y1995", ]
land_lr <- land(gdx, sum = FALSE, level = "cell")
Expand Down Expand Up @@ -122,15 +130,18 @@ land_hr <- interpolateAvlCroplandWeighted(x = land_lr,
urban_land_hr = urban_land_hr,
unit = "share")

land_hr <- land_hr[, "y1985", invert = TRUE]
# Add primary and secondaray other land
land_hr <- PrimSecdOtherLand(land_hr, land_hr_file)

# specify potential natural vegetation
land_hr <- land_hr * side_layers_hr[, , c("forested", "nonforested")]

# Sum over land classes
bii_hr <- dimSums(land_hr * bii_hr, dim = 3, na.rm = TRUE)

# Save BII data as .nc and .mz file, the first for better transferabiltiy, the second one for faster processing
write.magpie(bii_hr, file.path(outputdir, paste0("cell.bii_0.5.mz")), comment = "unitless")
write.magpie(bii_hr, file.path(outputdir, paste0("cell.bii_0.5.nc")), comment = "unitless")
write.magpie(bii_hr, file.path(outputdir, paste0(title, "_cell.bii_0.5.nc")), comment = "unitless")
write.magpie(bii_hr, file.path(outputdir, paste0(title, "_cell.bii_0.5.mz")), comment = "unitless")

# Clean up
rm(bii_hr)
Expand Down
4 changes: 2 additions & 2 deletions scripts/start/projects/project_FSEC_Scenarios.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ general_settings <- function(title) {
cfg$qos <- "priority_maxMem"
cfg$output <- c(cfg$output,
"rds_report_iso",
"extra/disaggregation_BII"
#"extra/disaggregation_BII", "projects/FSEC_dietaryIndicators",
"extra/disaggregation_BII",
"projects/FSEC_dietaryIndicators",
#"projects/FSEC_environmentalPollution_grid"
)

Expand Down