Useful GitHub: MAgPIE and the discipline of open land-system modelling

Science & Technology
Land & Agriculture
What the MAgPIE repository can teach researchers about modelling agriculture, forestry and land-use futures reproducibly.
Published

September 22, 2026

Some GitHub repositories are useful because you can borrow a function. Others are useful because they reveal how a serious modelling system is organised. MAgPIE belongs to the second group.

MAgPIE, the Model of Agricultural Production and its Impact on the Environment, is an open-source framework maintained by researchers associated with the Potsdam Institute for Climate Impact Research. It models global land systems, explicitly representing agriculture and forestry and linking economic drivers to spatially explicit biophysical constraints.

The basic modelling question is large: given demand for food, bioenergy and timber, technological change, production costs, crop yields, forest growth, land and water constraints, what patterns of production and land use can satisfy those demands at minimum cost?

That makes MAgPIE very different from a farm calculator or a statistical forecasting package. It is an optimisation model embedded in a wider modelling architecture. It is coupled to LPJmL, a grid-based vegetation model, and uses biophysical information at 0.5-degree resolution. Regional economic conditions and demands enter the model, while the optimisation determines land-use patterns, yields and production costs consistent with those conditions.

For researchers interested in land-use policy, the repository is valuable even if they never run the full model.

The first lesson is modularity. Large models become difficult to audit when assumptions are buried in a single script. MAgPIE separates model components, configuration and scenario settings. New scenarios can be defined through configuration rather than by rewriting the entire model. That sounds mundane, but it is one of the differences between code that produces one paper and infrastructure that can support a research programme.

The second lesson is reproducibility beyond code. The README does not pretend that publishing source files alone makes a model reproducible. It documents software requirements, installation, configuration, execution and outputs. The project provides tutorials, versioned documentation, a citation file and guidance for modifying the model. It also explicitly encourages model-based publications and consulting work to make source code available. The model is licensed under GNU AGPL v3 or later, with an additional MAgPIE licence exception documented in the repository.

The third lesson concerns data provenance. MAgPIE’s contribution guidance says model dependencies should be publicly available where possible and warns against input data that cannot be shared. Its data-processing workflow is designed around reproducibility rather than treating data preparation as an invisible stage before the “real” modelling begins.

There are important barriers. This is not a lightweight Python package that a new user can install in five minutes. The main model is written in GAMS, uses R around the workflow, and currently requires a GAMS licence with the CONOPT solver. The developers recommend substantial computing resources, including at least 16 GB of memory. For many researchers, especially those wanting a transparent teaching model or a small national application, that is a significant entry cost.

Its scale also matters. A global land-system optimisation model answers different questions from a spatial microsimulation of farms or a parcel-level land allocation model. MAgPIE can explore internally consistent global transitions and competition among food, forestry and bioenergy demands. It should not be read as predicting which individual farmer will change enterprise or which exact parcel will convert.

That distinction is itself useful. Good modelling starts by matching resolution to the decision being studied.

The repository is therefore worth exploring less as a piece of code to copy than as an example of research architecture: modular scenarios, explicit assumptions, documented dependencies, reproducible data preparation and outputs that can be traced back to the model. Those practices travel well across modelling traditions.

Further reading