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

Program main or entrypoint #26

Open
jmccartin opened this issue Dec 26, 2022 · 3 comments
Open

Program main or entrypoint #26

jmccartin opened this issue Dec 26, 2022 · 3 comments

Comments

@jmccartin
Copy link
Collaborator

It doesn't seem like there is an obvious entrypoint to the code, rather it seems like the project is a collection of classes and utilities designed to aid the plotting of the TEC for a given site. The closest scripts appear to be the two demo files under demos/.

Could we have a program main that generates a plot (or in future, a detection likelihood)? This could use ArgParse to pass in command line arguments that are backed up by defaults in a configuration.

@MGNute
Copy link
Collaborator

MGNute commented Jul 13, 2023

This is a good idea, although it's probably worth some discussion about what the structure of the sub-commands should be. I think one at least could be a "create_scenario" command that runs and creates a cached scenario file for a particular set of stations and dates. Another separate command could be something like "plot_scenario_interval" that takes the scenario file (or the scenario parameters themselves, although that would be a lot of arguments to specify) and a time range and outputs the plot. Something like that at least. Any other ideas on subcommands?

@MGNute
Copy link
Collaborator

MGNute commented Jul 14, 2023

Also, I'm thinking this would just be called main.py and would go in the project root folder, but if another structure makes sense by all means suggest.

@MGNute
Copy link
Collaborator

MGNute commented Jul 20, 2023

I've created a branch that has an example entrypoint file called run_cli.py using the python argparse module if anyone wants to take a look at it. @jmccartin if you know good style and best practices for that kind of thing let me know. Right now that one has three subcommands (really two actually, with one for debugging) and I'm not sure how expansive to make the options in a single entry-point file like that. I've seen software run the gamut, in some cases having hundreds of individual subcommands available. But there is a lot more that could be done with it.

I tried running black on this but IMO it made the argparser construction absolutely unreadable, so the latest commit does not have it run. Before creating a pull request I thought I'd get some feedback first. Right now the branch has two commits, one with a bunch of tiny changes like adding the US network to station_networks.json, and then one that adds the run_cli.py file.

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

When branches are created from issues, their pull requests are automatically linked.

2 participants