Be the first to rate this file! 145 downloads (last 30 days) File Size: 450.22 KB File ID: #22628

Log-Pearson Flood Flow Frequency using USGS 17B

by Jeff Burkey

 

08 Jan 2009 (Updated 29 Apr 2009)

Code covered by BSD License  

This function will calculate flood flow frequencies using published guidelines by the USGS.

Download Now | Watch this File

File Information
Description

This function estimates Flood Frequencies using U.S. Water Resources Council publication Flood Flow Frequencies, Bulletin #17B (1976, revised 1981,1982). This method uses a Log Pearson Type-3 distribution for estimating quantiles. See url: http://water.usgs.gov/osw/bulletin17b/bulletin_17B.html for further documentation.

Modifications:
January 28, 2009 - Tweaked the figure created by cleaning up the legend, reference lines can be turned on/off and are hard coded to display: Upper/Lower 100yr CIs, 100yr, 25yr, 10yr, 5yr, and 2yr. Also changed a few of the default tick placements used to make the grid.

March 13, 2009 - Removed the lower confidence reference line on the figure. Also now will project the last water year in the data set to the final frequency curve and plot a drop down reference line annotating what the interpreted return period would be.

April 20, 2009 - Modified pplot function to create a second type of graph that displays the legend outside the figure and also summarizes in a textbox flow frequencies. Made the comments more Report friendly.

NaN need to be removed in the dataset. If any years have missing data, it will still assume to include that year as part of the sample size-- as stipulated in 17B guidelines. An exmaple MAT file is provided for the user to test. Further down in these comments is some sample script to pre-process the examples.mat file provided.

There are only a couple of loops in this function and subfunctions, most of this is vectorized for speed.

A nice enhancement to this function is a plot of the analyses. It is plotted in probability space-- SKEWED probability space! Because data may not be normally distributed, plotting in skewed space maintains a straight line for the final frequency curve. Again, no need of any
special toolboxes to create this figure. All self contained in this function.

Outputs of this function include:
     estimates of a final frequency (based on a weighted skew),
     confidence intervals (95%) for the final frequency,
     expected frequency curve based on an adjusted conditional
       probability,
     observed data with computed plotting positions using Gringorten and
       Weibull techniques (no toolbox required),
     various Skews,
     mean of log10(Q),
     standard deviation of log10(Q),
     and the coup de grĂ¢ce,
     a probability plot that does not require a toolbox to create, but
     also plots the probability space using the computed weighted skew
     and not just the normal probability.

     *This added feature yields a straight line plot for the final
     frequency curve even if the data are not normally distributed.

The one important aspect not included in this funtion is the assumed generalized skew (which is variable throughout the country), which can be obtained from Plate 1 in the bulletin. Using the USGS program PKFQWin, this generalized skew is automatically estimated with given lat/long
coordinates. For this function, the user must specify a generalized skew, if no generalized skew is provided, 0.0 is assumed.

Even though this function computes probabilities, skews, etc., no toolboxes are required. All necessary tables are provided as additional MAT files supporting this function. These tables are created from the published USGS 17B manual, and not taken from any Matlab toolboxes, so there are no conflicts or copyright violations.

Other files required to support this function are:
  KNtable.mat - using normal distribution, a table of 10-percent
       significance level of K values per N sample size.
  ktable.mat - Appendix 3 table Pearson distributions
  PNtable.mat - Table 11-1 in Appendix 11. Table of probabilities
       adjusted for sample size.
  pscale.mat - table used to define tick/grid intervals when creating a
  probability plot of the results. Can be modified by user if other than
  the default values.
  examples.mat - dataset presented in the 17B publication.

Parabolic interpolation of Pearson Distribution is dependant on function: lagrange.m (written by Jeff Burkey 3/23/2007). Can be downloaded from Mathworks user community.

Syntax
   [dataout skews pp XS SS hp] =
                b17(datain, gg, imgfile, gaugeName, plotref)

 written by
   Jeff Burkey
   King County- Department of Natural Resources and Parks
   Seattle, WA
   email: jeff.burkey@kingcounty.gov
   January 6, 2009

MATLAB release MATLAB 7.8 (R2009a)
Other requirements lagrange.m- download the function from the user community
Zip File Content  
Other Files b17.m,
b17Lg.png,
ex1.mat,
exampleLg.png,
examples.mat,
KNtable.mat,
ktable.mat,
PNtable.mat,
pscale.mat
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (5)
28 Jan 2009 K R

I couldn't get your example script to run. I get the following error:

??? In an assignment A(I) = B, the number of elements in B and
 I must be the same.

Error in ==> b17>freqCurve at 429
        K(i) = lagrange([g k], G, 4);

Error in ==> b17 at 277
    [K floodfreq Gzero] = freqCurve(Xmean, S, G, ktable);

28 Jan 2009 Jeff Burkey

K R,
Hmm...not sure why you're getting unequal numbers. Assuming you open the example.mat file so it shows in your Workspace, then run these next for lines exactly:
  ex1 = examples(~isnan(examples(:,2)),1:2);
  ex2 = [examples(~isnan(examples(:,3)),1) examples(~isnan(examples(:,3)),3)];
  ex3 = [examples(~isnan(examples(:,4)),1) examples(~isnan(examples(:,4)),4)];
  ex4 = [examples(~isnan(examples(:,5)),1) examples(~isnan(examples(:,5)),5)];

Then run the function again pointing to either: ex1, ex2, ex3, or ex4. I hope this helps. Email me directly if you need more help. Regards,
jeff.

18 Feb 2009 Greg Hancock

When I run the ex1 file, created as you specify from the examples.mat file, I get the same message as the previous post:

>>b17(ex1, .590537, 'c:\temp\test.png', 'Demo Station',1)

??? In an assignment A(I) = B, the number of elements in B and
 I must be the same.

Error in ==> b17>freqCurve at 444
        K(i) = lagrange([g k], G, 4);

Error in ==> b17 at 292
    [K floodfreq Gzero] = freqCurve(Xmean, S, G, ktable);

Any resolution to this issue?

Thanks
Greg

18 Feb 2009 Jeff Burkey

Greg,
I'm not sure about the need of a resolution. I cannot recreate any errors. If you want, send me your ex1.mat file. It should be the same, but obviously something is different.

19 Feb 2009 Jeff Burkey

I've updated the zip file to include an example mat file (ex1) and forgo the need for people to extract out a sample dataset from the example.mat file. I hope this helps, and expedite any need to fix a problem should it arise.

Please login to add a comment or rating.
Updates
09 Jan 2009

Corrected a type-o in the title.

13 Jan 2009

Updated Graphing to include inverse of probabilities (i.e. Return Period). Also rotated X-axis tick labels (adapted code from rotateticklabel.m written by Andy Bliss).

29 Jan 2009

Updated the Figure by cleaning up the legend, also added reference lines with values displayed, and adjusted the default xticks used for the grid (i.e. pscale.mat). More detail is in the comments of the b17.m file.

19 Feb 2009

Given the couple of posts seeming to get errors using the example dataset, I've included the EX1.mat file for people to use instead of having people extract out the data from the example.mat file.

13 Mar 2009

Added a drop down reference line for projecting the last water year data point on the final frequency curve.

29 Apr 2009

Modified pplot function to create a second type of figure by displaying the legend outside the figure, and also summarizing flow frequencies in a text box. Made the comments more Report friendly.

Tag Activity for this File
Tag Applied By Date/Time
statistics Jeff Burkey 09 Jan 2009 12:38:34
hydrology Jeff Burkey 09 Jan 2009 12:38:34
logpearson Jeff Burkey 09 Jan 2009 12:38:34
flood Jeff Burkey 09 Jan 2009 12:38:34
frequency Jeff Burkey 09 Jan 2009 12:38:34
annual extremes Jeff Burkey 09 Jan 2009 12:38:34
nonlinear Jeff Burkey 09 Jan 2009 12:38:34
streams Jeff Burkey 09 Jan 2009 12:38:34
rivers Jeff Burkey 09 Jan 2009 12:38:34
regressions Jeff Burkey 09 Jan 2009 12:38:34
probability Jeff Burkey 09 Jan 2009 12:38:34
probability Cristina McIntire 15 Jan 2009 13:03:24
statistics Cristina McIntire 15 Jan 2009 13:03:24
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com