usgs / groundmotion-processing

Parsing and processing ground motion data
Other
54 stars 41 forks source link

Improve subcommand logging messages; refactor projects subcommand #1023

Closed baagaard-usgs closed 1 year ago

baagaard-usgs commented 1 year ago
baagaard-usgs commented 1 year ago

@emthompson-usgs For projects configuration in the local directory, I think relative paths makes sense. For system-level projects configuration, absolute paths make sense. Isn't this what you see?

I did keep code that compute the relative paths for non-Windows platforms.

emthompson-usgs commented 1 year ago

This is what I got for a system-level project:

$ gmrecords proj -c
No project config file detected. Please select a project setup option:
(1) Initialize the current directory as a gmrecords project,
    which will contain data and conf subdirectories.
(2) Setup a project with data and conf locations that are
    independent of the current directory.
(3) Exit.
> 2
Please enter a project title: [default] test
Please enter the conf: [/Users/emthompson/gmprocess_projects/test/conf]
Please enter the data: [/Users/emthompson/gmprocess_projects/test/data]
Please enter your name and email. This information will be added
to the config file and reported in the provenance of the data
processed in this project.
    Name: Eric
    Email address: eric@email.com

Created Project: test **Current Project**
    Conf Path: ../gmprocess_projects/test/conf
    Data Path: ../gmprocess_projects/test/data
INFO 2022-10-07 14:41:06 | gmrecords._initialize: Logging level includes INFO.
INFO 2022-10-07 14:41:06 | gmrecords._initialize: PROJECTS_PATH: /Users/emthompson/.gmprocess
INFO 2022-10-07 14:41:06 | projects.main: Running subcommand 'projects'
Please enter a project title: [default]

Note that it also prompts me to create a second project, which I think is undesirable. I didn't see this in my initial testing.

emthompson-usgs commented 1 year ago

Further testing, it seems that the only time I see the re-prompt for another project is creating a system level project and no projects.conf file previously existed.

baagaard-usgs commented 1 year ago

I found the problem. This doesn't happen unless you use the proj alias. I will add the fix to my comments in #1025

emthompson-usgs commented 1 year ago

Dang. I hadn't encountered issues that are specific to using aliases before so that wasn't on my radar.