<jupyter_start><jupyter_text>Comparing Urban and Rural StreamsIn this notebook we'll compare the hydrology of two streams in the Baltimore area:* [Grave Run](https://waterdata.usgs.gov/md/nwis/uv?site_no=01581830), a rural stream with only 0.3% impervious surfaces, and* [Dead Run](https://waterdata.usgs.gov/md/nwis/uv?site_no=01589330), an urban stream that is 39% impervious surfaces.These two watersheds are similar in size, topography, and geology. They also have very emo names.<jupyter_code># Start with the usual.
import hydrofunctions as hf
%matplotlib inline
hf.__version__
# request data for our two sites for a three-year period.
sites = ['01589330', '01581830']
request = hf.NWIS(sites, start_date='2002-01-01', end_date='2005-01-01', file='Urban_Rural.parquet')
request # Describe the dataset that we've received.
# We'll store our discharge data in a dataframe named 'Q'
Q = request.df('discharge')
Q.head()  # Print the first five rows to verify.
# Rename the columns to 'Urban' and 'Rural' so we remember which is which!
Q = Q.rename(columns={"USGS:01589330:00060:00003": "Urban", "USGS:01581830:00060:00003": "Rural"})
Q.head()  # List the first five rows.
# Let's plot our data to create a hydrograph. plot() is a method that is built-in to dataframes.
Q.plot()
# Let's create a flow duration chart for our two sites!
# .flow_duration is a function included in Hydrofunctions. It accepts dataframes as input.
hf.flow_duration(Q)<jupyter_output><empty_output><jupyter_text>Description of the two sitesIf you look carefully at the **hydrograph** above, you can see that the orange urban site tends to have lower baseflow,but it also tends to have higher peaks during storms. Unfortunately, this obscures the hydrograph for the rural site a little!The second diagram is a **flow duration chart**. The default Y axis is logarithmic, with values ranging from less than 1 to about 400 cfs. The default X axis uses a logit scale to plot the chance of exceedance. Values range from greater than zero to less than one, with a value of 0.9 meaning that 90% of the flows are higher than this value. The logit scale stretches out the extreme high and extreme low values so that the distance from the center to one standard deviation is approximately the same as from two standard deviations out to three standard deviations. This approximates the probability scale that Flow Duration charts are often plotted on.Comparing the two sites, you can see that the orange urban site has lower baseflows than the blue rural site, but also has higher peak flows.<jupyter_code># let's compare stats for the two sites!
Q.describe()<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup