weatherjoin is an R package for attaching gridded weather data to event-based datasets using efficient spatio-temporal planning and local caching.
The package is designed for workflows where weather variables need to be matched to many observations across space and time, while minimising repeated data downloads.
Currently, weather data are retrieved from the
NASA POWER project via the
nasapower R package.
This package is not affiliated with or endorsed by NASA.
- Attach daily or hourly gridded weather data to event tables
- Automatic planning of efficient spatio-temporal API calls
- Local caching of downloaded weather segments for reuse
- Exact or rolling joins for hourly data
- Flexible handling of multiple locations (spatial clustering, grouped sites, or exact points)
The package can be installed from GitHub:
remotes::install_github("hauae/weatherjoin")library(weatherjoin)
out <- join_weather(
x = events,
params = c("T2M", "PRECTOTCORR"),
time = "event_time",
lat_col = "lat",
lon_col = "lon"
)Downloaded weather data are cached locally and reused across calls. By default, the cache is stored in a user-specific directory obtained via tools::R_user_dir(). The cache can be inspected and managed using:
wj_cache_list()
wj_cache_clear()
Developed by Przemek Dolowy, Harper Adams University.
MIT License.