Skip to content
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

How to handle one or more file inputs #322

Closed
weiji14 opened this issue Aug 23, 2019 · 0 comments · Fixed by #325
Closed

How to handle one or more file inputs #322

weiji14 opened this issue Aug 23, 2019 · 0 comments · Fixed by #325
Labels
question Further information is requested

Comments

@weiji14
Copy link
Member

weiji14 commented Aug 23, 2019

Description of the desired feature

There are a lot of GMT processing scripts that take in one or more table/grid inputs, and I was wondering how this should be handled. This came up as I was trying to wrap text at #321 and it also applies to grdtrack at #308 and other functions (see e.g. this search).

In gmt bash, it looks something like this:

gmt func data1.txt data2.txt -A -B -C

Implementation ideas

So the least amount of work would be to disallow multiple file inputs and force the user write a for-loop to process each file separately. This 'feature' would then need to be documented somewhere.

Another way I've thought about is to patch the kwargs_to_string function in decorators.py to include a 'sequence_space' convertor. This means a user can pass in a list of filenames (e.g. ["data1.txt", "data2.txt"]) which will be converted into a space-separated string (i.e. "data1.txt data2.txt") that can then be passed into the wrapper function when we do:

arg_str = " ".join([fnames, build_arg_string(kwargs)])
lib.call_module("somefunction", arg_str)

Thoughts?

Are you willing to help implement and maintain this feature? Yes!

@weiji14 weiji14 added the question Further information is requested label Oct 1, 2019
@weiji14 weiji14 mentioned this issue Oct 15, 2019
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant