Index
ClimateTools.MSModel
— MethodMSModel(ds; k_switching=2, intercept="switching")
Compute the autocorrelation of a dataset ds
along the time dimension.
Arguments
ds
: The input dataset.lags
: The number of lags to compute autocorrelation for. Default is 30.
Returns
The autocorrelation of the input dataset ds
along the time dimension.
ClimateTools.autocorrelation
— Methodautocorrelation(ds; lags=30)
Compute the autocorrelation of a dataset ds
along the time dimension.
Arguments
ds
: The input dataset.lags
: The number of lags to compute autocorrelation for. Default is 30.
Returns
The autocorrelation of the input dataset ds
along the time dimension.
ClimateTools.climato_tp
— Methodclimato_tp(ds; fct::Function=sum, iduree=3, lead=0)
Calcul de la somme des précipitations pour tous les mois pour la durée spécifié par iduree. En ce moment, l'overlap des années n'est pas pris en charge: si iduree=3, on aura un Cube qui contient les accumulations sur 3 mois pour toutes les séquences de 3 mois, allant de janvier (janvier-février-mars) à octobre (octobre-novembre-décembre).
ClimateTools.cumsum
— Methodcumsum(xout, xin)
Compute the cumulative sum of the elements in xin
and store the result in xout
.
Arguments
xout
: An array to store the cumulative sum.xin
: An array containing the elements to be summed.
ClimateTools.cumsum
— Methodcumsum(cube::YAXArray, kwargs...)
Compute the cumulative sum along the "time" dimension of the input cube
.
Arguments
cube
: The input YAXArray cube.kwargs
: Additional keyword arguments.
Returns
A new YAXArray cube with the cumulative sum computed along the "time" dimension.
ClimateTools.daily_fct
— Methoddaily_fct(xout, xin; fct::Function, index_list = time_to_index)
Apply a function fct
to aggregate data from xin
into xout
on a daily basis used internally
Arguments
xout
: Output array to store the aggregated data.xin
: Input array containing the data to be aggregated.fct
: Function to be applied for aggregation.index_list
: (optional) Function to convert time to index.
ClimateTools.daily_fct
— Methoddaily_fct(cube::YAXArray; fct::Function=mean, shifthour=0, kwargs...)
Apply a function fct
to process the data in cube
on a daily basis. Assumes that the Cube have sub-daily values.
Arguments
cube::YAXArray
: The input data cube.fct::Function
: The function to apply for processus sub-daily values. Default ismean
.shifthour::Int
: The number of hours to shift the time values. Default is 0.kwargs...
: Additional keyword arguments to be passed to the aggregation function.
Returns
A new YAXArray
with aggregated data on a daily basis.
ClimateTools.diff
— Methoddiff(xout, xin)
Compute the difference between consecutive elements of xin
and store the result in xout
. A 0.0 is added at the beginning of the output array.
Arguments
xout
: An array to store the difference values.xin
: An array of values.
ClimateTools.diff
— Methoddiff(cube::YAXArray, kwargs...)
Compute the difference between consecutive time steps in the given cube
.
Arguments
cube::YAXArray
: The input data cube.kwargs...
: Additional keyword arguments.
Returns
- A new
YAXArray
object containing the difference between consecutive time steps.
ClimateTools.qqmap
— Methodqqmap(dataout, obsvec, refvec, futvec, days, obs_jul, ref_jul, fut_jul; method::String="Additive", detrend::Bool=true, order::Int=4, window::Int64=15, rankn::Int64=50, qmin::Real=0.01, qmax::Real=0.99, thresnan::Float64=0.1, keep_original::Bool=false, interp=Linear(), extrap=Interpolations.Flat())
The qqmap2
function performs quantile mapping bias correction on the futvec
data using the obsvec
and refvec
data as references. It corrects the values in futvec
for each day specified in days
based on the quantiles estimated from the corresponding days in obsvec
and refvec
.
Arguments
dataout
: Output array where the corrected values will be stored.obsvec
: Array of observed values.refvec
: Array of reference values.futvec
: Array of future values to be corrected.days
: Array of days of the year for which correction will be performed.obs_jul
: Array of Julian day values corresponding toobsvec
.ref_jul
: Array of Julian day values corresponding torefvec
.fut_jul
: Array of Julian day values corresponding tofutvec
.
Optional Arguments
method::String
: Method used for correction. Default is "Additive".detrend::Bool
: Whether to detrend the data before correction. Default istrue
.order::Int
: Order of the polynomial used for detrending. Default is 4.window::Int64
: Size of the moving window for selecting reference values. Default is 15.rankn::Int64
: Number of quantiles to estimate. Default is 50.qmin::Real
: Minimum quantile value. Default is 0.01.qmax::Real
: Maximum quantile value. Default is 0.99.thresnan::Float64
: Threshold for the percentage of NaN values allowed in the data. Default is 0.1.keep_original::Bool
: Whether to keep the original values in case of too many NaN values. Default isfalse
.interp
: Interpolation method used for building the correction function. Default isLinear()
.extrap
: Extrapolation method used for building the correction function. Default isInterpolations.Flat()
.
The function modifies dataout
in-place and returns nothing.
ClimateTools.qqmap
— Methodqqmap(obs::YAXArray, ref::YAXArray, fut::YAXArray; method::String="Additive", detrend::Bool=true, order::Int=4, window::Int=15, rankn::Int=50, qmin::Real=0.01, qmax::Real=0.99, thresnan::Float64=0.1, keep_original::Bool=false, interp=Linear(), extrap=Interpolations.Flat())
This function performs quantile mapping bias correction on data.
Arguments
obs::YAXArray
: The observed data.ref::YAXArray
: The reference data.fut::YAXArray
: The future data.method::String
: The method to apply on raw data for bias correction. Default is "Additive".detrend::Bool
: Whether to detrend the data before bias correction. Default istrue
.order::Int
: The order of the polynomial used for detrending. Default is 4.window::Int
: The window size (+/- window relative to a given julian day) for calculating the Julian days. Default is 15.rankn::Int
: The number of quantiles to use for mapping. Default is 50.qmin::Real
: The minimum quantile value. Default is 0.01.qmax::Real
: The maximum quantile value. Default is 0.99.thresnan::Float64
: The threshold for bias correcting a grid based in presence of NaN values. Default is 0.1 (i.e. if there is more than 10% of NaN values, the grid point is not corrected).keep_original::Bool
: Whether to keep the original data in the output if there is more than the threshold of NaN values. Default isfalse
.interp
: The interpolation method to use between quantiles. Default isLinear()
.extrap
: The extrapolation method to use over qmin and qmax. Default isInterpolations.Flat()
.
Returns
- A bias-corrected YAXArray.