wrapper, --rate_select is being set to True even when I explictly set it to False #6

Closed
opened 2025-05-22 19:10:47 +02:00 by ftong · 0 comments
Member

I am having some issues with the wrapper and understanding how it's supposed to behave. In troubleshooting, I have made the change to shf_wrapper.py to set the default value of *_select to be False.

parser.add_argument("--forecast_select", type=bool, default=False)
parser.add_argument("--m_select", type=bool, default=False)
parser.add_argument("--xy_select", type=bool, default=False)
parser.add_argument("--rate_select", type=bool, default=False)

When I call the script without specifying anything, it works as expected. It does not do any processing because I did not tell it to.

(base) igf@PC-1231GFD:/mnt/c/igf/git/SeismicHazardForecasting/src$ python shf_wrapper.py LGCD_catalog.mat
Namespace(catalog_file='LGCD_catalog.mat', mc_file=None, pdf_file=None, m_file=None, m_select=False, mag_label=None, mc=None, m_max=None, m_kde_method=None, xy_select=False, grid_dim=None, xy_win_method=None, rate_select=False, time_win_duration=None, forecast_select=False, custom_rate=None, forecast_len=None, time_unit=None, model=None, products_string=None, verbose=None)

Now I want to explicitly set rate_select to False.

(base) igf@PC-1231GFD:/mnt/c/igf/git/SeismicHazardForecasting/src$ python shf_wrapper.py LGCD_catalog.mat --rate_select=False  --time_win_duration 100 --time_unit days
Namespace(catalog_file='LGCD_catalog.mat', mc_file=None, pdf_file=None, m_file=None, m_select=False, mag_label=None, mc=None, m_max=None, m_kde_method=None, xy_select=False, grid_dim=None, xy_win_method=None, rate_select=True, time_win_duration=100.0, forecast_select=False, custom_rate=None, forecast_len=None, time_unit='days', model=None, products_string=None, verbose=None)

Now you can see that rate_select is now True but in calling the script, I set it to False.

Actually, it seems it does not matter what I actually set rate_select to. Any value means it will be True. False means True. Anything means True. It's very confusing.

(base) igf@PC-1231GFD:/mnt/c/igf/git/SeismicHazardForecasting/src$ python shf_wrapper.py LGCD_catalog.mat --rate_select=None  --time_win_duration 100 --time_u
nit days
Namespace(catalog_file='LGCD_catalog.mat', mc_file=None, pdf_file=None, m_file=None, m_select=False, mag_label=None, mc=None, m_max=None, m_kde_method=None, xy_select=False, grid_dim=None, xy_win_method=None, rate_select=True, time_win_duration=100.0, forecast_select=False, custom_rate=None, forecast_len=None, time_unit='days', model=None, products_string=None, verbose=None)
I am having some issues with the wrapper and understanding how it's supposed to behave. In troubleshooting, I have made the change to shf_wrapper.py to set the default value of *_select to be False. ``` parser.add_argument("--forecast_select", type=bool, default=False) parser.add_argument("--m_select", type=bool, default=False) parser.add_argument("--xy_select", type=bool, default=False) parser.add_argument("--rate_select", type=bool, default=False) ``` When I call the script without specifying anything, it works as expected. It does not do any processing because I did not tell it to. ``` (base) igf@PC-1231GFD:/mnt/c/igf/git/SeismicHazardForecasting/src$ python shf_wrapper.py LGCD_catalog.mat Namespace(catalog_file='LGCD_catalog.mat', mc_file=None, pdf_file=None, m_file=None, m_select=False, mag_label=None, mc=None, m_max=None, m_kde_method=None, xy_select=False, grid_dim=None, xy_win_method=None, rate_select=False, time_win_duration=None, forecast_select=False, custom_rate=None, forecast_len=None, time_unit=None, model=None, products_string=None, verbose=None) ``` Now I want to explicitly set rate_select to False. ``` (base) igf@PC-1231GFD:/mnt/c/igf/git/SeismicHazardForecasting/src$ python shf_wrapper.py LGCD_catalog.mat --rate_select=False --time_win_duration 100 --time_unit days Namespace(catalog_file='LGCD_catalog.mat', mc_file=None, pdf_file=None, m_file=None, m_select=False, mag_label=None, mc=None, m_max=None, m_kde_method=None, xy_select=False, grid_dim=None, xy_win_method=None, rate_select=True, time_win_duration=100.0, forecast_select=False, custom_rate=None, forecast_len=None, time_unit='days', model=None, products_string=None, verbose=None) ``` Now you can see that rate_select is now True but in calling the script, I set it to False. Actually, it seems it does not matter what I actually set rate_select to. Any value means it will be True. False means True. Anything means True. It's very confusing. ``` (base) igf@PC-1231GFD:/mnt/c/igf/git/SeismicHazardForecasting/src$ python shf_wrapper.py LGCD_catalog.mat --rate_select=None --time_win_duration 100 --time_u nit days Namespace(catalog_file='LGCD_catalog.mat', mc_file=None, pdf_file=None, m_file=None, m_select=False, mag_label=None, mc=None, m_max=None, m_kde_method=None, xy_select=False, grid_dim=None, xy_win_method=None, rate_select=True, time_win_duration=100.0, forecast_select=False, custom_rate=None, forecast_len=None, time_unit='days', model=None, products_string=None, verbose=None) ```
asia added reference boolean_value_parsing_fiz 2025-05-26 16:56:22 +02:00
asia closed this issue 2025-05-27 19:59:52 +02:00
Login to join this conversation.
No Label
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: official-apps/SeismicHazardForecasting#6
No description provided.