The National Water Model (NWM) is a hydrologic modelling framework by National Oceanic and Atmospheric Administration that provides simulation of both the observed and forecasted streamflow and other hydrologic variables for about 2.7 million stream reaches over the entire continental United States (CONUS), southern Alaska, Hawaii, Puerto Rico, and the US Virgin Islands. It is designed around the Weather Research and Forecasting Hydrologic model (WRF-Hydro) and take leverage of datasets like Multi-Radar/Muti-Sensor System (MRMS) and Stage IV Multisensor Precipitation Estimator (MPE) radar-gauge observed precipitation data, and High Resolution Rapid Refresh (HRRR), Rapid Refresh (RAP), North American Mesoscale Nest (NAM-Nest), Global Forecasting System (GFS) and Climate Forecast System (CFS) Numerical Weather Prediction (NWP) forecast data.
The model is run on NOAA's Weather and Climate Operational Supercomputing System (WCOSS) for its several configurations:
| Configuration Name | Simulation Length | Cycling Frequency | Additional Information |
|---|---|---|---|
| CONUS Extended Analysis and Assimilation | 28 hours lookback | 1 time in a day | features data assimilation |
| CONUS Standard Analysis and Assimilation | 3 hours lookback | 24 times in a day | features data assimilation |
| CONUS Short Range Forecast | 18 hours forecast | 24 times in a day | - |
| CONUS Medium Range Forecast | 240 hours forecast | 4 times in a day | 7 ensemble members |
| CONUS Long Range Forecast | 30 days forecast | 4 times in a day | 4 ensemble members |
| Hawaii Analysis and Assimilation | 3 hours lookback | 24 times in a day | features data assimilation |
| Hawaii Short Range Forecast | 48 hours forecast | 2 times in a day | - |
| PR/USVI Analysis and Assimilation | 3 hours lookback | 24 times in a day | features data assimilation |
| PR/USVI Short Range Forecast | 48 hours forecast | 2 times in a day | - |
An Application Programming Interface (API) is a set of rules that enables applications to connect with each other for sharing data or features. Thus, it has become a useful conecpt in the context of water data accession and been implemented in several ways for the NWM also.
One of the recent developments of NWM API is deployed by CIROH that starts with creating a public dataset in Google Bigquery for the NWM streamflow data products. Based on various Google cloud products such as Cloud Run, Bigquery, and API Gateway, this approach deployed a representational state transfer (REST) architecture API for the streamflow forecast. The API enable the users to obatain the output dataset in tabular or structured format instead of the original format of timestamp snapshot of the whole spatial domain in the netCDF file. The API comes with three endpoints dedicated for three different data configuration:
| Piece of Code | Explanation |
|---|---|
|
Create a function in JavaScript that access the NWM API and extract results |
|
Obtain the reach ID as a constant from the input field in HTML |
|
Populate the API access URL using the reach ID and store it as a constant |
|
Use the fetch function to access the API and indicate to store the response in a variable 'response' |
|
If the response is returned with any error, throw that error messgae |
|
Process the response as JSON and store in the variable 'json_data' |
|
Extract the streamflow data as streamflowData and create timestamps and flowValues data series from that |
|
Grab the HTML element inside which dataresults to be shown |
|
Show the results element that is otherwise not displayed by default |
|
Grab the table element to enable writing table contents from within JS |
|
Identify the maximum value between the lengths of timestamp and flowValues series to use in a for loop later |
|
Run a for loop to go over each timeseries data point |
|
For each of the flowValues, create a row in the timeseries-datatable and create two cells, one for timestamp and another for flow value |
|
In the very first iteration, create a placeholder for the timeseries graph in a table cell and spans it along all rows in the table |
|
Populate the created cells for timestamp and flow with actual values from the corresponding data series and end the for loop |
|
Grab the element in which the timeseries graph is to be shown and create a chart for that element with the Chart.js library | |
Assign the chart elements and attributes as per the convention of Chart.js open source library |
|
If any error is encountered following the fetch function up to this line of code, show the corresponding error message |
|
Close the function body |