GenericMappingTools / GenericMappingTools/pygmt

Handling plotting functions that have an inquire (I) only mode

Open
#896 3 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Python
Stars
874
Forks
255
Avg merge
1d 21h
Merged PRs (30d)
40

Description

**Description of the issue**

There are a few GMT modules that have a mode for extracting data (statistics or otherwise) via the inquire (I) flag in addition to plotting:

- [`rose`](https://docs.generic-mapping-tools.org/6.1/rose.html#i) - #794
- [`solar`](https://docs.generic-mapping-tools.org/6.1/solar.html#i) - #804, also has an `-M` mode where no plotting occurs
- [`histogram`](https://docs.generic-mapping-tools.org/6.1/histogram.html#i) - #563

How do we want to handle these cases? It seems weird to use `fig.histogram(..., inquire=...)` if no figure/plot is actually returned. One suggestion made at https://github.com/GenericMappingTools/pygmt/pull/794#pullrequestreview-584985363 was:

> Ideally, what we might have to do is make two user-facing `rose` functions:
>
> 1. A plotting-only `fig.rose`
>
> 2. A non-plotting `pygmt.rose` which will solely use the inquire (I) flag.
>
> Both of these could share a core `def _rose()` function and live within `pygmt/src/rose.py`. This is just an idea though, and probably quite hard to implement in one Pull Request. For now, we could implement just the plotting side (1) and raise a `NotImplementedError` for inquire (I), and perhaps wrap `pygmt.rose` (2) in a future PR? Or maybe there's a smarter alternative way.

Open to suggestions on how we want the API for this look like.

**Are you willing to help implement and maintain this feature?** Discuss first

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.