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

Configuring t-route with output_parameters.parquet_output without prefix_ids causes crash #820

Closed
aaraney opened this issue Aug 7, 2024 · 3 comments

Comments

@aaraney
Copy link
Member

aaraney commented Aug 7, 2024

prefix_ids = output_parameters["parquet_output"].get("prefix_ids")

This will crash if prefix_ids was not specified in the configuration.

Traceback (most recent call last):
  File "/python/versions/3.10.10/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/python/versions/3.10.10/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/github/t-route/t/venv/lib/python3.10/site-packages/nwm_routing/__main__.py", line 2223, in <module>
    main_v04(v_args[1])
  File "/github/t-route/t/venv/lib/python3.10/site-packages/nwm_routing/__main__.py", line 304, in main_v04
    nwm_output_generator(
  File "/github/t-route/t/venv/lib/python3.10/site-packages/nwm_routing/output.py", line 504, in nwm_output_generator
    timeseries_df = _parquet_output_format_converter(flowveldepth, restart_parameters.get("start_datetime"), dt,
  File "/github/t-route/t/venv/lib/python3.10/site-packages/nwm_routing/output.py", line 73, in _parquet_output_format_converter
    location_ids = prefix_ids + '-' + df['location_id'].astype(str)
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

prefix_ids: Optional[str] = None

I think the above should not be optional either it should be required field, or have default (e.g. wb-). @shorvath-noaa does that sound right? Happy to submit at PR

@shorvath-noaa
Copy link
Contributor

prefix_ids = output_parameters["parquet_output"].get("prefix_ids")

This will crash if prefix_ids was not specified in the configuration.

Traceback (most recent call last):
  File "/python/versions/3.10.10/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/python/versions/3.10.10/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/github/t-route/t/venv/lib/python3.10/site-packages/nwm_routing/__main__.py", line 2223, in <module>
    main_v04(v_args[1])
  File "/github/t-route/t/venv/lib/python3.10/site-packages/nwm_routing/__main__.py", line 304, in main_v04
    nwm_output_generator(
  File "/github/t-route/t/venv/lib/python3.10/site-packages/nwm_routing/output.py", line 504, in nwm_output_generator
    timeseries_df = _parquet_output_format_converter(flowveldepth, restart_parameters.get("start_datetime"), dt,
  File "/github/t-route/t/venv/lib/python3.10/site-packages/nwm_routing/output.py", line 73, in _parquet_output_format_converter
    location_ids = prefix_ids + '-' + df['location_id'].astype(str)
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

prefix_ids: Optional[str] = None

I think the above should not be optional either it should be required field, or have default (e.g. wb-). @shorvath-noaa does that sound right? Happy to submit at PR

Correct, the default should be "wb-". The other parameters should probably have better defaults too. I'll make a quick PR.

@aaraney
Copy link
Member Author

aaraney commented Aug 7, 2024

Awesome, thanks @shorvath-noaa!

@shorvath-noaa
Copy link
Contributor

Resolved with #821

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

No branches or pull requests

2 participants