E3SM-Project / e3sm_diags

E3SM Diagnostics package
https://e3sm-project.github.io/e3sm_diags
BSD 3-Clause "New" or "Revised" License
39 stars 32 forks source link

Give a useful error message when the user doesn't give parameters #36

Closed zshaheen closed 7 years ago

zshaheen commented 7 years ago

When they run the driver without a parameters file:

$ acme_diags_driver.py

they get:

  File "/export/baldwin32/anaconda2/envs/acme2/lib/python2.7/site-packages/acme_diags/acme_parameter.py", line 58, in check_values
    if self.reference_data_path == '':
AttributeError: 'ACMEParameter' object has no attribute 'reference_data_path'

Give a better error message.

Thanks @sterlingbaldwin

zshaheen commented 7 years ago

Fixed in 22a4b71e0c15672d88817d20f75f0a914d4027b3 Get the latest cdp and it should work.

(acme_diags_env) shaheen2@shaheen2ml:~$ acme_diags_driver.py
usage: acme_diags_driver.py [-h] -p PARAMETERS
                            [-d OTHER_PARAMETERS [OTHER_PARAMETERS ...]]
                            [--reference_data_set REFERENCE_DATA_SET]
                            [--reference_data_path REFERENCE_DATA_PATH]
                            [-t TEST_DATA_SET]
                            [--test_data_path TEST_DATA_PATH] [-v VARIABLES]
                            [--levels LEVELS] [-s SEASON [SEASON ...]]
                            [-r REGION [REGION ...]] [--case_id CASE_ID]
                            [-o OUTPUT_FILE] [--reference_name REFERENCE_NAME]
                            [--test_name TEST_NAME] [--diff_name DIFF_NAME]
                            [--main_title MAIN_TITLE]
                            [--reference_title REFERENCE_TITLE]
                            [--test_title TEST_TITLE]
                            [--diff_title DIFF_TITLE]
                            [--reference_colormap REFERENCE_COLORMAP]
                            [--test_colormap TEST_COLORMAP]
                            [--diff_colormap DIFF_COLORMAP]
                            [--backend BACKEND]
acme_diags_driver.py: error: argument -p/--parameters is required

Even this.

(acme_diags_env) shaheen2@shaheen2ml:~$ acme_diags_driver.py -p shit.py
You need to specify reference_data_path in the parameters file or in the command line using --reference_data_path