The defDatabase()
function creates a stormsDataset
object from a NetCDF file.
This is an essential first step before other stormR
functions can be used.
Usage
defDatabase(
filename = system.file("extdata", "test_dataset.nc", package = "StormR"),
fields = c(names = "name", seasons = "season", isoTime = "iso_time", lon = "usa_lon",
lat = "usa_lat", msw = "usa_wind", basin = "basin", sshs = "usa_sshs", rmw =
"usa_rmw", pressure = "usa_pres", poci = "usa_poci"),
basin = NULL,
seasons = c(1980, as.numeric(format(Sys.time(), "%Y"))),
unitConversion = c(msw = "knt2ms", rmw = "nm2km", pressure = "mb2pa", poci = "mb2pa"),
verbose = 1
)
Arguments
- filename
character. Name of the NetCDF (.nc) file. Default is the
test_dataset.nc
file located in theinst/extdata
repository of the directory (accessible bysystem.file("extdata", "test_dataset.nc", package = "StormR")
). This test dataset is extracted from the IBTrACS.SP.v04r00.nc file and provides all the tropical cyclones that occurred around Vanuatu from 2015 to 2016 and around New Caledonia from 2020 to 2021.- fields
named character vector. This argument allows to specify the corresponding variable names in the input NetCDF file for each field in the output
stormsDataset
. By default, the corresponding variable names are set up to import data from a NetCDF file from the IBTrACS database (Knapp et al., 2010). Corresponding variable names for following fields have to (mandatory fields) or can be (recommended or optional fields) provided:"
names"
, names of the storms (mandatory),"seasons"
, years of observations (mandatory),"isoTime"
, date and time of observations (mandatory),"lon"
, longitude of the observations (mandatory),"lat"
, latitude of the observations (mandatory),"msw"
, maximum sustained wind speed (mandatory),"basin"
, name of the area where the storm originated (recommended),"rmw"
, radius of maximum winds: distance between the centre of the storm and its band of strongest winds (recommended),"pressure"
, central pressure (recommended),"poci"
, pressure of the last closed isobar (recommended), and"sshs"
, Saffir-Simpson hurricane wind scale rating based on msw (optional).
- basin
character. If the basin field is provided, then storm track data will only be extracted for the named basin. By default
basin=NULL
, meaning that all storms irrespective of the basin they originated in are extracted. Seven basins can be used to filter the data set:"NA"
, for North Atlantic basin,"SA"
, for South Atlantic basin,"EP"
, for Eastern North Pacific basin,"WP"
, for Western North Pacific basin,"SP"
, for South Pacific basin,"SI"
, for South India basin, or"NI"
, for North India basin.
- seasons
numeric vector. Seasons of occurrence of the storms (e.g., c(2020,2022)). In the Southern Hemisphere, the cyclone season extends across two consecutive years. Therefore, to capture the 2021 to 2022 cyclone season both years should be specified, with cyclones assigned for the year that originated in. By default all storms occurring since 1980 are extracted.
- unitConversion
named character vector.
StormR
functions use the metric system (international system of units), thereforemsw
has to be provided in \(m.s^{-1}\),rmw
in \(km\),pressure
andpoci
in \(Pa\). By defaultunitConversion=c(msw = "knt2ms", rmw = "nm2km", pressure = "mb2pa", poci = "mb2pa")
to meet the requirements when importing a NetCDF file from the IBTrACS database. This argument is mandatory even if no conversion is needed. If no conversion is needed then use"None"
in the corresponding fields. The following unit conversions are implemented:For
msw
,"knt2ms"
, to convert knot to meter per second (default setting),"kmh2ms"
, to convert kilometre per hour to meter per second,"
mph2ms"
, to convert miles per hour to meter per second, or"None"
, if no conversion is needed.
For
rmw
,"nm_to_ms"
to convert nautical miles to kilometre (default setting), or"None"
if no conversion is needed.
For
pressure
andpoci
,"
mb2pa"
, to convert millibar to Pascal (default setting),"b2pa"
, to convert bar to Pascal,"atm2pa"
, to convert atmosphere to Pascal,"psi2pa"
, to convert psi to Pascal, or"None"
, if no conversion is needed.
- verbose
numeric. Whether the function should display (
= 1
) or not (= 0
) information about the processes.