Pseudoensemble

The Pseudoensemble data structure is illustrated using the unobserved riverflows at an ungauged section of the Chaudière River in Québec from 1960 to 2020.

Load the data

Loading the pseudo-observations into an object of type Pseudoensemble:

filename = "../../../test/data/A2020_Analyse_Historique_QMA_SLSO00003.nc"
pensemble = ErrorsInVariablesExtremes.load_discharge_distribution(filename)
6-element Vector{Pseudodata}:
 Pseudodata:
  name: LN24HA
  year: Vector{Int64}[60]
  value:Vector{Distributions.LogNormal{Float64}}[60]

 Pseudodata:
  name: MG24HA
  year: Vector{Int64}[60]
  value:Vector{Distributions.LogNormal{Float64}}[60]

 Pseudodata:
  name: MG24HI
  year: Vector{Int64}[60]
  value:Vector{Distributions.LogNormal{Float64}}[60]

 Pseudodata:
  name: MG24HK
  year: Vector{Int64}[60]
  value:Vector{Distributions.LogNormal{Float64}}[60]

 Pseudodata:
  name: MG24HQ
  year: Vector{Int64}[60]
  value:Vector{Distributions.LogNormal{Float64}}[60]

 Pseudodata:
  name: MG24HS
  year: Vector{Int64}[60]
  value:Vector{Distributions.LogNormal{Float64}}[60]

The vector of years can be extracted:

years = pensemble.value[1].year;

Convert to DataFrame

Converting Pseudoensemble to DataFrame:

df = convert(DataFrame, pensemble)
first(df,5)

5 rows × 3 columns

YearConfigurationDistribution
Int64StringDistribu…
11961LN24HADistributions.LogNormal{Float64}(μ=6.74475, σ=0.328861)
21962LN24HADistributions.LogNormal{Float64}(μ=6.66903, σ=0.60999)
31963LN24HADistributions.LogNormal{Float64}(μ=7.12515, σ=0.640745)
41964LN24HADistributions.LogNormal{Float64}(μ=7.12626, σ=0.484738)
51965LN24HADistributions.LogNormal{Float64}(μ=6.38777, σ=0.461077)

Compute the mean and the 1-α confidence interval for each of the configurations

α = 0.5

df[:, :y] = mean.(df.Distribution)
df[:, :ymin] = quantile.(df.Distribution, α/2)
df[:, :ymax] = quantile.(df.Distribution, 1-α/2)

first(df, 5)

5 rows × 6 columns

YearConfigurationDistributionyyminymax
Int64StringDistribu…Float64Float64Float64
11961LN24HADistributions.LogNormal{Float64}(μ=6.74475, σ=0.328861)896.796680.5771060.58
21962LN24HADistributions.LogNormal{Float64}(μ=6.66903, σ=0.60999)948.679521.9621188.51
31963LN24HADistributions.LogNormal{Float64}(μ=7.12515, σ=0.640745)1526.04806.721914.72
41964LN24HADistributions.LogNormal{Float64}(μ=7.12626, σ=0.484738)1399.33897.2291725.4
51965LN24HADistributions.LogNormal{Float64}(μ=6.38777, σ=0.461077)661.205435.623811.399

Display the discharge of all configurations

set_default_plot_size(12cm, 8cm)
plot(df, x=:Year, y=:y, color=:Configuration, Geom.line,
    ymin=:ymin, ymax=:ymax, Geom.ribbon,
    Guide.ylabel("Discharge [m³/s]"))
Year 1890 1900 1910 1920 1930 1940 1950 1960 1970 1980 1990 2000 2010 2020 2030 2040 2050 2060 2070 2080 2090 1900 1905 1910 1915 1920 1925 1930 1935 1940 1945 1950 1955 1960 1965 1970 1975 1980 1985 1990 1995 2000 2005 2010 2015 2020 2025 2030 2035 2040 2045 2050 2055 2060 2065 2070 2075 2080 1900 1950 2000 2050 2100 1900 1902 1904 1906 1908 1910 1912 1914 1916 1918 1920 1922 1924 1926 1928 1930 1932 1934 1936 1938 1940 1942 1944 1946 1948 1950 1952 1954 1956 1958 1960 1962 1964 1966 1968 1970 1972 1974 1976 1978 1980 1982 1984 1986 1988 1990 1992 1994 1996 1998 2000 2002 2004 2006 2008 2010 2012 2014 2016 2018 2020 2022 2024 2026 2028 2030 2032 2034 2036 2038 2040 2042 2044 2046 2048 2050 2052 2054 2056 2058 2060 2062 2064 2066 2068 2070 2072 2074 2076 2078 2080 LN24HA MG24HA MG24HI MG24HK MG24HQ MG24HS Configuration h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? -7.0×10³ -6.0×10³ -5.0×10³ -4.0×10³ -3.0×10³ -2.0×10³ -1.0×10³ 0 1.0×10³ 2.0×10³ 3.0×10³ 4.0×10³ 5.0×10³ 6.0×10³ 7.0×10³ 8.0×10³ 9.0×10³ 1.0×10⁴ 1.1×10⁴ 1.2×10⁴ 1.3×10⁴ -6.00×10³ -5.50×10³ -5.00×10³ -4.50×10³ -4.00×10³ -3.50×10³ -3.00×10³ -2.50×10³ -2.00×10³ -1.50×10³ -1.00×10³ -5.00×10² 0 5.00×10² 1.00×10³ 1.50×10³ 2.00×10³ 2.50×10³ 3.00×10³ 3.50×10³ 4.00×10³ 4.50×10³ 5.00×10³ 5.50×10³ 6.00×10³ 6.50×10³ 7.00×10³ 7.50×10³ 8.00×10³ 8.50×10³ 9.00×10³ 9.50×10³ 1.00×10⁴ 1.05×10⁴ 1.10×10⁴ 1.15×10⁴ 1.20×10⁴ -1×10⁴ 0 1×10⁴ 2×10⁴ -6.00×10³ -5.80×10³ -5.60×10³ -5.40×10³ -5.20×10³ -5.00×10³ -4.80×10³ -4.60×10³ -4.40×10³ -4.20×10³ -4.00×10³ -3.80×10³ -3.60×10³ -3.40×10³ -3.20×10³ -3.00×10³ -2.80×10³ -2.60×10³ -2.40×10³ -2.20×10³ -2.00×10³ -1.80×10³ -1.60×10³ -1.40×10³ -1.20×10³ -1.00×10³ -8.00×10² -6.00×10² -4.00×10² -2.00×10² 0 2.00×10² 4.00×10² 6.00×10² 8.00×10² 1.00×10³ 1.20×10³ 1.40×10³ 1.60×10³ 1.80×10³ 2.00×10³ 2.20×10³ 2.40×10³ 2.60×10³ 2.80×10³ 3.00×10³ 3.20×10³ 3.40×10³ 3.60×10³ 3.80×10³ 4.00×10³ 4.20×10³ 4.40×10³ 4.60×10³ 4.80×10³ 5.00×10³ 5.20×10³ 5.40×10³ 5.60×10³ 5.80×10³ 6.00×10³ 6.20×10³ 6.40×10³ 6.60×10³ 6.80×10³ 7.00×10³ 7.20×10³ 7.40×10³ 7.60×10³ 7.80×10³ 8.00×10³ 8.20×10³ 8.40×10³ 8.60×10³ 8.80×10³ 9.00×10³ 9.20×10³ 9.40×10³ 9.60×10³ 9.80×10³ 1.00×10⁴ 1.02×10⁴ 1.04×10⁴ 1.06×10⁴ 1.08×10⁴ 1.10×10⁴ 1.12×10⁴ 1.14×10⁴ 1.16×10⁴ 1.18×10⁴ 1.20×10⁴ Discharge [m³/s]

Display the discharge of one specific configuration

config = "MG24HQ"

df2 = filter(row -> row.Configuration ==config, df)

set_default_plot_size(12cm, 8cm)
plot(df2, x=:Year, y=:y, Geom.line,
    ymin=:ymin, ymax=:ymax, Geom.ribbon,
    Guide.ylabel("Discharge [m³/s]"))
Year 1890 1900 1910 1920 1930 1940 1950 1960 1970 1980 1990 2000 2010 2020 2030 2040 2050 2060 2070 2080 2090 1900 1905 1910 1915 1920 1925 1930 1935 1940 1945 1950 1955 1960 1965 1970 1975 1980 1985 1990 1995 2000 2005 2010 2015 2020 2025 2030 2035 2040 2045 2050 2055 2060 2065 2070 2075 2080 1900 1950 2000 2050 2100 1900 1902 1904 1906 1908 1910 1912 1914 1916 1918 1920 1922 1924 1926 1928 1930 1932 1934 1936 1938 1940 1942 1944 1946 1948 1950 1952 1954 1956 1958 1960 1962 1964 1966 1968 1970 1972 1974 1976 1978 1980 1982 1984 1986 1988 1990 1992 1994 1996 1998 2000 2002 2004 2006 2008 2010 2012 2014 2016 2018 2020 2022 2024 2026 2028 2030 2032 2034 2036 2038 2040 2042 2044 2046 2048 2050 2052 2054 2056 2058 2060 2062 2064 2066 2068 2070 2072 2074 2076 2078 2080 h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? -5×10³ -4×10³ -3×10³ -2×10³ -1×10³ 0 1×10³ 2×10³ 3×10³ 4×10³ 5×10³ 6×10³ 7×10³ 8×10³ 9×10³ -4.0×10³ -3.5×10³ -3.0×10³ -2.5×10³ -2.0×10³ -1.5×10³ -1.0×10³ -5.0×10² 0 5.0×10² 1.0×10³ 1.5×10³ 2.0×10³ 2.5×10³ 3.0×10³ 3.5×10³ 4.0×10³ 4.5×10³ 5.0×10³ 5.5×10³ 6.0×10³ 6.5×10³ 7.0×10³ 7.5×10³ 8.0×10³ -5×10³ 0 5×10³ 1×10⁴ -4.0×10³ -3.8×10³ -3.6×10³ -3.4×10³ -3.2×10³ -3.0×10³ -2.8×10³ -2.6×10³ -2.4×10³ -2.2×10³ -2.0×10³ -1.8×10³ -1.6×10³ -1.4×10³ -1.2×10³ -1.0×10³ -8.0×10² -6.0×10² -4.0×10² -2.0×10² 0 2.0×10² 4.0×10² 6.0×10² 8.0×10² 1.0×10³ 1.2×10³ 1.4×10³ 1.6×10³ 1.8×10³ 2.0×10³ 2.2×10³ 2.4×10³ 2.6×10³ 2.8×10³ 3.0×10³ 3.2×10³ 3.4×10³ 3.6×10³ 3.8×10³ 4.0×10³ 4.2×10³ 4.4×10³ 4.6×10³ 4.8×10³ 5.0×10³ 5.2×10³ 5.4×10³ 5.6×10³ 5.8×10³ 6.0×10³ 6.2×10³ 6.4×10³ 6.6×10³ 6.8×10³ 7.0×10³ 7.2×10³ 7.4×10³ 7.6×10³ 7.8×10³ 8.0×10³ Discharge [m³/s]