Giter Site home page Giter Site logo

py-gdx's Introduction

py-gdx

1. What?

py-gdx is a small set of Python utilities for manipulating GAMS GDX files. It uses the Python bindings available in recent (as of 2011) versions of GAMS. py-gdx in released under the MIT Licence.

There are several example scripts:

  • gdx_insert_csv.py inserts or replaces variables in the GDX file with data in a CSV file. If required it can create a new GDX file from scratch.
  • gdx_extract_csv.py produces a CSV report of parameter and variable values in one or more GDX files. If parameter domains are missing from the GDX file, it guesses them. It can act as if several GDX files were one, or it can compare the same parameters in several GDX files. It can export a selected set of parameters, it can export all parameters that are defined over a selected set of domains, or it can export all parameters and variables in a GDX file. The csv files it writes are readable by gdx_insert_csv.py, so you can export an entire GDX file to CSV, edit it, and rebuild a new copy of the GDX.
  • gdx_merge.py merges two GDX files without creating an extra index as the standard GDX merge tool does.

In all cases use python gdx_<example>.py --help to find out how to use them.

The above scripts use gdxdict.py to do their magic. gdxdict.py loads a GDX file into an object that acts much like Python a dictionary, and can write a GDX file from a such a dictionary.

At the moment, documentation of gdxdict.py is limited to the example files.

2. Requirements

  • a "recent" version of GAMS or at least the GDX library - GAMS 23.2 does not have Python bindings, 23.7 does.
  • Python 2.6 - the GDX bindings do not seem to support Python 3 or 2.7.
  • you must have followed the installation instructions for Python in <gams-dir>\apifiles\readme.txt
    • make sure you have the right bindings for your Python version
    • make sure that the relevant files (gdxcc.[so,dll] and gdxcc.py are either installed in your python site-packages directory or the path to the files is in your PythonPath (on Windows they'll be somewhere like C:\Program Files\GAMS23.7\apifiles\gdx)

In short, if python <gams-dir>\apifiles\Python\example1.py <gams-dir> doesn't work, then py-gdx won't work either. You need to install the GAMS/Python bindings correctly. Either ask GAMS for help, or use Lua.

3. Who?

py-gdx was developed by Incremental with support from the Electricity Authority You can contact us at [email protected].

py-gdx's People

Contributors

geoffleyland avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  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.