Skip to content

Commit

Permalink
Merge branch 'develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
jansteinhauser authored Apr 5, 2024
2 parents 4766d87 + 9919c63 commit efb738b
Show file tree
Hide file tree
Showing 701 changed files with 1,164 additions and 883 deletions.
29 changes: 16 additions & 13 deletions .Rprofile
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
# | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK)
# | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK)
# | authors, and contributors see CITATION.cff file. This file is part
# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of
# | AGPL-3.0, you are granted additional permissions described in the
# | MAgPIE License Exception, version 1.0 (see LICENSE file).
# | Contact: [email protected]
Sys.setenv(RENV_PATHS_LIBRARY = "renv/library")
if (Sys.info()[["sysname"]] == "Windows") {
# make renv use R's default download function to prevent
# curl: (35) schannel: next InitializeSecurityContext failed: Unknown error
# (0x80092012) - The revocation function was unable to check revocation for the certificate.
options(renv.download.override = utils::download.file)
}

source("renv/activate.R")
# do not check if library and renv.lock are in sync, because normally renv.lock does not exist
options(renv.config.synchronized.check = FALSE,
renv.config.user.profile = TRUE) # load user specific settings from ~/.Rprofile

renvVersion <- "0.16.0"
if (packageVersion("renv") != renvVersion) {
renvLockExisted <- file.exists(renv::paths$lockfile())
renv::upgrade(version = renvVersion, reload = TRUE, prompt = FALSE)
if (!renvLockExisted) {
unlink(renv::paths$lockfile())
}
}
# the text "renvVersion" is required for a check in a coupling script, will be removed soon

source("renv/activate.R")

if (!"https://rse.pik-potsdam.de/r/packages" %in% getOption("repos")) {
options(repos = c(getOption("repos"), pik = "https://rse.pik-potsdam.de/r/packages"))
Expand All @@ -28,7 +31,7 @@ if (isTRUE(rownames(installed.packages(priority = "NA")) == "renv")) {
message("Finished installing R package dependencies.")
}

# source global .Rprofile (very important to load user specific settings)
if (file.exists("~/.Rprofile")) {
source("~/.Rprofile")
# in case bootstrapping fails halfway, install piamenv and rely on requirement auto-fixing
if (!requireNamespace("piamenv", quietly = TRUE)) {
renv::install("piamenv", prompt = FALSE)
}
4 changes: 2 additions & 2 deletions .zenodo.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"title": "MAgPIE - An Open Source land-use modeling framework",
"version": "4.7.1dev",
"version": "4.7.2dev",
"creators": [
{
"name": "Dietrich, Jan Philipp",
Expand Down Expand Up @@ -114,5 +114,5 @@
"license": {
"id": "AGPL-3.0-or-later"
},
"publication_date": "2024-02-28"
"publication_date": "2024-04-02"
}
38 changes: 27 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,14 @@
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).


## [Unreleased]

### changed
- **config** updated FSEC scenario config for revision and included new calibration file (after cost fix in preprocessing)
- **70_livestock** if `c70_fac_req_regr` is set to `reg`: use of USDA/FAO values for historic factor requirements for livestock instead of using regression values and change of calibration year from 2005 to 2010 for regional factor requirements regression
- **21_trade** Revision of trade module. Replaced `cfg$gms$s21_trade_bal_damper` in favour of `cfg$gms$k_import21`, which allows for additional imports to maintain feasibility
- **58_peatland** Threshold in equations changed from 1e-10 to 1e-8 to avoid rare divisions by zero
- - **44_biodiversity** update `bii_target realization` to take `f44_rr_layer` into account in `q44_bii`
- **default.cfg** update additional data to rev4.49
- **44_biodiversity** update `bii_target realization` to take `f44_rr_layer` into account in `q44_bii`
- **default.cfg** update additional data to rev4.50

### added
- **scripts** added a new validation_cell.R output script that generates a pdf with the comparison of magpie land use and crop type outputs with LUH and MAPSPAM historical data at cellular resolution.
- **default.cfg** added cropland growth constraint `cfg$gms$s30_annual_max_growth`
- **default.cfg** added early afforestation constraint `cfg$gms$s32_max_aff_cell_2025`
- **default.cfg** added technical cost for missing BII increase `cfg$gms$s44_cost_bii_missing`
Expand All @@ -24,16 +20,35 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- **core** added `coup2110`timesteps
- **15_food** added additional sigmoid food substition scenarios `sigmoid_75pc_25_50`, `sigmoid_50pc_25_50` and `sigmoid_25pc_25_50`
- **30_crop** added regional cropland equation `q30_crop_reg` and presolve growth constraint
- **32_forestry** added cluster-level new afforestation area constraint
- **32_forestry** added cluster-level new afforestation area constraint for 2025
- **60_bioenergy** added new realization `1st2ndgen_priced_feb24` to enable price-driven 2nd gen bioenergy production
- **scripts** added automatic set writer for new bioenergy realization to `start_functions`
- **scripts** added start scripts for the GENIE project
- **scenario_config.csv** added preset for GENIE project
- **config** added `.codeCheck` with additonal configuration when running `gms::codeCheck`

### removed
-

### fixed
-

## [4.7.2] - 2024-04-02

### changed
- **21_trade** Revision of trade module. Replaced `cfg$gms$s21_trade_bal_damper` in favour of `cfg$gms$k_import21`, which allows for additional imports to maintain feasibility
- **58_peatland** Threshold in equations changed from 1e-10 to 1e-8 to avoid rare divisions by zero
- **70_livestock** if `c70_fac_req_regr` is set to `reg`: use of USDA/FAO values for historic factor requirements for livestock instead of using regression values and change of calibration year from 2005 to 2010 for regional factor requirements regression
- **config** updated FSEC scenario config for revision and included new calibration file (after cost fix in preprocessing)
- **scripts** modified output reporting for SEALS to account for forestry plantations

### added
- **30_crop** Improved representation of cropland requiring relocation in response to introducing semi-natural habitat at the 1 km level based on high-resolution satellite imagery.
- **config** added `.codeCheck` with additonal configuration when running `gms::codeCheck`
- **scripts** add additional BII reporting variables in FSDP_collect.R
- **scripts** added a new validation_cell.R output script that generates a pdf with the comparison of magpie land use and crop type outputs with LUH and MAPSPAM historical data at cellular resolution.

### removed
- **core** removed no longer needed set `si` Suitability classes
- **core** removed no longer needed set `si` Suitability classes

### fixed
- **52_carbon** i52_land_carbon_sink was not identical before 2020 for different RCPs. Fixed by setting to RCPBU until the year defined in sm_fix_cc.
Expand Down Expand Up @@ -857,7 +872,8 @@ This release version is focussed on consistency between the MAgPIE setup and the
First open source release of the framework. See [MAgPIE 4.0 paper](https://doi.org/10.5194/gmd-12-1299-2019) for more information.


[Unreleased]: https://github.com/magpiemodel/magpie/compare/v4.7.1...develop
[Unreleased]: https://github.com/magpiemodel/magpie/compare/v4.7.2...develop
[4.7.2]: https://github.com/magpiemodel/magpie/compare/v4.7.1...v4.7.2
[4.7.1]: https://github.com/magpiemodel/magpie/compare/v4.7.0...v4.7.1
[4.7.0]: https://github.com/magpiemodel/magpie/compare/v4.6.11...v4.7.0
[4.6.11]: https://github.com/magpiemodel/magpie/compare/v4.6.10...v4.6.11
Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ authors:
email: [email protected]

title: MAgPIE - An Open Source land-use modeling framework
version: 4.7.1dev
date-released: 2024-02-28
version: 4.7.2dev
date-released: 2024-04-02
repository-code: https://github.com/magpiemodel/magpie
keywords:
- landuse
Expand Down
88 changes: 63 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ https://www.pik-potsdam.de/research/projects/activities/land-use-modelling/magpi
A framework description paper has been published in
Geoscientific Model Development (GMD): https://doi.org/10.5194/gmd-12-1299-2019

The model documentation for version 4.7.1 can be found at
https://rse.pik-potsdam.de/doc/magpie/4.7.1/
The model documentation for version 4.7.2 can be found at
https://rse.pik-potsdam.de/doc/magpie/4.7.2/

A most recent version of the documentation can also be extracted from the
model source code via the R package goxygen
Expand Down Expand Up @@ -65,31 +65,69 @@ When using a modified version of **MAgPIE** which is not identical to versions
in the official main repository at https://github.com/magpiemodel add a suffix
to the name to allow distinguishing versions (format **MAgPIE-suffix**).

## SYSTEM REQUIREMENTS
## HARDWARE REQUIREMENTS
The model is quite resource heavy and works best on machines with high CPU clock
and memory. Recommended is a machine with Windows, MacOS or Linux, with at least
16GB of memory and a Core i7 CPU or similar.
and memory. Recommended is a machine with at least 16GB of memory and a Core i7 CPU or similar.

## HOW TO INSTALL
MAgPIE requires *GAMS* (https://www.gams.com/) including licenses for the
solvers *CONOPT* and (optionally) *CPLEX* for its core calculations. As the model
benefits significantly of recent improvements in *GAMS* and *CONOPT4* it is
recommended to work with the most recent versions of both.
Please make sure that the GAMS installation path is added to the PATH variable
of the system.

In addition *R* (https://www.r-project.org/) is required for pre- and
postprocessing and run management (needs to be added to the PATH variable
as well).

Several R packages are required to run MAgPIE. Under Windows you first need to install
Rtools (https://cran.r-project.org/bin/windows/Rtools/) and to add it to the PATH
variable. When running R from the MAgPIE folder for the first time all
required packages are automatically installed into an isolated,
project specific R package environment (renv).
For post-processing model outputs *Latex* is required
(https://www.latex-project.org/get/). To be seen by the model it also needs to
added to the PATH variable of your system.
Commands formatted as `code` should generally be run in a terminal (PowerShell on Windows).

### List of Requirements
- license for gams incl. CONOPT solver
- gams >= 43.4.1
- git >= 2.16.1
- R >= 4.1.2 (+ matching Rtools on Windows)
- pandoc >= 2.14.2
- TeX >= 3.14159265

### OS specific setup
Choose your operating system and follow the instructions there. You can also
install requirements differently (e.g. using only installers on Windows), in
the end it is only important that all requirements are installed in a suitable
version and added to the PATH environment variable, so MAgPIE can use them.

#### Ubuntu
1. make sure you have a gams license incl. the CONOPT solver
1. [install gams](https://www.gams.com/46/docs/UG_UNIX_INSTALL.html)
1. install git, R, and pandoc with `sudo apt install git r-base pandoc`
1. install TinyTeX with `Rscript -e 'install.packages("tinytex"); tinytex::install_tinytex()'`

#### macOS
1. make sure you have a gams license incl. the CONOPT solver
1. [install gams](https://www.gams.com/46/docs/UG_MAC_INSTALL.html)
1. install git, R, and pandoc with `brew install git r pandoc`
1. install TinyTeX with `Rscript -e 'install.packages("tinytex"); tinytex::install_tinytex()'`

#### Windows
1. make sure you have a gams license incl. the CONOPT solver
1. [install gams](https://www.gams.com/46/docs/UG_WIN_INSTALL.html)
1. [download .msi pandoc file](https://github.com/jgm/pandoc/releases/latest) and run installer (`choco install pandoc` did not work in testing)
1. [install chocolatey](https://chocolatey.org/install)
1. install git, rig (R installer), and tinytex with `choco install -y git rig tinytex`
1. restart terminal
1. install R and Rtools with `rig add release; rig add rtools`

### check setup is complete
- restart terminal
- `gams` should print many lines including "The installed license is valid."
- `git --version`
- `Rscript --version`
- `pandoc --version`
- `tex --version`

If any of these are not found: Find the path to that executable
(gams/git/Rscript/pandoc/tex, on Windows ending in '.exe') and add it to your
PATH environment variable. Search for a tutorial online if you are unsure how to do that.

### download and run MAgPIE
1. download MAgPIE with `git clone https://github.com/magpiemodel/magpie.git`
1. go into the MAgPIE folder `cd magpie`
1. start a MAgPIE run with `Rscript start.R`, first time: installs all required R packages (takes a while)
1. choose "1" for a default run
1. then select "1" for direct execution

### troubleshooting
Please check [this discussion](https://github.com/magpiemodel/magpie/discussions/650) for known problems and solutions and to report new problems you encounter while setting up MAgPIE.

## DOCKER
To use Docker, copy your `gamslice.txt`
Expand Down Expand Up @@ -188,7 +226,7 @@ [email protected]
Please contact [email protected]

## CITATION
See file CITATION.cff or the [How-to-Cite section](https://rse.pik-potsdam.de/doc/magpie/4.7.1/#how-to-cite) in the model documentation for information how to cite the model.
See file CITATION.cff or the [How-to-Cite section](https://rse.pik-potsdam.de/doc/magpie/4.7.2/#how-to-cite) in the model documentation for information how to cite the model.

## AUTHORS
See list of authors in CITATION.cff
Expand Down
2 changes: 1 addition & 1 deletion config/default.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK)
# | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK)
# | authors, and contributors see CITATION.cff file. This file is part
# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of
# | AGPL-3.0, you are granted additional permissions described in the
Expand Down
2 changes: 1 addition & 1 deletion core/calculations.gms
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK)
*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK)
*** | authors, and contributors see CITATION.cff file. This file is part
*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of
*** | AGPL-3.0, you are granted additional permissions described in the
Expand Down
2 changes: 1 addition & 1 deletion core/declarations.gms
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK)
*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK)
*** | authors, and contributors see CITATION.cff file. This file is part
*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of
*** | AGPL-3.0, you are granted additional permissions described in the
Expand Down
2 changes: 1 addition & 1 deletion core/load_gdx.gms
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK)
*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK)
*** | authors, and contributors see CITATION.cff file. This file is part
*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of
*** | AGPL-3.0, you are granted additional permissions described in the
Expand Down
2 changes: 1 addition & 1 deletion core/macros.gms
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK)
*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK)
*** | authors, and contributors see CITATION.cff file. This file is part
*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of
*** | AGPL-3.0, you are granted additional permissions described in the
Expand Down
2 changes: 1 addition & 1 deletion core/sets.gms
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK)
*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK)
*** | authors, and contributors see CITATION.cff file. This file is part
*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of
*** | AGPL-3.0, you are granted additional permissions described in the
Expand Down
2 changes: 1 addition & 1 deletion main.gms
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK)
*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK)
*** | authors, and contributors see CITATION.cff file. This file is part
*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of
*** | AGPL-3.0, you are granted additional permissions described in the
Expand Down
2 changes: 1 addition & 1 deletion modules/09_drivers/aug17/declarations.gms
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK)
*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK)
*** | authors, and contributors see CITATION.cff file. This file is part
*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of
*** | AGPL-3.0, you are granted additional permissions described in the
Expand Down
2 changes: 1 addition & 1 deletion modules/09_drivers/aug17/input.gms
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK)
*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK)
*** | authors, and contributors see CITATION.cff file. This file is part
*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of
*** | AGPL-3.0, you are granted additional permissions described in the
Expand Down
2 changes: 1 addition & 1 deletion modules/09_drivers/aug17/preloop.gms
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK)
*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK)
*** | authors, and contributors see CITATION.cff file. This file is part
*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of
*** | AGPL-3.0, you are granted additional permissions described in the
Expand Down
2 changes: 1 addition & 1 deletion modules/09_drivers/aug17/realization.gms
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK)
*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK)
*** | authors, and contributors see CITATION.cff file. This file is part
*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of
*** | AGPL-3.0, you are granted additional permissions described in the
Expand Down
2 changes: 1 addition & 1 deletion modules/09_drivers/aug17/sets.gms
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK)
*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK)
*** | authors, and contributors see CITATION.cff file. This file is part
*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of
*** | AGPL-3.0, you are granted additional permissions described in the
Expand Down
2 changes: 1 addition & 1 deletion modules/09_drivers/module.gms
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK)
*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK)
*** | authors, and contributors see CITATION.cff file. This file is part
*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of
*** | AGPL-3.0, you are granted additional permissions described in the
Expand Down
2 changes: 1 addition & 1 deletion modules/10_land/landmatrix_dec18/declarations.gms
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK)
*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK)
*** | authors, and contributors see CITATION.cff file. This file is part
*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of
*** | AGPL-3.0, you are granted additional permissions described in the
Expand Down
2 changes: 1 addition & 1 deletion modules/10_land/landmatrix_dec18/equations.gms
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK)
*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK)
*** | authors, and contributors see CITATION.cff file. This file is part
*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of
*** | AGPL-3.0, you are granted additional permissions described in the
Expand Down
2 changes: 1 addition & 1 deletion modules/10_land/landmatrix_dec18/input.gms
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK)
*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK)
*** | authors, and contributors see CITATION.cff file. This file is part
*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of
*** | AGPL-3.0, you are granted additional permissions described in the
Expand Down
2 changes: 1 addition & 1 deletion modules/10_land/landmatrix_dec18/postsolve.gms
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK)
*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK)
*** | authors, and contributors see CITATION.cff file. This file is part
*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of
*** | AGPL-3.0, you are granted additional permissions described in the
Expand Down
2 changes: 1 addition & 1 deletion modules/10_land/landmatrix_dec18/preloop.gms
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK)
*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK)
*** | authors, and contributors see CITATION.cff file. This file is part
*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of
*** | AGPL-3.0, you are granted additional permissions described in the
Expand Down
Loading

0 comments on commit efb738b

Please sign in to comment.