Thursday, June 22, 2017

Python Advanced #14 - Using Lambda in Python for Interpolation

In my post on November 13, 2016, I showed how to interpolate values by using a function in Python.

That function is shown below.



The full post is located here:

Link for Interpolating Values Post

The function shown above computed a flow value given a stage along with the stages and flows above and below in the rating table.

In this post, I show how to perform the same computation using lambda in Python.  The coding to do this is shown below.



The results of this computation are given below.  Since I entered 2.5 as the stage value, I would expect the flow value to return 250 based on the values that I supplied for the bounding values of stage and flow.




Wednesday, June 21, 2017

When to Use Multiple Reservoir Networks in HEC-ResSim

This post details the use of multiple reservoir networks within an HEC-ResSim model.

This post is a continuation of the post titled, "When to Use Multiple Watershed Configurations in HEC-ResSim", from 30May2017.

That post is found here:

Multiple Watershed Configurations Link

Basically, multiple reservoir networks are needed whenever you want to vary a physical parameter of the system while also preserving the original parameter.  These parameters can include:

  • Routing parameters
  • Outlet capacity or number of outlets
  • Storage elevation tables
For example, in the model shown below, I use null routing for the stream reaches.  To compare the differences in results from using various routing methods, multiple reservoir networks can be created with the various routing methods.








In this model, I have a single controlled outlet.  If the capacity of this outlet has changed or additional outlets have been added or proposed, the impacts of the physical changes can be examined by creating a new reservoir network that reflects these changes.



As I mentioned above, the impact of an updated storage-elevation table can be examined by updating that rating within a new reservoir network.  Running alternatives with the original storage-elevation relationship and the updated storage-elevation relationship, for example, can allow the modeler to determine the impact of reservoir sedimentation on peak release and peak pool elevation from an historic or synthetic event.  




Thursday, June 15, 2017

Python Advanced #13 - Computing average annual flow from a csv file

In this post I extracted daily data for the year 2016 for the White River at Newport gage from the USGS site and saved it in a csv file.  I then computed the average of the daily values from this csv file using Python.

USGS White River at Newport data

I import the data into a csv file.  A portion of the file is shown below.





To compute the average of the daily values, I use the code shown below.  To create this code, I modified an example given in a lesson from Coursera.

Link to Coursera


The code is shown below and was run using Anaconda available from the following site:

Where I downloaded Anaconda from




The result of running this code is as follows:




Note that this is the average for the entire year and not just for the values shown above.







Friday, June 9, 2017

Microsoft Excel Advanced #6 - Extracting a Value on a Specific Day and Month for Multiple Years

This post will demonstrate how to extract a value on 01 April for multiple years in Microsoft Excel.  I used the coding example from the following link to guide the development of the needed equations.

Example from stackoverflow.com

Below is the data that I am using for this example.  It is in columns A and B of the Excel worksheet.  There are three instances where the date is 01 April.




I write an IF statement that checks if the month is April and the day is 1.  If it is, a number is added to column C that represents the number of occurrences of 01 April that have occurred up to that row.



This IF statement is added to all appropriate rows in column C.  The results are shown below.




I then use the following equation in column E to extract the date if there is a value in column C.



I then use the following equation in column F to extract the value if there is a value in column C.




The results of applying these equations is shown below.



The explanation of the methods used above are as follows (from Excel help menu).
















Wednesday, May 31, 2017

Python Intermediate #9: Additional Text Formatting in Python

In Python Intermediate #8, I showed a method for text formatting.  In this post, I show an alternative method.

The first example in this post takes the values of the variables, "name" and "grade" and uses them in a simple sentence.

The coding is shown below.



The result of this code is below.




The next example uses the same method, however, the information is extracted from a dictionary named, "personal_info".  The coding is shown below.




The result of this code is below.



Tuesday, May 30, 2017

When to Use Multiple Watershed Configurations in HEC-ResSim

For many studies involving ResSim, various operating criteria are applied to an existing system.  In this post, I provide an example of using multiple watershed configurations to study the addition of a new reservoir to the system.

The figure below shows the existing system.  In this system, there is a single reservoir located on the main stem.  This configuration is named "existing system".




We can look at the details of this configuration.  Notice that the reservoir is listed as being an existing reservoir.



To model a proposed reservoir on the tributary, we can save this configuration under the name, "proposed system" and add a reservoir on the tributary.



When looking at the details of this configuration, we notice that the proposed reservoir is not listed as being an existing reservoir.





Monday, May 22, 2017

Example application of HEC-ResSim

This blog post details a study that I performed several years ago using HEC-ResSim.  I presented the results of this analysis at the 2011 U.S. Society on Dams Annual Conference.

This analysis was necessary since two of the six spillway gates at this project had the potential to become inoperable.  If this were to occur, an alternative reservoir operating plan would be needed.



The reservoir has the following pools:

  • Inactive Pool
  • Conservation Pool
  • Flood Pool
  • Surcharge Pool
The top of the flood pool corresponds to the top of the spillway gates in their closed position.  Once the pool level is projected to exceed to the top of the flood pool, the spillway gates are opened creating a surcharge operation.  However, if two gates are stuck in the down position, the surcharge operation is impacted by flow going over the top of the two gates stuck in the down position.


At this project, a family of curves is used to determine the surcharge operation.  As can be seen in the figure below, the release increases much more significantly with pool elevation changes at the higher elevations (shown by the flattening of the curves).  As one would expect, releases are greater for high inflows.  These curves define the minimum release value for a given combination of pool elevation and inflow.

 

To develop the alternative operating plan, I analyzed several combinations of a reduced top of conservation level along with alterations to the surcharge curves.  The alterations lead to a more aggressive release at a given pool elevation.  The curve below shows the original surcharge envelope curve and the revised envelope curve.  For the revised curve, the original curve is dropped down 1 foot.  However, it should also be noted that it is shifted over to the right due to the values being increased by 35%.  The original minimum required release at elevation 636.0 feet is approximately 25,000 cfs while the revised minimum required release is closer to 40,000 cfs.    

I studied historical and synthetic events for this study.  The figure below shows a comparison of results from various alternatives applied to the 1919 inflow event.  Peak pool elevations and peak releases are shown.  

For this study, there were numerous alternatives that would satisfy the desired parameters, however, some were discarded based on their impacts.  For example, in the table above, one alternative involves dropping the top of conservation down to elevation 620.0 feet.  This alternative was not desirable since it left this project with no conservation storage.