Package 'gtropic'

Title: Access and Plot 'G-TROPIC' Tropical Cyclone Exposure Data
Description: Retrieves, filters and maps tropical cyclone exposure data from the 'G-TROPIC' collection on 'Harvard Dataverse' <https://dataverse.harvard.edu/dataverse/gtropic>, which is updated weekly (<doi:10.7910/DVN/EAVWC3>). For every second-level administrative unit (ADM2) and every storm in the International Best Track Archive for Climate Stewardship (IBTrACS) since 1980, the collection provides wind and precipitation exposure; from 2000 it also provides flood exposure based on places named in news reports of flooding. A single query function is complemented by helpers for exploring the available administrative units and storms, version manifests for reproducible retrieval, a managed on-disk cache, and static and interactive maps. Published exposure values are returned as they are; nothing is recomputed.
Authors: Lawrence G. Chillrud [aut, cre] (ORCID: <https://orcid.org/0000-0003-0727-0161>), Lingke Jiang [aut] (ORCID: <https://orcid.org/0009-0009-4873-4648>), Majd Abid [aut] (ORCID: <https://orcid.org/0009-0009-8065-7101>), Anna Y. Palmer [aut] (ORCID: <https://orcid.org/0009-0003-9772-5664>), G. Brooke Anderson [aut], Robbie M. Parks [aut, cph] (ORCID: <https://orcid.org/0000-0002-7916-1717>), Columbia University [fnd] (ROR: <https://ror.org/00hj8s172>)
Maintainer: Lawrence G. Chillrud <[email protected]>
License: GPL (>= 3)
Version: 0.1.0
Built: 2026-12-03 07:25:43 UTC
Source: https://github.com/sparklabnyc/gtropic

Help Index


Format G-TROPIC objects as text

Description

The lines the corresponding print() method displays, as a character vector, for example to include in a log or a report.

Usage

## S3 method for class 'gtropic_data'
format(x, ...)

## S3 method for class 'summary.gtropic_data'
format(x, ...)

## S3 method for class 'gtropic_manifest'
format(x, ...)

## S3 method for class 'gtropic_filters'
format(x, ...)

Arguments

x

A gtropic_data, summary.gtropic_data, gtropic_manifest or gtropic_filters object.

...

Passed to the print() method.

Value

A character vector with one element per printed line.

See Also

Other result methods: print.gtropic_data(), print.gtropic_filters(), print.gtropic_manifest(), summary.gtropic_data()

Examples

format(gtropic_manifest(gtropic_example()))

List available second-level administrative units

Description

Retrieves the G-TROPIC lookup table for second-level administrative units (ADM2), such as counties, districts, or provinces. The table provides the geographic identifiers and names used to define study areas in gtropic_data().

Use this function to identify valid geographic values before requesting exposure data. Filters that do not match a published value produce an error rather than an empty result.

Usage

gtropic_adm2(
  ADM2_NAME = NULL,
  ADM2_GROUP = NULL,
  WHO_ENTITY = NULL,
  WHO_REGION = NULL,
  version = ":latest",
  cache = NULL
)

Arguments

ADM2_NAME

Optional character vector of ADM2 names, matched case-insensitively.

ADM2_GROUP

Optional character vector of published ADM2 groupings, typically country or territory codes, matched case-insensitively.

WHO_ENTITY

Optional character vector of WHO entity names, matched case-insensitively.

WHO_REGION

Optional character vector of WHO region names or codes, matched case-insensitively.

version

Dataset version specification. Use ":latest" (the default), a single version applied to both datasets, or a named character vector such as c(historical = "2.0", current = "3.0"). A pinned version reads the files of that version, and the manifest records their file ids and checksums.

cache

Whether downloaded source files may be cached. NULL uses getOption("gtropic.cache_enabled"); TRUE or FALSE overrides that setting for this call.

Value

A tibble containing the published ADM2 lookup. Each row represents an administrative unit and includes its stable ADM2_ID and available name, country or territory, and WHO regional classifications.

See Also

Other discovery functions: gtropic_codebook(), gtropic_excluded_storms(), gtropic_metrics(), gtropic_storms(), gtropic_years()

Examples

# Review all available administrative units
gtropic_adm2()

# Find the identifiers used for units in the Philippines
gtropic_adm2(WHO_ENTITY = "Philippines")

Natural Earth basemaps cached for the current R session

Description

Countries use the locally installed Natural Earth data package. First use of an administrative-level-1 layer requires the optional, non-CRAN rnaturalearthhires package. No layer is downloaded by this function.

Usage

gtropic_basemap(what = c("countries", "admin1", "none"), scale = "medium")

Arguments

what

One of "countries" (the default), "admin1", or "none".

scale

Country resolution: "small" (110) or "medium" (50). Large (10) country layers are deliberately unsupported. Ignored for admin1, which uses the resolution supplied by rnaturalearth::ne_states().

Value

An sf object, or NULL for what = "none". Layers are cached by resolution and type until the R session ends.

See Also

Other plotting functions: gtropic_plot(), gtropic_saffir_simpson(), gtropic_save(), plot.gtropic_data(), scale_fill_gtropic_c(), theme_gtropic()

Examples

gtropic_basemap(what = "none")


countries <- gtropic_basemap()
nrow(countries)

Delete all cached G-TROPIC files

Description

Removes all downloaded file content from the configured cache and clears its index. This operation does not change whether caching is enabled.

Usage

gtropic_cache_clear(confirm = TRUE)

Arguments

confirm

Logical. If TRUE (the default), confirmation is requested before deletion in an interactive R session. No prompt is issued in a non-interactive session. Set to FALSE to proceed without prompting.

Value

Invisibly, the number of cached files selected for removal. Returns 0 if the cache is empty or interactive confirmation is declined.

See Also

Other cache functions: gtropic_cache_dir(), gtropic_cache_enable(), gtropic_cache_list(), gtropic_cache_prune()

Examples

gtropic_cache_enable()
gtropic_cache_clear(confirm = FALSE)

Locate the G-TROPIC cache

Description

Returns the directory used to store downloaded G-TROPIC source files. Reusing these files can reduce data transfer and retrieval time for repeated or overlapping analyses.

Usage

gtropic_cache_dir()

Details

Unless changed through options(gtropic.cache_dir = ...) or gtropic_cache_enable(), the path is tools::R_user_dir("gtropic", "cache"). Calling this function reports the path but does not create it.

Value

A character scalar containing the cache directory path.

See Also

Other cache functions: gtropic_cache_clear(), gtropic_cache_enable(), gtropic_cache_list(), gtropic_cache_prune()

Examples

gtropic_cache_dir()

Enable or disable caching

Description

gtropic_cache_enable() enables storage of downloaded G-TROPIC source files for reuse. gtropic_cache_disable() stops using the cache for subsequent retrievals but leaves existing files unchanged.

Usage

gtropic_cache_enable(dir = NULL, persist = FALSE)

gtropic_cache_disable(persist = FALSE)

Arguments

dir

Optional path for the cache. If NULL, the current value returned by gtropic_cache_dir() is used. A custom location may be useful when exposure files must be stored on a larger disk.

persist

Logical. Should this enabled or disabled state be used in future R sessions? Defaults to FALSE, so the change affects only the current session.

Details

Caching is enabled by default for each R session. These functions change the gtropic.cache_enabled option for the current session. Set persist = TRUE to use the same choice in future sessions; this writes the setting under tools::R_user_dir("gtropic", "config"). The package never edits .Rprofile. Enabling creates the cache directory if needed; disabling does not delete cached files. Use gtropic_cache_clear() to delete them.

The first time in a session that a file is cached, a message says where. The cache is managed automatically: after each retrieval that adds to it, files downloaded more than getOption("gtropic.cache_max_age_days") (180) days ago, files superseded by a newer dataset version retrieved with version = ":latest", and then the least recently downloaded files beyond getOption("gtropic.cache_max_gb") (10) gigabytes are removed. Files used by that retrieval are never removed. Set either option to Inf to switch its rule off; see gtropic_options.

Value

Invisibly, a character scalar containing the cache directory path.

See Also

Other cache functions: gtropic_cache_clear(), gtropic_cache_dir(), gtropic_cache_list(), gtropic_cache_prune()

Examples

# Stop caching for the rest of this session, then start again
gtropic_cache_disable()
gtropic_cache_enable()

## Not run: 
# Not run: persist = TRUE writes the choice to your configuration directory
gtropic_cache_disable(persist = TRUE)

## End(Not run)

Inspect cached G-TROPIC files

Description

gtropic_cache_list() reports the dataset file references recorded in the cache index. gtropic_cache_size() reports the physical disk space occupied by cached file content.

Cached content is identified by checksum and may be shared by more than one dataset version. Consequently, multiple index entries can refer to one file on disk.

Usage

gtropic_cache_list()

gtropic_cache_size()

Value

gtropic_cache_list() returns a tibble with one row per indexed dataset file reference and columns server, doi, version, directory_label, label, checksum, size_bytes, and fetched_at (the original download time, retained when a cached file is reused). gtropic_cache_size() returns a numeric scalar giving the physical cache size in bytes, or 0 when the cache is empty.

See Also

Other cache functions: gtropic_cache_clear(), gtropic_cache_dir(), gtropic_cache_enable(), gtropic_cache_prune()

Examples

gtropic_cache_list()
gtropic_cache_size()

Prune cached G-TROPIC files by size or age

Description

Removes cache entries according to their original retrieval time. Entries older than the specified age are removed, and the oldest remaining entries are removed as needed to satisfy the size limit. When both criteria are supplied, an entry is removed if required by either criterion. With no arguments, nothing is removed.

If identical file content is referenced by multiple dataset versions, the physical file is retained until no remaining cache entry references it.

The cache is also pruned automatically after retrievals; see gtropic_cache_enable() and gtropic_options.

Usage

gtropic_cache_prune(max_size_gb = NULL, older_than_days = NULL)

Arguments

max_size_gb

Optional maximum indexed cache size in gigabytes. The oldest entries are removed until the indexed size is at or below this value.

older_than_days

Optional age threshold in days. Entries fetched before the resulting cutoff are removed.

Value

Invisibly, a tibble containing the removed cache-index entries. An empty tibble is returned when no entries are removed.

See Also

Other cache functions: gtropic_cache_clear(), gtropic_cache_dir(), gtropic_cache_enable(), gtropic_cache_list()

Examples

gtropic_cache_enable()
gtropic_cache_prune(max_size_gb = 5, older_than_days = 90)

Retrieve the G-TROPIC data codebook

Description

Downloads the published G-TROPIC codebook. The codebook describes the tables, variables, measurement units, and data provenance needed to interpret wind, precipitation, flood, population, and storm metadata in an exposure analysis.

Usage

gtropic_codebook(version = ":latest", cache = NULL)

Arguments

version

Dataset version specification. Use ":latest" (the default), a single version applied to both datasets, or a named character vector such as c(historical = "2.0", current = "3.0"). A pinned version reads the files of that version, and the manifest records their file ids and checksums.

cache

Whether downloaded source files may be cached. NULL uses getOption("gtropic.cache_enabled"); TRUE or FALSE overrides that setting for this call.

Value

A nested list preserving the structure of the published JSON codebook.

See Also

Other discovery functions: gtropic_adm2(), gtropic_excluded_storms(), gtropic_metrics(), gtropic_storms(), gtropic_years()

Examples

codebook <- gtropic_codebook()
names(codebook)

Conditions signalled by gtropic

Description

Errors and warnings that a script may want to handle carry classes, so they can be caught with tryCatch() or withCallingHandlers() by class rather than by matching message text.

Errors

Each inherits from gtropic_error (and then rlang_error):

  • gtropic_error_network: a request to the Dataverse server failed, for example because there is no network connection, the DOI or version does not exist, or the server is down.

  • gtropic_error_checksum: a downloaded file does not match the checksum published for it.

  • gtropic_error_no_match: a filter value matches nothing in the published metadata, or the filters together select no storm or ADM2 unit.

  • gtropic_error_download_size: a query is larger than getOption("gtropic.confirm_threshold_gb") and was not confirmed, or a download was stopped because the server sent more than the file's listed size (plus 1 MB or 1 %, whichever is more), or more than 8 GB for a file listed without a size.

  • gtropic_error_manifest: a manifest failed validation before replay.

Other errors, such as an invalid argument value, are ordinary rlang errors.

Warnings

Each inherits from gtropic_warning:

  • gtropic_warning_availability: the requested period reaches recent data that may still lag or change.

  • gtropic_warning_polygon: ADM2 units moved in or out of a polygon filter across the years evaluated.

  • gtropic_warning_precip_all_missing: some ADM2 units have no non-missing precipitation values (see gtropic_known_limitations).

  • gtropic_warning_flood_reports: the result contains flood rows, which record places named in news reports about flooding (see gtropic_known_limitations). Shown once per session.

  • gtropic_warning_ambiguous_storm_name and gtropic_warning_ambiguous_excluded_storm_name: a STORM_NAME matches more than one STORM_ID.

Value

This topic documents condition classes; it has no return value.

See Also

gtropic_data(), gtropic_diagnostics()

Examples

# A manifest from elsewhere that fails validation:
bad <- gtropic_manifest(gtropic_example())
bad$files$label[1] <- "../outside.parquet"
tryCatch(
  gtropic_data(manifest = bad),
  gtropic_error_manifest = function(e) "rejected the manifest"
)

Retrieve tropical cyclone exposure data from G-TROPIC

Description

Retrieves and filters published G-TROPIC data for assessing tropical cyclone exposures at the second-level administrative unit (ADM2). Available data include wind exposure, daily precipitation, flood events, population, administrative-unit characteristics, storm tracks, and storm metadata.

The function subsets published values; it does not recalculate hazard or exposure measures. This preserves the definitions and provenance of the source data for environmental health and epidemiologic analyses.

Usage

gtropic_data(
  ADM2_ID = NULL,
  ADM2_NAME = NULL,
  ADM2_GROUP = NULL,
  WHO_ENTITY = NULL,
  WHO_REGION = NULL,
  polygon = NULL,
  reproject = TRUE,
  date_range = NULL,
  date_list = NULL,
  date_format = NULL,
  STORM_ID = NULL,
  STORM_NAME = NULL,
  USA_ATCF_ID = NULL,
  wind_radius_km = 500,
  tables = c("wind", "precip", "flood", "pop", "adm2", "codebook", "zero_pairs",
    "tracks", "geometry", "storm_metadata"),
  precip_days_before = 2,
  precip_days_after = 1,
  precip_radius_km = 500,
  flood_days_before = 2,
  flood_days_after = 1,
  flood_radius_km = 500,
  flood_match = c("start", "overlap"),
  geometry_resolution = c("simplified", "full"),
  make_valid = TRUE,
  version = ":latest",
  manifest = NULL,
  cache = NULL,
  confirm = TRUE,
  quiet = getOption("gtropic.quiet", FALSE),
  offline = FALSE
)

Arguments

ADM2_ID

Optional character vector of published ADM2 identifiers. Matching is exact and case-sensitive.

ADM2_NAME

Optional character vector of ADM2 names, matched case-insensitively.

ADM2_GROUP

Optional character vector of published ADM2 groupings, typically country or territory codes, matched case-insensitively.

WHO_ENTITY

Optional character vector of WHO entity names, matched case-insensitively.

WHO_REGION

Optional character vector of WHO region names or codes, matched case-insensitively.

polygon

Optional sf or sfc study area with a coordinate reference system; needs the sf package. A unit is selected when its published population-weighted centroid lies inside the polygon in at least one year the query covers, and units whose membership changes between years are reported. Centroids are read from the yearly population file of every candidate year (about 2 MB each), so without a date filter a polygon query downloads one such file for every published year.

reproject

Logical. If TRUE (the default), a polygon not already in EPSG:4326 is transformed before evaluation. If FALSE, a non-EPSG:4326 polygon produces an error.

date_range

Optional vector of one or two endpoints defining an inclusive period of storm genesis dates. A single value is used for both endpoints. Cannot be combined with date_list.

date_list

Optional vector of complete genesis dates to match exactly. Cannot be combined with date_range.

date_format

Optional character scalar specifying the order of non-ISO dates, such as "ymd", "mdy", or "dmy". When supplied, automatic date-order inference is not used.

STORM_ID

Optional character vector of published G-TROPIC storm identifiers. Each value uniquely identifies one storm. Matching is exact and case-sensitive; this is the preferred storm key.

STORM_NAME

Optional character vector of published convenience labels in Name-YYYY form, such as Katrina-2005, matched case-insensitively. Complete values can match multiple STORM_IDs, including across basins. YYYY is the published SEASON year and need not be the genesis calendar year. Use gtropic_storms() to inspect matches, then prefer STORM_ID for retrieval and downstream work. Storm and date filters combine with AND.

USA_ATCF_ID

Optional character vector of US Automated Tropical Cyclone Forecasting System identifiers. Matching is exact and case-sensitive.

wind_radius_km

Maximum published storm-track distance (km) for returned wind records; default 500. Records at exactly this distance are kept. Inf or NULL removes the bound and also keeps records without a published distance. It does not filter the returned zero_pairs.

tables

Tables to return; default all of "wind", "precip", "flood", "pop", "adm2", "codebook", "zero_pairs", "tracks", "geometry" and "storm_metadata". A shorter vector downloads less. "geometry" needs the suggested sf package: when tables is not supplied and sf is missing, it is left out with a message. storm_metadata is added whenever a storm-linked table is requested, and a links table is always returned. Precipitation and flood also need the zero_pairs files to build links, which adds to the download.

precip_days_before, precip_days_after

Days (whole numbers, 0 or more) before and after the local date of closest approach in each precipitation window; defaults 2 and 1.

precip_radius_km

Maximum published storm-track distance (km) for a pair to be linked to precipitation; default 500. Inf or NULL removes the bound.

flood_days_before, flood_days_after

Days (whole numbers, 0 or more) before and after the local date of closest approach in each flood window; defaults 2 and 1.

flood_radius_km

Maximum published storm-track distance (km) for a pair to be linked to floods; default 500. Inf or NULL removes the bound.

flood_match

How floods are matched to windows: "start" (the default) keeps floods that start inside the window; "overlap" keeps any flood that overlaps it, including one already under way when the window opens.

geometry_resolution

Resolution of boundaries returned when tables includes "geometry": either "simplified" (the default) or "full".

make_valid

Logical; default TRUE, which repairs invalid returned ADM2 geometries with sf::st_make_valid(). Repair can change geometry types, for example from polygon to multipolygon. FALSE keeps the published geometry exactly and skips the check. Recorded in the manifest.

version

Dataset version specification. Use ":latest" (the default), a single version applied to both datasets, or a named character vector such as c(historical = "2.0", current = "3.0"). A pinned version reads the files of that version, and the manifest records their file ids and checksums.

manifest

Optional gtropic_manifest from gtropic_manifest(). When supplied, its recorded source files and canonical resolved query are used. Data-shaping arguments cannot also be supplied; only cache, confirm, quiet, and offline may differ during replay.

cache

Whether downloaded source files may be cached. NULL uses getOption("gtropic.cache_enabled"); TRUE or FALSE overrides that setting for this call.

confirm

Logical; default TRUE, which asks before a download larger than getOption("gtropic.confirm_threshold_gb"). FALSE downloads without asking.

quiet

Logical. If TRUE, progress and informational messages are suppressed. Warnings and errors are still reported. Defaults to getOption("gtropic.quiet", FALSE), so options(gtropic.quiet = TRUE) silences every call in a session.

offline

Logical; default FALSE. TRUE uses only cached files and the saved discovery snapshot, makes no request to Dataverse, and reports the snapshot's age. Requires an enabled cache.

Details

Combining filters

Several values in one filter are combined with OR; different filters are combined with AND. WHO_ENTITY = c("United States", "Mexico") selects units in either country, whereas ⁠ADM2_NAME = "San Jose", ADM2_GROUP = "CRI"⁠ requires both. A polygon is combined with the other geographic filters the same way. Identifiers (ADM2_ID, STORM_ID, USA_ATCF_ID) match exactly; names and classifications match case-insensitively after whitespace is normalised. Every value must match a published value, and the filters together must select something: gtropic_adm2(), gtropic_storms() and gtropic_excluded_storms() list the valid and excluded values.

The filter arguments are written in capitals because each is named after the published column it filters, as that column appears in the returned tables and the codebook.

Flood columns

Each flood row pairs one place named in a news report about flooding (from Groundsource) with one ADM2 unit. Three published columns are renamed to say what they measure, so they differ from the files on Harvard Dataverse and from the codebook:

  • PROP_AREA_IN_FLOOD_REPORT (published as PROP_FLOODED_AREA): the share of the unit's area inside the reported place.

  • PROP_POP_IN_FLOOD_REPORT (published as PROP_FLOODED_POP): the share of the unit's population inside the reported place.

  • POP_CENTROID_IN_FLOOD_REPORT (published as FLOODED_POP_CENTROID): whether the unit's population-weighted centroid lies inside the reported place.

These are not flooded area or population: see gtropic_known_limitations.

Dates

date_range and date_list select storms by STORM_GENESIS_DATE_UTC, the UTC date of the first best-track observation, not by landfall or by the date of local exposure (see vignette("filtering", package = "gtropic")). The endpoints of date_range are read as follows:

Input Start endpoint End endpoint
"2001" or 2001 2001-01-01 2001-12-31
"2001-03" 2001-03-01 2001-03-31
"2001-03-04" unchanged unchanged
Date or POSIXct calendar date calendar date

Values in date_list must be complete dates. Non-ISO dates are read in one order for all values; when more than one order fits, ymd is preferred, then mdy, then dmy, with a warning. date_format fixes the order.

Defaults that shape the result

  • wind_radius_km = 500 keeps wind records for pairs whose published STORM_DIST_KM is at most 500 km.

  • Precipitation and flood records are kept for pairs within precip_radius_km and flood_radius_km (500 km each), in windows from 2 days before to 1 day after the local date of closest approach. links keeps every pair inside the largest requested radius, so it can hold pairs beyond the wind radius. Each precipitation or flood record appears once, even when it falls in several storms' windows: join it to links to assign it to storms (see vignette("linkage", package = "gtropic")).

  • A download estimated above getOption("gtropic.confirm_threshold_gb") (1 GB) needs confirmation; in a non-interactive session it is an error unless confirm = FALSE.

Each result carries a manifest of the dataset versions, files and checksums it used. Passing it back as manifest retrieves the same source files and replays the resolved query, including the resolved ADM2 and storm identifiers (see vignette("versions-and-caching", package = "gtropic")).

Value

An object of class gtropic_data, implemented as a named list. It contains the requested data tables and a links tibble with one row per ADM2-storm pair retained by the union of requested hazard radii (or all available selected pairs when that union is unbounded). links includes ADM2_ID, STORM_ID, the published local date and distance at closest approach, logical WIND_EXPOSURE (TRUE for nonzero wind exposure), WIND_IN_FIELD, PRECIP_IN_FIELD and FLOOD_IN_FIELD, and the start and end of each precipitation and flood window. With a finite requested hazard radius, tracks contains only storms with at least one qualifying link. pop has a YEAR column taken from each yearly source file name.

Tabular elements are tibbles, codebook is a nested list, and geometry is an sf object. Date-only columns (genesis, local and closest-approach dates, flood start and end, window bounds) are Date vectors; datetimes with a local UTC offset stay ISO 8601 text, as published.

The object also stores the source-file manifest, original query, resolved filters, recorded diagnostics, availability metadata, retrieval time and package version as attributes. Use gtropic_manifest(), gtropic_filters(), gtropic_diagnostics() and gtropic_availability() to read them.

See Also

gtropic_storms() and gtropic_adm2() to look up filter values, gtropic_plot() to map the result, gtropic_options for settings.

Other retrieval functions: gtropic_example(), gtropic_manifest(), gtropic_manifest_write()

Examples

# A small synthetic result, with the same structure as a real one
x <- gtropic_example()
x
names(x)


# The queries below download data from Harvard Dataverse.

# All available tables for storms with genesis dates in calendar year 2005
# that were evaluated in Jamaica
jamaica <- gtropic_data(WHO_ENTITY = "Jamaica", date_range = 2005)
jamaica

# Find a storm by its convenience label, then query by its unique STORM_ID
gtropic_storms(STORM_NAME = "Haiyan-2013")
haiyan <- gtropic_data(
  STORM_ID = "2013306N07162",
  date_range = 2013,
  tables = c("wind", "adm2")
)

# Define a seven-day rainfall window and a 300-km storm field for an
# epidemiologic study in the Philippines
philippines <- gtropic_data(
  WHO_ENTITY = "Philippines",
  date_range = c("2015-06-01", "2015-12-31"),
  precip_days_before = 3,
  precip_days_after = 3,
  precip_radius_km = 300,
  tables = c("precip", "pop", "adm2")
)

# Retain source-file provenance for a subsequent retrieval
source_manifest <- gtropic_manifest(philippines)
philippines_retrieved_again <- gtropic_data(manifest = source_manifest)

Example G-TROPIC result

Description

Returns a small synthetic gtropic_data() result for examples, tests and trying out the plotting and accessor functions without a network connection. All values are invented: six square administrative units in two made-up places ("Example Coast" and "Example Pacific", one straddling the antimeridian), three storms in August 2020, and a manifest that points at the non-existent server example.invalid and the placeholder DOI doi:10.0000/EXAMPLE. Do not use it for analysis.

Usage

gtropic_example()

Value

A gtropic_data object with the tables wind, precip, flood, zero_pairs, tracks, storm_metadata, adm2, geometry, codebook and links. geometry is an sf table when the sf package is installed and is left out otherwise.

See Also

Other retrieval functions: gtropic_data(), gtropic_manifest(), gtropic_manifest_write()

Examples

x <- gtropic_example()
x
names(x)
x$wind

List excluded tropical cyclones

Description

Retrieves records for storms excluded from the published wind data. These records identify storms that cannot be retrieved with gtropic_data(). Published STORM_NAME convenience labels can duplicate; the unique STORM_ID values in the returned rows distinguish excluded records.

Date filters are applied to STORM_GENESIS_DATE_UTC, the UTC date of the first best-track observation. They do not select storms by landfall, closest approach, or date of exposure.

Usage

gtropic_excluded_storms(
  date_range = NULL,
  STORM_NAME = NULL,
  version = ":latest",
  cache = NULL
)

Arguments

date_range

Optional vector of one or two endpoints defining an inclusive range of storm genesis dates; a single value is used for both endpoints, so date_range = 2005 selects storms that formed in 2005. Bare years, year-month values, complete dates, and Date or POSIXct values are accepted as described in gtropic_data(). Years outside the published collection are omitted.

STORM_NAME

Optional character vector of published convenience labels in Name-YYYY form. Labels can duplicate across distinct STORM_IDs. Matching is case-insensitive; every supplied value must match an excluded-storm record. The suffix is the storm season; partitions for genesis years YYYY - 1 and YYYY are considered and combined with a date_range filter using AND.

version

Dataset version specification. Use ":latest" (the default), a single version applied to both datasets, or a named character vector such as c(historical = "2.0", current = "3.0"). A pinned version reads the files of that version, and the manifest records their file ids and checksums.

cache

Whether downloaded source files may be cached. NULL uses getOption("gtropic.cache_enabled"); TRUE or FALSE overrides that setting for this call.

Value

A tibble with STORM_ID, STORM_NAME, and STORM_GENESIS_DATE_UTC for published excluded storms satisfying the requested genesis period and name filters. If no exclusion files are available for the selected years, a warning is issued and an empty tibble is returned. STORM_GENESIS_DATE_UTC is returned as a Date.

See Also

Other discovery functions: gtropic_adm2(), gtropic_codebook(), gtropic_metrics(), gtropic_storms(), gtropic_years()

Examples

# Review exclusion records for storms that formed during calendar year 2005
gtropic_excluded_storms(date_range = 2005)

Known G-TROPIC data limitations

Description

Documents limitations in the published G-TROPIC source data that can affect retrievals and maps: precipitation gaps for small or coastal units, and flood data that record places named in news reports rather than mapped flood extent.

Details

Precipitation for small or coastal ADM2 units

Some small or coastal ADM2 units in the current precipitation data have no non-missing values. This can occur when no ERA5-Land precipitation grid cell is assigned to the unit. A future G-TROPIC dataset release is planned to fill these gaps using finer-resolution ERA5 precipitation data.

gtropic_data() warns when a precipitation query includes an ADM2 unit with no non-missing precipitation values in the returned period. The complete vector of identifiers is retained in gtropic_diagnostics(x)$precip_all_missing_adm2_ids. Automatic precipitation captions from gtropic_plot() include a shorter note for affected mapped units.

The diagnostic is based on the values actually returned, rather than a fixed list of identifiers. It will therefore stop appearing when corrected source data provide precipitation for those units. Other temporary source-data gaps can also produce the same diagnostic.

Flood exposure from news reports

G-TROPIC's flood data come from Groundsource (Mayo et al. 2026), a dataset of flood events extracted from news articles. An AI model reads each article, picks out the place and date of the flooding, and looks up that place's boundary on Google Maps. The place can be a street, a neighbourhood, a town, a county or a whole province. Each flood polygon is therefore the outline of a place named in a news report about flooding, not a map of where the water was, and one flood appears once for every place its coverage names.

G-TROPIC overlays each polygon on each ADM2 unit and publishes one row per polygon and unit. gtropic returns three of its columns under names that say what they measure; the files on Harvard Dataverse and the codebook keep the published names:

  • PROP_AREA_IN_FLOOD_REPORT (published as PROP_FLOODED_AREA): the share of the unit's area inside the reported place.

  • PROP_POP_IN_FLOOD_REPORT (published as PROP_FLOODED_POP): the share of the unit's population inside the reported place.

  • POP_CENTROID_IN_FLOOD_REPORT (published as FLOODED_POP_CENTROID): whether the unit's population-weighted centroid lies inside the reported place.

These values mostly reflect how precisely a report named a place, not how much of a unit flooded:

  • A report naming a whole county gives that county a share near 1, even when the flooding it describes was local.

  • A place reported neighbourhood by neighbourhood gives many small shares.

  • Summarising a unit by its largest share ignores all its other reports.

  • An outline that crosses a border gives a small share to a neighbouring unit where nothing was reported.

For Hurricane Harvey (2017), the largest share is 99% for Bexar County (San Antonio) but 19% for Harris County (Houston), the centre of the catastrophic flooding. The same applies to the population measures.

As noted by Groundsource, flood data is also both spatially and temporally biased: flood events in regions and time periods with more accurate reporting are over-represented, while those lacking in news coverage are under-represented. The record covers 2000-01-01 to 2026-01-22. Care should be taken when interpreting and utilizing G-TROPIC flood exposure metrics, especially when comparing places, countries or years.

What the rows support most directly is whether a flood was reported in a unit during a storm's flood window. The default exposure map of gtropic_plot() shows this as "Flood reported" or "No flood reported" (see its Details); an outline crossing a border can still mark a neighbouring unit. Future G-TROPIC releases are planned to resolve this with a new flood exposure metric.

gtropic_data() warns once per session when it returns flood rows (class gtropic_warning_flood_reports, see gtropic_conditions), and every such result keeps the note in gtropic_diagnostics(x)$flood_reports. Maps with a flood panel carry a short version of it in their automatic caption.

References

Mayo, R., Zlydenko, O., Bootbool, M., Fronman, S., Gilon, O., Hassidim, A., Kratzert, F., Loike, G., Matias, Y., Nakar, Y., Nearing, G., Sayag, R., Sicherman, A., Zemach, I. and Cohen, D. (2026). Groundsource: A Dataset of Flood Events from News. EarthArXiv preprint. doi:10.31223/X5RR2K

See Also

gtropic_data(), gtropic_plot(), gtropic_diagnostics()


Extract metadata from a G-TROPIC result

Description

These accessor functions retrieve provenance, resolved query settings, and recorded diagnostic information from an object returned by gtropic_data().

gtropic_manifest() identifies the source datasets and files used in the retrieval, including their versions and checksums. Supplying the manifest to a later gtropic_data() call requests those same source files, provided they remain available.

Every file is checked against its published checksum when it is downloaded and again before a cached copy is used; the manifest records each checksum and its algorithm (checksum_type). The checksums are published by the same server as the files, and are usually MD5, so they detect truncated or corrupted transfers and silent changes to a published file, but they do not prove who published it.

To keep or share a manifest, save it as JSON with gtropic_manifest_write(). A manifest saved with saveRDS() works too, but readRDS() can run code hidden in the file, so only read .rds files from people you trust.

gtropic_filters() reports the filters as resolved by the package, including selected ADM2 and storm identifiers, genesis-date bounds, years represented by the selected storms, the wind radius, and precipitation and flood window settings. These values support transparent reporting and quality assurance in downstream analyses. Resolved storm identifiers are unique STORM_ID values, the preferred keys for reproducible joins and grouping.

gtropic_diagnostics() returns diagnostic details retained with the result. This can include complete values that were abbreviated in a console warning, such as ADM2 units whose polygon membership varied over time. It is not a log of every warning that may have been emitted during retrieval.

gtropic_availability() returns structured source update schedules, known coverage, and the requested time range used for availability diagnostics.

Usage

gtropic_manifest(x)

gtropic_filters(x)

gtropic_diagnostics(x)

gtropic_availability(x)

Arguments

x

A gtropic_data object.

Value

gtropic_manifest() returns an object of class gtropic_manifest. gtropic_filters() returns a named gtropic_filters list of resolved query settings. List elements retain their complete values; printing shows a compact preview. gtropic_diagnostics() returns a named list of recorded diagnostics, which is empty when none were retained. gtropic_availability() returns a named list of source availability and coverage metadata.

See Also

Other retrieval functions: gtropic_data(), gtropic_example(), gtropic_manifest_write()

Examples

x <- gtropic_example()
gtropic_manifest(x)
gtropic_filters(x)
gtropic_diagnostics(x)
names(gtropic_availability(x))

Save and load a manifest as JSON

Description

gtropic_manifest_write() saves the manifest of a result as a JSON file; gtropic_manifest_read() reads one back as a gtropic_manifest that can be passed to gtropic_data(manifest = ).

A JSON manifest is plain text. It is the safe way to share a manifest: reading an .rds file with readRDS() can run code placed in it by whoever made it, but reading JSON cannot. It is also readable, and easy to keep in version control next to an analysis. gtropic_manifest_read() checks every field, and then applies the same validation as a replay, so a file that is not a manifest made by gtropic is rejected with an error of class gtropic_error_manifest (see gtropic_conditions).

Usage

gtropic_manifest_write(x, path)

gtropic_manifest_read(path)

Arguments

x

A gtropic_manifest, or a gtropic_data result whose manifest is saved.

path

Path of the JSON file.

Value

gtropic_manifest_write() returns path, invisibly. gtropic_manifest_read() returns a gtropic_manifest.

See Also

Other retrieval functions: gtropic_data(), gtropic_example(), gtropic_manifest()

Examples

path <- tempfile(fileext = ".json")
gtropic_manifest_write(gtropic_example(), path)
manifest <- gtropic_manifest_read(path)
manifest
unlink(path)

List G-TROPIC exposure metrics

Description

Summarizes the published wind, precipitation, and flooding exposure metrics available in G-TROPIC. The returned aggregation is the default used when a metric is summarized across its published records; it does not recompute a published exposure value.

Usage

gtropic_metrics()

Details

plot_supported identifies metrics currently supported by gtropic_plot(). POP_CENTROID_IN_FLOOD_REPORT is included because it documents a published flood exposure, although it is not currently available for plotting.

The flood metrics describe places named in news reports about flooding, not mapped flood extent, and gtropic returns them under names that differ from the published ones; see gtropic_known_limitations.

Value

A named list with wind, precip, and flood components. Each component is a tibble with columns metric, label, unit, aggregate, and plot_supported.

See Also

Other discovery functions: gtropic_adm2(), gtropic_codebook(), gtropic_excluded_storms(), gtropic_storms(), gtropic_years()

Examples

metrics <- gtropic_metrics()
metrics$flood

Options used by gtropic

Description

gtropic is configured entirely through options(). Setting these is how you point the package at a different Dataverse installation, or change how it caches and confirms downloads, without needing a package update.

Details

Option Default Meaning
gtropic.server "dataverse.harvard.edu" Dataverse host name (requests always use HTTPS), optionally with a port.
gtropic.doi_historical "doi:10.7910/DVN/EAVWC3" DOI of the historical dataset.
gtropic.doi_current "doi:10.7910/DVN/FZBAKO" DOI of the current-year dataset. Used only as a fallback if automatic discovery fails.
gtropic.collection "gtropic" Dataverse collection (alias) searched during discovery.
gtropic.cache_enabled TRUE Whether downloaded files are kept on disk.
gtropic.cache_dir tools::R_user_dir("gtropic", "cache") Where cached files live.
gtropic.cache_max_age_days 180 Cached files downloaded more than this many days ago are removed automatically after a retrieval that adds to the cache. Inf keeps them.
gtropic.cache_max_gb 10 Size cap, in gigabytes, for the cache: after a retrieval that adds to it, the least recently downloaded files are removed until it fits. Inf disables the cap.
gtropic.confirm_threshold_gb 1 Download size, in gigabytes, above which you are asked to confirm.
gtropic.timeout 600 Seconds to wait for the server. A metadata request that takes longer is abandoned (and retried, see gtropic.max_tries), and so is a download that receives no data for this long; a download that keeps receiving data may take longer. Inf waits indefinitely.
gtropic.max_tries 3 Maximum attempts per request. Only transient failures are retried: a lost or refused connection, a timeout, and HTTP 408, 429 and 5xx responses.
gtropic.quiet FALSE Session-wide default for quiet: TRUE suppresses progress and informational messages from every call.
gtropic.discovery_ttl 600 Seconds for which a session reuses what it learned about the collection's ":latest" datasets before asking the server again. A new weekly release is therefore seen within this time. 0 asks on every call; a pinned version is looked up once per session.

Each option is checked when it is read, and an invalid value is an error that names the option.

A "cache" here means a folder of previously downloaded files on your own computer. It is enabled by default and uses a standard per-user location chosen by R. Use gtropic_cache_disable() or cache = FALSE on a retrieval to bypass it. See gtropic_cache_enable() to persist an enabled or disabled choice across R sessions; a persisted choice replaces the default of gtropic.cache_enabled when the package is loaded.

Value

These are options, not a function; nothing is returned. This topic exists for documentation only.

Examples

# Inspect a setting
getOption("gtropic.server")

# Change one for a while, then restore it
old <- options(gtropic.confirm_threshold_gb = 2)
getOption("gtropic.confirm_threshold_gb")
options(old)

Plot G-TROPIC data as static or interactive maps

Description

Creates exposure maps, exposure-day or exposure-storm count maps, and storm-track maps from data retrieved by gtropic_data(). This function never retrieves data itself, nor does it recalculate published exposure values, storm distances, or metadata.

Usage

gtropic_plot(
  data,
  type = c("exposure", "count", "track"),
  metric = NULL,
  storm = NULL,
  adm2 = NULL,
  aggregate = NULL,
  threshold = NULL,
  binary = FALSE,
  wind_categories = NULL,
  count_unit = c("storms", "days"),
  facet_by = NULL,
  track = NULL,
  track_map_key = gtropic_saffir_simpson(),
  track_labels = TRUE,
  track_interval = 6,
  track_legend_position = NULL,
  basemap = c("countries", "admin1", "none"),
  bbox = NULL,
  expand = 2,
  crs = NULL,
  interactive = FALSE,
  palette = NULL,
  direction = NULL,
  gridlines = TRUE,
  make_valid = TRUE,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  quiet = getOption("gtropic.quiet", FALSE),
  ...
)

Arguments

data

A gtropic_data object returned by gtropic_data(), or a named list of equivalent tables.

type

The output type. One of "exposure" (the default), "count", or "track". Exposure maps summarize the specified metric argument; count maps plot exposure-day or exposure-storm counts that meet exposure-specific thresholds; and track maps draw storm track paths.

metric

A supported published metric name, or a character vector of metric names to plot. The metrics are plotted in the order they are given. For type = "exposure", NULL selects every available core metric in this order: "VMAX_SUST_MS", "PRECIP_MM", and "PROP_AREA_IN_FLOOD_REPORT", the last drawn as a yes/no flood-report panel (see Details); name it in metric to map the share itself. For type = "count", it selects the first available count default; type = "track" selects "USA_WIND". Track maps require exactly one of "USA_WIND" or "USA_STATUS". See gtropic_metrics() for all available metrics available for plotting.

storm

Optional character vector of STORM_IDs or STORM_NAMEs used to subset all applicable tables in data. Specifying storms requires that the data object passed in contains the storm_metadata table. STORM_NAMEs are matched case-insensitively and a complete name can select multiple STORM_IDs, including across basins. Names are convenience labels in Name-YYYY form, where YYYY is the published SEASON year, not necessarily the genesis calendar year. Prefer unique STORM_IDs for unambiguous plots. storm = NULL (the default) retains all storms.

adm2

Optional character vector of ADM2_IDs used to subset all applicable tables in data. adm2 = NULL (the default) retains all ADM2 units. For a track map, this retains tracks linked to the selected ADM2 units when the links table is present in data.

aggregate

Summary method for exposure maps: one of "max", "min", "sum", "mean", or "n". aggregate = NULL (the default) uses the metric-specific published default (see the aggregate column of the tables returned by gtropic_metrics() for these defaults). A single value is recycled over metric; multiple values must either be in metric order or be named for every selected metric. Count maps always use "n" and reject another value; this argument is ignored when type = "track" is passed.

threshold

A named list of finite numeric thresholds, with names matching selected metrics. threshold = NULL (the default) uses a built-in threshold where one is defined. Thresholds determine which observations are counted for type = "count" and which areas are classified for binary = TRUE; an explicit threshold is required when no default exists. This argument is ignored when binary = FALSE and type = "exposure" or "track".

binary

Logical; default FALSE. TRUE shows exposure and count maps as exposed or not exposed, using threshold, instead of a continuous scale; flood panels show "Flood reported" or "No flood reported". The default exposure map's flood panel is yes/no even when binary = FALSE. Ignored for track maps.

wind_categories

Optional key that classifies aggregated wind values into categories instead of a continuous scale: a data frame with category, upper threshold, constant unit and color columns, or a list of such keys named by wind metric. NULL (the default) uses the continuous scale. Applies only to non-binary exposure maps of wind metrics. gtropic_saffir_simpson() is allowed only for VMAX_SUST_MS with aggregate = "max"; see vignette("plotting", package = "gtropic") for the rules a custom key must follow.

count_unit

The unit counted when type = "count": distinct qualifying "storms" (the default) or "days". It applies only when type = "count" and is otherwise ignored.

facet_by

An optional single column name in the assembled plotting data to use for facets. NULL (the default) adds no extra facet; multiple metrics always receive separate panels. The column must be available after matching and aggregation.

track

Whether to overlay tracks on exposure/count maps. NULL (the default) overlays them when data contains a tracks table; TRUE or FALSE explicitly enables or suppresses the overlay. Track maps always draw tracks regardless of this value.

track_map_key

A data frame defining the discrete color scale used when plotting track points. Defaults to the data frame returned by gtropic_saffir_simpson(). The track_map_key must contain the following four columns: category, threshold, unit, and color. The unit column must contain a single, constant value, and can be one of: "m/s", "knots", "mph", "km/h". This key controls USA_WIND track points and exposure/count track overlays, but not a USA_STATUS track map. Static wind legends display every category in the supplied key, including categories absent from the plotted observations.

track_labels

Logical; if TRUE (the default), static maps label each storm with more than one valid observation at its first valid position when multiple storms are shown. It is ignored for interactive maps.

track_interval

Hours (UTC) between displayed track intensity points: 6 (the default), 3, or NULL for every point. Paths always use every observation. Affects track maps and track overlays.

track_legend_position

Position of per-panel metric scale strips on static exposure/count maps. NULL (the default) places horizontal strips below the panels. Can be one of "top", "bottom", "left", "right", "top left", "top right", "bottom left", or "bottom right". This argument is ignored when type = "track" or interactive = TRUE.

basemap

Natural Earth background layer: "countries" (the default), "admin1" or "none". Layers come from installed packages and are never downloaded; "admin1" needs the optional rnaturalearthhires package.

bbox

Map extent as an sf/sfc object, an sf bbox with a known CRS, or four geographic bounds in sf::st_bbox() order: c(xmin, ymin, xmax, ymax). NULL (the default) derives the extent from the plotted geometry and any displayed tracks.

expand

Padding (degrees, 0 or more) added to each side of the map extent; default 2. Latitude limits stay within -90 to 90.

crs

A coordinate reference system understood by sf::st_crs(). NULL (the default) selects EPSG:4326 for longitudinal spans under 40 degrees and Equal Earth for wider extents. Static maps use this projection; interactive Leaflet maps are always rendered in geographic coordinates.

interactive

Logical; if TRUE, return an offline Leaflet exposure or count map instead of a ggplot. Defaults to FALSE; track maps cannot be interactive.

palette

Viridis palette name or letter, or a vector of them. NULL (the default) uses metric-specific palettes. One value is recycled over metric; multiple values must be in metric order or named for every metric. It applies to exposure/count fills and a USA_STATUS track map, but is ignored for categorical USA_WIND track points controlled by track_map_key.

direction

Palette direction: 1 (the default) or -1. It accepts the same scalar, positional, and named forms as palette, and applies in the same situations.

gridlines

Logical; if TRUE (the default), static maps show gridlines and longitude/latitude labels. It is ignored for Leaflet maps, which have no static axes.

make_valid

Logical. If TRUE (the default), invalid ADM2 geometries are repaired with sf::st_make_valid() before plotting. Set to FALSE to preserve supplied geometry or avoid the validity-check and repair cost. Repair can change geometry types. This argument is ignored for track maps.

title, subtitle, caption

Plot labels. Each defaults to NULL, which uses an automatic title/subtitle/caption. A supplied caption replaces the automatic provenance and method caption.

quiet

Logical; if FALSE, report data-preparation progress. Defaults to getOption("gtropic.quiet", FALSE).

...

For static exposure and count maps, named arguments passed to ggplot2::geom_sf() for the ADM2 polygons. For interactive maps, named arguments passed to leaflet::addPolygons(). Track plots accept none.

Details

Maps use the actual date range of contributing observations after storm, ADM2, and linkage filters. Automatic subtitles begin with "Aggregated across" and show the displayed date range. Single-metric titles use readable aggregate labels; multi-metric titles describe the panel set. A single plotted storm prefixes the title, while multiple storms do not alter it. Metric strips use readable aggregate and active-threshold labels. Automatic captions use newline-separated source, retrieval, dataset-provenance, hazard-parameter, known source-data limitation, track-interval, and plotting-CRS lines as applicable. Hazard radii and windows are derived from rows that contributed to the plot.

Flood rows record places named in news reports about flooding, not mapped flood extent (gtropic_known_limitations). A yes/no flood panel therefore shows "Flood reported" when at least one report's place covers a share of the unit above the threshold (default: more than 0) in a matched storm's flood window, and "No flood reported" when the unit was in a storm's flood field, its window lies inside the Groundsource record (2000-01-01 to 2026-01-22) and no report matched. Units whose windows fall outside the record have no flood data and are shown as missing.

Track paths are drawn from every supplied observation. By default, constant- size points use gtropic_saffir_simpson() categories derived from USA_WIND, which is published in knots and converted to the map key's unit before classification. An explicit metric = "USA_STATUS" retains the status-color display.

Value

A ggplot for static output or a leaflet widget for interactive output.

Arguments by purpose

  • What to plot: data, type, metric, storm, adm2, aggregate, threshold, binary, wind_categories, count_unit, facet_by.

  • Tracks: track, track_map_key, track_labels, track_interval, track_legend_position.

  • Map frame: basemap, bbox, expand, crs, interactive.

  • Appearance: palette, direction, gridlines, make_valid, title, subtitle, caption, quiet, ....

See Also

Other plotting functions: gtropic_basemap(), gtropic_saffir_simpson(), gtropic_save(), plot.gtropic_data(), scale_fill_gtropic_c(), theme_gtropic()

Examples

x <- gtropic_example()

# Exposure map of maximum sustained wind
gtropic_plot(x, metric = "VMAX_SUST_MS", basemap = "none")

# Track map
gtropic_plot(x, type = "track", basemap = "none")

Saffir-Simpson tropical-cyclone wind categories

Description

Provides the category thresholds and conventional display colors for the Saffir-Simpson Hurricane Wind Scale. Thresholds are sustained wind speeds in meters per second. Each threshold is the upper bound of its category, except for "Cat5", which has no upper bound.

Usage

gtropic_saffir_simpson()

Value

A tibble with one row per category and columns category, threshold, unit, and color. threshold is numeric and "Cat5" has an infinite threshold.

See Also

Other plotting functions: gtropic_basemap(), gtropic_plot(), gtropic_save(), plot.gtropic_data(), scale_fill_gtropic_c(), theme_gtropic()

Examples

gtropic_saffir_simpson()

Save a plot or interactive widget

Description

Save a ggplot with ggplot2::ggsave() or an HTML widget, including a Leaflet map, with htmlwidgets::saveWidget(). This helper writes files; gtropic_plot() itself only returns plot objects.

Usage

gtropic_save(
  plot,
  filename,
  ...,
  dpi = 300,
  width = NULL,
  height = NULL,
  units = "in"
)

Arguments

plot

A ggplot or HTML widget, such as one returned by gtropic_plot().

filename

One nonempty output filename, optionally including a path. For static plots the extension selects the device unless device is supplied in .... HTML widgets require a .html filename.

...

Uniquely named arguments. For static plots, passed unchanged to ggplot2::ggsave(), including device, path, bg, and scale. For HTML widgets, path is combined with filename; other arguments are passed to htmlwidgets::saveWidget(), including selfcontained, libdir, background, title, and knitrOptions.

dpi

Positive finite resolution in dots per inch. Defaults to 300.

width, height

Positive finite output dimensions in units, or NULL to infer them. Explicit dimensions are preserved. See Details for defaults.

units

Dimension units: "in", "cm", "mm", or "px". Pixel sizes are converted using dpi.

Details

Interactive maps

Interactive maps are saved as HTML widgets. By default, their JavaScript and CSS dependencies are written to a sibling directory rather than embedded in the HTML file (selfcontained = FALSE), which does not require Pandoc. Keep that directory with the HTML file when moving or publishing the map. Set selfcontained = TRUE to request a single-file widget when Pandoc is available.

Figure dimensions

Map plots carry a geographic gtropic_bbox attribute in the order c(xmin, ymin, xmax, ymax) (named bounds may be in any order), matching sf::st_bbox(). The estimated width-to-height ratio is longitude span times the cosine of mean latitude, divided by latitude span. This is a geographic approximation, not a measurement of the final projected panels, legends, or facets.

Without usable bounds, the ratio is 7:5. With neither dimension supplied, width defaults to 7 inches and height follows the ratio. With one dimension supplied, the other follows the ratio. Inferred dimensions are bounded to 3–10 inches to keep narrow, polar, or very wide extents usable. Supplying both dimensions overrides all automatic sizing. Defaults are converted to the requested units.

Value

Invisibly, the output filename, combined with path when supplied. The path is not normalized. Saver errors are propagated.

See Also

ggplot2::ggsave()

Other plotting functions: gtropic_basemap(), gtropic_plot(), gtropic_saffir_simpson(), plot.gtropic_data(), scale_fill_gtropic_c(), theme_gtropic()

Examples

p <- ggplot2::ggplot(mtcars, ggplot2::aes(wt, mpg)) +
  ggplot2::geom_point()
output <- gtropic_save(p, tempfile(fileext = ".pdf"), width = 7, height = 5)
unlink(output)

List available tropical cyclones

Description

Retrieves metadata for tropical cyclones represented in G-TROPIC, including storm identifiers, names, and genesis dates. This function can be used to identify storms and confirm temporal coverage before retrieving exposure data with gtropic_data().

Date filters are applied to STORM_GENESIS_DATE_UTC, the UTC date of the first best-track observation. They do not select storms by landfall, closest approach, or date of exposure.

When a requested STORM_NAME is not available, G-TROPIC checks the published exclusion records and reports whether the storm is excluded or absent from both lists.

STORM_NAME is a convenience lookup and can identify multiple storms. If a name matches multiple unique STORM_IDs after all filters are applied, this function returns every match and warns. Use gtropic_storms(STORM_NAME = ...) to identify the intended STORM_ID, then query gtropic_data() with STORM_ID, which is unique and preferred.

Usage

gtropic_storms(
  date_range = NULL,
  STORM_NAME = NULL,
  version = ":latest",
  cache = NULL
)

Arguments

date_range

Optional vector of one or two endpoints defining an inclusive range of storm genesis dates; a single value is used for both endpoints, so date_range = 2005 selects storms that formed in 2005. Bare years, year-month values, complete dates, and Date or POSIXct values are accepted as described in gtropic_data(). Years outside the published collection are omitted.

STORM_NAME

Optional character vector of published convenience labels in Name-YYYY form, such as Katrina-2005. Labels can duplicate across distinct STORM_IDs. Matching is case-insensitive; every supplied value must match a published name. The suffix is the storm season. Because Southern Hemisphere storms can form in the preceding calendar year, partitions for both YYYY - 1 and YYYY are considered. This candidate set is combined with a date_range filter using AND.

version

Dataset version specification. Use ":latest" (the default), a single version applied to both datasets, or a named character vector such as c(historical = "2.0", current = "3.0"). A pinned version reads the files of that version, and the manifest records their file ids and checksums.

cache

Whether downloaded source files may be cached. NULL uses getOption("gtropic.cache_enabled"); TRUE or FALSE overrides that setting for this call.

Value

A tibble containing the published metadata records for storms that satisfy the requested genesis period and name filters. If no metadata files are available for the selected years, a warning is issued and an empty tibble is returned. STORM_GENESIS_DATE_UTC is returned as a Date.

See Also

Other discovery functions: gtropic_adm2(), gtropic_codebook(), gtropic_excluded_storms(), gtropic_metrics(), gtropic_years()

Examples

# Review storms that formed during calendar year 2005
gtropic_storms(date_range = 2005)

# Retrieve the published identifiers and dates for Hurricane Katrina
gtropic_storms(STORM_NAME = "Katrina-2005")

Report the temporal coverage of G-TROPIC

Description

Reports the genesis calendar years represented in the historical and current-year G-TROPIC datasets. Storm-linked annual coverage is based on STORM_GENESIS_DATE_UTC, not the season suffix in STORM_NAME. This information can be used to define feasible study periods before retrieving storm exposure data.

The historical collection contains completed genesis calendar years. When available, the separate current-year collection is updated as storms with genesis dates in the current calendar year are published, so coverage for that calendar year may be provisional.

Usage

gtropic_years(version = ":latest")

Arguments

version

Dataset version specification. Use ":latest" (the default), a single version applied to both datasets, or a named character vector such as c(historical = "2.0", current = "3.0"). A pinned version reads the files of that version, and the manifest records their file ids and checksums.

Value

A list of integer vectors with components historical, current, and all. all is the sorted union of the two collections; current is empty when no separate current-year dataset is available.

See Also

Other discovery functions: gtropic_adm2(), gtropic_codebook(), gtropic_excluded_storms(), gtropic_metrics(), gtropic_storms()

Examples

coverage <- gtropic_years()
range(coverage$all)

Plot a G-TROPIC retrieval result

Description

Thin S3 interface to gtropic_plot().

Usage

## S3 method for class 'gtropic_data'
plot(x, type = "exposure", ...)

Arguments

x

A gtropic_data object.

type

Plot type, defaulting to "exposure".

...

Arguments passed to gtropic_plot().

Value

The plot object returned by gtropic_plot().

See Also

Other plotting functions: gtropic_basemap(), gtropic_plot(), gtropic_saffir_simpson(), gtropic_save(), scale_fill_gtropic_c(), theme_gtropic()

Examples

plot(gtropic_example(), metric = "VMAX_SUST_MS", basemap = "none")

Print a G-TROPIC data result

Description

Displays a concise overview of a G-TROPIC retrieval, including source dataset versions, resolved genesis period, numbers of storms and ADM2 units, and the dimensions of each returned table. Printing does not modify or materialize the result.

Usage

## S3 method for class 'gtropic_data'
print(x, ...)

Arguments

x

A gtropic_data object.

...

Additional arguments passed to the print method. Currently ignored.

Value

x, invisibly.

See Also

Other result methods: format.gtropic_data(), print.gtropic_filters(), print.gtropic_manifest(), summary.gtropic_data()

Examples

print(gtropic_example())

Print resolved G-TROPIC filters

Description

Displays each resolved filter with a compact value preview. Long vectors, such as selected ADM2 identifiers, show at most n values and state how many values were omitted. The complete values remain available through ordinary list access.

Usage

## S3 method for class 'gtropic_filters'
print(x, n = 10L, ...)

Arguments

x

A gtropic_filters object returned by gtropic_filters().

n

Maximum number of values to display for each filter.

...

Additional arguments passed to the print method. Currently ignored.

Value

x, invisibly.

See Also

Other result methods: format.gtropic_data(), print.gtropic_data(), print.gtropic_manifest(), summary.gtropic_data()

Examples

print(gtropic_filters(gtropic_example()), n = 3)

Print a G-TROPIC version manifest

Description

Displays the dataset server, DOI and version information for datasets actually used, file count and total size, retrieval time, and package version recorded for a G-TROPIC retrieval. A manifest can be supplied to gtropic_data() to request the same published source files in a subsequent analysis.

Usage

## S3 method for class 'gtropic_manifest'
print(x, ...)

Arguments

x

A gtropic_manifest object returned by gtropic_manifest().

...

Additional arguments passed to the print method. Currently ignored.

Value

x, invisibly.

See Also

gtropic_manifest()

Other result methods: format.gtropic_data(), print.gtropic_data(), print.gtropic_filters(), summary.gtropic_data()

Examples

print(gtropic_manifest(gtropic_example()))

Color-blind-safe fill scales for G-TROPIC plots

Description

Native ggplot2 viridis scales: inferno for wind, mako for precipitation, and viridis for flooding when a metric is supplied. Missing values are gray.

Usage

scale_fill_gtropic_c(
  ...,
  metric = NULL,
  palette = NULL,
  direction = 1,
  name = NULL,
  na.value = "grey90"
)

scale_fill_gtropic_d(
  ...,
  metric = NULL,
  palette = NULL,
  direction = 1,
  name = NULL,
  na.value = "grey90"
)

Arguments

...

Additional arguments passed to the ggplot2 viridis fill scale.

metric

Optional published metric name, used for palette and title.

palette

Viridis palette name; NULL chooses a hazard-specific palette.

direction

Palette direction, either 1 or -1.

name

Legend title; NULL uses the metric label and unit when available.

na.value

Color for missing values.

Value

A continuous or discrete ggplot2 fill scale.

See Also

Other plotting functions: gtropic_basemap(), gtropic_plot(), gtropic_saffir_simpson(), gtropic_save(), plot.gtropic_data(), theme_gtropic()

Examples

scale_fill_gtropic_c(metric = "VMAX_SUST_MS")
scale_fill_gtropic_d(name = "Exposed")

Summarize a G-TROPIC data result

Description

Builds an extended overview of a G-TROPIC retrieval; printing it shows dataset provenance, retrieval time and size, returned table dimensions, resolved geographic and storm filters, hazard-specific temporal and spatial windows, and any diagnostics retained with the result.

Usage

## S3 method for class 'gtropic_data'
summary(object, ...)

## S3 method for class 'summary.gtropic_data'
print(x, ...)

Arguments

object

A gtropic_data object.

...

Additional arguments. Currently ignored.

x

A summary.gtropic_data object.

Value

summary() returns an object of class summary.gtropic_data: a list with the result's manifest, resolved filters, retained diagnostics, retrieved_at time and the dimensions of each returned table (tables, a named character vector). Its print() method displays it and returns x invisibly.

See Also

Other result methods: format.gtropic_data(), print.gtropic_data(), print.gtropic_filters(), print.gtropic_manifest()

Examples

summary(gtropic_example())

Publication defaults for G-TROPIC plots

Description

A minimal theme with subdued grid lines, bold titles, and readable captions. Map builders remove axis titles and move multi-panel legends to the bottom.

Usage

theme_gtropic(base_size = 12)

Arguments

base_size

Base text size in points.

Value

A ggplot2 theme that can be added to a plot.

See Also

Other plotting functions: gtropic_basemap(), gtropic_plot(), gtropic_saffir_simpson(), gtropic_save(), plot.gtropic_data(), scale_fill_gtropic_c()

Examples

theme_gtropic(base_size = 11)