writeRast {StormR}R Documentation

Exporting rasters to GeoTIFF or NetCDF files

Description

The writeRast() function exports rasters stored in SpatRaster objects to GeoTIFF or NetCDF files.

Usage

writeRast(rast, filename = NULL, path = "./", ...)

Arguments

rast

SpatRaster object.

filename

character. Output file name. Can be either a ".tiff" file (GeoTIFF) or ".nc" (NetCDF). By default filename=NULL and the name of the file is generated based on raster information (storms and products) with the '.tiff' extension.

path

character. Path to the directory where the file is exported to. By default ⁠path=./'⁠.

...

Additional arguments to be passed to terra::writeRaster function when saving to ".tiff" format.

Value

NULL

Examples

# Creating a stormsDataset

sds <- defStormsDataset()

# Getting storm track data for tropical cyclone Pam (2015) near Vanuatu
pam <- defStormsList(sds = sds, loi = "Vanuatu", names = "PAM")

# Computing maximum sustained wind speed
pam.msw <- spatialBehaviour(pam)

# Exporting maximum sustained wind speed raster layer to a GeoTIFF file
writeRast(pam.msw, path = paste0(tempdir(), "/"))

# Computing power dissipation index for several storms near New Caledonia
sts.nc <- defStormsList(sds = sds, loi = "New Caledonia")
pdi.nc <- spatialBehaviour(sts.nc, product = "PDI")

# Exporting the power dissipation index raster layers to a NetCDF file
writeRast(pdi.nc, path = paste0(tempdir(), "/"))


[Package StormR version 0.2.1 Index]