diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 6686f97..a0b1dea 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-06-15T21:41:51","documenter_version":"1.4.1"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-06-15T21:59:22","documenter_version":"1.4.1"}} \ No newline at end of file diff --git a/dev/examples/plot_utilities/index.html b/dev/examples/plot_utilities/index.html index 165af6c..7f67d15 100644 --- a/dev/examples/plot_utilities/index.html +++ b/dev/examples/plot_utilities/index.html @@ -131,4 +131,4 @@ elseif -T+1≤i≤0 return T + i end -end
cyclic (generic function with 1 method)

This page was generated using Literate.jl.

+end
cyclic (generic function with 1 method)

This page was generated using Literate.jl.

diff --git a/dev/examples/tuto_paper/079d669c.svg b/dev/examples/tuto_paper/3703b500.svg similarity index 85% rename from dev/examples/tuto_paper/079d669c.svg rename to dev/examples/tuto_paper/3703b500.svg index 8efd23b..b36837d 100644 --- a/dev/examples/tuto_paper/079d669c.svg +++ b/dev/examples/tuto_paper/3703b500.svg @@ -1,47 +1,47 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/examples/tuto_paper/index.html b/dev/examples/tuto_paper/index.html index 1f7fb6c..c0ab92c 100644 --- a/dev/examples/tuto_paper/index.html +++ b/dev/examples/tuto_paper/index.html @@ -25,4 +25,4 @@ file_for_plot_utilities = download("https://raw.githubusercontent.com/dmetivie/StochasticWeatherGenerators.jl/master/examples/plot_utilities.jl") include(file_for_plot_utilities)
cyclic (generic function with 1 method)

To plot maps, we use GeoMakie.jl + a hack with NaturalEarth.jl. This is still experimental. I used cartopy before with PyCall.jl which works very well.

For the following code to work you will need to add the following packages

import Pkg
 Pkg.add("HTTP", "JSON3", "GeoMakie", "CairoMakie")
file_for_maps_with_geomakie = download("https://raw.githubusercontent.com/dmetivie/StochasticWeatherGenerators.jl/master/examples/geo_makie_features.jl") # download file from a GitHub repo
-include(file_for_maps_with_geomakie)
map_with_stations (generic function with 3 methods)

Global Parameters

plot(0:5)
Example block output

This page was generated using Literate.jl.

+include(file_for_maps_with_geomakie)
map_with_stations (generic function with 3 methods)

Global Parameters

plot(0:5)
Example block output

This page was generated using Literate.jl.

diff --git a/dev/index.html b/dev/index.html index 98b3028..8ede138 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,18 +1,18 @@ -StochasticWeatherGenerators.jl · StochasticWeatherGenerators

StochasticWeatherGenerators.jl

Documentation for StochasticWeatherGenerators.jl

Index

StochasticWeatherGenerators.VCX3Function
VCX3(y, idxs; nb = 3)

Yearly Max of nb = 3 days sliding mean for y. Here idxs can be a vector of vector (or range) corresponds to the index of every year.

using DataFrames, Dates, RollingFunctions
+StochasticWeatherGenerators.jl · StochasticWeatherGenerators

StochasticWeatherGenerators.jl

Documentation for StochasticWeatherGenerators.jl

Index

StochasticWeatherGenerators.VCX3Function
VCX3(y, idxs; nb = 3)

Yearly Max of nb = 3 days sliding mean for y. Here idxs can be a vector of vector (or range) corresponds to the index of every year.

using DataFrames, Dates, RollingFunctions
 time_range = Date(1956):Day(1):Date(2019,12,31)
 year_range = unique(year.(time_range))
 df = DataFrame(:DATE => time_range, :Temperature => 20 .+ 5*randn(length(time_range)))
 idx_year = [findall(x-> year.(x) == m, df[:, :DATE]) for m in year_range]
-VCX3(df.Temperature, idx_year)
source
StochasticWeatherGenerators.VCX3Method
VCX3(df; y_col, nb = 3)

Yearly Max of nb = 3 days sliding mean for y for every year. By default, y_col is the first column not with a Date type

using DataFrames, Dates, RollingFunctions
+VCX3(df.Temperature, idx_year)
source
StochasticWeatherGenerators.VCX3Method
VCX3(df; y_col, nb = 3)

Yearly Max of nb = 3 days sliding mean for y for every year. By default, y_col is the first column not with a Date type

using DataFrames, Dates, RollingFunctions
 time_range = Date(1956):Day(1):Date(2019,12,31)
 df = DataFrame(:DATE => time_range, :Temperature => 20 .+ 5*randn(length(time_range)))
-VCX3(df)
source
StochasticWeatherGenerators.collect_data_ECAFunction
collect_data_ECA(STAID, date_start::Date, date_end::Date, path::String, var::String="RR"; portion_valid_data=1, skipto=19, header = 18, return_nothing = true)
  • path gives the path where all data files are stored in a vector
  • Filter the DataFrame s.t. date_start ≤ :DATE ≤ date_end
  • var = "RR", "TX" etc.
  • portion_valid_data is the portion of valid data we are ok with. If we don't want any missing, fix it to 1.
  • skipto and header for csv files with meta informations/comments at the beginning of files. See CSV.jl.
  • return_nothing if true it will return nothing is the file does not exists or does not have enough valid data.
source
StochasticWeatherGenerators.corTailFunction
corTail(x::AbstractMatrix, q = 0.95)

Compute the (symmetric averaged) tail index matrix M of a vector x, i.e. M[i, j] = (ℙ(x[:,j] > Fxⱼ(q) ∣ x[:,i] > Fxᵢ(q)) + ℙ(x[:,i] > Fxᵢ(q) ∣ x[:,j] > Fxⱼ(q)))/2 where Fx(q) is the CDF of x. Note it uses the same convention as cor function i.e. observations in rows and features in colums.

source
StochasticWeatherGenerators.collect_data_ECAFunction
collect_data_ECA(STAID, date_start::Date, date_end::Date, path::String, var::String="RR"; portion_valid_data=1, skipto=19, header = 18, return_nothing = true)
  • path gives the path where all data files are stored in a vector
  • Filter the DataFrame s.t. date_start ≤ :DATE ≤ date_end
  • var = "RR", "TX" etc.
  • portion_valid_data is the portion of valid data we are ok with. If we don't want any missing, fix it to 1.
  • skipto and header for csv files with meta informations/comments at the beginning of files. See CSV.jl.
  • return_nothing if true it will return nothing is the file does not exists or does not have enough valid data.
source
StochasticWeatherGenerators.corTailFunction
corTail(x::AbstractMatrix, q = 0.95)

Compute the (symmetric averaged) tail index matrix M of a vector x, i.e. M[i, j] = (ℙ(x[:,j] > Fxⱼ(q) ∣ x[:,i] > Fxᵢ(q)) + ℙ(x[:,i] > Fxᵢ(q) ∣ x[:,j] > Fxⱼ(q)))/2 where Fx(q) is the CDF of x. Note it uses the same convention as cor function i.e. observations in rows and features in colums.

source
StochasticWeatherGenerators.cum_monthlyFunction
cum_monthly(y::AbstractArray, idxs)
using DataFrames, Dates, RollingFunctions
 time_range = Date(1956):Day(1):Date(2019,12,31)
 year_range = unique(year.(time_range))
 df = DataFrame(:DATE => time_range, :Temperature => 20 .+ 5*randn(length(time_range)))
 idx_year = [findall(x-> year.(x) == m, df[:, :DATE]) for m in year_range]
 idx_month = [findall(x-> month.(x) == m, df[:, :DATE]) for m in 1:12]
 idx_all = [intersect(yea, mon) for yea in idx_year, mon in idx_month]
-cum_monthly(y, idx_all)
source
StochasticWeatherGenerators.dms_to_ddMethod
dms_to_dd(l)

Convert Degrees Minutes Seconds to Decimal Degrees. Inputs are strings of the form

  • LAT : Latitude in degrees:minutes:seconds (+: North, -: South)
  • LON : Longitude in degrees:minutes:seconds (+: East, -: West)
source
StochasticWeatherGenerators.fit_mle_RRMethod
fit_mle_RR(df::DataFrame, K, local_order; maxiter=5000, tol=2e-4, robust=true, silence=true, warm_start=true, display=:none, mix₀=mix_ini(T))
mix_allE = fit_mle_RR.(data_stations, K, local_order)
source
StochasticWeatherGenerators.rand_RRMethod
rand_RR(mixs::AbstractArray{<:MixtureModel}, n2t::AbstractVector, z::AbstractVector, y::AbstractMatrix, Σk::AbstractArray)

Generate a (nonhomegenous) sequence of length length(n2t) of rain amounts conditionally to a given dry/wet matrix y and (hidden) state sequence z. Univariate distribution are given by mixs while correlations are given by covariance matrix Σk.

source
StochasticWeatherGenerators.rand_condMethod
rand_cond(ϵ, z, θ_uni, θ_cor, n2t, T)

Genererate a random variable conditionnaly to another one Using Copula

\[X_1 \mid X_2 = ϵ \sim \mathbb{N}\left(\mu_1 + \dfrac{\sigma_1}{\sigma_2}\rho (a - \mu_2), (1-\rho^2)\sigma_1^2 \right)\]

For two N(0,1)

\[X_1 \mid X_2 = ϵ \sim \mathbb{N}\left(\rho a , (1-\rho^2) \right)\]

source
StochasticWeatherGenerators.select_in_range_dfMethod
select_in_range_df(datas, start_Date, interval_Date, [portion])

Select station with some data availability in dates and quality (portion of valid data). Input is a vector (array) of DataFrame (one for each station for example) or a Dict of DataFrame. If 0 < portion ≤ 1 is specified, it will authorize some portion of data to be missing.

source
StochasticWeatherGenerators.shortnameMethod
shortname(name::String)

Experimental function that returns only the most relevant part of a station name.

long_name = "TOULOUSE-BLAGNAC"
-shortname(long_name) # "TOULOUSE"
source
+cum_monthly(y, idx_all)
source
StochasticWeatherGenerators.dms_to_ddMethod
dms_to_dd(l)

Convert Degrees Minutes Seconds to Decimal Degrees. Inputs are strings of the form

  • LAT : Latitude in degrees:minutes:seconds (+: North, -: South)
  • LON : Longitude in degrees:minutes:seconds (+: East, -: West)
source
StochasticWeatherGenerators.fit_mle_RRMethod
fit_mle_RR(df::DataFrame, K, local_order; maxiter=5000, tol=2e-4, robust=true, silence=true, warm_start=true, display=:none, mix₀=mix_ini(T))
mix_allE = fit_mle_RR.(data_stations, K, local_order)
source
StochasticWeatherGenerators.rand_RRMethod
rand_RR(mixs::AbstractArray{<:MixtureModel}, n2t::AbstractVector, z::AbstractVector, y::AbstractMatrix, Σk::AbstractArray)

Generate a (nonhomegenous) sequence of length length(n2t) of rain amounts conditionally to a given dry/wet matrix y and (hidden) state sequence z. Univariate distribution are given by mixs while correlations are given by covariance matrix Σk.

source
StochasticWeatherGenerators.rand_condMethod
rand_cond(ϵ, z, θ_uni, θ_cor, n2t, T)

Genererate a random variable conditionnaly to another one Using Copula

\[X_1 \mid X_2 = ϵ \sim \mathbb{N}\left(\mu_1 + \dfrac{\sigma_1}{\sigma_2}\rho (a - \mu_2), (1-\rho^2)\sigma_1^2 \right)\]

For two N(0,1)

\[X_1 \mid X_2 = ϵ \sim \mathbb{N}\left(\rho a , (1-\rho^2) \right)\]

source
StochasticWeatherGenerators.select_in_range_dfMethod
select_in_range_df(datas, start_Date, interval_Date, [portion])

Select station with some data availability in dates and quality (portion of valid data). Input is a vector (array) of DataFrame (one for each station for example) or a Dict of DataFrame. If 0 < portion ≤ 1 is specified, it will authorize some portion of data to be missing.

source
StochasticWeatherGenerators.shortnameMethod
shortname(name::String)

Experimental function that returns only the most relevant part of a station name.

long_name = "TOULOUSE-BLAGNAC"
+shortname(long_name) # "TOULOUSE"
source
diff --git a/dev/objects.inv b/dev/objects.inv index 1d070af..7c0f140 100644 Binary files a/dev/objects.inv and b/dev/objects.inv differ