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

Suggestion: show tidal models in help #155

Closed
bjarnebuchmann opened this issue Jan 31, 2023 · 2 comments · Fixed by #159
Closed

Suggestion: show tidal models in help #155

bjarnebuchmann opened this issue Jan 31, 2023 · 2 comments · Fixed by #159

Comments

@bjarnebuchmann
Copy link

This is a suggestion regarding the script-API, eg compute_tidal_elevations.py
It falls squarely in "nice-to-have", so no rush to implement. This is not a bug report.

The --help for --tide/-T does not show the (hard-coded) choices, which are available.

It is possible to get the list if a wrong value is given on purpose, for instance:

python3 compute_tidal_elevations.py . . . --tide=BUMMER . . 
. . .
usage: compute_tidal_elevations.py [-h] [--directory DIRECTORY] [--tide TIDE] [--atlas-format {OTIS,netcdf}]
                                   [--gzip] [--definition-file DEFINITION_FILE]
                                   [--format {csv,netCDF4,HDF5,geotiff}]
                                   [--variables VARIABLES [VARIABLES ...]] [--header HEADER]
                                   [--delimiter DELIMITER] [--type {drift,grid}] [--epoch EPOCH]
                                   [--deltatime DELTATIME [DELTATIME ...]]
                                   [--standard {UTC,GPS,TAI,LORAN,datetime}] [--projection PROJECTION]
                                   [--interpolate METHOD] [--extrapolate] [--cutoff CUTOFF]
                                   [--apply-flexure] [--verbose] [--mode MODE]
                                   [infile] [outfile]
compute_tidal_elevations.py: error: argument --tide/-T: invalid choice: 'BUMMER' (choose from 'AODTM-5', 'AOTIM-5', 'AOTIM-5-2018', 'Arc2kmTM', 'CATS0201', 'CATS2008', 'CATS2008_load', 'CATS2022', 'EOT20', 'EOT20_load', 'FES2014', 'FES2014_load', 'GOT4.10', 'GOT4.10_load', 'GOT4.7', 'GOT4.7_load', 'GOT4.8', 'GOT4.8_load', 'Gr1km-v2', 'Gr1kmTM', 'TPXO7.2', 'TPXO7.2_load', 'TPXO8-atlas', 'TPXO9-atlas', 'TPXO9-atlas-v2', 'TPXO9-atlas-v3', 'TPXO9-atlas-v4', 'TPXO9-atlas-v5', 'TPXO9.1')

I would find it helpful, if the choices were shown as part of the help.
One way to d it is to change the definition of the tide-option to eg:

    group.add_argument('--tide','-T',
                       metavar='TIDE', type=str,
                       choices=choices,
                       help=f'Tide model to use in correction. Choose from: {", ".join(choices)}')

It will then output (on --help) eg

  --tide TIDE, -T TIDE  Tide model to use in correction. Choose from: AODTM-5, AOTIM-5, AOTIM-5-2018,
                        Arc2kmTM, CATS0201, CATS2008, CATS2008_load, CATS2022, EOT20, EOT20_load, FES2014,
                        FES2014_load, GOT4.10, GOT4.10_load, GOT4.7, GOT4.7_load, GOT4.8, GOT4.8_load,
                        Gr1km-v2, Gr1kmTM, TPXO7.2, TPXO7.2_load, TPXO8-atlas, TPXO9-atlas, TPXO9-atlas-v2,
                        TPXO9-atlas-v3, TPXO9-atlas-v4, TPXO9-atlas-v5, TPXO9.1

Just a suggestion,
/Bajrne

tsutterley added a commit that referenced this issue Jan 31, 2023
feat: use debug level logging instead of import warnings in `tools.py` to address #156
docs: don't have metavar for `--tide` to address #155
docs: updated v2 link for Arc2km to address #157
@tsutterley
Copy link
Owner

I removed the metavar tags from the parser for the tide models. Should give you all the options now. 👍

tsutterley added a commit that referenced this issue Feb 1, 2023
…159)

feat: use debug level logging instead of import warnings in `tools.py` to address #156
docs: don't have metavar for `--tide` to address #155
docs: updated v2 link for Arc2km to address #157
@bjarnebuchmann
Copy link
Author

bjarnebuchmann commented Feb 1, 2023

Thank you for addressing this issue.
Just a comment.
Although removing the metavar does result in showing the options, they are now shown twice. Once for --tide and once for -T. I find that this adds unnecessary clutter: and it is easy to to miss that there is a short-option -T.
I'm not to say how you like your --help formatted, but personally, I would prefer a metavar, and then later a list of possibilities. Especially, as it is pretty simple to implement.
As long as you have taken an informed decision on this, I'll keep my trap shut.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants