get_meteo: Get daily, monthly, or annual; aggregated or long-term means...

View source: R/get_meteo.R

get_meteoR Documentation

Get daily, monthly, or annual; aggregated or long-term means meteorological data for specific location(s) and date(s).

Description

The function gives back daily, monthly, or annual and aggregated or long-term means metorological data for specific location(s) and date(s) for entire World for 1961-2020 period from DailyMeteo portal (https://app.dailymeteo.com/).

Usage

get_meteo(loc,
          var = "tmean",
          agg_level = "agg",
          time_scale = "day",
          time,
          from,
          to,
          api_key)

Arguments

loc

sf, SpatVector, data.frame, matrix, numeric or integer; Location(s) in WGS84 (EPSG:4326). If data.frame or matrix columns are lon/lat. See get_coordinates.

var

character; Meteorological variable. Possible values are: "tmean" (mean temperature, default), "tmax" (maximum temperature), "tmin" (minimum temperature), "prcp" (total precipitation), or "slp" (sea-level pressure).

agg_level

character; Aggregation level. Possible values are: "agg" (aggregated, default) or "ltm" (long-term mean).

time_scale

character; Time scale. Possible values are: "day" (daily, default), "mon" (monthly), or "ann" (annual).

time

character; Vector of time references. If specified, ignore from and to. If time_scale="day" then format is 'YYYY-MM-DD'. If time_scale="mon" then the format is 'YYYY-MM'. If time_scale="ann" then format is 'YYYY' (e.g. if time_scale="day" then c('2020-01-01,2020-01-02'); if time_scale="mon" then c('2020-01,2020-02'); if time_scale="ann" then c('2020,2019')).

from

character; Time reference from. Format is the same as for the parameter time

to

character; Time reference to. Format is the same as for the parameter time

api_key

character; API key. Check DailyMeteo portal (https://app.dailymeteo.com/)

Value

data.frame object with columns loc (location index from loc argument), timestamp (time reference), and value (meteorological value).

Author(s)

Aleksandar Sekulić asekulic@grf.bg.ac.rs

See Also

get_coordinates

Examples

## Not run: 
loc <- get_coordinates("Belgrade")
loc <- rbind(loc, get_coordinates("Kopaonik"))
loc
api_key <- "" # get API key from DailyMeteo portal (https://app.dailymeteo.com/)
result <- get_meteo(loc = loc,
                   var = "tmean",
                   agg_level = "agg",
                   time_scale = "day",
                   from = "2020-01-01",
                   to = "2020-01-02", # or use time = c("2020-01-01", "2020-01-02"),
                   api_key = api_key)
# result
#   loc  timestamp value
# 1   1 2020-01-01   0.7
# 2   1 2020-01-02   1.0
# 3   2 2020-01-01  -9.2
# 4   2 2020-01-02  -8.6
# 5   3 2020-01-01  -9.2
# 6   3 2020-01-02  -8.6

## End(Not run)

meteo documentation built on May 29, 2024, 6:13 a.m.

Related to get_meteo in meteo...