This notebook validates the organized Spring River eBFE delivery as a
results-ready HEC-RAS 6.1 example. It uses the shared delivery workspace,
reviews the saved audit evidence, optionally executes a fresh
geometry-preprocessor validation run, confirms the local compatibility assets
that distinguish Spring River from Spring Creek, and verifies that all seven
plan result HDFs resolve inside the organized RAS project folder.
RasEbfeModels.organize_model("spring-river") resolves to the shared organized delivery for HUC 11010010.
The organized study remains clearly distinct from spring-creek / SpringCreek_12040102 in code, folder names, and notebook messaging.
The organized RAS project has local projection, terrain, Land Cover, legacy Land Classification, DSS, and RASMapper assets.
The optional notebook validation run can execute the HEC-RAS 6.1 geometry preprocessor for plan 01 / geometry 01 and archives fresh review evidence under the configured artifact root.
All seven hydraulic result HDFs are present and resolve from ras.plan_df inside the organized project folder.
Python
frompathlibimportPathimportjsonimportloggingimportosimportsysimporth5pyimportpandasaspdfromIPython.displayimportdisplaydeffind_repo_root(start:Path|None=None)->Path:search_start=(startorPath.cwd()).resolve()forcandidatein[search_start,*search_start.parents]:if(candidate/"scripts"/"ebfe_geometry_preprocessor_batch.py").exists():returncandidateraiseFileNotFoundError("Could not locate repository root from current working directory.")try:fromras_commanderimportRasPrj,RasUtils,init_ras_projectfromras_commander.sources.federalimportRasEbfeModelsexceptImportError:repo_root=find_repo_root()sys.path.insert(0,str(repo_root))fromras_commanderimportRasPrj,RasUtils,init_ras_projectfromras_commander.sources.federalimportRasEbfeModelslogging.getLogger().setLevel(logging.WARNING)logging.getLogger("ras_commander").setLevel(logging.WARNING)pd.options.display.max_colwidth=160
organized_plan_hdfs=sorted(project_folder.glob("*.p??.hdf"))hdf_summary=pd.DataFrame(classify_plan_hdf(path)forpathinorganized_plan_hdfs)print(f"{existing_path_count(ras.plan_df['HDF_Results_Path'])} of {len(ras.plan_df)} plan dataframe HDF paths exist locally")display(hdf_summary)result_path_df=ras.plan_df[["plan_number","HDF_Results_Path"]].copy()result_path_df["exists"]=result_path_df["HDF_Results_Path"].apply(lambdavalue:bool(value)andPath(str(value)).exists())result_path_df["inside_project"]=result_path_df["HDF_Results_Path"].apply(lambdavalue:bool(value)andPath(str(value)).exists()andproject_folderinPath(str(value)).parents)result_path_df.sort_values("plan_number")
RUN_GEOMETRY_PREPROCESSOR=os.environ.get("RAS_COMMANDER_RUN_GEOMETRY_PREPROCESSOR","0").strip().lower()notin{"0","false","no"}GEOMETRY_PREPROCESSOR_MAX_WAIT=int(os.environ.get("RAS_COMMANDER_GEOMETRY_PREPROCESSOR_MAX_WAIT","7200"))repo_root=find_repo_root()batch_script=repo_root/"scripts"/"ebfe_geometry_preprocessor_batch.py"rerun_output_dir=NOTEBOOK_ARTIFACT_ROOT/"preprocessor_validation"rerun_output_dir.mkdir(parents=True,exist_ok=True)plan_01_hdf=project_folder/"Spring_BLE.p01.hdf"temporary_full_result_backup=rerun_output_dir/"Spring_BLE.p01.full_results_backup.hdf"validation_preprocessor_path=archived_preprocessor_reportvalidation_preprocessor_hdf=archived_preprocessor_hdfvalidation_preprocessor_payload=preprocessor_payloadvalidation_preprocessor_status="not_run"validation_preprocessor_return_code=Nonevalidation_preprocessor_error=Nonecmd=[sys.executable,str(batch_script),"--root",str(ras_model_root),"--ras-version","6.1","--plan","01","--max-wait",str(GEOMETRY_PREPROCESSOR_MAX_WAIT),"--output-dir",str(rerun_output_dir),]display_cmd=["python",str(batch_script.relative_to(repo_root)),*cmd[2:],]ifRUN_GEOMETRY_PREPROCESSOR:importshutilimportsubprocessifnotbatch_script.exists():validation_preprocessor_status="skipped"validation_preprocessor_error=f"Batch script not found at {batch_script}"print(f"SKIP: {validation_preprocessor_error}")elifnotplan_01_hdf.exists():validation_preprocessor_status="skipped"validation_preprocessor_error=f"Plan 01 result HDF not found before preprocessor run: {plan_01_hdf}"print(f"SKIP: {validation_preprocessor_error}")else:shutil.copy2(plan_01_hdf,temporary_full_result_backup)print(f"Backed up full-result plan HDF: {temporary_full_result_backup}")print("Running Spring River geometry preprocessor validation:")print(" ".join(f'"{part}"'if" "inpartelsepartforpartindisplay_cmd))try:completed=subprocess.run(cmd,check=False,timeout=GEOMETRY_PREPROCESSOR_MAX_WAIT+300,)validation_preprocessor_return_code=completed.returncodererun_preprocessor_path=find_latest_json(rerun_output_dir,["geometry_preprocessor_validation_*.json"],["Spring_BLE","spring-river","SpringRiver_11010010"],)ifrerun_preprocessor_pathisNone:validation_preprocessor_status="failed"validation_preprocessor_error=f"No rerun preprocessor report found in {rerun_output_dir}"else:validation_preprocessor_payload=json.loads(rerun_preprocessor_path.read_text(encoding="utf-8"))validation_records=validation_preprocessor_payload.get("records",[])validation_project=validation_records[0]ifvalidation_recordselse{}validation_plan=validation_project.get("plans",[{}])[0]validation_generated_at=validation_preprocessor_payload.get("generated_at")validation_preprocessor_status=validation_project.get("status")or"unknown"validation_preprocessor_error=validation_plan.get("error")validation_preprocessor_path=rerun_preprocessor_pathprint(f"Fresh preprocessor report: {validation_preprocessor_path}")ifvalidation_plan.get("success"):validation_preprocessor_hdf=rerun_output_dir/f"Spring_BLE.p01.preprocessor_{validation_generated_at}.hdf"shutil.copy2(plan_01_hdf,validation_preprocessor_hdf)print(f"Archived fresh preprocessor HDF: {validation_preprocessor_hdf}")else:validation_preprocessor_hdf=Noneprint(f"Fresh preprocessor status: {validation_preprocessor_status}")ifvalidation_preprocessor_error:print(f"Fresh preprocessor detail: {validation_preprocessor_error}")validation_summary=pd.DataFrame([{"generated_at":validation_generated_at,"status":validation_preprocessor_status,"return_code":validation_preprocessor_return_code,"plan":validation_plan.get("plan_number"),"geometry":validation_plan.get("geometry_number"),"elapsed_seconds":round(validation_plan.get("elapsed_seconds",0),1),"errors":validation_plan.get("error_count"),"warnings":validation_plan.get("warning_count"),"preprocessor_hdf":str(validation_preprocessor_hdf)ifvalidation_preprocessor_hdfelseNone,}])display(validation_summary)ifvalidation_preprocessor_return_codenotin(0,None):print(f"Geometry preprocessor batch exited with return code {validation_preprocessor_return_code}; see report above.")exceptsubprocess.TimeoutExpired:validation_preprocessor_status="timed_out"validation_preprocessor_error=f"Geometry preprocessor timed out after {GEOMETRY_PREPROCESSOR_MAX_WAIT+300} seconds."print(f"ERROR: {validation_preprocessor_error}")print("Check HEC-RAS installation and model configuration.")exceptExceptionasexc:validation_preprocessor_status="failed"validation_preprocessor_error=str(exc)print(f"ERROR: Unexpected failure during geometry preprocessor run: {exc}")finally:iftemporary_full_result_backup.exists():shutil.copy2(temporary_full_result_backup,plan_01_hdf)temporary_full_result_backup.unlink()print(f"Restored full-result plan HDF: {plan_01_hdf}")else:print("Geometry preprocessor execution disabled via RAS_COMMANDER_RUN_GEOMETRY_PREPROCESSOR.")print(f"Expected review artifact path: {rerun_output_dir}")print(" ".join(f'"{part}"'if" "inpartelsepartforpartindisplay_cmd))
Wrote review summary: <artifact-root>\review\spring_river_notebook\spring_river_validation_summary.json
Wrote review markdown: <artifact-root>\review\spring_river_notebook\spring_river_validation_summary.md
Spring River is a results-ready, notebook-validated eBFE example. The
organized project remains clearly separated from Spring Creek through the
spring-river slug and SpringRiver_11010010 folder naming, while still
preserving the legacy Land Classification compatibility copy required by
the delivered geometry HDF land-cover reference.
When enabled, the validation cell executes the HEC-RAS 6.1 geometry
preprocessor for plan 01 / geometry 01, writes the fresh preprocessor report
under NOTEBOOK_ARTIFACT_ROOT / "preprocessor_validation", restores the
delivered full-result Spring_BLE.p01.hdf, confirms the organized project
still resolves all seven hydraulic result HDFs, and writes an issue-scoped
review summary under NOTEBOOK_ARTIFACT_ROOT.