petershintech / Hydrographs.jl

Plotting tools for streamflow flow and precipitation.
Other
3 stars 0 forks source link
hydrology visualization water

Hydrographs

Build Status

Hydrograph plotting tools.

Installation

The package can be installed with the Julia package manager. From the Julia REPL, type ] to enter the Pkg REPL mode and run:

pkg> add Hydrographs

If you want to install the package directly from its github development site,

pkg> add http://github.com/petershintech/Hydrographs.jl

And load the package using the command:

using Hydrographs

Hydrograph only with streamflow data

hydrograph() returns forecast data as Vega Lite specification.

You can plot a hydrograph with a dataframe. In this case, hydrograph looks for the Date column for dates and the Flow column for streamflow data.

julia> data = dataset("doherty")
julia> hydrograph(data)

You can also use pipe operator to use a dataframe.

julia> data |> hydrograph

You can give column names for dates and streamflow data.

julia> hydrograph(data, "Date", "Flow")

You can also give the indices of columns for dates and streamflow data.

julia> hydrograph(data, 1, 2)

If you plot streamflow data in a log scale,

julia> hydrograph(data; logscale=true)

If you want to plot rainfall data along with streamflow data, give the column name as following.

````julia
julia> hydrograph(data, "Date", "Flow", "Rainfall")

Or, you can give column indices.

julia> hydrograph(data, 1, 2, 4)

You can directly give arrays. The arrays should have the same lengths.

julia> hydrograph(data.Date, data.Flow, data.Rainfall)

You can plot a hydrograph with two dataframes: one for streamflow data and the other for rainfall data. In the case, the data periods can be different.

julia> Q = data[!,[:Date,:Flow]]
julia> P = data[!,[:Date,:Rainfall]]
julia> hydrograph(Q, P)

If you want to change the width of hydrograph,

julia> hydrograph(data; width=1000)

The hydrograph at the bottom does not aggregate streamflow data. If you want to show monthly aggregated data in the hydrograph, use aggregate keyword.

julia> hydrograph(data; aggregate="monthly")

If you want to show weekly aggregated streamflow data,

julia> hydrograph(data; aggregate="weekly")