Skip to content

More Pythonic interface for the x2sys package #3929

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
seisman opened this issue Apr 26, 2025 · 2 comments
Open

More Pythonic interface for the x2sys package #3929

seisman opened this issue Apr 26, 2025 · 2 comments
Labels
feature request New feature wanted help wanted Helping hands are appreciated

Comments

@seisman
Copy link
Member

seisman commented Apr 26, 2025

Description of the desired feature

The x2sys package contains the following modules for cross-over analysis:

  • x2sys_binlist
  • x2sys_cross
  • x2sys_datalist
  • x2sys_get
  • x2sys_init
  • x2sys_list
  • x2sys_merge
  • x2sys_put
  • x2sys_report
  • x2sys_solve

Currently, PyGMT provides wrappers for x2sys_init and x2sys_cross as separate functions under the pygmt namespace.

Perhaps it's more Pythonic to wrap all the modules in a class instead. The syntax would be same thing like:

from pygmt import X2SYS

x2sys = X2SYS(...)   # Class __init__ function that wraps `x2sys_init`
x2sys.cross()  # Wraps `x2sys_cross`
x2sys.solve()  # Wraps `x2sys_solve`
...

Disclaimer: I've never used x2sys.

Are you willing to help implement and maintain this feature?

No

@seisman seisman added the feature request New feature wanted label Apr 26, 2025
@weiji14
Copy link
Member

weiji14 commented Apr 28, 2025

It's been a while since I used x2sys, and I've only used x2sys_init and x2sys_cross really (so unsure of the other ones), but I don't think X2SYS holds much of an internal state (nor does it even support virtual files - GenericMappingTools/gmt#3717) to warrant using a class. x2sys_init will write a format definition file (*.fmt), and once that is in place, you could run x2sys_cross without calling x2sys_init again, as long as you set the X2SYS_HOME environment variable correctly. So at most, the class would store the X2SYS_HOME environment variable I suppose 🤷

@seisman seisman added the help wanted Helping hands are appreciated label May 15, 2025
@seisman
Copy link
Member Author

seisman commented May 15, 2025

So at most, the class would store the X2SYS_HOME environment variable I suppose 🤷

I see that most x2sys modules need the TAG setting. Perhaps the class can also store the TAG setting? Anyway, we need inputs from heave x2sys users before taking any actions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature wanted help wanted Helping hands are appreciated
Projects
None yet
Development

No branches or pull requests

2 participants