Skip to content

Flow duration curve plotting #364

@jnvn7

Description

@jnvn7

Describe the bug:

There seems to be an issue with plotting the flow duration curve in the updated 0.8.x version. It was producing the expected plot in the 0.7.x version.

In particular, when using commit 2ccc286, I got the following plot

When using latest commit, I got

To Reproduce:

Sample script:

#!/usr/bin/env python3
#-----------------------------------------------------------------------#
from mhkit import river
import matplotlib.pyplot as plt
#-----------------------------------------------------------------------#
# Obtain 5 years of daily discharge data
data = river.io.usgs.request_usgs_data(station="04216000",
                                       parameter='00060',
                                       start_date='2017-01-01',
                                       end_date='2022-01-31',
                                       data_type='Daily')

data = data.rename(columns={data.columns[0]: 'Q'})
data = data.reset_index()

# Convert to discharge data from ft3/s to m3/s
data.Q = data.Q/(3.28084)**3

# Calculate exceedence probability (flow duration curve)
data['ExcP'] = river.resource.exceedance_probability(data.Q)

# Plot FDC
fig = plt.axes()
river.graphics.plot_flow_duration_curve(data.Q, data.ExcP, ax=fig)
plt.show()

Expected behavior:

There should be only one curve in the flow duration plot (discharge vs. exceedance probability).

Desktop (please complete the following information):

  • OS: N/A
  • MHKiT Version: 0.8.x

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions