Skip to content

Commit

Permalink
Update docs with pkgdev
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Nov 28, 2024
1 parent 4ec7bd8 commit b0cf2d3
Show file tree
Hide file tree
Showing 8 changed files with 167 additions and 86 deletions.
5 changes: 4 additions & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ references:
email: [email protected]
orcid: https://orcid.org/0000-0002-4035-0289
year: '2024'
identifiers:
- type: url
value: https://arxiv.org/abs/1403.2805
doi: 10.32614/CRAN.package.jsonlite
version: '>= 1.7.0'
- type: software
Expand Down Expand Up @@ -397,7 +400,7 @@ references:
abstract: 'mapSpain: Administrative Boundaries of Spain'
notes: Suggests
url: https://ropenspain.github.io/mapSpain/
repository: https://ropenspain.r-universe.dev
repository: https://CRAN.R-project.org/package=mapSpain
authors:
- family-names: Hernangómez
given-names: Diego
Expand Down
2 changes: 2 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,5 @@ Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
X-schema.org-applicationCategory: Meteorology
X-schema.org-isPartOf: https://ropenspain.es/
X-schema.org-keywords: aemet, climate, cran, data, forecast-api, r,
r-package, ropenspain, rstats, science, spain, weather-api
106 changes: 53 additions & 53 deletions README.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,8 @@
},
"applicationCategory": "Meteorology",
"isPartOf": "https://ropenspain.es/",
"fileSize": "856.092KB",
"keywords": ["aemet", "climate", "cran", "data", "forecast-api", "r", "r-package", "ropenspain", "rstats", "science", "spain", "weather-api"],
"fileSize": "868.068KB",
"citation": [
{
"@type": "SoftwareSourceCode",
Expand Down Expand Up @@ -395,6 +396,5 @@
"releaseNotes": "https://github.com/rOpenSpain/climaemet/blob/master/NEWS.md",
"readme": "https://github.com/rOpenSpain/climaemet/blob/main/README.md",
"contIntegration": ["https://github.com/rOpenSpain/climaemet/actions/workflows/roscron-check-full.yaml", "https://github.com/rOpenSpain/climaemet/actions/workflows/rhub.yaml", "https://app.codecov.io/gh/rOpenSpain/climaemet"],
"developmentStatus": "https://www.repostatus.org/#active",
"keywords": ["science", "data", "climate", "aemet", "r", "rstats", "cran", "r-package", "ropenspain", "forecast-api", "spain", "weather-api"]
"developmentStatus": "https://www.repostatus.org/#active"
}
33 changes: 24 additions & 9 deletions vignettes/climaemet.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,25 @@ See how a `tibble` is displayed:
# See a tibble in action

aemet_last_obs("9434")
#> Error in `httr2::req_perform()` at climaemet/R/aemet_api_query.R:308:3:
#> ! Failed to perform HTTP request.
#> Caused by error in `curl::curl_fetch_memory()`:
#> ! Failure when receiving data from the peer [opendata.aemet.es]: Recv failure: Connection was reset
#> # A tibble: 13 × 25
#> idema lon fint prec alt vmax vv dv lat dmax
#> <chr> <dbl> <dttm> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 9434 -1.00 2024-11-28 06:00:00 0 249 1.4 1 89 41.7 70
#> 2 9434 -1.00 2024-11-28 07:00:00 0 249 1.3 0.7 93 41.7 125
#> 3 9434 -1.00 2024-11-28 08:00:00 0 249 1.6 0.7 66 41.7 65
#> 4 9434 -1.00 2024-11-28 09:00:00 0 249 1.9 0.7 133 41.7 85
#> 5 9434 -1.00 2024-11-28 10:00:00 0 249 1.5 0.9 164 41.7 293
#> 6 9434 -1.00 2024-11-28 11:00:00 0 249 1.5 0.6 155 41.7 210
#> 7 9434 -1.00 2024-11-28 12:00:00 0 249 2.4 0.9 128 41.7 70
#> 8 9434 -1.00 2024-11-28 13:00:00 0 249 2.2 1.1 85 41.7 100
#> 9 9434 -1.00 2024-11-28 14:00:00 0 249 3.6 1.9 85 41.7 88
#> 10 9434 -1.00 2024-11-28 15:00:00 0 249 4.4 2.6 109 41.7 98
#> 11 9434 -1.00 2024-11-28 16:00:00 0 249 4 2.6 128 41.7 135
#> 12 9434 -1.00 2024-11-28 17:00:00 0 249 4 2.5 115 41.7 143
#> 13 9434 -1.00 2024-11-28 18:00:00 0 249 4.2 3.2 120 41.7 130
#> # ℹ 15 more variables: ubi <chr>, pres <dbl>, hr <dbl>, stdvv <dbl>, ts <dbl>,
#> # pres_nmar <dbl>, tamin <dbl>, ta <dbl>, tamax <dbl>, tpr <dbl>,
#> # stddv <dbl>, inso <dbl>, tss5cm <dbl>, pacutp <dbl>, tss20cm <dbl>
```

Note that when possible, data representing dates and numbers are converted to
Expand All @@ -115,10 +130,6 @@ all_stations <- aemet_daily_clim(
start = "2021-01-08", end = "2021-01-08",
return_sf = TRUE
)
#> Error in `httr2::req_perform()` at climaemet/R/aemet_api_query.R:308:3:
#> ! Failed to perform HTTP request.
#> Caused by error in `curl::curl_fetch_memory()`:
#> ! Failure when receiving data from the peer [opendata.aemet.es]: Recv failure: Connection was reset


ggplot(all_stations) +
Expand All @@ -140,9 +151,13 @@ ggplot(all_stations) +
plot.title = element_text(face = "bold"),
plot.subtitle = element_text(face = "italic")
)
#> Error: objeto 'all_stations' no encontrado
```

<div class="figure">
<img src="./spatial-1.png" alt="Example: Temperature in Spain" width="100%" />
<p class="caption">Example: Temperature in Spain</p>
</div>

## Further enhancements

Other enhancements included on the **v1.0.0**:
Expand Down
Binary file modified vignettes/example-gif.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
101 changes: 81 additions & 20 deletions vignettes/extending-climaemet.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -40,32 +40,88 @@ today <- "/api/prediccion/nacional/hoy"

# Metadata
knitr::kable(get_metadata_aemet(today))
#> Error in `httr2::req_perform()` at climaemet/R/aemet_api_query.R:308:3:
#> ! Failed to perform HTTP request.
#> Caused by error in `curl::curl_fetch_memory()`:
#> ! Failure when receiving data from the peer [opendata.aemet.es]: Recv failure: Connection was reset
```



|unidad_generadora |descripcion |periodicidad |formato |copyright |notaLegal |
|:-------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------|:-------------------------------------------------------------------------------------------------------|:----------------------------------|
|Grupo Funcional de Predicción de Referencia |Predicción general nacional para hoy / mañana / pasado mañana / medio plazo (tercer y cuarto día) / tendencia (del quinto al noveno día) |Disponibilidad. Para hoy, solo se confecciona si hay cambios significativos. Para mañana y pasado mañana diaria a las 15:00 h.o.p.. Para el medio plazo diaria a las 16:00 h.o.p.. La tendencia, diaria a las 18:30 h.o.p. |ascii/txt |© AEMET. Autorizado el uso de la información y su reproducción citando a AEMET como autora de la misma. |https://www.aemet.es/es/nota_legal |



``` r

# Data
pred_today <- get_data_aemet(today)
#> Error in `httr2::req_perform()` at climaemet/R/aemet_api_query.R:308:3:
#> ! Failed to perform HTTP request.
#> Caused by error in `curl::curl_fetch_memory()`:
#> ! Failure when receiving data from the peer [opendata.aemet.es]: Recv failure: Connection was reset
#>
#> Results are MIME type: text/plain
#> Returning data as string
```


``` r
# Produce a result

clean <- gsub("\r", "\n", pred_today, fixed = TRUE)
Error: objeto 'pred_today' no encontrado
clean <- gsub("\n\n\n", "\n", clean, fixed = TRUE)
Error: objeto 'clean' no encontrado

cat(paste("---\n\n", clean, "\n---"))
Error: objeto 'clean' no encontrado
```

---

AGENCIA ESTATAL DE METEOROLOGÍA
PREDICCIÓN GENERAL PARA ESPAÑA
DÍA 26 DE NOVIEMBRE DE 2024 A LAS 07:50 HORA OFICIAL
PREDICCIÓN VÁLIDA PARA EL MARTES 26

A.- FENÓMENOS SIGNIFICATIVOS
Intervalos de viento fuertes en litorales de Galicia. Nieblas
localmente densas en las mesetas e interior peninsular. Descenso
notable de las máximas en amplias zonas de la meseta Norte, alto
Ebro, Cantábrico oriental e interiores del tercio este
peninsular.

B.- PREDICCIÓN
Se prevé que, tras el paso del frente frío del día anterior, se
establezca una situación de altas presiones, que desde Europa
central se extiendan hacia la península Ibérica. No obstante, el
acercamiento de un nuevo frente atlántico dejará abundante
nubosidad de tipo medio y alto en la Península y Baleares, con
cielos nubosos o cubiertos en Galicia y precipitaciones afectando
a su mitad oeste, sin descartarlas en el resto de la Comunidad
así como en el extremo occidental de Asturias. Asimismo existe
una baja probabilidad de alguna precipitación débil y ocasional
en el Pirineo oriental, litorales de Cataluña, norte de Baleares
y sistemas Béticos. También se espera abundante nubosidad baja,
con probables nieblas matinales, en áreas de ambas mesetas,
sierras de Andalucía, Baleares y depresiones del nordeste. En
Canarias, predominarán los cielos nubosos en el norte de las
islas de mayor relieve con posibles chubascos ocasionales, con
probabilidad de ser más intensos en el este de La Palma, y con
intervalos de nubes medias y altas en el resto del archipiélago.

Probabilidad de calima débil en las islas Canarias orientales.

Las temperaturas descenderán de forma prácticamente generalizada
en la Península y Baleares, exceptuando aumentos en Galicia y
Asturias, y con pocos cambios en Canarias. Los descensos de las
máximas serán notables en amplias zonas de la meseta Norte, alto
Ebro, Cantábrico oriental e interiores del tercio este
peninsular. Heladas débiles en montañas, más intensas en
Pirineos.

Soplarán vientos de componente norte en la mitad septentrional
del área mediterránea y predominarán los vientos flojos del sur
y suroeste en el Cantábrico y cuadrante noroeste, más intensos
en Galicia, también con intervalos de fuerte en sus litorales.
Vientos flojos variables con predominio de la componente oeste en
el resto. En Canarias se espera un alisio de flojo a moderado.


---

## Example: Maps

AEMET also provides map data, usually on `image/gif` format. One way to get this
Expand All @@ -78,22 +134,27 @@ a_map <- "/api/mapasygraficos/analisis"

# Metadata
knitr::kable(get_metadata_aemet(a_map))
#> Error in `httr2::req_perform()` at climaemet/R/aemet_api_query.R:308:3:
#> ! Failed to perform HTTP request.
#> Caused by error in `curl::curl_fetch_memory()`:
#> ! Failure when receiving data from the peer [opendata.aemet.es]: Recv failure: Connection was reset
```



|unidad_generadora |descripción |periodicidad |formato |copyright |notaLegal |
|:---------------------------------|:------------------------------------------|:-----------------------------------------------------------------------------------------|:---------|:-------------------------------------------------------------------------------------------------------|:----------------------------------|
|Grupo Funcional de Jefes de Turno |Mapas de análisis de frentes en superficie |Dos veces al día, a las 02:00 y 14:00 h.o.p. en invierno y a las 03:00 y 15:00 en verano. |image/gif |© AEMET. Autorizado el uso de la información y su reproducción citando a AEMET como autora de la misma. |https://www.aemet.es/es/nota_legal |



``` r

the_map <- get_data_aemet(a_map)
#> Error in `httr2::req_perform()` at climaemet/R/aemet_api_query.R:308:3:
#> ! Failed to perform HTTP request.
#> Caused by error in `curl::curl_fetch_memory()`:
#> ! Failure when receiving data from the peer [opendata.aemet.es]: Recv failure: Connection was reset
#>
#> Results are MIME type: image/gif
#> Returning raw data


# Write as gif and include it
giffile <- "example-gif.gif"
writeBin(the_map, giffile)
#> Error: objeto 'the_map' no encontrado

# Display on the vignette
knitr::include_graphics(giffile)
Expand Down
Binary file modified vignettes/spatial-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b0cf2d3

Please sign in to comment.