Linking rainfall and flooding to storms

library(gtropic)
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#>     filter, lag
#> The following objects are masked from 'package:base':
#>
#>     intersect, setdiff, setequal, union

This vignette covers how to link precipitation and flood exposure data to specific STORM_IDs, and how to avoid double-counting exposure data in your analyses. STORM_ID is the unique, preferred storm key for these joins and groupings; STORM_NAME is a potentially duplicated convenience display label and should not be used as a relational key.

We’ll start by noting that the wind exposures come already linked to STORM_IDs, the $wind table contains rows for every ADM2_ID-STORM_ID pairing:

jam_05 <- gtropic_data(WHO_ENTITY = "Jamaica", date_range = c(2005, 2005))
#> Discovering datasets in collection "gtropic".
#> Downloading '02_wind/storm_metadata/2005.parquet'.
#> Retrieving 6 files (154.8 MB) ; 4 already cached.
#> Downloading '02_wind/exposures/2005.parquet'.
#> Downloading '02_wind/zero_pairs/2005.parquet'.
#> Downloading '04_precip/2005.parquet'.
#> Warning in assemble_gtropic_data(args, call = call): No non-missing precipitation values were returned for 146 selected ADM2 units.
#> ! "35162164B10440863111199", "35162164B11758798186333",
#>   "35162164B13235352626667", "35162164B13736079230506",
#>   "35162164B14656063603224", "35162164B14734200252425",
#>   "35162164B15393502878039", "35162164B15608303769076",
#>   "35162164B15658417820468", "35162164B15710553395599", and "... and 136 more"
#> ℹ A known current source-data limitation can affect small or coastal ADM2 units
#>   when no ERA5-Land grid cell is assigned.
#> ℹ A future G-TROPIC dataset release is planned to fill these gaps using
#>   finer-resolution ERA5 precipitation data.
#> ℹ See `?gtropic_known_limitations`; complete identifiers are available from
#>   `gtropic_warnings()`.
#> Downloading '03_flood/2005.parquet'.
#> Downloading '01_pop/2005.parquet'.
#> Downloading '02_wind/storm_tracks/2005.parquet'.

jam_05$wind
#> # A tibble: 3,719 × 12
#>    ADM2_ID  STORM_ID LOCAL_DATETIME_STORM…¹ LOCAL_DATETIME_MAX_W…² STORM_DIST_KM
#>    <chr>    <chr>    <chr>                  <chr>                          <dbl>
#>  1 3516216… 2005186… 2005-07-07T17:45:00-0… 2005-07-07T18:30:00-0…         146.
#>  2 3516216… 2005192… 2005-07-16T16:00:00-0… 2005-07-16T16:45:00-0…         191.
#>  3 3516216… 2005289… 2005-10-15T13:00:00-0… 2005-10-15T13:00:00-0…          94.7
#>  4 3516216… 2005318… 2005-11-16T20:45:00-0… 2005-11-16T21:30:00-0…         356.
#>  5 3516216… 2005186… 2005-07-07T17:45:00-0… 2005-07-07T18:15:00-0…         130.
#>  6 3516216… 2005192… 2005-07-16T15:45:00-0… 2005-07-16T16:15:00-0…         205.
#>  7 3516216… 2005289… 2005-10-15T13:00:00-0… 2005-10-15T13:00:00-0…         111.
#>  8 3516216… 2005318… 2005-11-16T20:15:00-0… 2005-11-16T21:15:00-0…         367.
#>  9 3516216… 2005186… 2005-07-07T17:00:00-0… 2005-07-07T17:45:00-0…         127.
#> 10 3516216… 2005192… 2005-07-16T14:15:00-0… 2005-07-16T14:45:00-0…         198.
#> # ℹ 3,709 more rows
#> # ℹ abbreviated names: ¹​LOCAL_DATETIME_STORM_CLOSEST, ²​LOCAL_DATETIME_MAX_WIND
#> # ℹ 7 more variables: VMAX_SUST_MS <dbl>, SUST_DUR_MINUTES <dbl>,
#> #   VMAX_GUST_MS <dbl>, GUST_DUR_MINUTES <dbl>, WIND_RADII_VMAX_SUST_MS <dbl>,
#> #   WIND_RADII_SUST_DUR_MINUTES <dbl>, LOCAL_DATE_STORM_CLOSEST <date>

Linking precipitation and flooding data to specific storms is a task left up to you, the user, since different use cases may require different spatial and temporal fields, and these fields may even be hazard-specific. Deciding which precipitation/flooding data “belong” to a given storm is therefore a modeling choice you need to make.

Hazard-specific spatial fields and temporal windows

When calling gtropic_data() to retrieve exposure data, you need to be aware of the following hazard-specific arguments that determine the wind/precip/flood spatial fields and temporal windows:

The wind, precip, and flood radius filters

The [wind/precip/flood]_radius_km arguments (all 500 by default) specify the maximum distance (in km) an ADM2 must be from the closest approach made by a storm track for that ADM2’s corresponding wind/precip/flood data to be returned. These filters are applied directly to the STORM_DIST_KM data column in the $links table. Set these [wind/precip/flood]_radius_km arguments to Inf or NULL to retrieve wind/precip/flood data for all ADM2s regardless of their distance to the selected storm tracks.

These filters also restric the set of storms returned in your query. For example, using the defaults mean that storms failing to come within 500km of any ADM2 in your search will be excluded from your resulting gtropic_data object.

Note that these defaults of 500km are not prescriptive, and we do not claim to define an “exposure” with these default values. We leave this configurable per data retrieval query so that you the user can define your specific wind/precipitation/flood fields of interest. Smaller values for these arguments will also result in smaller data tables being returned, which can help save on memory consumption.

The precip and flood temporal window filters

Both the precipitation and flooding data use a temporal window centered on the LOCAL_DATE_STORM_CLOSEST value for an ADM2_ID-STORM_ID pair, which captures the local datetime when that STORM_ID’s storm track came nearest to that ADM2_ID’s population-weighted centroid:

[ LOCAL_DATE_STORM_CLOSEST - days_before , LOCAL_DATE_STORM_CLOSEST + days_after ]

The [precip/flood]_days_[before/after] arguments in gtropic_data() are used to define this temporal window. By default, [precip/flood]_days_before = 2, and [precip/flood]_days_after = 1, meaning precipitation/flood data is obtained for an ADM2_ID for all days inside the window given by the 2 days before and 1 day after a STORM_ID’s LOCAL_DATETIME_STORM_CLOSEST date. These windows are computed independently for rainfall and flooding, so you can widen or narrow one without adjusting the other.

How to avoid double-counting exposure data

Depending on how you define your precipitation data’s temporal window, one ADM2’s rainy day can fall inside two distinct storms’ temporal windows (E.g. two storms hit the same region within days of one another). If the package returned that day once per storm, then calculating something like:

sum(res$precip$PRECIP_MM)   # WRONG if rows were duplicated

would silently overstate total rainfall. So precip and flood come back as tidy tables at their natural grain – one row per unit per date, one row per flood event – and you join through links deliberately.

Joining rainfall to storms

Let’s take a look at all storms whose genesis date fell in 2019 that came within 500km of any ADM2 within India. We’ll examine precipitation data 1 week either side of the storm’s LOCAL_DATE_STORM_CLOSEST:

india_19 <- gtropic_data(
  WHO_ENTITY = "India",
  date_range = c(2019, 2019),
  precip_days_before = 7,
  precip_days_after = 7
)
#> Discovering datasets in collection "gtropic".
#> Downloading '02_wind/storm_metadata/2019.parquet'.
#> Retrieving 6 files (161.4 MB) ; 4 already cached.
#> Downloading '02_wind/exposures/2019.parquet'.
#> Downloading '02_wind/zero_pairs/2019.parquet'.
#> Downloading '04_precip/2019.parquet'.
#> Warning in assemble_gtropic_data(args, call = call): No non-missing precipitation values were returned for 2 selected ADM2 units.
#> ! "76128533B41477629049356" and "76128533B56857410767766"
#> ℹ A known current source-data limitation can affect small or coastal ADM2 units
#>   when no ERA5-Land grid cell is assigned.
#> ℹ A future G-TROPIC dataset release is planned to fill these gaps using
#>   finer-resolution ERA5 precipitation data.
#> ℹ See `?gtropic_known_limitations`; complete identifiers are available from
#>   `gtropic_warnings()`.
#> Downloading '03_flood/2019.parquet'.
#> Downloading '01_pop/2019.parquet'.
#> Downloading '02_wind/storm_tracks/2019.parquet'.

Let’s say we want to calculate total rainfall per ADM2 within the temporal window defined during our gtropic_data() call. Then we simply aggregate the returned $precip table:

india_19$precip |>
  group_by(ADM2_ID) |>
  summarise(total_mm = sum(PRECIP_MM, na.rm = TRUE))
#> # A tibble: 397 × 2
#>    ADM2_ID                 total_mm
#>    <chr>                      <dbl>
#>  1 76128533B10270619600482  381.
#>  2 76128533B11082155919544   64.7
#>  3 76128533B11421856387892  112.
#>  4 76128533B12079567451207   69.8
#>  5 76128533B12144400448811    1.04
#>  6 76128533B1222571856670    11.6
#>  7 76128533B12294379827032    0.793
#>  8 76128533B12380735325851   27.4
#>  9 76128533B12519626815499  211.
#> 10 76128533B12694285477701   12.2
#> # ℹ 387 more rows

But let’s say instead we want to calculate the rainfall per storm within the spatial & temporal window we defined. Use a non-equi join, matching on unit and on the date falling inside the window:

storm_rain <- india_19$precip |>
  inner_join(
    india_19$links |> filter(PRECIP_IN_FIELD),
    by = join_by(
      ADM2_ID,
      between(LOCAL_DATE, PRECIP_WINDOW_START, PRECIP_WINDOW_END)
    )
  )

This expands the data: a day inside two windows would now appears twice, once per storm, as intended. We can use the storm_rain table to first check whether overlap affects our data at all:

storm_rain |>
  count(ADM2_ID, LOCAL_DATE) |>
  filter(n > 1)

Then, sum the joined table, knowing that a shared day contributes to both storms:

storm_rain |>
  group_by(STORM_ID, ADM2_ID) |>
  summarise(storm_adm2_mm = sum(PRECIP_MM, na.rm = TRUE), .groups = "drop")
#> # A tibble: 764 × 3
#>    STORM_ID      ADM2_ID                 storm_adm2_mm
#>    <chr>         <chr>                           <dbl>
#>  1 2019116N02090 76128533B10270619600482       381.
#>  2 2019116N02090 76128533B11421856387892        76.0
#>  3 2019116N02090 76128533B12144400448811         1.04
#>  4 2019116N02090 76128533B1222571856670         10.4
#>  5 2019116N02090 76128533B12294379827032         0.793
#>  6 2019116N02090 76128533B12694285477701        12.2
#>  7 2019116N02090 76128533B13437137070957       182.
#>  8 2019116N02090 76128533B13733639953372        75.3
#>  9 2019116N02090 76128533B14292125820380         1.26
#> 10 2019116N02090 76128533B14403163214152        34.0
#> # ℹ 754 more rows

Or alternatively:

storm_rain |>
  group_by(STORM_ID) |>
  summarise(storm_mm = sum(PRECIP_MM, na.rm = TRUE), .groups = "drop")
#> # A tibble: 7 × 2
#>   STORM_ID      storm_mm
#>   <chr>            <dbl>
#> 1 2019116N02090   20391.
#> 2 2019160N11073    8369.
#> 3 2019264N19071    8369.
#> 4 2019296N15066    6107.
#> 5 2019301N05081   10221.
#> 6 2019302N11118    4889.
#> 7 2019337N11072     981.

Flood matching

The flood event data shipped in G-TROPIC span intervals defined by the FLOOD_START_DATE and FLOOD_END_DATE columns:

india_19$flood
#> # A tibble: 340 × 7
#>    ADM2_ID            FLOOD_ID FLOOD_START_DATE FLOOD_END_DATE PROP_FLOODED_AREA
#>    <chr>              <chr>    <date>           <date>                     <dbl>
#>  1 76128533B72541188… 5393f9b… 2019-05-01       2019-05-01             0.00197
#>  2 76128533B79750857… f76129e… 2019-05-03       2019-05-04             0.00329
#>  3 76128533B52802748… ec9ea5e… 2019-05-03       2019-05-04             0.0899
#>  4 76128533B70842759… ec9ea5e… 2019-05-03       2019-05-04             0.0000322
#>  5 76128533B98951704… e938903… 2019-05-03       2019-05-03             0.0283
#>  6 76128533B28605354… 8d35cc4… 2019-05-03       2019-05-04             0.0116
#>  7 76128533B22077262… 8d35cc4… 2019-05-03       2019-05-04             0.00355
#>  8 76128533B72507508… 8d35cc4… 2019-05-03       2019-05-04             0.944
#>  9 76128533B93453964… 8d35cc4… 2019-05-03       2019-05-04             0.00338
#> 10 76128533B77719785… 7f9bde2… 2019-05-03       2019-05-03             0.00233
#> # ℹ 330 more rows
#> # ℹ 2 more variables: PROP_FLOODED_POP <dbl>, FLOODED_POP_CENTROID <lgl>

This gives rise to two possible ways of matching flood events to storm data via gtropic_data()’s flood_match argument:

flood_match = "start" (the default) matches floods whose FLOOD_START_DATE falls inside the temporal window defined by flood_days_before and flood_days_after arguments (again with the temporal window anchored by the LOCAL_DATE_STORM_CLOSEST). Using this option retrieves those flood events the storm may have initiated.

flood_match = "overlap" includes any flood interval that overlaps the window, including events already in progress at the beginning of the window.

Which option is more appropriate for your analysis depends on your research question. For attributing flooding to a storm, "start" is the conservative choice. For studying compound events, e.g. a storm striking an already-flooded region, "overlap" may be the better choice.

Summary

  • Rainfall and flooding are linked to storms per unit-storm pair, by a temporal window and a distance radius.
  • Your geographic filter bounds everything; the radius only narrows within it.
  • Tables are returned at their natural grain. You must join using the $links yourself, and be careful about aggregation afterwards.
  • Window and radius settings are recorded in the resulting metadata. Make sure these arguments are set appropriately for your analysis!

Where to go next

  • vignette("getting-started") introduces G-TROPIC data retrieval and result metadata.
  • vignette("filtering") explains how geographic, temporal, and storm filters define the records available for linking.
  • vignette("plotting") shows how to visualize linked exposure data and storm tracks.
  • vignette("versions-and-caching") covers manifests and cache settings for reproducible data retrieval.