Function to detect events within a NetCDF file using the Hobday et al. 2016 definition.

detect3(
  file_in,
  clim_period,
  min_dur = 5,
  max_gap = 2,
  file_out = NULL,
  return_type = NULL,
  save_to_file = NULL,
  ...
)

Arguments

file_in

A NetCDF file

clim_period

The climatology baseline period provided as two date values. E.g. c("1982-01-01", "2011-12-31")

min_dur

The minimum duration for acceptance of detected events. The default is 5 days.

max_gap

The maximum length of gap allowed for the joining of MHWs. The default is 2 days.

file_out

File output location with name and extension of the file

return_type

Default NULL will prevent the data being saved in memory. Other options are "rast", to return a SpatRasterDataset, and "df", to return a data.frame with the events organized by raster cell

save_to_file

Default NULL will prevent the data being saved in memory. Other options are "nc", to save a NetCDF, and "csv", to save as a csv file.

...

One may pass any arguments to this functions that would be used via heatwaveR::ts2clm() or heatwaveR::detect_event().

Value

Depending on the arguments set, this function will return the heatwaves detected in the NetCDF file provide. It may also output the results as a CSV file.

Examples

# \donttest{
mhw_cube <- detect3(file_in = system.file("extdata/oisst_short.nc", package = "heatwave3"),
                    return_type = "df", clim_period = c("1982-01-01", "2011-12-31"))
# }