monthlyWind: R function to download month-averaged wind data (from Global...

Description Usage Arguments Details See Also Examples

View source: R/monthlyWind.R

Description

The function allows to download wind data from NOAA/NCEP Global Forecast System (GFS) Atmospheric Model colection, creating monthly averages.

Usage

1
2
monthlyWind(raster, country = NULL, year = 2015, month = 1, days = 31,
  lon1 = NULL, lon2 = NULL, lat1 = NULL, lat2 = NULL)

Arguments

raster:

raster dataset representing the study area.

country:

code of the country for which monthly wind average has to be calculated.

year:

selected year (from 2011 to current); 2015 by default.

month:

selected month; 01 by default.

days:

number of days featuring the selected month; 31 by default.

lon1:

western longitude. If it is set to NULL (default), it is derived from either the raster or the country parameter.

lon2:

eastern longitude. If it is set to NULL (default), it is derived from either the raster or the country parameter.

lat1:

southern latitude. If it is set to NULL (default), it is derived from either the raster or the country parameter.

lat2:

northern latitude. If it is set to NULL (default), it is derived from either the raster or the country parameter.

Details

The extent of the study area can be specified:
(1) by entering the geographic coordinates;
(2) on the basis of an input raster dataset representing the study area itself (for instance, a Digital Terrain Model);
(3) using a country code (for a list of country codes see http://kirste.userpage.fu-berlin.de/diverse/doc/ISO_3166.html).

Using option (3), the function dowloads a Digital Terrain Model (which is saved in the computer's working directory) for the country of interest, and uses its extent's coordinates as input for the lon1, lon2, lat1, and lat2 parameters. The function internally uses the 'getData()' function from the 'raster' package; see the help documentation of that function (?getData) for more information about the DTM. The function also saves two .geotiff files in the computer's working directory, one representing the wind speed, the other the wind direction. In both cases, the values are the average of the wind speed and direction values in the study area across the days of the selected month, in the selected year. A plot is also returned in the R console.

The function returns a list containing the following data:
-$windMonth: stores the U and V components for each output grid cell (spatial resolution 0.5 degrees=50 Km)
-$windMonthFit: stores the wind speed and direction for each output grid cell.

The function builds upon the 'wind.dl()' function from Javier Fern<c3><a1>ndez-L<c3><b3>pez's package 'rWind'. The help provided by Dr Fern<c3><a1>ndez-L<c3><b3>pez in creating an earlier version of the 'monthlyWind()' function is gratefully acknowledged.

See Also

windAver

Examples

1
2
res <- monthlyWind(year=2014, month=12, days=31, lon1=-10, lon2=5, lat1=35, lat2=45) #download wind data for Spain region, averaging the values across the 31 days of December 2014
res <- monthlyWind(country="ESP", year=2014, month=12, days=31) #same as above, but using the country code ESP (=Spain).

gianmarcoalberti/GmAMisc documentation built on May 3, 2019, 6:44 p.m.