{"id":16571577,"url":"https://github.com/hrbrmstr/weatherkit","last_synced_at":"2025-03-21T12:30:59.435Z","repository":{"id":41823435,"uuid":"509984970","full_name":"hrbrmstr/weatherkit","owner":"hrbrmstr","description":"🍎🌡🔎 Obtain Historical, Current, and Predictive Weather Data from Apple WeatherKit REST API in R","archived":false,"fork":false,"pushed_at":"2022-08-05T10:40:46.000Z","size":2247,"stargazers_count":48,"open_issues_count":3,"forks_count":4,"subscribers_count":4,"default_branch":"batman","last_synced_at":"2025-03-18T01:11:16.221Z","etag":null,"topics":["darksky","r","rstats","weatherkit","weatherkit-rest-api"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hrbrmstr.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-03T10:02:10.000Z","updated_at":"2023-11-10T11:33:01.000Z","dependencies_parsed_at":"2022-07-15T15:30:37.682Z","dependency_job_id":null,"html_url":"https://github.com/hrbrmstr/weatherkit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrbrmstr%2Fweatherkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrbrmstr%2Fweatherkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrbrmstr%2Fweatherkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrbrmstr%2Fweatherkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hrbrmstr","download_url":"https://codeload.github.com/hrbrmstr/weatherkit/tar.gz/refs/heads/batman","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244799242,"owners_count":20512213,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["darksky","r","rstats","weatherkit","weatherkit-rest-api"],"created_at":"2024-10-11T21:24:29.046Z","updated_at":"2025-03-21T12:30:58.916Z","avatar_url":"https://github.com/hrbrmstr.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: rmarkdown::github_document\neditor_options: \n  chunk_output_type: console\n---\n```{r pkg-knitr-opts, include=FALSE}\nhrbrpkghelpr::global_opts()\n```\n\n```{r badges, results='asis', echo=FALSE, cache=FALSE}\nhrbrpkghelpr::stinking_badges()\n```\n\n```{r description, results='asis', echo=FALSE, cache=FALSE}\nhrbrpkghelpr::yank_title_and_description()\n```\n\n## What's Inside The Tin\n\nThe following functions are implemented:\n\n```{r ingredients, results='asis', echo=FALSE, cache=FALSE}\nhrbrpkghelpr::describe_ingredients()\n```\n\n## Installation\n\n```{r install-ex, results='asis', echo=FALSE, cache=FALSE}\nhrbrpkghelpr::install_block()\n```\n\n## NOTE\n\nPlease reference the local [Authorization](authorization.md) documentation or use `vignette(\"authorization\", package=\"weatherkit\")` at an R console for information on how to obtain the necessary authentication and signing components required to use the WeatherKit REST API from this package.\n\nIf your apps, web apps, or websites display any Apple weather data (other than weather alerts or value-added services or products, as described below), you must clearly display the Apple Weather trademark ( Weather), as well as the [legal link to other data sources](https://weatherkit.apple.com/legal-attribution.html).\n\n## Usage\n\n```{r lib-ex}\nlibrary(weatherkit)\nlibrary(ragg)\n\n# current version\npackageVersion(\"weatherkit\")\n\n```\n\n```{r availability}\nwxkit_availability(43.2683199, -70.8635506, \"US\")\n```\n\n```{r weather}\nwx \u003c- wxkit_weather(43.2683199, -70.8635506)\nwx \u003c- wx_tidy(wx)\nstr(wx)\n```\n\n```{r current-conditions}\ncurrent_conditions(wx)\n```\n\n```{r hourly-forecast}\nhourly_forecast(wx)\n```\n\n```{r daily-forecast}\ndaily_forecast(wx)\n```\n\n```{r wx-alerts, eval=FALSE}\n# weatherAlerts structure\n\nList of 4\n $ name      : chr \"WeatherAlertCollection\"\n $ metadata  :List of 9\n $ detailsUrl: chr \"https://weather-data.apple.com/alertDetails/index.html?ids=55f14171-c72f-5340-8003-9b51e52d14e5\u0026lang=en-US\u0026time\"| __truncated__\n $ alerts    :'data.frame':     1 obs. of  18 variables:\n\u003e str(y$weatherAlerts)\nList of 4\n $ name      : chr \"WeatherAlertCollection\"\n $ metadata  :List of 9\n  ..$ attributionURL: chr \"https://weather-data.apple.com/legal-attribution.html\"\n  ..$ expireTime    : chr \"2022-07-28T18:13:02Z\"\n  ..$ language      : chr \"en-US\"\n  ..$ latitude      : num 43.3\n  ..$ longitude     : num -70.9\n  ..$ providerName  : chr \"National Weather Service\"\n  ..$ readTime      : chr \"2022-07-28T18:08:02Z\"\n  ..$ reportedTime  : chr \"2022-07-28T18:08:02Z\"\n  ..$ version       : int 1\n $ detailsUrl: chr \"https://weather-data.apple.com/alertDetails/index.html?ids=55f14171-c72f-5340-8003-9b51e52d14e5\u0026lang=en-US\u0026time\"| __truncated__\n $ alerts    :'data.frame':     1 obs. of  18 variables:\n  ..$ name         : chr \"WeatherAlertSummary\"\n  ..$ id           : chr \"55f14171-c72f-5340-8003-9b51e52d14e5\"\n  ..$ areaId       : chr \"mez018\"\n  ..$ areaName     : chr \"Interior York\"\n  ..$ countryCode  : chr \"US\"\n  ..$ description  : chr \"Special Weather Statement\"\n  ..$ effectiveTime: chr \"2022-07-28T17:42:00Z\"\n  ..$ expireTime   : chr \"2022-07-28T19:00:00Z\"\n  ..$ issuedTime   : chr \"2022-07-28T17:42:00Z\"\n  ..$ detailsUrl   : chr \"https://weather-data.apple.com/alertDetails/index.html?ids=55f14171-c72f-5340-8003-9b51e52d14e5\u0026lang=en-US\u0026time\"| __truncated__\n  ..$ precedence   : int 0\n  ..$ severity     : chr \"minor\"\n  ..$ source       : chr \"National Weather Service\"\n  ..$ eventSource  : chr \"US\"\n  ..$ urgency      : chr \"expected\"\n  ..$ certainty    : chr \"observed\"\n  ..$ importance   : chr \"low\"\n  ..$ responses    :List of 1\n  .. ..$ : list()\n```\n\n```{r temps, dev=\"ragg_png\", fig.width=800/96, fig.height=500/96}\nlibrary(ggtext)\nlibrary(ggforce)\nlibrary(hrbragg) # remotes::install_github(\"hrbrmstr/hrbragg\")\nlibrary(ggplot2)\nlibrary(weatherkit)\n\ndata.frame(\n  x = celsius_to_fahrenheit(wx$forecastDaily$days$temperatureMin),\n  xend = celsius_to_fahrenheit(wx$forecastDaily$days$temperatureMax),\n  y = as.integer(as.Date(wx$forecastDaily$days$forecastStart))\n) -\u003e xdf\n\nxdf |\u003e\n  ggplot() +\n  geom_link(\n    aes(\n      x, y, xend=xend, yend=y,\n      colour = stat(index)\n    ),\n    linewidth = 4, # remotes::install_github(\"tidyverse/ggplot2\")\n    lineend = \"round\",\n    show.legend = FALSE\n  ) +\n  scale_x_continuous(\n    name = NULL,\n    label = function(x) sprintf(\"%s°F\", x),\n    sec.axis = dup_axis()\n  ) +\n  scale_y_reverse(\n    name = NULL,\n    breaks = seq_rng(xdf$y),\n    labels = function(x) {\n      x \u003c- as.Date(x, origin=\"1970-01-01\")\n      ifelse(x == Sys.Date(), \"Today\", strftime(x, \"%a\"))\n    },\n    sec.axis = dup_axis()\n  ) +\n  scale_colour_viridis_c(\n    option = \"cividis\"\n  ) +\n  labs(\n    title = \"Weather for Berwick, Maine\"\n  ) +\n  theme_gs(grid=\"XY\", axis_text_size = 12) +\n  theme(\n    axis.title.x.top = element_blank(),\n    axis.text.y.left = element_markdown(family = \"Inter\"),\n    axis.text.y.right = element_markdown(family = \"Inter\"),\n    panel.grid.major.x = element_line(linetype = \"dotted\", size = 0.5),\n    panel.grid.major.y = element_line(linetype = \"dotted\", size = 0.5)\n  )\n```\n\n## weatherkit Metrics\n\n```{r cloc, echo=FALSE}\ncloc::cloc_pkg_md()\n```\n\n## Code of Conduct\n\nPlease note that this project is released with a Contributor Code of Conduct. \nBy participating in this project you agree to abide by its terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhrbrmstr%2Fweatherkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhrbrmstr%2Fweatherkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhrbrmstr%2Fweatherkit/lists"}