Curation, Dissemination, and Reusability of Research Code in GRASS

Vaclav (Vashek) Petras, Anna Petrasova

NCSU GeoForAll Lab at the Center for Geospatial Analytics
NC State University

IALE-North America 2025 in Raleigh, NC, April 13-17, 2025

wenzeslaus.github.io/grass-talks

Vaclav (Vashek) Petras

  • Sr. Research Software Engineer at NC State's Center for Geospatial Analytics
  • GRASS: Core Development Team, Project Steering Committee
  • OSGeo: Charter Member, GRASS is an OSGeo Project

How to publish a method?

  • supplemental file to a paper
  • Zenodo upload
  • ...
  • source code repository on GitHub

Okay, I uploaded my code to GitHub.

  • Is it clear how to use it?
  • What happens when my funding ends?
  • Does it work with the new software versions?
  • What if I don't want to touch it anymore?
  • What if I need to use it again?
  • How someone else will know about it?
  • Can someone use it in a different way?
  • How can I combine it with some other code?
  • How can I use it with different data?

GRASS

GRASS Tool

  • Aka: Function, module, command, utility
  • Specific set of functionality
  • Code and documentation
  • Python, C, or C++

Tool Example: Wind-water Interactions

r.windfetch – distance which winds blow without obstruction

In GRASS Addons repository

by Anna Petrasova, funded by NSF Award #2322073, granted to Natrx, Inc.

Documentation: Standardized Interface

  • Standardized definition, overview, and example.
  • Specific, detailed description and examples.

Documentation: Authors and Source Code

  • Specific authors listed for each tool.
  • Documentation links to the source code of each tool.
  • Also: See also section showing related or similar tools.

Documentation: References

  • References to papers associated with tools.
  • References to related and cited scientific papers.

  • Is it clear how to use it? ✓
  • What happens when my funding ends?
  • Does it work with the new software versions?
  • What if I don't want to touch it anymore?
  • What if I need to use it again?
  • How someone else will know about it?
  • Can someone use it in a different way?
  • How can I combine it with some other code?
  • How can I use it with different data?

Curation

Initial Publishing

  • Researchers, code authors develop and publish new tools and algorithms.
  • Reviewes and mentors review the code, guide new contributors, foster best practices.

Commercial Support

Long-Term Curation

  • Technical maintainers address issues like deprecated libraries and API changes to keep tools functional.
  • Community organizers host events like meetups and sprints.
  • Governance leaders foster collaboration and ensure the sustainability of the project.

Project Steering Committee

  • Elections: October 2024, Positions Filled: 4
  • Total Members: 9, Term Length: 6 years
  • OSGeo Foundation committee

Tools: Skyview - Algorithm

r.skyview – non-directional alternative to shaded relief

by Anna Petrasova

Tools: SLIC - Algorithm

i.superpixels.slic - image segmentation using SLIC superpixels

by Rashad Kanavath and Markus Metz

Tools: EODAG Digestion - Data Handling

download, import, preprocessing, cloud detection, and masking of remote sensing data with EODAG (Earth Observation Data Access Gateway)

by Hamed A. Elgizery, Veronica Andreo, Stefan Blumentrath

Tools: Temporal Algebra - General Algoritm

D = if(start_date(A) < "2005-01-01", A + B)
Sum maps from A with maps with equal time stamps from B which are temporally before Jan 1, 2005

by Thomas Leppelt and Soeren Gebbert

Tools: Fast Flow Accumulation - Field-specific Algorithm

r.accumulate – fast weighted flow accumulation, watersheds, stream networks, and longest flow paths using a flow direction

by Huidae Cho

Tools: Vector Topology Cleaning - Build Over Time

v.clean – automated topology with outputs for additional checks

by Markus Metz, Radim Blazek, and others

Tools: Machine Learning - Addition of Algoritm

Supervised classification with Support Vector Machines

by Maris Nartiss (Nartiss & Melniks 2023)

Tools: Better Horizon Identification - Improvemnt of Tool

r.horizon: Output for multiple points, distances, and many other improvements

by Anna Petrasova, funded by NSF Award #2322073, granted to Natrx, Inc.

Tools: Urban Modeling - Model

r.futures - set of tools for urban growth modeling

by Meentemeyer et al.

  • Is it clear how to use it? ✓
  • What happens when my funding ends? ✓
  • Does it work with the new software versions? ✓
  • What if I don't want to touch it anymore? ✓
  • What if I need to use it again? ✓
  • How someone else will know about it?
  • Can someone use it in a different way?
  • How can I combine it with some other code?
  • How can I use it with different data?

Dissemination

Python

  • Python API comes with GRASS

Command Line

  • Interactive shell
  • One-time execution or batch usage with --exec

Graphical User Interface

  • Interactive use on a desktop

actinia

  • REST API and advanced processing system for cloud

R

  • rgrass package to use GRASS from R is on CRAN

QGIS

  • GRASS tools are available through the Processing Plugin
    (GUI and Python)

New Documentation

Available online for the preview version

lead by the NC State Center for Geospatial Analytics

New Tutorials Site

Just launched: grass-tutorials.osgeo.org

lead by the NC State Center for Geospatial Analytics

NSF Grant Lead by NC State

  • NSF grant awarded to NC State, ASU, NMSU, Yale
    • To enhance infrastructure
    • To revise contributing guidelines
    • To support community building
  • The NSF program is not funding new tools, bug fixes, or ongoing maintenance

Open-Source Licensing

  • Organizations:
    • Clear technology transfer path for research code.
    • Provider-independent, contractor-independent.
    • Financial investments go to a public pool.
    • Pay for support and features, not usage.
    • No per-CPU license fees.
  • Individuals:
    • Author retains right to use.
    • Employer-independent.
    • Work computer, personal laptop, or cloud.

  • Is it clear how to use it? ✓
  • What happens when my funding ends? ✓
  • Does it work with the new software versions? ✓
  • What if I don't want to touch it anymore? ✓
  • What if I need to use it again? ✓
  • How someone else will know about it? ✓
  • Can someone use it in a different way? ✓
  • How can I combine it with some other code?
  • How can I use it with different data?

Reusability

Categories of Tools

Name convention and associated parameter conventions

Prefix Functionality Example
r. raster processing r.mapcalc: raster map algebra
v. vector processing v.surf.rst: interpolation from points
g. general management g.remove: removes maps
d. display and rendering d.rast: display raster map
There is more: i., t., r3., m., ps.

Unified Interfaces

Latest example: JSON output format support (format="json") in multiple tools (v.db.select, t.rast.list, …)

        v.db.select roadsmajor format=json
    

With better integration in Python:


        import json
        import grass.script as gs

        data = gs.parse_command("v.db.select", map="roadsmajor", format="json")
        for row in data["records"]:
            print(row["ROAD_NAME"])
    

More coming in 8.5 (r.report, r.info, …)

by Anna Petrasova, Vaclav Petras, Huidae Cho, Kriti Birda, Corey White, and others

Transitions Between Interfaces

Command line (Bash):
Python:

Projects

  • Projects separate concerns of data preparation and data analysis.
  • Projects keep the data consistent.
    • Same format and CRS for all data.
    • Mapsets keep the data organized within a project.
    • Work is happening in one mapset, but data from any mapset can be used.

        import grass.script as gs

        gs.create_project("/path/to/project", epsg="3358")
    

Computational Region

  • extent and resolution for raster computations

Carrier-long Reusability

  • Technologies which stay and don't disapear in couple years.
  • Bash scripting, Python, GRASS
  • Longetivity, open-source, platfrom-idependent
  • Things develop, versions update, features are added...
  • ...but general ideas stay the same.

Code from 2002 running in 2025?

version 5.0 code works as is in 8.4:
r.mapcalc depr.bin="if((elev - fill)< 0., 1, 0)"

although there is a better way to write it:

r.mapcalc "depr_bin = if((elev - fill) < 0., 1, 0)"

  • Is it clear how to use it? ✓
  • What happens when my funding ends? ✓
  • Does it work with the new software versions? ✓
  • What if I don't want to touch it anymore? ✓
  • What if I need to use it again? ✓
  • How someone else will know about it? ✓
  • Can someone use it in a different way? ✓
  • How can I combine it with some other code? ✓
  • How can I use it with different data? ✓

Next Steps

Mentoring and Student Grants Program

  • Mentoring to integrate GRASS into your workflows (registration closes in May)
  • Student grants to contribute to GRASS (call open for 2025)
  • Google Summer of Code to become an open-source contributor (get ready for next year)

co-lead by the NC State Center for Geospatial Analytics

GRASS Developer Summit 2025

lead by the NC State Center for Geospatial Analytics

GRASS Lightning Talks

  • Thursday, May 22 at NC State, 4pm
  • User-focused session
  • Speakers from mundialis, Natrx, Bohannan Huston, government, and academia
  • RSVP: tinyurl.com/grass-2025

lead by the NC State Center for Geospatial Analytics

Community

Thanks to all those involved!
GRASS logo

Summit and Lightning Talks: tinyurl.com/grass-2025

vpetras@ncsu.edu, LinkedIn: Vaclav Petras, @wenzeslaus

wenzeslaus.github.io/grass-talks

This talk was funded by the US National Science Foundation (NSF), award 2303651.