This function processes the model data by separating soil moisture storage from the dataset, calculating changes in storage, and combining this information back with the original data.
Arguments
- x
A data frame acquired from the `CABCMParquetRead()` or `TerraClimParquetRead()` function. This data frame should include columns for `divide_id`, `var`, `date`, `value`, and `source`.
Value
A data frame containing the combined and cleaned data. The dataset includes:
Data points where `var` is not "str", including columns `divide_id`, `var`, `date`, `value`, and `source`.
Calculated changes in soil moisture storage where `var` is "str", which is computed as the day-to-day difference in `value`.
The combined data with appropriate renaming and omission of missing values.
Details
The `model_clean` function performs the following steps:
Filters out data points where `var` is not "str" and retains only those columns needed.
For data points where `var` is "str", calculates the day-to-day change in soil moisture storage.
Renames the calculated changes and combines this cleaned data with the original dataset.