File Exchange

image thumbnail

Log-Pearson Flood Flow Frequency using USGS 17B

version 1.7.0.0 (451 KB) by Jeff Burkey
This function will calculate flood flow frequencies using published guidelines by the USGS.

10 Downloads

Updated 02 Dec 2009

View Version History

View License

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.

December 2, 2009 - updated code to use matlab interp1 function instead of the lagrange.m function. People were downloading the wrong lagrange.m function.

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

Cite As

Jeff Burkey (2020). Log-Pearson Flood Flow Frequency using USGS 17B (https://www.mathworks.com/matlabcentral/fileexchange/22628-log-pearson-flood-flow-frequency-using-usgs-17b), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (8)

Calvin Paul

the*

So Ko

HI

I can not run this function. I have error in line 202:
Error using b17 (line 202)
Not enough input arguments

Could you please help?

Jeff Burkey

The error people were getting was because of them downloading the wrong lagrange.m function. To make things simplier, I've updated the code to use INTERPT1. Lagrange.m is no longer needed. Thanks goes to Shan Zou for letting me know why he was getting the same error as previous people here.

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.

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.

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

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.

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);

MATLAB Release Compatibility
Created with R2009a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!