Skip to main content

The IAM_tools - a Python package of tools to deal with IAM data.

Project description

IAM_tools

The IAM_tools is command line utility to query data from AMPERE Scenario database. Input data are comma separated value [csv] file.

For testing purpose there is small test file following IAM structure: tests/iam_test.csv

Installation

IAM_tools can be installed directly from gitlab repository:

pip install iam_tools --upgrade

Usage

The IAM_tools can be used to filter, query and export data from IAM. The command line tool is filter_IAM The filter use regexp when selecting values from columns. The columns to filter are: mode, region, scenario, variable. The utility can be used to show unique values of this columns. Selection can be exported to csv, mat and h5 output file. If the output arg is omitted the result will be printed to console.

Examples

Run help:

filter_IAM -h

IAM_tools is designed to work with the AMPERE project model output. To follow the examples described below, you can use the small subsample (with modified numbers) used for testing. You can downlowd this file here.

Viewing unique entries for a specific index

Print all unique models:

filter_IAM iam_input.csv -unique model

Print to console unique regions of rows where model is GCAM:

filter_IAM iam_input.csv -model "GCAM" -unique region
Selecting rows based on the index

Print to console all rows where variables starts with "Capacity|Electricity|":

filter_IAM iam_input.csv -variable "^Capacity\|Electricity\|.*"

Note, that the vertical bar '|' has a special meaning in regex (as the or symbol). Thus to match the literal character '|' you have to escape it with a backslash ('\').

Export all rows where variable column start with Secondary Energy|Electricity| to my_output.mat [cell array] file:

filter_IAM iam_input.csv -variable "^Secondary Energy\|Electricity\|.*" -output my_output.mat

Export all rows where scenario column contains 450- and -OPT to my_output.csv file:

filter_IAM iam_input.csv -scenario "450-.*.-OPT" -output my_output.csv

Print to console all rows where models are either GCAM or REMIND:

filter_IAM iam_input.csv -model "GCAM|REMIND"

Export all rows where variable column start with Emissions|CO2 to my_output.csv file:

filter_IAM iam_input.csv -variable "^Emissions\|CO2.*" -output my_output.csv

Contributing

If you find a bug or have suggestions for improvement please use the Issue Tracker for communication. Development follows a gitlab centric workflow, thus if you want to contribute fork the repository and file a merge request when you are finished.

Authors

  • Radek Lonka
  • Konstantin Stadler

License

BSD 3-Clause License

Copyright (c) 2018, Industrial Ecology Digital Lab at NTNU

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iam_tools-0.1.5.tar.gz (5.0 kB view details)

Uploaded Source

File details

Details for the file iam_tools-0.1.5.tar.gz.

File metadata

  • Download URL: iam_tools-0.1.5.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for iam_tools-0.1.5.tar.gz
Algorithm Hash digest
SHA256 6619f179df983703f8d746c46e91f178b9a426901b36c4f65e24d24d45c81aca
MD5 be6a25b736798bd0bf7141e1390ef54f
BLAKE2b-256 c2b64278b41d2739268438966876fa7924706ecff78550063b6b463e711b2231

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page