Skip to content

PlantandFoodResearch/IrrigationAnimation

Repository files navigation

IrrigationAnimation

A tool to visualise modelled temporal and spacial data.

The tool will accept a set of CSV files and set of GIS files and render an animation of the data. There must be a single CSV file for each part of the GIS data, with a matching number.

Because the tool was largely designed for use by two people in a limited timespan, the focus was on implementing features. As such, the GUI is a bit flaky, and there may be remaining bugs that affect the visualisation.

The tool was created as part of the "Maximising the value of irrigation" MBIE program, to visualise modelled spatial data generated by ApsimX of crops under a center-pivot irrigator. However, it should be able to be used to render and explore other datasets.

An example animation is on Youtube.

Using

Currently, we have two interfaces; a tkinter GUI, and the builtin pygame UI.

Tkinter GUI

Run gui.py for the Tkinter GUI, which should be largely self-explanatory.

$ python gui.py

Pygame UI

Edit animate.py to adjust the configurables, number of Values, etc. Running animate.py should bring up the pygame previewer.

$ python animate.py

The pygame previewer has a few keybindings:

  • Up: Skip forward 10 frames
  • Down: Skip backward 10 frames
  • Page Up: Skip forward 50 frames
  • Page Down: Skip backward 50 frames
  • Left: Slow down
  • Right: Speed up

Dependencies

Python 2.7 is used, however porting to Python 3 should not be too difficult.

  • pygame (for rendering, displaying a preview)
  • PyMovie (for generating movies)
  • pyshp (for parsing the GIS files)
  • numpy (used by pygame to generate arrays to be passed to PyMovie)

When installing packages, it is essential to use anaconda's python! Either launch Anaconda's CLI, or launch the command prompt and type 'anaconda'. numpy is already installed with anaconda.

Pygame

Pygame can be downloaded from the main website, unfortunately it is a 32 bit version which does not play nicely with anaconda's 64 bit python. 64 bit Windows builds can be found online; download one and install it. From memory, I had to jump through a few hoops; the files are .whl (wheel) files, and so installing them is slightly convoluted. See also: https://pip.pypa.io/en/latest/user_guide/#installing-from-wheels https://www.webucator.com/blog/2015/03/installing-the-windows-64-bit-version-of-pygame/

Note that the 'wheel' package must be installed using pip to install other wheel packages.

PyMovie

PyMovie can be installed via Anaconda's PIP:

$ pip install pymovie

PySHP

PySHP can be installed via Anaconda's PIP:

$ pip install pyshp

People

This program was written by Alastair Hughes as a part-time work experience project at Plant & Food Research, between the 19th of November and the 24th of December, 2015.

Joanna Sharp and Hamish Brown at Plant & Food directed the project, and contributed essential ideas and feedback.

About

Tools for visualising spacial simulation data

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages