RClimacell

The {RClimacell} R package provides a high level wrapper around the Climacell version 4 API using the Timeline Interface. Currently, the package only provides access to some of the CORE layers provided by Climacell. This is due to my inability to subscribe to the premium tier of the API.

Note that this package requires the user to have an API key as it is necessary to access the Climacell API and obtain results.

Functions

The {RClimacell} package consists of three functions:

Climacell API CORE Layers

The following table summarizes which CORE layers are available in the current package version:

API Field {RClimacell} Equivalent Name Implemented in package? Part of Function
temperature temp_c yes climacell_temperature()
temperatureApparent temp_feel_c yes climacell_temperature()
dewPoint dewpoint yes climacell_temperature()
humidity humidity yes climacell_temperature()
windSpeed wind_speed yes climacell_wind()
windDirection wind_direction yes climacell_wind()
windGust wind_gust yes climacell_wind()
pressureSurfaceLevel pressure_surface_level yes climacell_precip()
pressureSeaLevel pressure_sea_level yes climacell_precip()
precipitationIntensity precipitation_intensity yes climacell_precip()
precipitationProbability precipitation_probability yes climacell_precip()
precipitationType precipitation_type yes climacell_precip()
sunriseTime n/a NO n/a
sunsetTime n/a NO n/a
solarGHI n/a NO n/a
visibility visibility yes climacell_precip()
cloudCover cloud_cover yes climacell_precip()
cloudBase cloud_base yes climacell_precip()
cloudCeiling cloud_ceiling yes n/a
moonPhase n/a NO n/a
weatherCode weather_code yes climacell_precip()

Limitations

API Call Limits

The Climacell API has certain limitations based on the subscription tier. This package is tested using the free tier. Due to this limitation, the author is only able to provide access to the CORE layers. Note that the free tier allows for 1,000 calls per day to CORE layers.

Date/Time Range Limits

Depending on the timestep value chosen, there are upper limits to how far into the future you can get results for. Typically, with the free API, you are not able to obtain results prior to 6 hours from the current time. These limits can be found here.

Units

This package leverage version 4 of the Climacell API. Hence, it can be assumed that all units are in metric and all times are in UTC using the ISO 8601 standard. The user is advised to strongly ensure that all times entered strictly adhere to the ISO 8601 standard. It is also encouraged that the user input all times in UTC. Note that returned times are always in UTC. This is due to the API - not the R package.

Data Structure

Consult the Climacell API documentation on CORE layers to understand the unit labels for each field. Where possible, the value types have been adjusted to either integer, numeric, date-time, or character.

Temperature

library(RClimacell)
library(dplyr)
library(lubridate)

st <- lubridate::now()
et <- st + lubridate::days(5)

climacell_temperature(lat = 41.71530861778755,
                      long = -93.61438914464473,
                      timestep = '1d',
                      start_time = st,
                      end_time = et) %>%
  dplyr::glimpse()

#> Rows: 6
#> Columns: 5
#> $ start_time  <dttm> 2021-02-05 12:00:00, 2021-02-06 12:00:00, 2021-02-07 12:00:00, 2021-02-08 12:00:00, 2021-02-09 12:00:0…
#> $ temp_c      <dbl> -7.00, -13.20, -17.70, -16.31, -15.59, -14.44
#> $ temp_feel_c <dbl> -14.61, -20.54, -25.70, -25.11, -20.03, -17.36
#> $ dewpoint    <dbl> -12.21, -17.60, -21.97, -19.47, -18.61, -17.80
#> $ humidity    <dbl> 78.37, 79.06, 76.37, 94.21, 90.15, 88.55

Wind

library(RClimacell)
library(dplyr)
library(lubridate)

st <- lubridate::now()
et <- st + lubridate::days(5)

climacell_wind(lat = 41.71530861778755,
               long = -93.61438914464473,
               timestep = '1d',
               start_time = st,
               end_time = et) %>%
  dplyr::glimpse()

#> Rows: 6
#> Columns: 4
#> $ start_time     <dttm> 2021-02-05 12:00:00, 2021-02-06 12:00:00, 2021-02-07 12:00:00, 2021-02-08 12:00:00, 2021-02-09 12:0…
#> $ wind_speed     <dbl> 7.26, 4.56, 4.44, 5.25, 3.67, 2.09
#> $ wind_gust      <dbl> 11.88, 9.91, 6.44, 7.33, 4.70, 2.28
#> $ wind_direction <dbl> 254.85, 177.01, 55.58, 128.68, 280.36, 77.19

Precipitation

library(RClimacell)
library(dplyr)
library(lubridate)

st <- lubridate::now()
et <- st + lubridate::days(5)

climacell_precip(lat = 41.71530861778755,
                 long = -93.61438914464473,
                 timestep = '1d',
                 start_time = st,
                 end_time = et) %>%
  dplyr::glimpse()
  
#> Rows: 5
#> Columns: 13
#> $ start_time                <dttm> 2021-02-05 12:00:00, 2021-02-06 12:00:00, 2021-02-07 12:00:00, 2021-02-08 12:00:00, 2021…
#> $ precipitation_intensity   <dbl> 0.0000, 0.3922, 0.5828, 0.2734, 0.0000
#> $ precipitation_probability <dbl> 0, 50, 25, 15, 0
#> $ precipitation_type_code   <dbl> 2, 2, 2, 2, 2
#> $ precipitation_type_desc   <chr> "Snow", "Snow", "Snow", "Snow", "Snow"
#> $ visibility                <dbl> 14.81, 16.00, 16.00, 24.14, 24.14
#> $ pressure_surface_level    <dbl> 980.73, 990.21, 993.32, 993.83, 995.58
#> $ pressure_sea_level        <dbl> 1011.14, 1016.76, 1027.34, 1027.21, 1032.76
#> $ cloud_cover               <dbl> 100.00, 100.00, 100.00, 100.00, 61.58
#> $ cloud_base                <dbl> 5.78, 3.92, 3.92, 4.82, 0.00
#> $ cloud_ceiling             <dbl> 6.17, 6.17, 3.92, 5.18, 0.00
#> $ weather_code              <dbl> 1102, 5100, 5100, 5100, 1101
#> $ weather_desc              <chr> "Mostly Cloudy", "Light Snow", "Light Snow", "Light Snow", "Partly Cloudy"