Skip to content

Commit

Permalink
Merge pull request #230 from magpiemodel/rc
Browse files Browse the repository at this point in the history
Hotfix release v4.3.1
  • Loading branch information
tscheypidi authored Nov 3, 2020
2 parents 2d57956 + 50f7b1e commit 428fd43
Show file tree
Hide file tree
Showing 11 changed files with 139 additions and 21 deletions.
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Changes are deletion or updates to the existing model components in default conf
## Checklist:

- [ ] Self-review of my own code.
- [ ] Compilation check (model starts without compilation errors).
- [ ] Added changes to `CHANGELOG.md`
- [ ] No hard coded numbers and cluster/country/region names.
- [ ] The code doesn't contain declared but unused parameters or variables.
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ magpie_calib.*
*.out
/scripts/npi_ndc/npi_ndc_overview.txt
Rplots.pdf

#ignore GAMS license
gamslice.txt
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.3.0",
"version": "4.3.1",
"creators": [
{
"name": "Dietrich, Jan Philipp",
Expand Down Expand Up @@ -76,5 +76,5 @@
"license": {
"id": "AGPL-3.0-or-later"
},
"publication_date": "2020-09-15"
"publication_date": "2020-11-03"
}
16 changes: 13 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ 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/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [4.3.1] - 2020-11-03

### added
- **main** Added Dockerfile for running MAgPIE in a container

### fixed
- **35_natveg** Bugfix "v35_secdforest_expansion"
- **52_carbon** Bugfix "p52_scaling_factor" for climate change runs

## [4.3.0] - 2020-09-15

### added
Expand All @@ -24,7 +33,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **32_forestry** include new datasets of the bph effect of afforestation / replaced the bph ageclass switch with a fade-in between ac10 and ac30 in (dynamic_may20)
- **13_tc**, **39_landconversion**, **41_area_equipped_for_irrigation** and **58_peatland**. For the current time step, the optimization costs only include now the annuity of the present investment. magpie4's reportCosts() function was modified to consider these changes.

### Removed
### removed
- **scripts** deleted outdated start and output scripts

### fixed
Expand Down Expand Up @@ -72,7 +81,7 @@ This release version is focussed on consistency between the MAgPIE setup and the
### changed
- **config** new default ghg emission pricing policy "redd+_nosoil" in c56_emis_policy. Includes all pools included in the previous default "SSP_nosoil", and in addition "forestry".
- **13_tau** lower bound for vm_tau for historical time steps
- **50_nr_soil_budget** atmospheric deposition is now estimated on the cluster-level instead of the region level to improve spatial patterns.
- **50_nr_soil_budget** atmospheric deposition is now estimated on the cluster-level instead of the region level to improve spatial patterns.
- **56_ghg_policy** updated scenarios in f56_emis_policy: none, all natural (called 'ssp') and all land use change emissions (pure co2) being included in greenhouse gas pricing. ssp and all also featuring additional scenarios excluding soil carbon pricing (marked with '_nosoil' postscript).
- **56_ghg_policy** Several changes regarding afforestation: use of detailed formula for incentive calculation instead of simplified Hotelling formula, 50 year planning horizon (instead of 80 years), phase-in of GHG prices deactivated by default (now done in REMIND), CO2 price reduction factor deactivated by default, introduced buffer reduction factor of 20% for afforestation.
- **59_som** updated cellpool_aug16 realization to use new interfaces from land module on land use type specific land expansion and reduction as well as crop type specific land initialization pattern. Additionally added irrigation as stock change factor sub-type. N fertilizer from soil organic matter decomposition is truncated after threshold to avoid unrealistically high fertilization rates.
Expand Down Expand Up @@ -141,7 +150,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.3.0...develop
[Unreleased]: https://github.com/magpiemodel/magpie/compare/v4.3.1...develop
[4.3.1]: https://github.com/magpiemodel/magpie/compare/v4.3.0...v4.3.1
[4.3.0]: https://github.com/magpiemodel/magpie/compare/v4.2.1...v4.3.0
[4.2.1]: https://github.com/magpiemodel/magpie/compare/v4.2.0...v4.2.1
[4.2.0]: https://github.com/magpiemodel/magpie/compare/v4.1.1...v4.2.0
Expand Down
10 changes: 5 additions & 5 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ authors:
given-names: Abhijeet
affiliation: "Potsdam Institute for Climate Impact Research"
email: mishra@pik-potsdam.de

- family-names: Beier
given-names: Felicitas Dorothea
affiliation: "Potsdam Institute for Climate Impact Research"
email: beier@pik-potsdam.de

- family-names: Molina Bacca
given-names: Edna Johanna
affiliation: "Potsdam Institute for Climate Impact Research"
affiliation: "Potsdam Institute for Climate Impact Research"
email: mbacca@pik-potsdam.de

- family-names: Klein
Expand Down Expand Up @@ -86,8 +86,8 @@ authors:
email: popp@pik-potsdam.de

title: MAgPIE - An Open Source land-use modeling framework
version: 4.3.0
date-released: 2020-09-15
version: 4.3.1
date-released: 2020-11-03
repository-code: https://github.com/magpiemodel/magpie
keywords:
- landuse
Expand Down
69 changes: 69 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
FROM rocker/r-ver:3.6.2

RUN mkdir /home/magpie
COPY . /home/magpie/

RUN apt-get update \
&& apt-get install -y libpng-dev \
&& apt-get install -y libjpeg-dev \
&& apt-get install -y zlib1g-dev \
&& apt-get install -y pkg-config \
&& apt-get install -y libssl-dev \
&& apt-get install -y libxml2-dev \
&& apt-get install -y libcurl4-openssl-dev \
&& apt-get install -y curl \
&& apt-get install -y texlive \
&& apt-get install -y fonts-inconsolata \
&& apt-get install -y pandoc \
&& apt-get install -y pandoc-citeproc \
&& fc-cache -fv




RUN R -e "options(repos = \
list(CRAN = 'https://cran.rstudio.com/',pik='https://rse.pik-potsdam.de/r/packages')); \
install.packages(c('gdxrrw', \
'ggplot2', \
'curl', \
'gdx', \
'magclass', \
'madrat', \
'mip', \
'lucode2', \
'magpie4', \
'magpiesets', \
'lusweave', \
'luscale', \
'goxygen', \
'luplot'))"

# Set GAMS version
ENV LATEST=30.3.0
ENV GAMS_VERSION=${LATEST}

# Set GAMS bit architecture, either 'x64_64' or 'x86_32'
ENV GAMS_BIT_ARC=x64_64


# Download GAMS
RUN curl -SL "https://d37drm4t2jghv5.cloudfront.net/distributions/${LATEST}/linux/linux_${GAMS_BIT_ARC}_sfx.exe" --create-dirs -o /opt/gams/gams.exe

# Install GAMS
RUN cd /opt/gams &&\
chmod +x gams.exe; sync &&\
cp /home/magpie/gamslice.txt . &&\
./gams.exe &&\
rm -rf gams.exe

COPY gamslice.txt /opt/gams/gams30.3_linux_x64_64_sfx/gamslice.txt
# Add GAMS path to user env path
RUN GAMS_PATH=$(dirname $(find / -name gams -type f -executable -print)) &&\
ln -s $GAMS_PATH /usr/local/bin &&\
echo "export PATH=\$PATH:$GAMS_PATH" >> ~/.bashrc &&\
cd $GAMS_PATH &&\
./gamsinst -a

COPY gamslice.txt /opt/gams/gams30.3_linux_x64_64_sfx/gamslice.txt

CMD cd /home/magpie && Rscript start.R
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ 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.3.0 can be found at
The model documentation for version 4.3 can be found at
https://rse.pik-potsdam.de/doc/magpie/4.3/

A most recent version of the documentation can also be extracted from the
Expand Down Expand Up @@ -115,6 +115,23 @@ 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.

## DOCKER
To use Docker, copy your `gamslice.txt`
into the MAgPIE main directory, and build the magpie image using the command
```
sudo docker build -t magpie .
```
Basic usage: Run the container (note the use of an absolute path) using
```
sudo docker run -v /an/absolute/path/to/a/folder/:/home/magpie/output -it magpie
```
Note: this will run MAgPIE with the default settings, if you want to change them choose the

Advanced usage: Run the container interactively using
```
sudo docker run -v /an/absolute/path/to/a/folder/:/home/magpie/output -it magpie bash
```

## HOW TO CONFIGURE
Model run settings are set in `config/default.cfg` (or another config file of
the same structure). New model scenarios can be created by adding a column to
Expand Down
2 changes: 1 addition & 1 deletion modules/35_natveg/dynamic_may20/equations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
pc35_other(j2,ac_sub) - v35_other(j2,ac_sub);

q35_secdforest_expansion(j2,ac_est) ..
v35_other_expansion(j2,ac_est) =e=
v35_secdforest_expansion(j2,ac_est) =e=
v35_secdforest(j2,ac_est) - pc35_secdforest(j2,ac_est);

q35_secdforest_reduction(j2,ac_sub) ..
Expand Down
8 changes: 4 additions & 4 deletions modules/35_natveg/dynamic_may20/preloop.gms
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
*** | MAgPIE License Exception, version 1.0 (see LICENSE file).
*** | Contact: magpie@pik-potsdam.de

** Change rotation based on switch. If not use calculation before faustmann
* initialize secdforest area depending on switch.
if(s35_secdf_distribution = 0,
i35_secdforest(j,"acx") = pcm_land(j,"secdforest");

elseif s35_secdf_distribution = 1,
i35_secdforest(j,ac) = pcm_land(j,"secdforest")/card(ac);
elseif s35_secdf_distribution = 1,
* ac0 is excluded here. Therefore no initial shifting is needed.
i35_secdforest(j,ac)$(not sameas(ac,"ac0")) = pcm_land(j,"secdforest")/(card(ac)-1);
);

*use residual approach to avoid rounding errors
Expand Down
10 changes: 8 additions & 2 deletions modules/52_carbon/normal_dec17/start.gms
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ pm_carbon_density_ac_forestry(t_all,j,ac,"vegc") = m_growth_vegc(pc52_carbon_den
*Creating a scaling factor for carbon densities which are lower than the threshold. This will
*hlep upscale these numbers in later stage. We compare the maximum stable carbon density from LPJmL
*with the threshold.
p52_scaling_factor(t_all,j) = s52_plantation_threshold/pm_carbon_density_ac_forestry(t_all,j,"acx","vegc");
*Initialize the scalaing factor as 1
p52_scaling_factor(t_all,j) = 1;
*Update scaling factor for every cell where carbon density is greater than 0 to avoid division bx zero error
*This also makes sure that there are always reasonable numbers in zero carbon density cells
p52_scaling_factor(t_all,j)$(pm_carbon_density_ac_forestry(t_all,j,"acx","vegc")>0) = s52_plantation_threshold/pm_carbon_density_ac_forestry(t_all,j,"acx","vegc");
*Cells with zero carbon density would have to use the maximum threshold number for bringing the yields up to plantation levels.
p52_scaling_factor(t_all,j)$(pm_carbon_density_ac_forestry(t_all,j,"acx","vegc")=0) = s52_plantation_threshold;

*Comparison above would yield values lower than 1 when LPJmL carbon densities are higher than threshold.
p52_scaling_factor(t_all,j)$(p52_scaling_factor(t_all,j) <= 1) = 1;
Expand All @@ -27,7 +33,7 @@ p52_scaling_factor(t_all,j)$(p52_scaling_factor(t_all,j) <= 1) = 1;
* still has access to the information about how low were the yields compared to the threshold. A penalty component is then
* added in forestry module to make sure that the model does not use extremely unproductive cells for establishment decisions.
pm_investment_layer(t_all,j)$(p52_scaling_factor(t_all,j) <= 1) = 0;
pm_investment_layer(t_all,j)$(p52_scaling_factor(t_all,j) > 1) = s52_plantation_threshold - pm_carbon_density_ac_forestry(t_all,j,"acx","vegc");
pm_investment_layer(t_all,j)$(p52_scaling_factor(t_all,j) > 1) = s52_plantation_threshold - pm_carbon_density_ac_forestry(t_all,j,"acx","vegc");

* Certain cells have quite low carbon density and with a lower rotation length, it is not possioble to produce
* any reasonable amount of thimber. This has impact on timber yield calculations. With higher carbon densities
Expand Down
18 changes: 15 additions & 3 deletions scripts/start/projects/sticky.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
######################################################################################
#### Script to start a MAgPIE run using different factor_costs realizations ##########
######################################################################################
# | (C) 2008-2020 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: magpie@pik-potsdam.de

# ----------------------------------------------------------
# description: Sticky cost runs
# position: 5
# ----------------------------------------------------------


##### Version log (YYYYMMDD - Description - Author(s))
## v0.1 - 20200923 - Sticky cost runs - EMJB,AM

library(lucode2)
library(magclass)
Expand Down

0 comments on commit 428fd43

Please sign in to comment.