A Julia package for temporal sampling, aggregation, and resampling of time series data.
- Flexible Time Aggregation: Aggregate data to hourly, daily, monthly, or yearly time steps
- Anomaly Calculations: Compute anomalies at various time scales
- Climatological Statistics: Calculate multi-year seasonal cycles (MSC) and inter-annual variability (IAV)
- Efficient Views: Uses array views to avoid unnecessary data copying
- Multiple Sampling Methods: Support for various temporal operations including year shuffling and random selection
using Pkg
Pkg.add("TimeSamplers")using TimeSamplers
using Dates
# Create a date vector
dates = collect(Date(2000, 1, 1):Day(1):Date(2000, 12, 31))
# Create time samplers for daily aggregation (returns a Vector{TimeSample})
daily_samplers = create_TimeSampler(dates, TimeDay())
# Example data (time is the first dimension, so size(data, 1) == length(dates))
data = rand(length(dates), 2)
# Apply sampling/aggregation (2-arg form defaults to `TimeNoDiff()`)
sampled_data = do_time_sampling(data, daily_samplers)TimeHour: aggregation to hourly time stepsTimeDay: aggregation to daily time stepsTimeMonth: aggregation to monthly time stepsTimeYear: aggregation to yearly time stepsTimeMean: aggregation to mean over all time steps
TimeHourAnomaly: aggregation to hourly anomaliesTimeDayAnomaly: aggregation to daily anomaliesTimeMonthAnomaly: aggregation to monthly anomaliesTimeYearAnomaly: aggregation to yearly anomaliesTimeDayMSCAnomaly: aggregation to daily MSC anomaliesTimeMonthMSCAnomaly: aggregation to monthly MSC anomalies
TimeDayMSC: aggregation to daily MSCTimeMonthMSC: aggregation to monthly MSCTimeDayIAV: aggregation to daily IAVTimeMonthIAV: aggregation to monthly IAVTimeHourDayMean: aggregation to mean of hourly data over days
TimeAllYears: aggregation/slicing to include all yearsTimeFirstYear: aggregation/slicing of the first yearTimeRandomYear: aggregation/slicing of a random yearTimeShuffleYears: aggregation/slicing/selection of shuffled years
For detailed documentation, see the TimeSamplers.jl documentation.
This package is licensed under the EUPL-1.2 (European Union Public Licence v. 1.2). See the LICENSE file for details.
Contributions are welcome! Please open an issue or pull request in this repository.
TimeSamplers.jl Contributors