Giter Site home page Giter Site logo

xapple / cbmcfs3_runner Goto Github PK

View Code? Open in Web Editor NEW
2.0 4.0 0.0 30.17 MB

`cbmcfs3_runner` is a python package for dealing with the automation and running of a complex series of models involving the European economy, carbon budgets and their interactions. Notably in relation to the CBM-CFS3 model developed by Canada.

License: MIT License

Python 98.74% Mustache 1.26%

cbmcfs3_runner's Introduction

[[TOC]]

cbmcfs3_runner version 0.5.0

cbmcfs3_runner is a python package for dealing with the automation and running of a complex series of models involving the European economy, the forest sector, carbon budgets and their interactions. Notably in relation to the CBM-CFS3 model developed by Canada.

The development version is hosted on git lab: https://gitlab.com/bioeconomy/cbmcfs3/cbmcfs3_runner

Warnings

This package is currently under heavy development, and the master branch is subject to breaking changes at any moment. If you are interested in using this package in your own installation, please contact the authors.

Installing

No automated installation has been developed for the cbmcfs3_runner package yet. In the meantime, following this document and typing these commands on your command-line interface should get you started. If you cannot get a functional installation set up, contact the authors.

Step 1: Cloning the repository

Here you will download a copy of the code from GitHub and place it in your file system.

$ cd /
$ mkdir repos
$ cd repos
$ git clone [email protected]:xapple/cbmcfs3_runner.git

Step 2: Modify your python search path

Here you will edit your .bashrc or .bash_profile to add a reference to the python package you just downloaded. If you are on Windows, you can change your environment variables with the setx command.

$ vim ~/.bash_profile
export PYTHONPATH="/repos/cbmcfs3_runner/":$PYTHONPATH

When you type import cbmcfs3_runner python will know where to look.

Step 3: Install all required python packages

cbmcfs3_runner uses many third party python libraries. You can get them by running these commands:

$ pip install --user autopaths
$ pip install --user plumbing
$ pip install --user pymarktex
$ pip install --user pbs3

Step 4: Retrieve European forest data

Here you will download a copy of the dataset that describes the forest inventory of 26 EU member states along with their historical harvesting.

$ cd /repos/
$ git clone [email protected]:xapple/cbmcfs3_data.git

NB: Currently the access to that repository is restricted. Please contact the authors.

Step 5: Follow other specific instructions

Setting up the rest of the OS environment and installing the other required executables is covered in the bioeconomy_notes repository.

NB: Currently the access to that repository is restricted. Please contact the authors.

Running the model

Via an ipython session

To start an interactive session with the model on the command line, run:

$ ipython3

At the ipython prompt, to import the continent object that gives access to simulations pertaining to the 26 countries, run:

>>> from cbmcfs3_runner.core.continent import continent

For instance, you can now create a runner for the 'growth_only' scenario, the 'AT' country and the simulation period zero:

>>> runner = continent[('growth_only', 'AT', 0)]

Finally, to run that step of the model:

>>> runner.run(verbose=True)

Accessing metadata

Inventory start year and base year

The inventory start year and simulation base year are visible by creating a runner object for a given scenario (here called "static_demand") and by calling the following methods:

from cbmcfs3_runner.core.continent import continent
runner = continent[('static_demand', 'AT', 0)]
runner.country.inventory_start_year
runner.country.base_year

Reference years are defined in the set_years method of the country. The simulation base year is the same for all countries, hard coded to 2015, the inventory start year differs.

Data Flowchart

Below is drawn the flowchart describing the data processing along all the steps of cbmcfs3_runner:

Flowchart

Objects Diagram

Below is presented a tentative UML-style diagram detailing not the inheritance of the classes but the use of the composition design pattern between the objects created:

Diagram

Timeline representation

The simulation is broken down into several periods which are represented below.

Timeline

cbmcfs3_runner's People

Contributors

blujdvi avatar paulrougieux avatar viorelblujdea avatar xapple avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.