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

[3pt] PR: New unit inundation and run benchmark tests tool #283

Merged
merged 54 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
4ff386d
WIP: merge rating curves
RobHanna-NOAA Oct 11, 2023
d7f6920
added some domain models merge code
RobHanna-NOAA Oct 12, 2023
c91c241
Merge dev branch
RobHanna-NOAA Nov 9, 2023
5760bc5
Update ras2release.py
RobHanna-NOAA Nov 14, 2023
e9aa435
temp update to main
RobHanna-NOAA Nov 15, 2023
e7f4bb2
Added part calib merge
RobHanna-NOAA Nov 16, 2023
b7639f5
Merge 'dev' into dev-ras2release
RobHanna-NOAA Jan 4, 2024
2a73362
WIP
RobHanna-NOAA Jan 25, 2024
167d3fe
Merge branch 'dev' into dev-ras2release
RobHanna-NOAA Jan 25, 2024
7391b8e
WIP - fix download iteratator
RobHanna-NOAA Feb 2, 2024
f7b0122
Merge branch 'dev' into dev-ras2release
RobHanna-NOAA Feb 2, 2024
1f61708
All done, just testing left
RobHanna-NOAA Feb 6, 2024
6f89c38
tested and good
RobHanna-NOAA Feb 6, 2024
c116d28
remove quite mode notes
RobHanna-NOAA Feb 6, 2024
1278c60
ras2inn is good
RobHanna-NOAA Feb 7, 2024
1210bfd
Downloading from s3 working
RobHanna-NOAA Feb 11, 2024
d2f85bd
S3 download working
RobHanna-NOAA Feb 11, 2024
53ce880
Done basic Dev
RobHanna-NOAA Feb 12, 2024
6d41068
Finished initial dev
RobHanna-NOAA Feb 12, 2024
d6cd98f
Add local flow files loading
RobHanna-NOAA Feb 14, 2024
e2247cb
Quick fixes from testing
RobHanna-NOAA Feb 14, 2024
a7d6a6a
batch evals work and need more adj later
RobHanna-NOAA Feb 15, 2024
1e1b904
batch tool works and needs more cleanup
RobHanna-NOAA Feb 15, 2024
5651330
Merge branch 'dev'
RobHanna-NOAA Feb 16, 2024
35acb36
Merge with dev
RobHanna-NOAA Feb 16, 2024
5e03674
merge cleanup
RobHanna-NOAA Feb 16, 2024
baa7aa4
Merge fixes
RobHanna-NOAA Feb 19, 2024
77aeccb
Appears to be fully running
RobHanna-NOAA Feb 21, 2024
d727265
Linting cleanup
RobHanna-NOAA Feb 21, 2024
be50a6e
testing bug fixes
RobHanna-NOAA Feb 21, 2024
a94a4a4
Update CHANGELOG.md
RobHanna-NOAA Feb 21, 2024
ec2a1fa
minor fixes
RobHanna-NOAA Feb 21, 2024
07d85fa
Merge branch 'dev-inundate-unit' of https://github.com/NOAA-OWP/ras2f…
RobHanna-NOAA Feb 21, 2024
1d48d8f
Added some text to users
RobHanna-NOAA Feb 21, 2024
dc2a160
pre merge from dev
RobHanna-NOAA Feb 27, 2024
a43cba8
Merge branch 'dev' into dev-inundate-unit
RobHanna-NOAA Feb 27, 2024
9c9761c
merge dev into dev-inundate-unit
RobHanna-NOAA Feb 27, 2024
109139b
new get unit inputs tool (#295)
RobHanna-NOAA Feb 27, 2024
7d37fdf
WIP benchmark
RobHanna-NOAA Mar 7, 2024
cf4180d
Wip add master metrics
RobHanna-NOAA Mar 7, 2024
47e8a2f
WIP before dev merge
RobHanna-NOAA Mar 7, 2024
d9a1688
Merge branch 'dev' of https://github.com/NOAA-OWP/ras2fim into dev-in…
RobHanna-NOAA Mar 7, 2024
6ed3f11
finished full with Bench - first draft
RobHanna-NOAA Mar 11, 2024
4085165
adj for v1 rerun
RobHanna-NOAA Mar 12, 2024
c7b1f2c
fix bug in ras_unit_to_s3
RobHanna-NOAA Mar 13, 2024
71c0de8
Fix memory error (bad model)
RobHanna-NOAA Mar 13, 2024
6388c34
Add message about second pass hecras hanging
RobHanna-NOAA Mar 13, 2024
6e804ec
fix for failing geocurves
RobHanna-NOAA Mar 19, 2024
92fc2f9
change proj for output geocurves
RobHanna-NOAA Mar 19, 2024
7193521
fix proj error
RobHanna-NOAA Mar 19, 2024
d88f2ad
minor adj to which domain file is loaded for benchmark
RobHanna-NOAA Mar 20, 2024
54dc5a9
Update CHANGELOG.md
RobHanna-NOAA Mar 20, 2024
04982b4
Update s3_unit_download_files.lst
RobHanna-NOAA Mar 20, 2024
00c52e9
Update CHANGELOG.md
RobHanna-NOAA Mar 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ config/**
!config/r2f_config.env
!config/*.lst
!config/source_codes.csv
!config/symbology/

# Base data #
#############
Expand Down
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,14 @@ This download will include the following files / folders:
3. National Water Model (NWM) Flowline Hydrofabric: nwm_flows.gpkg
4. National Water Model to Watershed Boundary Lookup: nwm_wbd_lookup.nc
5. National Water Model (NWM) Catchments file: nwm_catchments.gpkg
6. You will need a HUC specific DEM which should exist in s3://noaa-nws-owp-fim/ras2fim/inputs/dems/ras_3dep_HUC8_10m/HUC8_{your huc number}_dem.tif. You can save it anywhere on your computer but it is suggested to save it at C:\ras2fim_data\inputs\dems\ras_3dep_HUC8_10m.
<br>
If that HUC8 DEM does not exist, you can create one using the tools/acquire_and_preprocess_3dep_dems.py. Include the argument of -skips3 so it does not attemp to upload it to an S3 bucket unless you have your own. ras2fim.py has an parameter to point to this file if not in the default path.
<br><br>

### (2) Get AWS Folder - OWP_ras_models folder and OWP_ras_models_catalog.csv

At this point, ras2fim.py needs a file named OWP_ras_models_catalog.csv, or similar, and we have loaded a sample for you. It has some meta data that is used in the final output files. While the file must exist with the correct schema, it will not fail if records in it do not match. This file may become optional at a later point, but for now, please include it and also add the `-mc` argument to `ras2fim.py`. eg. `-mc c:\ras2fim_data\OWP_ras_models\OWP_ras_models_catalog.csv` (or pathing of your choice of course, as is with most arguments).
At this point, ras2fim.py needs a file named OWP_ras_models_catalog.csv, or similar, and we have loaded a sample for you. It has some meta data that is used in the final output files. Thee file must have records that match models being processed. For the 'model_id' add any unique numbers you like, if you haven't used the tools/s3_get_models.py tool to download from an S3 bucket. Please include it and also add the `-mc` argument to `ras2fim.py`. eg. `-mc c:\ras2fim_data\OWP_ras_models\OWP_ras_models_catalog_{the huc8 number}_.csv` (or pathing of your choice of course, as is with most arguments).

To download the `OWP_ras_models` folder, you AWS CLI command will be (adjusting for path overrides if you like):
```
Expand All @@ -103,14 +106,9 @@ The install package can be downloaded from [the USACE website](https://github.co
### (4) Clone the Git-hub repository
<img src="https://github.com/NOAA-OWP/ras2fim/blob/main/doc/Git_logo.png" align="right" alt="git logo" height="80"> Install [git](https://git-scm.com/downloads) onto your Windows machine. Next, clone this ras2fim reporitory on to your Windows machine (see note below). Path to the windows folder of your choice, then type:
```
git clone https://github.com/NOAA-OWP/ras2fim.git (see note below)
git clone https://github.com/NOAA-OWP/ras2fim.git
```
**Note: ras2fim V2 series has started development as of early November 2023. Initial check-ins for the default branch will fail for the short term future until an advanced version is ready.** When the CHANGELOG.md shows version check-ins starting with the phrase `V2.0.beta.x`, means the branch is not yet operational but you are still welcome to contibute to the new WIP branch. Once the usable versions have been merged, the CHANGELOG.md will start with the number of `v2.0.0.0`.
<br>
**If you want to view the last stable `V1` series, use the following git clone command which will come from the ras2fim `main (V1)` branch.**
```
git clone https://github.com/NOAA-OWP/ras2fim.git -b V1
```

### (5) Building and Testing ras2fim

Expand Down
7 changes: 7 additions & 0 deletions config/s3_unit_download_files.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Relative to an S3 'inputs' path - use [] for huc subsitution.
## Case sensitive for the S3 paths
X-National_Datasets\nwm_flows.gpkg
X-National_Datasets\nwm_wbd_lookup.nc
X-National_Datasets\WBD_National.gpkg
X-National_Datasets\WBD_HUC8\HUC8_[].gpkg
dems\ras_3dep_HUC8_10m\HUC8_[]_dem.tif
4 changes: 4 additions & 0 deletions config/source_codes.csv
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
ble,FEMA Base Level Engineering (BLE)
nws,National Weather Services
ifc,Iowa Flood Services
ras2fim,ras2fim
usgs,United States Geological Survey
Binary file added config/symbology/esri/agreement_raster.lyr
Binary file not shown.
Binary file added config/symbology/esri/inundation_raster.lyr
Binary file not shown.
39 changes: 39 additions & 0 deletions config/symbology/qgis/agreement_raster.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>
<qgis styleCategories="AllStyleCategories" version="3.10.5-A Coruña" minScale="1e+08" maxScale="0" hasScaleBasedVisibilityFlag="0">
<flags>
<Identifiable>1</Identifiable>
<Removable>1</Removable>
<Searchable>1</Searchable>
</flags>
<customproperties>
<property value="false" key="WMSBackgroundLayer"/>
<property value="false" key="WMSPublishDataSourceUrl"/>
<property value="0" key="embeddedWidgets/count"/>
<property value="Value" key="identify/format"/>
</customproperties>
<pipe>
<rasterrenderer type="paletted" opacity="1" alphaBand="-1" band="1">
<rasterTransparency/>
<minMaxOrigin>
<limits>None</limits>
<extent>WholeRaster</extent>
<statAccuracy>Estimated</statAccuracy>
<cumulativeCutLower>0.02</cumulativeCutLower>
<cumulativeCutUpper>0.98</cumulativeCutUpper>
<stdDevFactor>2</stdDevFactor>
</minMaxOrigin>
<colorPalette>
<paletteEntry label="TN" value="0" alpha="255" color="#000000"/>
<paletteEntry label="FN" value="1" alpha="255" color="#fdae61"/>
<paletteEntry label="FP" value="2" alpha="255" color="#d7191c"/>
<paletteEntry label="TP" value="3" alpha="255" color="#2c7bb6"/>
<paletteEntry label="Waterbody mask" value="4" alpha="255" color="#b2b2b2"/>
</colorPalette>
<colorramp type="randomcolors" name="[source]"/>
</rasterrenderer>
<brightnesscontrast brightness="0" contrast="0"/>
<huesaturation colorizeBlue="128" colorizeRed="255" grayscaleMode="0" colorizeStrength="100" colorizeOn="0" saturation="0" colorizeGreen="128"/>
<rasterresampler maxOversampling="2"/>
</pipe>
<blendMode>0</blendMode>
</qgis>
44 changes: 44 additions & 0 deletions config/symbology/qgis/inundation_raster.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>
<qgis styleCategories="AllStyleCategories" minScale="1e+8" hasScaleBasedVisibilityFlag="0" version="3.12.0-București" maxScale="0">
<flags>
<Identifiable>1</Identifiable>
<Removable>1</Removable>
<Searchable>1</Searchable>
</flags>
<customproperties>
<property key="WMSBackgroundLayer" value="false"/>
<property key="WMSPublishDataSourceUrl" value="false"/>
<property key="embeddedWidgets/count" value="0"/>
<property key="identify/format" value="Value"/>
</customproperties>
<pipe>
<rasterrenderer type="singlebandpseudocolor" opacity="1" classificationMin="0" alphaBand="-1" nodataColor="" classificationMax="0" band="1">
<rasterTransparency/>
<minMaxOrigin>
<limits>None</limits>
<extent>WholeRaster</extent>
<statAccuracy>Estimated</statAccuracy>
<cumulativeCutLower>0.02</cumulativeCutLower>
<cumulativeCutUpper>0.98</cumulativeCutUpper>
<stdDevFactor>2</stdDevFactor>
</minMaxOrigin>
<rastershader>
<colorrampshader classificationMode="1" colorRampType="INTERPOLATED" clip="0">
<colorramp name="[source]" type="gradient">
<prop v="166,97,26,255" k="color1"/>
<prop v="1,133,113,255" k="color2"/>
<prop v="0" k="discrete"/>
<prop v="gradient" k="rampType"/>
<prop v="0.25;223,194,125,255:0.5;245,245,245,255:0.75;128,205,193,255" k="stops"/>
</colorramp>
<item label="Dry" alpha="128" value="0" color="#dfc27d"/>
<item label="Wet" alpha="179" value="0" color="#0018f5"/>
</colorrampshader>
</rastershader>
</rasterrenderer>
<brightnesscontrast brightness="0" contrast="0"/>
<huesaturation colorizeGreen="128" grayscaleMode="0" colorizeOn="0" colorizeStrength="100" saturation="0" colorizeRed="255" colorizeBlue="128"/>
<rasterresampler maxOversampling="2"/>
</pipe>
<blendMode>0</blendMode>
</qgis>
184 changes: 184 additions & 0 deletions config/symbology/qgis/inundation_vector.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>
<qgis hasScaleBasedVisibilityFlag="0" readOnly="0" simplifyDrawingHints="1" labelsEnabled="0" simplifyDrawingTol="1" styleCategories="AllStyleCategories" maxScale="0" minScale="100000000" simplifyMaxScale="1" simplifyAlgorithm="0" simplifyLocal="1" version="3.12.0-București">
<flags>
<Identifiable>1</Identifiable>
<Removable>1</Removable>
<Searchable>1</Searchable>
</flags>
<renderer-v2 type="singleSymbol" enableorderby="0" forceraster="0" symbollevels="0">
<symbols>
<symbol type="fill" alpha="1" force_rhr="0" clip_to_extent="1" name="0">
<layer class="SimpleFill" enabled="1" pass="0" locked="0">
<prop k="border_width_map_unit_scale" v="3x:0,0,0,0,0,0"/>
<prop k="color" v="31,120,180,255"/>
<prop k="joinstyle" v="bevel"/>
<prop k="offset" v="0,0"/>
<prop k="offset_map_unit_scale" v="3x:0,0,0,0,0,0"/>
<prop k="offset_unit" v="MM"/>
<prop k="outline_color" v="31,120,180,255"/>
<prop k="outline_style" v="solid"/>
<prop k="outline_width" v="0.26"/>
<prop k="outline_width_unit" v="MM"/>
<prop k="style" v="solid"/>
<data_defined_properties>
<Option type="Map">
<Option type="QString" name="name" value=""/>
<Option name="properties"/>
<Option type="QString" name="type" value="collection"/>
</Option>
</data_defined_properties>
</layer>
</symbol>
</symbols>
<rotation/>
<sizescale/>
</renderer-v2>
<customproperties>
<property key="embeddedWidgets/count" value="0"/>
<property key="variableNames"/>
<property key="variableValues"/>
</customproperties>
<blendMode>0</blendMode>
<featureBlendMode>0</featureBlendMode>
<layerOpacity>1</layerOpacity>
<SingleCategoryDiagramRenderer attributeLegend="1" diagramType="Histogram">
<DiagramCategory labelPlacementMethod="XHeight" backgroundColor="#ffffff" spacingUnitScale="3x:0,0,0,0,0,0" opacity="1" enabled="0" showAxis="1" barWidth="5" direction="0" lineSizeScale="3x:0,0,0,0,0,0" height="15" minimumSize="0" minScaleDenominator="0" lineSizeType="MM" sizeType="MM" penAlpha="255" spacing="5" maxScaleDenominator="1e+8" rotationOffset="270" diagramOrientation="Up" scaleBasedVisibility="0" backgroundAlpha="255" spacingUnit="MM" scaleDependency="Area" width="15" penColor="#000000" penWidth="0" sizeScale="3x:0,0,0,0,0,0">
<fontProperties description="Sans Serif,9,-1,5,50,0,0,0,0,0" style=""/>
<axisSymbol>
<symbol type="line" alpha="1" force_rhr="0" clip_to_extent="1" name="">
<layer class="SimpleLine" enabled="1" pass="0" locked="0">
<prop k="capstyle" v="square"/>
<prop k="customdash" v="5;2"/>
<prop k="customdash_map_unit_scale" v="3x:0,0,0,0,0,0"/>
<prop k="customdash_unit" v="MM"/>
<prop k="draw_inside_polygon" v="0"/>
<prop k="joinstyle" v="bevel"/>
<prop k="line_color" v="35,35,35,255"/>
<prop k="line_style" v="solid"/>
<prop k="line_width" v="0.26"/>
<prop k="line_width_unit" v="MM"/>
<prop k="offset" v="0"/>
<prop k="offset_map_unit_scale" v="3x:0,0,0,0,0,0"/>
<prop k="offset_unit" v="MM"/>
<prop k="ring_filter" v="0"/>
<prop k="use_custom_dash" v="0"/>
<prop k="width_map_unit_scale" v="3x:0,0,0,0,0,0"/>
<data_defined_properties>
<Option type="Map">
<Option type="QString" name="name" value=""/>
<Option name="properties"/>
<Option type="QString" name="type" value="collection"/>
</Option>
</data_defined_properties>
</layer>
</symbol>
</axisSymbol>
</DiagramCategory>
</SingleCategoryDiagramRenderer>
<DiagramLayerSettings showAll="1" placement="1" linePlacementFlags="18" obstacle="0" dist="0" priority="0" zIndex="0">
<properties>
<Option type="Map">
<Option type="QString" name="name" value=""/>
<Option name="properties"/>
<Option type="QString" name="type" value="collection"/>
</Option>
</properties>
</DiagramLayerSettings>
<geometryOptions geometryPrecision="0" removeDuplicateNodes="0">
<activeChecks/>
<checkConfiguration type="Map">
<Option type="Map" name="QgsGeometryGapCheck">
<Option type="double" name="allowedGapsBuffer" value="0"/>
<Option type="bool" name="allowedGapsEnabled" value="false"/>
<Option type="QString" name="allowedGapsLayer" value=""/>
</Option>
</checkConfiguration>
</geometryOptions>
<referencedLayers/>
<referencingLayers/>
<fieldConfiguration>
<field name="fid">
<editWidget type="TextEdit">
<config>
<Option/>
</config>
</editWidget>
</field>
<field name="HydroID">
<editWidget type="Range">
<config>
<Option/>
</config>
</editWidget>
</field>
</fieldConfiguration>
<aliases>
<alias name="" index="0" field="fid"/>
<alias name="" index="1" field="HydroID"/>
</aliases>
<excludeAttributesWMS/>
<excludeAttributesWFS/>
<defaults>
<default applyOnUpdate="0" expression="" field="fid"/>
<default applyOnUpdate="0" expression="" field="HydroID"/>
</defaults>
<constraints>
<constraint notnull_strength="1" constraints="3" unique_strength="1" field="fid" exp_strength="0"/>
<constraint notnull_strength="0" constraints="0" unique_strength="0" field="HydroID" exp_strength="0"/>
</constraints>
<constraintExpressions>
<constraint exp="" field="fid" desc=""/>
<constraint exp="" field="HydroID" desc=""/>
</constraintExpressions>
<expressionfields/>
<attributeactions>
<defaultAction key="Canvas" value="{00000000-0000-0000-0000-000000000000}"/>
</attributeactions>
<attributetableconfig sortExpression="" actionWidgetStyle="dropDown" sortOrder="0">
<columns>
<column type="field" width="-1" hidden="0" name="fid"/>
<column type="field" width="-1" hidden="0" name="HydroID"/>
<column type="actions" width="-1" hidden="1"/>
</columns>
</attributetableconfig>
<conditionalstyles>
<rowstyles/>
<fieldstyles/>
</conditionalstyles>
<storedexpressions/>
<editform tolerant="1"></editform>
<editforminit/>
<editforminitcodesource>0</editforminitcodesource>
<editforminitfilepath></editforminitfilepath>
<editforminitcode><![CDATA[# -*- coding: utf-8 -*-
"""
QGIS forms can have a Python function that is called when the form is
opened.

Use this function to add extra logic to your forms.

Enter the name of the function in the "Python Init function"
field.
An example follows:
"""
from qgis.PyQt.QtWidgets import QWidget

def my_form_open(dialog, layer, feature):
geom = feature.geometry()
control = dialog.findChild(QWidget, "MyLineEdit")
]]></editforminitcode>
<featformsuppress>0</featformsuppress>
<editorlayout>generatedlayout</editorlayout>
<editable>
<field editable="1" name="HydroID"/>
<field editable="1" name="fid"/>
</editable>
<labelOnTop>
<field labelOnTop="0" name="HydroID"/>
<field labelOnTop="0" name="fid"/>
</labelOnTop>
<widgets/>
<previewExpression>fid</previewExpression>
<mapTip></mapTip>
<layerGeometryType>2</layerGeometryType>
</qgis>
Loading