RAPID to GSSHA¶
It is possible to use RAPID streamflow as an overland flow boundary condition to the Gridded Surface Subsurface Hydrologic Analysis (GSSHA) model.
What is GSSHA?¶
GSSHA is a physically-based, distributed hydrologic model. GSSHA is developed and maintained by Coastal and Hydraulics Laboratory (CHL) which is a member of the Engineer Research & Development Center of the United States Army Corps of Engineers (USACE).
Note
For more information about GSSHA please visit the the gsshawiki .
Tutorial¶
There are two ways to input RAPID as a boundary condition for GSSHA. One is to connect the GSSHA stream network link and node to the RAPID river ID and generate the IHG file. The other is to generate an XYS timeseries file and add it to the netork using WMS.
Method 1: Generate IHG File¶
Step 1.1: Look at Stream Network in WMS to find Link & Node¶
Open GSSHA project in WMS
- Switch to 2-D Grid Module
- In the top menu: GSSHA -> Open Project File
Turn on Stream Link Numbers Display
- In the top menu: Display -> Display Options
- Select Map Data in top left box
- In the center box, make sure Stream Link Numbers is checked under the Arcs subsection.
Determine the Link ID by looking on model.
Step 1.2: Connect RAPID river ID to GSSHA Link & Node and Generate IHG¶
-
RAPIDDataset.
write_flows_to_gssha_time_series_ihg
(path_to_output_file, connection_list_file, date_search_start=None, date_search_end=None, daily=False, mode='mean')[source] Write out RAPID output to GSSHA time series ihg file
Note
See: http://www.gsshawiki.com/Surface_Water_Routing:Introducing_Dischage/Constituent_Hydrographs
Note
GSSHA project card is CHAN_POINT_INPUT
Parameters: - path_to_output_file (str) – Path to the output xys file.
- connection_list_file (list) – CSV file with link_id, node_id, baseflow, and rapid_rivid header and rows with data.
- date_search_start (Optional[datetime]) – This is a datetime object with the date of the minimum date for starting.
- date_search_end (Optional[datetime]) – This is a datetime object with the date of the maximum date for ending.
- out_tzinfo (Optional[tzinfo]) – Timezone object with output time zone for GSSHA. Default is the native RAPID output timezone (UTC).
- daily (Optional[boolean]) – If True and the file is CF-Compliant, write out daily flows.
- mode (Optional[str]) – You can get the daily average “mean” or the maximum “max”. Defauls is “mean”.
Example connection list file:
link_id, node_id, baseflow, rapid_rivid 599, 1, 0.0, 80968 603, 1, 0.0, 80967
Example writing entire time series to file:
from RAPIDpy import RAPIDDataset path_to_rapid_qout = '/path/to/Qout.nc' connection_list_file = '/path/to/connection_list_file.csv' with RAPIDDataset(path_to_rapid_qout) as qout_nc: #for writing entire time series to file qout_nc.write_flows_to_gssha_time_series_ihg('/timeseries/Qout_3624735.ihg', connection_list_file, )
Example writing entire time series as daily average to file:
from RAPIDpy import RAPIDDataset path_to_rapid_qout = '/path/to/Qout.nc' connection_list_file = '/path/to/connection_list_file.csv' with RAPIDDataset(path_to_rapid_qout) as qout_nc: # if file is CF compliant, you can write out daily average qout_nc.write_flows_to_gssha_time_series_ihg('/timeseries/Qout_3624735.ihg', connection_list_file, daily=True, )
Example writing subset of time series as daily maximum to file:
from datetime import datetime from RAPIDpy import RAPIDDataset path_to_rapid_qout = '/path/to/Qout.nc' connection_list_file = '/path/to/connection_list_file.csv' with RAPIDDataset(path_to_rapid_qout) as qout_nc: # if file is CF compliant, you can filter by date and get daily values qout_nc.write_flows_to_gssha_time_series_ihg('/timeseries/Qout_daily_date_filter.ihg', connection_list_file, date_search_start=datetime(2002, 8, 31), date_search_end=datetime(2002, 9, 15), daily=True, mode="max" )
Method 2: Generate XYS File¶
Step 2.1: Generate XYS File¶
-
RAPIDDataset.
write_flows_to_gssha_time_series_xys
(path_to_output_file, series_name, series_id, river_index=None, river_id=None, date_search_start=None, date_search_end=None, daily=False, mode='mean')[source] Write out RAPID output to GSSHA WMS time series xys file.
Parameters: - path_to_output_file (str) – Path to the output xys file.
- series_name (str) – The name for the series.
- series_id (int) – The ID to give the series.
- river_index (Optional[datetime]) – This is the index of the river in the file you want the streamflow for.
- river_id (Optional[datetime]) – This is the river ID that you want the streamflow for.
- date_search_start (Optional[datetime]) – This is a datetime object with the date of the minimum date for starting.
- date_search_end (Optional[datetime]) – This is a datetime object with the date of the maximum date for ending.
- daily (Optional[boolean]) – If True and the file is CF-Compliant, write out daily flows.
- mode (Optional[str]) – You can get the daily average “mean” or the maximum “max”. Defauls is “mean”.
Example writing entire time series to file:
from RAPIDpy import RAPIDDataset river_id = 3624735 path_to_rapid_qout = '/path/to/Qout.nc' with RAPIDDataset(path_to_rapid_qout) as qout_nc: qout_nc.write_flows_to_gssha_time_series_xys('/timeseries/Qout_3624735.xys', series_name="RAPID_TO_GSSHA_{0}".format(river_id), series_id=34, river_id=river_id, )
Example writing entire time series as daily average to file:
from RAPIDpy import RAPIDDataset river_id = 3624735 path_to_rapid_qout = '/path/to/Qout.nc' with RAPIDDataset(path_to_rapid_qout) as qout_nc: # NOTE: Getting the river index is not necessary # this is just an example of how to use this river_index = qout_nc.get_river_index(river_id) # if file is CF compliant, you can write out daily average qout_nc.write_flows_to_gssha_time_series_xys('/timeseries/Qout_daily.xys', series_name="RAPID_TO_GSSHA_{0}".format(river_id), series_id=34, river_index=river_index, daily=True, )
Example writing subset of time series as daily maximum to file:
from datetime import datetime from RAPIDpy import RAPIDDataset river_id = 3624735 path_to_rapid_qout = '/path/to/Qout.nc' with RAPIDDataset(path_to_rapid_qout) as qout_nc: # NOTE: Getting the river index is not necessary # this is just an example of how to use this river_index = qout_nc.get_river_index(river_id) # if file is CF compliant, you can filter by date and # get daily values qout_nc.write_flows_to_gssha_time_series_xys('/timeseries/Qout_daily_date_filter.xys', series_name="RAPID_TO_GSSHA_{0}".format(river_id), series_id=34, river_index=river_index, date_search_start=datetime(2002, 8, 31), date_search_end=datetime(2002, 9, 15), daily=True, mode="max" )
Step 2.2: Add XYS File in WMS¶
In the Distributed Hydrology section, go to Overland Flow Boundary Conditions in GSSHA (Tutorial 55) at http://www.aquaveo.com/software/wms-learning-tutorials
Here is a direct link to the document: http://wmstutorials-10.1.aquaveo.com/55%20Gssha-Applications-OverlandBoundaryConditions.pdf