Title: | Access Arizona Weather Data from the AZMet API |
---|---|
Description: | Provides R functions to access the Arizona Meteorological Network (AZMet) API. Functions are more than just "thin wrappers" and do some parsing of input parameters and wrangling of output data. |
Authors: | Jeremy Weiss [aut, cre, cph] , Eric Scott [aut] |
Maintainer: | Jeremy Weiss <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.4.0 |
Built: | 2024-11-20 04:50:59 UTC |
Source: | https://github.com/uace-azmet/azmetr |
Retrieves 15-minute data from the AZMet (Arizona Meteorological Network) API. For a list of weather stations and their locations see station_info, or visit https://azmet.arizona.edu/about.
az_15min(station_id = NULL, start_date_time = NULL, end_date_time = NULL)
az_15min(station_id = NULL, start_date_time = NULL, end_date_time = NULL)
station_id |
Station ID can be supplied as numeric vector (e.g.
|
start_date_time |
A length-1 vector of class POSIXct or character in YYYY-MM-DD HH:MM:SS format, in AZ time. If only a date (YYYY-MM-DD) is supplied, data will be requested starting at 00:00:01 of that day. |
end_date_time |
A length-1 vector of class POSIXct or character in
YYYY-MM-DD HH:MM:SS format, in AZ time. If only a date (YYYY-MM-DD) is
supplied, data will be requested through the end of that day (23:59:59).
Defaults to the current date and time if left blank and |
If neither start_date_time
nor end_date_time
are supplied, the
most recent datetime of data will be returned. If only start_date_time
is supplied, then end_date_time
defaults to the current time. Supplying
only end_date_time
will result in an error.
A tibble. For units and other metadata, see https://azmet.arizona.edu/about
If station_id
is supplied as a vector, multiple successive calls to
the API will be made. You may find better performance getting data for all
the stations by leaving station_id
blank and subsetting the resulting
dataframe. Only the most recent 48 hours of 15-minute data are stored in
the AZMet API.
az_daily()
, az_heat()
, az_hourly()
, az_lw15min()
, az_lwdaily()
## Not run: # Most recent 15-minute data for all stations: az_15min() # Specify stations: az_15min(station_id = c(1, 2)) az_15min(station_id = c("az01", "az02")) # Specify dates: az_15min(start_date_time = "2022-09-25 01:00:00") az_15min(start_date_time = "2022-09-25 01:00:00", end_date_time = "2022-09-25 07:00:00") ## End(Not run)
## Not run: # Most recent 15-minute data for all stations: az_15min() # Specify stations: az_15min(station_id = c(1, 2)) az_15min(station_id = c("az01", "az02")) # Specify dates: az_15min(start_date_time = "2022-09-25 01:00:00") az_15min(start_date_time = "2022-09-25 01:00:00", end_date_time = "2022-09-25 07:00:00") ## End(Not run)
units
packageAssigns correct units to the output of az_hourly()
, az_daily()
, and
az_heat()
using the units
package.
az_add_units(x)
az_add_units(x)
x |
A tibble output by |
A tibble with columns of class "units"
## Not run: daily <- az_daily() daily_units <- az_add_units(daily) #unit conversions with `units::set_units()` daily_units$sol_rad_total %>% units::set_units("kW h m-2") #units carry through calculations climatic_balance <- daily_units$precip_total_mm - daily_units$eto_pen_mon climatic_balance ## End(Not run)
## Not run: daily <- az_daily() daily_units <- az_add_units(daily) #unit conversions with `units::set_units()` daily_units$sol_rad_total %>% units::set_units("kW h m-2") #units carry through calculations climatic_balance <- daily_units$precip_total_mm - daily_units$eto_pen_mon climatic_balance ## End(Not run)
Retrieves daily data from the Arizona Meteorological Network API. For a list of weather stations and their locations see station_info, or visit https://azmet.arizona.edu/about.
az_daily(station_id = NULL, start_date = NULL, end_date = NULL)
az_daily(station_id = NULL, start_date = NULL, end_date = NULL)
station_id |
station ID can be supplied as numeric vector (e.g.
|
start_date |
A length-1 vector of class Date, POSIXct, or character in YYYY-MM-DD format. Will be rounded down to the nearest day if more precision is supplied. Defaults to the day before the current date (i.e., the most recent complete day) if left blank. |
end_date |
A length-1 vector of class Date, POSIXct, or character in YYYY-MM-DD format. Will be rounded down to the nearest day if more precision is supplied. Defaults to the day before the current date (i.e., the most recent complete day) if left blank. |
If neither start_date
nor end_date
are supplied, the most recent
day of data will be returned. If only start_date
is supplied, then the
end date defaults to the day before the current date (i.e.,
the most recent complete day). Supplying only end_date
will
result in an error.
A tibble. For units and other metadata, see https://azmet.arizona.edu/about
If station_id
is supplied as a vector, multiple successive calls to
the API will be made. You may find better performance getting data for all
the stations by leaving station_id
blank and subsetting the resulting
dataframe. Requests for data from all stations for more than 6-12 months
may take considerable time.
az_15min()
, az_heat()
, az_hourly()
, az_lw15min()
, az_lwdaily()
## Not run: # Most recent data for all stations: az_daily() # Specify stations: az_daily(station_id = c(1, 2)) az_daily(station_id = c("az01", "az02")) # Specify dates: az_daily(start_date = "2022-09-25") az_daily(start_date = "2022-09-25", end_date = "2022-09-26") ## End(Not run)
## Not run: # Most recent data for all stations: az_daily() # Specify stations: az_daily(station_id = c(1, 2)) az_daily(station_id = c("az01", "az02")) # Specify dates: az_daily(start_date = "2022-09-25") az_daily(start_date = "2022-09-25", end_date = "2022-09-26") ## End(Not run)
Retrieves accumulated heat units and reference evapotranspiration units from the Arizona Meteorological Network API. By default, returned values are cumulative since January 1 of the current year. For a list of weather stations and their locations see station_info, or visit https://azmet.arizona.edu/about.
az_heat(station_id = NULL, start_date = NULL, end_date = NULL)
az_heat(station_id = NULL, start_date = NULL, end_date = NULL)
station_id |
station ID can be supplied as numeric vector (e.g.
|
start_date |
A length-1 vector of class Date, POSIXct, or character in YYYY-MM-DD format. Will be rounded down to the nearest day if more precision is supplied. |
end_date |
A length-1 vector of class Date, POSIXct, or character in
YYYY-MM-DD format. Will be rounded down to the nearest day if more
precision is supplied. Defaults to the current date if left blank. If only
an |
Unlike az_daily()
, only one row of data per station is returned,
regardless of start_date
and end_date
. However, the data returned is
cumulative over the time period specified by start_date
and end_date
.
A tibble. For units and other metadata, see https://azmet.arizona.edu/about
If station_id
is supplied as a vector, multiple successive calls to
the API will be made. You may find better performance getting data for all
the stations by leaving station_id
blank and subsetting the resulting
dataframe.
az_15min()
, az_daily()
, az_hourly()
, az_lw15min()
, az_lwdaily()
## Not run: # Most recent data for all stations: az_heat() # Specify stations: az_heat(station_id = c(1, 2)) az_heat(station_id = c("az01", "az02")) # Specify dates: ## Cumulative since October 2022 az_heat(start_date = "2022-10-01") ## Cumulative from the first of the year through March yr <- format(Sys.Date(), "%Y") az_heat(end_date = paste(yr, "03", "31", sep = "-")) ## End(Not run)
## Not run: # Most recent data for all stations: az_heat() # Specify stations: az_heat(station_id = c(1, 2)) az_heat(station_id = c("az01", "az02")) # Specify dates: ## Cumulative since October 2022 az_heat(start_date = "2022-10-01") ## Cumulative from the first of the year through March yr <- format(Sys.Date(), "%Y") az_heat(end_date = paste(yr, "03", "31", sep = "-")) ## End(Not run)
Retrieves hourly weather data from the Arizona Meteorological Network API. For a list of weather stations and their locations see station_info, or visit https://azmet.arizona.edu/about.
az_hourly(station_id = NULL, start_date_time = NULL, end_date_time = NULL)
az_hourly(station_id = NULL, start_date_time = NULL, end_date_time = NULL)
station_id |
station ID can be supplied as numeric vector (e.g.
|
start_date_time |
A length-1 vector of class POSIXct or character in YYYY-MM-DD HH format, in AZ time. Will be rounded down to the nearest hour if more precision is supplied. If only a date (YYYY-MM-DD) is supplied, data will be requested starting at 01:00:00 of that day |
end_date_time |
A length-1 vector of class POSIXct or character in
YYYY-MM-DD HH format, in AZ time. Will be rounded down to the nearest
hour if more precision is supplied. If only a date (YYYY-MM-DD) is
supplied, data will be requested through the end of that day (23:59:59).
Defaults to the current date and time if left blank and |
If neither start_date_time
nor end_date_time
are supplied, the
most recent hour of data will be returned. If only start_date_time
is
supplied, then end_date_time
defaults to the current time. Supplying
only end_date_time
will result in an error.
A tibble. For units and other metadata, see https://azmet.arizona.edu/about
If station_id
is supplied as a vector, multiple successive calls to
the API will be made. You may find better performance getting data for all
the stations by leaving station_id
blank and subsetting the resulting
dataframe. Requests for data from all stations for more than 10-15 days may
take considerable time.
az_15min()
, az_daily()
, az_heat()
, az_lw15min()
, az_lwdaily()
## Not run: # Most recent data for all stations: az_hourly() # Specify stations: az_hourly(station_id = c(1, 2)) az_hourly(station_id = c("az01", "az02")) # Specify dates: az_hourly(start_date_time = "2022-09-25 01") az_hourly(start_date_time = "2022-09-25 01", end_date = "2022-09-25 20") ## End(Not run)
## Not run: # Most recent data for all stations: az_hourly() # Specify stations: az_hourly(station_id = c(1, 2)) az_hourly(station_id = c("az01", "az02")) # Specify dates: az_hourly(start_date_time = "2022-09-25 01") az_hourly(start_date_time = "2022-09-25 01", end_date = "2022-09-25 20") ## End(Not run)
Retrieves 15-minute leaf-wetness data from the AZMet (Arizona Meteorological Network) API. Currently, these data only are available from weather stations in the Yuma area. For a list of stations and their locations see station_info, or visit https://azmet.arizona.edu/about.
az_lw15min(station_id = NULL, start_date_time = NULL, end_date_time = NULL)
az_lw15min(station_id = NULL, start_date_time = NULL, end_date_time = NULL)
station_id |
Station ID can be supplied as numeric vector (e.g.
|
start_date_time |
A length-1 vector of class POSIXct or character in YYYY-MM-DD HH:MM:SS format, in AZ time. If only a date (YYYY-MM-DD) is supplied, data will be requested starting at 00:00:01 of that day. |
end_date_time |
A length-1 vector of class POSIXct or character in
YYYY-MM-DD HH:MM:SS format, in AZ time. If only a date (YYYY-MM-DD) is
supplied, data will be requested through the end of that day (23:59:59).
Defaults to the current date and time if left blank and |
If neither start_date_time
nor end_date_time
are supplied, the
most recent datetime of data will be returned. If only start_date_time
is supplied, then end_date_time
defaults to the current time. Supplying
only end_date_time
will result in an error.
A tibble. For units and other metadata, see https://azmet.arizona.edu/about
If station_id
is supplied as a vector, multiple successive calls to
the API will be made. You may find better performance getting data for all
the stations by leaving station_id
blank and subsetting the resulting
dataframe. Only the most recent 48 hours of 15-minute data are stored in
the AZMet API.
az_15min()
, az_daily()
, az_heat()
, az_hourly()
, az_lwdaily()
## Not run: # Most recent 15-minute leaf-wetness data for all stations: az_lw15min() # Specify stations: az_lw15min(station_id = c(1, 2)) az_lw15min(station_id = c("az01", "az02")) # Specify dates: az_lw15min(start_date_time = "2022-09-25 01:00:00") az_lw15min(start_date_time = "2022-09-25 01:00:00", end_date_time = "2022-09-25 07:00:00") ## End(Not run)
## Not run: # Most recent 15-minute leaf-wetness data for all stations: az_lw15min() # Specify stations: az_lw15min(station_id = c(1, 2)) az_lw15min(station_id = c("az01", "az02")) # Specify dates: az_lw15min(start_date_time = "2022-09-25 01:00:00") az_lw15min(start_date_time = "2022-09-25 01:00:00", end_date_time = "2022-09-25 07:00:00") ## End(Not run)
Retrieves daily leaf wetness data from the Arizona Meteorological Network API. Currently, these data only are available from weather stations in the Yuma area. For a list of stations and their locations see station_info, or visit https://azmet.arizona.edu/about.
az_lwdaily(station_id = NULL, start_date = NULL, end_date = NULL)
az_lwdaily(station_id = NULL, start_date = NULL, end_date = NULL)
station_id |
station ID can be supplied as numeric vector (e.g.
|
start_date |
A length-1 vector of class Date, POSIXct, or character in YYYY-MM-DD format. Will be rounded down to the nearest day if more precision is supplied. Defaults to the day before the current date (i.e., the most recent complete day) if left blank. |
end_date |
A length-1 vector of class Date, POSIXct, or character in YYYY-MM-DD format. Will be rounded down to the nearest day if more precision is supplied. Defaults to the day before the current date (i.e., the most recent complete day) if left blank. |
If neither start_date
nor end_date
are supplied, the most recent
day of data will be returned. If only start_date
is supplied, then the
end date defaults to the day before the current date (i.e., the most recent
complete day). Supplying only end_date
will result in an error.
A tibble. For units and other metadata, see https://azmet.arizona.edu/about
If station_id
is supplied as a vector, multiple successive calls to
the API will be made. You may find better performance getting data for all
the stations by leaving station_id
blank and subsetting the resulting
dataframe. Requests for data from all stations for more than 6-12 months
may take considerable time.
az_15min()
, az_daily()
, az_heat()
, az_hourly()
, az_lw15min()
## Not run: # Most recent data for all stations: az_lwdaily() # Specify stations: az_lwdaily(station_id = c(1, 2)) az_lwdaily(station_id = c("az01", "az02")) # Specify dates: az_lwdaily(start_date = "2022-09-25") az_lwdaily(start_date = "2022-09-25", end_date = "2022-09-26") ## End(Not run)
## Not run: # Most recent data for all stations: az_lwdaily() # Specify stations: az_lwdaily(station_id = c(1, 2)) az_lwdaily(station_id = c("az01", "az02")) # Specify dates: az_lwdaily(start_date = "2022-09-25") az_lwdaily(start_date = "2022-09-25", end_date = "2022-09-26") ## End(Not run)
Station names, station IDs, and location (lat, lon, elevation) of active AZMet weather stations
station_info
station_info
A tibble with 30 rows and 5 columns:
meta_station_name
Station name
meta_station_id
Station ID
latitude
, logitude
Station location
elev_m
Station elevation in meters