Skip to content

Commit aecb1dc

Browse files
added NWM analysis data assimilation streamflow product within fimserv
1 parent bf2ced7 commit aecb1dc

18 files changed

Lines changed: 466 additions & 37 deletions

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ FIMserv/
4141
│ │ ├── nwmretrospectivedata.py # Processes NWM retrospective data
4242
│ │ ├── geoglows.py # Module to retrieve geoglows streamflow data
4343
│ │ ├── usgsdata.py # Retrieve USGS gauge station data
44-
│ │ └── forecasteddata.py # Processes all range forecasted streamflow data
44+
│ │ ├── forecasteddata.py # Processes all range forecasted streamflow data
45+
│ │ └── nwmanalysisassim.py # Processes NWM Analysis and Assimilation (AnA) data
4546
│ ├── plots/ # Vizualization functionalities
4647
│ ├── FIMsubset/ # Subsetting functionalities for FIM
4748
│ │ ├── xycoord.py # Subset using Lat, Lon
@@ -134,6 +135,12 @@ Users can retrieve NWM forecasted and retrospective data for a specified date ra
134135
```bash
135136
fm.getNWMretrospectivedata(start_date, end_date, huc, value_time)
136137
```
138+
NWM Analysis and Assimilation (AnA) streamflow, the gauge assimilated best estimate of past conditions, is also available for events from 2018-09-17 onwards. It is indexed by valid time, so users pass a start and end date (with or without an hour, in UTC) and get either one aggregated discharge file or a continuous hourly series.
139+
```bash
140+
fm.getNWManalysisAssim(huc, start_date, end_date) #One file aggregated over the range
141+
fm.getNWManalysisAssim(huc, start_date, end_date, continuous_discharge=True) #One file per hour
142+
fm.getNWManalysisAssim(huc, start_date, end_date, value_times=value_times) #Only the event day or timestep
143+
```
137144
**Step 3. Generate the Flood Inundation Mapping**
138145

139146
This functionality automatically uses the recently downloaded and stored streamflow to generate FIM. This automation is based on the HUCID.

dist/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.
88.9 KB
Binary file not shown.

dist/fimserve-0.2.0.tar.gz

83.5 KB
Binary file not shown.
88.9 KB
Binary file not shown.

dist/fimserve-0.2.1.tar.gz

84.1 KB
Binary file not shown.
93.2 KB
Binary file not shown.

dist/fimserve-0.2.11.tar.gz

88.1 KB
Binary file not shown.

docs/code_usage.ipynb

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,62 @@
834834
"fm.getNWMForecasteddata(huc, forecast_range=\"longrange\", sort_by=\"maximum\") #This is an example of getting longrange data with minimum sorting"
835835
]
836836
},
837+
{
838+
"cell_type": "markdown",
839+
"metadata": {},
840+
"source": [
841+
"#### **STEP 6.2 Downloading the NWM Analysis and Assimilation (AnA) Streamflow data**\n",
842+
"\n",
843+
"**Unlike the forecasts, AnA is the NWM best estimate of what already happened. It is run every hour with observed forcing and is nudged towards the observed USGS streamflow, so it is indexed by valid time rather than by a forecast cycle. This makes it the configuration to use when mapping a past event or validating FIM against an observed flood extent.**\n",
844+
"\n",
845+
"**The user provides a start and an end date (with or without an hour, in UTC). By default a single aggregated discharge file is saved for the whole range. NWM AnA is available from 2018-09-17 onwards; for older events use ```getNWMretrospectivedata```.**"
846+
]
847+
},
848+
{
849+
"cell_type": "code",
850+
"execution_count": null,
851+
"metadata": {},
852+
"outputs": [],
853+
"source": [
854+
"# One aggregated discharge file for the whole range (maximum by default)\n",
855+
"fm.getNWManalysisAssim(huc, start_date=\"2024-09-26\", end_date=\"2024-09-28\")"
856+
]
857+
},
858+
{
859+
"cell_type": "markdown",
860+
"metadata": {},
861+
"source": [
862+
"#### **STEP 6.2.1 Continuous hourly, single event day or single timestep AnA streamflow**\n",
863+
"\n",
864+
"**Setting ```continuous_discharge=True``` saves one discharge CSV per hour, which generates an hourly FIM series for the event. Passing ```value_times``` inside the range instead saves only those timesteps, using the same parameter name as ```getNWMretrospectivedata```. A plain day saves that whole day aggregated with ```sort_by```, while a timestamp with an hour saves that exact hour.**"
865+
]
866+
},
867+
{
868+
"cell_type": "code",
869+
"execution_count": null,
870+
"metadata": {},
871+
"outputs": [],
872+
"source": [
873+
"# Continuous hourly discharge, one CSV per timestep\n",
874+
"fm.getNWManalysisAssim(huc, \"2024-09-26\", \"2024-09-28\", continuous_discharge=True)\n",
875+
"\n",
876+
"# Only the event day within the range, aggregated with sort_by\n",
877+
"fm.getNWManalysisAssim(huc, \"2024-09-26\", \"2024-09-28\", value_times=\"2024-09-27\")\n",
878+
"\n",
879+
"# Only a single timestep within the range\n",
880+
"fm.getNWManalysisAssim(\n",
881+
" huc, \"2024-09-26\", \"2024-09-28\", value_times=\"2024-09-27 12:00:00\"\n",
882+
")\n",
883+
"\n",
884+
"# Several value_times at once, same as getNWMretrospectivedata accepts\n",
885+
"fm.getNWManalysisAssim(\n",
886+
" huc,\n",
887+
" \"2024-09-26\",\n",
888+
" \"2024-09-28\",\n",
889+
" value_times=[\"2024-09-27 06:00:00\", \"2024-09-27 18:00:00\"],\n",
890+
")"
891+
]
892+
},
837893
{
838894
"cell_type": "markdown",
839895
"metadata": {},

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "fimserve"
3-
version = "0.2.1"
3+
version = "0.2.11"
44
description = "Framework which is developed with the purpose of quickly generating Flood Inundation Maps (FIM) for emergency response and risk assessment. It is developed under Surface Dynamics Modeling Lab (SDML)."
55
authors = [
66
{ name = "Surface Dynamics Modeling Lab (SDML)" },

0 commit comments

Comments
 (0)