grd2stream – QGIS Plugin

Table of Contents

Overview

The grd2stream QGIS plugin allows users to comfortably generate multiple flowlines from velocity grids by selecting seed points. This plugin utilizes GMT6 (Generic Mapping Tools) to ensure compatibility with all GDAL file formats.

The core functionality is based on the grd2stream command-line utility, which calculates streamlines from gridded velocity fields using Runge-Kutta integration methods.

Key Features

Installation & Requirements

QGIS Plugin Installation

  1. Open QGIS
  2. Go to Plugins → Manage and Install Plugins
  3. Search for "grd2stream"
  4. Click "Install Plugin"

Dependencies

The plugin requires:

Note: On Linux and macOS, the plugin can automatically install these dependencies in an isolated Miniconda environment.

Platform Support

Current Status

Platform Status Notes
Linux ✅ Fully Supported Automatic installation of dependencies via Miniconda
macOS ✅ Fully Supported Automatic installation of dependencies via Miniconda
Windows 🚧 In Development Currently only planning/parameter configuration available. Command execution not yet supported.

Windows Limitations

On Windows, the plugin currently cannot execute the grd2stream command. However, you can still:

Full Windows support is being developed and will be available in a future update.

Technical Architecture

Component Overview

The plugin consists of several key components:

Dependency Management

On Linux and macOS, the plugin:

  1. Installs Miniconda3 to ~/miniconda3 (if not already installed)
  2. Creates a "GMT6" Conda environment with GMT6 and required dependencies
  3. Installs the grd2stream utility in the Conda environment

This approach ensures that:

Using the Plugin

Basic Workflow

  1. Click the grd2stream icon in the QGIS toolbar
  2. If this is your first time using the plugin on Linux or macOS, you may be prompted to install dependencies
  3. Select input rasters:
  4. Configure parameters or load a preset
  5. Click OK to proceed to seed point selection
  6. Choose a method to select the seed point:
  7. The plugin will calculate the flowline and add it to your project as a vector layer

Parameter Configuration

Required Parameters

Optional Parameters

Output Formats

Working with Presets

Saving Presets

To save your current configuration as a preset:

  1. Configure parameters in the main dialog
  2. Click "Save as Preset"
  3. Enter a name for your preset
  4. Confirm to save

Loading Presets

To load a saved preset:

  1. Click "Load Preset" in the main dialog
  2. Select a preset from the list
  3. Click "Select"

Managing Presets

The preset management dialog allows you to:

Using Last Settings

The "Use Last Settings" button quickly reapplies:

Note: Presets are stored in a presets.json file in the plugin directory and persist between QGIS sessions.

Technical Details

Integration Method

The plugin uses the grd2stream utility, which implements:

Supported File Formats

The plugin can work with any raster format supported by GDAL, including:

Tip: For NetCDF and similar multi-dimensional formats, you can select the specific variable by choosing the appropriate band in the input dialog.

Output Processing

The plugin:

  1. Executes the grd2stream command with the specified parameters
  2. Captures the command output (a text stream of coordinates and attributes)
  3. Parses the output and converts it to a QGIS vector layer
  4. Adds the vector layer to the current project

Troubleshooting

Common Issues

No Flowline Generated

Installation Problems

Windows Support

Checking Logs

For detailed troubleshooting:

  1. Open the QGIS Python Console (Plugins → Python Console)
  2. Look for messages related to grd2stream
  3. Check detailed execution logs and error messages

Development Information

Plugin Structure

The plugin code is organized as follows:

Contributing

Contributions to the plugin are welcome! Priority areas include:

License Information

Plugin License

The grd2stream QGIS plugin is licensed under the GNU General Public License v3.0 (GPL-3.0).

Third-Party Components

The plugin includes:

Copyright

© 2013-2025 Thomas Kleiner & ScienceFlightPlanner-Team