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

[2pt] Add a check in ras2inundation.py to ensure the flow file is built correctly #322

Open
ar-siddiqui opened this issue May 8, 2024 · 3 comments
Labels
bug Something isn't working help wanted Extra attention is needed ras2fim_V2

Comments

@ar-siddiqui
Copy link
Contributor

ar-siddiqui commented May 8, 2024

When using 2024 04 05 outputs from RAS2FIM and the ras2inundation.py script and conda environment from latest dev branch (6584be0). The following error is encountered

TypeError: Cannot index by location index with a non-integer key

Details:

================================================================= 
          RUN Inundation tool
  (-g): geocurves directory D:\Users\abdul.siddiqui\workbench\projects\ras2fim_demo\20240405\final\geo_rating_curves
  (-f): flow file D:\Users\abdul.siddiqui\workbench\projects\ripple_1d_outputs\flows_harvey.csv
  (-t): output inundation gkpg D:\Users\abdul.siddiqui\workbench\projects\ras2fim_demo\20220508\inundation\harvey.gpkg
 --- Start: 05/08/2024 18:18:44 (UTC time)
=================================================================

Completed creating a dictionary of available feature_ids and geocurve files. 
Derived ras2fim version v2.0.2.0 from geocurve files. 
Compiling feature_ids info (discharge, stage, geometry) ...  
 2024-05-08 18:18:58 <CRITICAL> : Traceback (most recent call last):
  File "ras2inundation.py", line 244, in <module>
    produce_inundation_from_geocurves(**args)
  File "ras2inundation.py", line 131, in produce_inundation_from_geocurves
    subset_geocurve = geocurve_df.iloc[row_idx]
  File "D:\Users\abdul.siddiqui\AppData\Local\anaconda3\envs\ras2fim\lib\site-packages\pandas\core\indexing.py", line 1103, in __getitem__
    return self._getitem_axis(maybe_callable, axis=axis)
  File "D:\Users\abdul.siddiqui\AppData\Local\anaconda3\envs\ras2fim\lib\site-packages\pandas\core\indexing.py", line 1653, in _getitem_axis
    raise TypeError("Cannot index by location index with a non-integer key")
TypeError: Cannot index by location index with a non-integer key
@BradfordBates-NOAA BradfordBates-NOAA added bug Something isn't working ras2fim_V2 help wanted Extra attention is needed labels May 8, 2024
@BradfordBates-NOAA
Copy link
Member

@ar-siddiqui Can you please upload the flow file you used when running ras2inundation.py?

@ar-siddiqui
Copy link
Contributor Author

After more investigation, this issue is because of an empty discharge field in the flows file. I am leaving this issue open for devs to decide if this is a case that the ras2inundation script should deal with. Feel free to close it if needed.

@CarsonPruitt-NOAA
Copy link
Collaborator

I'm going to change the name up and add it to our backlog. Thanks for bringing the issue to our attention.

@CarsonPruitt-NOAA CarsonPruitt-NOAA changed the title Pandas TypeError: Cannot index by location index with a non-integer key when creating FIM using ras2inundation.py with the 20240405 RAS2FIM outputs [2pt] Add a check in ras2inundation.py to ensure the flow file is built correctly May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed ras2fim_V2
Projects
None yet
Development

No branches or pull requests

3 participants