Learn R Programming

rWind (version 0.4.1)

wind2raster: Wind-data to raster file

Description

wind2raster crates a raster file (gridded) from a data.frame created by wind.fit function from "rWind" package. Latitude and logitude values are used to locate raster file and create raster resolution using rasterFromXYZ function from raster package. As raster files only can store one field of information, you should choose between direction (by default, type="dir") and speed (type="speed") to be represented by the new raster file.

Usage

wind2raster(x, type = "dir")

Arguments

x

a data.frame obtained by wind.fit

type

Feature represented by raster file. "dir" (wind direction) is selected by default. If you choose "speed", wind speed will be represented by raster file.

Value

A raster file representing wind direction or wind speed of the study area.

Details

WGS84 datum (non-projected) CRS is selected by default to build the raster file.

See Also

wind.dl, wind.fit

Examples

Run this code
# NOT RUN {
# Download wind for Iberian Peninsula region at 2015, February 12, 00:00
# wind_data <- wind.dl(2015,2,12,0,-10,5,35,45)

data(wind_data)

# Fit downloaded dataset to be plotted
wind_fitted_data <- wind.fit(wind_data)

# Create raster file from the data.frame created by wind.fit, representing wind speed.
wind2raster(wind_fitted_data, type="speed")

# }

Run the code above in your browser using DataLab