Description
If the code gets to attempt to conflate but has no valid models
, either by failing or bad models submitted or a bad HUC, or similar, you get a very misleading error.
e.g.
Attempted:
python ras2fim.py -w 12100202 -p EPSG:2277 -o 12100202_test_1
Error:
+=================================================================+
| CONFLATE HEC-RAS TO NATIONAL WATER MODEL STREAMS |
+-----------------------------------------------------------------+
---(w) HUC-8: 12100202
---(i) HEC-RAS INPUT SHP DIRECTORY: c:\ras2fim_data\output_ras2fim\12100202_test_1\01_shapes_from_hecras
---(o) OUTPUT DIRECTORY: c:\ras2fim_data\output_ras2fim\12100202_test_1\02_shapes_from_conflation
---(n) NATIONAL DATASET LOCATION: c:\ras2fim_data\inputs\X-National_Datasets
+-----------------------------------------------------------------+
Loading Watershed Boundary Dataset ~ 60 sec
Traceback (most recent call last):
File "ras2fim.py", line 610, in
init_and_run_ras2fim(**args)
File "ras2fim.py", line 471, in init_and_run_ras2fim
fn_run_ras2fim(str_huc8_arg,
File "ras2fim.py", line 132, in fn_run_ras2fim
fn_conflate_hecras_to_nwm(str_huc8_arg,
File "C:\Users\rdp-user\Projects\dev-change-output-folder-name\ras2fim\src\conflate_hecras_to_nwm.py", line 193, in fn_conflate_hecras_to_nwm
gdf_ble_streams_intersect.to_file(str_filepath_ble_stream)
File "C:\Users\rdp-user\anaconda3\envs\ras2fim\lib\site-packages\geopandas\geodataframe.py", line 1086, in to_file
_to_file(self, filename, driver, schema, index, **kwargs)
File "C:\Users\rdp-user\anaconda3\envs\ras2fim\lib\site-packages\geopandas\io\file.py", line 304, in _to_file
schema = infer_schema(df)
File "C:\Users\rdp-user\anaconda3\envs\ras2fim\lib\site-packages\geopandas\io\file.py", line 362, in infer_schema
raise ValueError("Cannot write empty DataFrame to file.")
ValueError: Cannot write empty DataFrame to file.
Update: This means there was no valid models matching the HUC submitted (or a variant of it). We need a MUCH better error handling on this.