Skip to content

rcpurdue/agmipex

Repository files navigation

AgMIP Explorer

AgMIP Explorer ("agmipex") is a data exploration tool for AgMIP based on the Self-Contained Science App (SCSA).

Input Files

The tool allows the user to select from mutliple data files. These are stored in the data subdirectory. Note that data files must meet these requirements:

  1. File must be in CSV (comma separated values) format.
  2. File must contain an initial header line.
  3. Columns must use the following spelling and order exactly: Model, Scenario, Region, Indicator, Sector, Unit, Year, Value
  4. Data in each column must be of type string, except for the Year (numeric integer) and Value (numeric float) columns.

Example:

Model,Scenario,Region,Indicator,Sector,Unit,Year,Value
"MOD","Scenario_1","REG","INDIC","SEC","million",2001,1.23456
"MOD","Scenario_1","REG","INDIC","SEC","million",2002,7.89012
...

Note that input data files are not provided as part of this repository. Please contact the AgMIP project for more information.

Development

Code Structure

The AgMIP Explorer tool is a Jupyter notebook -based application. User interface widgets (menus, buttons, etc.) are created using ipywidgets.

The tool runs the agmipex.ipynb notebooxk. However, instead of storing most of the code in notebook cells, the notebook references external Python code. So, the majority of logic resides in the Python files in the scripts subdirectory. The code follows the Model-View-Controller (MVC) pattern. That is, for simple organizational reasons, logic is split between the following:

  • model.py: Data access
  • view.py: User interface
  • controller.py: General program logic, plotting, and coordination between model and view

Pandas is used for data access and Matplotlib is used for plotting.

Environment

The tool is currently hosted on MyGeoHub. MyGeoHub is a website based on HUBzero. AgMIP Explorer is therefore a HUBzero "tool". As such, supplementary files are required. This enforces most of the directory structure of this repository. It requries the src directory and unused Makefile. Also, it requires the invoke file in the middleware subdirectory.

Building, Developing, and Testing

Use of an Anaconda envirnment is highly recommended. After creating and activating the conda environment (see environment.yml) run jupter notebook to start the notebook server. Then, use the local URLs displayed by that command to access and run the notebook using your browser. Note that during development, you can change code in the .py files and simply refresh the notebook to test changes.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published