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,
parallel = TRUE,
workers = NULL,
chunk_size = 29,
sleep = 60
)
env.id |
vector (character or level). Identifies 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", etc. See Details for more information. |
dir.path |
character. Directory for the output. If not informed, the output will be saved in the current working directory. |
save |
bollean. If TRUE, save each environmental data.frame as .csv in dir.path. |
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 (from NASAPOWER & Computed):
T2M: Temperature at 2 Meters. C
T2M_MAX: Maximum Temperature at 2 Meters, C
T2M_MIN: Minimum Temperature at 2 Meters, C
PRECTOT: Precipitation (mm)
WS2M: Wind Speed at 2 Meters, m/s
RH2M: Relative Humidity at 2 Meters, percentage
QV2M: Specific Humidity, the ratio of the mass of water vapor to the total mass of air at 2 meters (kg water/kg total air).
T2MDEW: Dew/Frost Point at 2 Meters, C
ALLSKY_SFC_LW_DWN: Downward Thermal Infrared (Longwave) Radiative Flux
ALLSKY_SFC_SW_DWN: All Sky Insolation Incident on a Horizontal Surface
ALLSKY_SFC_SW_DNI All Sky Surface Shortwave Downward Direct Normal Irradiance
ALLSKY_SFC_UVA: All Sky Surface Ultraviolet A (315nm-400nm) Irradiance
ALLSKY_SFC_UVB: All Sky Surface Ultraviolet B (280nm-315nm) Irradiance
ALLSKY_SFC_PAR_TOT: All Sky Surface Photosynthetically Active Radiation (PAR) Total
FROST_DAYS: If it was a frost day (temperature less than 0C or 32F)
GWETROOT: Root Zone Soil Wetness (layer from 0 to 100cm),ranging from 0 (water-free soil) to 1 (completely saturated soil).
GWETTOP: Surface Soil Wetness (layer from 0 to 5cm),ranging from 0 (water-free soil) to 1 (completely saturated soil).
EVPTRNS: Evapotranspiration energy flux at the surface of the earth.
P-ETP: Computed difference between preciptation and evapotranspiration.
VPD: Vapour pressure deficit (kPa), computed from T2MDEW,T2M_MAX and T2M_MIN
N: Photoperiod (in h), computed from latitude and julian day (day of the year)
n: number of sunny hours in the day for a clear sky (no clouds)
RTA: Radiation on the top of the atmosphere, computed from latitude and julian day (day of the year)
TH1: Temperature-Humidity Index by NRC 1971
TH2: Temperature-Humidity Index by Yousef 1985
PAR_TEMP: computed ratio between ALLSKY_SFC_PAR_TOT and T2M
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 and Giovanni Galli, 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>. Yousef M.K.(1985) _Stress Physiology in Livestock_, CRC Press, Boca Raton, FL NRC (1971) _A guide to environmental research on animals_, Natl. Acad. Sci., Washington, DC (1971)
## 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"))
## GWETROOT (Root Zone Soil Wetness) 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("GWETROOT"))
## 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.