Creates a wind_series, a time series of wind fields, from a raster, a list of rasters, or
one or more raster files, such as the monthly files saved by download_wind_data(). Multiple
inputs are combined into one series, in the order given, without reading the data into
memory until needed.
Usage
wind_series(x, order = c("uuvv", "uvuv"))Arguments
- x
A multi-layer
SpatRasterwith layers containing u and v wind components; a list of them; or a character vector of paths to raster files. Each input must contain an equal number of u and v layers, arranged as given byorder, and all inputs must share the same grid. Data must be on a longitude/latitude grid with square cells (equal x and y resolution in degrees), with u and v components in m/s, oriented to true east and north; seewind_rose().- order
Either
"uuvv", the default, indicating that each input has all u components followed by all v components, or"uvuv", indicating alternating u and v components.
Value
A wind_series object, a SpatRaster with all the u layers of all inputs, followed
by all the v layers, in time order.
See also
subset_series() and wind_times() for working with time steps.
Examples
series <- windscape_example("wind_series")
series
#> class : SpatRaster
#> size : 64, 96, 192 (nrow, ncol, nlyr)
#> resolution : 0.3157895, 0.3174603 (x, y)
#> extent : -120.1579, -89.84211, 29.84127, 50.15873 (xmin, xmax, ymin, ymax)
#> coord. ref. : lon/lat WGS 84 (EPSG:4326)
#> sources : wind_usa.tif
#> names : u 2000-01-01, u 200~00:00, u 200~00:00, u 200~00:00, u 2000-01-15, u 200~00:00, ...
#> min values : -0.4, -0.4, -0.6, -0.6, -0.4, -0.5, ...
#> max values : 0.7, 1, 0.9, 1, 0.7, 1.1, ...
# combine series stored in separate files, such as monthly files from download_wind_data()
files <- c(tempfile(fileext = ".tif"), tempfile(fileext = ".tif"))
terra::writeRaster(subset_series(series, steps = 1:48), files[1])
terra::writeRaster(subset_series(series, steps = 49:96), files[2])
wind_series(files)
#> class : SpatRaster
#> size : 64, 96, 192 (nrow, ncol, nlyr)
#> resolution : 0.3157895, 0.3174603 (x, y)
#> extent : -120.1579, -89.84211, 29.84127, 50.15873 (xmin, xmax, ymin, ymax)
#> coord. ref. : lon/lat WGS 84 (EPSG:4326)
#> sources : file1f8e6ab55070.tif (96 layers)
#> file1f8e2957e8e4.tif (96 layers)
#> names : u 2000-01-01, u 200~00:00, u 200~00:00, u 200~00:00, u 2000-01-15, u 200~00:00, ...
#> min values : -4.7, -4.7, -6.4, -6.9, -4.7, -5.7, ...
#> max values : 7.8, 10.6, 9.4, 10.8, 7, 11.9, ...
