Interpolate adjusted estimates of flooded area from estimate_flood_extent()
to cover specific dates, facilitating a sum across multiple units.
Arguments
- df
Input tibble from
estimate_flood_extent()
- interval
one of "day", "week", "month", "quarter" or "year"; see
seq.Date()
- wateryear
numeric; water years to interpolate over
- sum
Logical; if TRUE, summarize by date across all units
Details
For each unit, this function interpolates values of
ObservedAreaWater_adjust
generated form estimate_flood_extent()
across a
desired water years. For each water year, the sequence of dates to
interpolate is first generated from Oct 1 through Sep 30 at the desired
interval. For intervals of weeks or days in leap years, leap day is
intentionally skipped in the sequence of dates, facilitating comparisons
across multiple years on common dates.
Values are then interpreted using zoo::na.spline()
, and any values less
than zero are changed to zero. Optionally, if sum = TRUE
, summarizes
across all units for each unique date to return the total area flooded.
Examples
df = format_watertracker(sampledat) |> estimate_flood_extent()
interpolate_flooding(df, wateryear = c(2015, 2016))
#> # A tibble: 1,802 × 7
#> wateryear year month date interval AreaWater_ha AreaWater_ac
#> <dbl> <dbl> <dbl> <date> <int> <dbl> <dbl>
#> 1 2015 2014 10 2014-10-01 1 2.95 7.30
#> 2 2015 2014 10 2014-10-08 2 5.39 13.3
#> 3 2015 2014 10 2014-10-15 3 7.28 18.0
#> 4 2015 2014 10 2014-10-22 4 6.95 17.2
#> 5 2015 2014 10 2014-10-29 5 4.19 10.4
#> 6 2015 2014 11 2014-11-05 6 2.80 6.91
#> 7 2015 2014 11 2014-11-12 7 6.30 15.6
#> 8 2015 2014 11 2014-11-19 8 12.6 31.1
#> 9 2015 2014 11 2014-11-26 9 17.5 43.2
#> 10 2015 2014 12 2014-12-03 10 19.1 47.1
#> # ℹ 1,792 more rows