View source: R/get_weather_gis.R
get_weather | R Documentation |
Imports daily-scale weather data from the NASA-POWER GIS and geographic data from SRTM database.
get_weather(
env.id = NULL,
lat = NULL,
lon = NULL,
start.day = NULL,
end.day = NULL,
variables.names = NULL,
dir.path = NULL,
save = FALSE,
temporal.scale = "daily",
country = NULL,
parallel = TRUE,
workers = NULL,
chunk_size = 29,
sleep = 60
)
env.id |
vector (character or level). Identification of the site/environment (e.g. Piracicaba01). |
lat |
vector (numeric). Latitude values of the site/environment (e.g. -13.05) in WGS84. |
lon |
vector (numeric). Longitude values site/environment (e.g. -56.05) in WGS84. |
start.day |
vector (character). First date in which weather/geographic data should be collected (e.g. "2015-02-15"). |
end.day |
vector (character). Last date in which weather/geographic data should be collected (e.g. "2015-06-15"). |
variables.names |
vector (character). Name of the variables. Should be "T2M","T2M_MAX","T2M_MIN","PRECTOT", "WS2M","RH2M","T2MDEW", "ALLSKY_SFC_LW_DWN", "ALLSKY_SFC_SW_DWN", and/or "ALLSKY_TOA_SW_DWN". See Details for more information. |
dir.path |
character. Directory for the output. If not informed, the output will be saved in the current workind directory. |
save |
bollean. If TRUE, save each environmental data.frame as .csv in dir.path. |
temporal.scale |
character. Default = 'DAILY'. See |
country |
vector (character). Country in which the lat and lon values are positioned (e.g. 'BRA'). For USA continental area, use USA1. Wrapper of raster::getData. |
parallel |
bollean. If TRUE, a parallel strategy is implemented. The vectors are split into chunks with 'chunk_size' elements (30 by default) where the data is downloaded. The function then sleeps for 'sleep' seconds to ensure the available number of requests per minute. (https://github.com/ropensci/nasapower/issues/57) |
workers |
The number of processes in parallel. Defaults to 90 available cores. |
chunk_size |
The size of the chunks where the parallel strategy is implemented. Defaults to 29. Increasing this number may exceed the limit of queries per minute of the API. |
sleep |
The time (in seconds) to sleep the function after each chunk has been downloaded. Defaults to 60. Decreasing this number may exceed the limit of queries per minute of the API. |
The available variables are:
T2M: Temperature at 2 Meters
T2M_MAX: Maximum Temperature at 2 Meters
T2M_MIN: Minimum Temperature at 2 Meters
PRECTOT: Precipitation
WS2M: Wind Speed at 2 Meters
RH2M: Relative Humidity at 2 Meters
T2MDEW: Dew/Frost Point at 2 Meters
ALLSKY_SFC_LW_DWN: Downward Thermal Infrared (Longwave) Radiative Flux
ALLSKY_SFC_SW_DWN: All Sky Insolation Incident on a Horizontal Surface
ALLSKY_TOA_SW_DWN: Top-of-atmosphere Insolation
A data.frame with selected variable.names
collected from a start.day
to a end.day
at the informed lat
and lon
.
Germano Costa Neto, modified by Tiago Olivoto
Sparks A (2018). _nasapower: NASA-POWER Data from R_. R package version 1.1.3, <URL:https://CRAN.R-project.org/package=nasapower>.
## Not run:
## Temperature for a single location:
get_weather(env.id = "NM", lat = -13.05, lon = -56.05,
start.day = "2015-02-15", end.day = "2015-06-15",
variables.names = c("T2M"))
## All variables for two locations:
env = c("NM","SO")
lat = c(-13.05,-12.32); lon = c(-56.05,-55.42)
plant.date = c("2015-02-15",'2015-02-13')
harv.date = rep("2015-06-15", 2)
get_weather(env.id = env, lat = lat, lon = lon,
start.day = plant.date, end.day = harv.date)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.