Impute Missing Climate Data Using Climatological Daily Means
Source:R/aux_functions.R
impute_climate_to_end_date.Rd
This function imputes missing dates in a climate time series using the average value for each (month, day) combination across all prior years in the dataset. It is useful for filling in short gaps at the end of a time series, such as imputing values for December 2023 using earlier years' averages.
Arguments
- data
A data frame with at least the following columns:
dates
(Date): The observation date.CumulativeRainfall
,anom
,temp
: Numeric climate variables to impute.
- end_date
A
Date
object indicating the final date that should be present. The function will impute values from the last available date up toend_date
. Assumes thedates
column ends before this value.