Skip to content

Commit

Permalink
Fix rebasing
Browse files Browse the repository at this point in the history
  • Loading branch information
dieghernan committed Jan 30, 2024
1 parent 3645bfe commit d120ff1
Show file tree
Hide file tree
Showing 15 changed files with 101 additions and 67 deletions.
5 changes: 1 addition & 4 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ message: 'To cite package "climaemet" in publications use:'
type: software
license: GPL-3.0-only
title: 'climaemet: Climate AEMET Tools'
version: 1.2.0.9000
version: 1.2.1
doi: 10.5281/zenodo.5205573
abstract: Tools to download the climatic data of the Spanish Meteorological Agency
(AEMET) directly from R using their API and create scientific graphs (climate charts,
Expand Down Expand Up @@ -177,9 +177,6 @@ references:
email: [email protected]
orcid: https://orcid.org/0000-0002-4035-0289
year: '2024'
identifiers:
- type: url
value: https://arxiv.org/abs/1403.2805
version: '>= 1.7.0'
- type: software
title: rappdirs
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: climaemet
Title: Climate AEMET Tools
Version: 1.2.0.9000
Version: 1.2.1
Authors@R: c(
person("Manuel", "Pizarro", role = c("aut", "cph"),
comment = c(ORCID = "0000-0002-6981-0154")),
Expand Down
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# climaemet (development version)
# climaemet 1.2.1

- On `aemet_monthly_period(extract_metadata = TRUE)` honor the `start` and
`end` parameters.
- Update docs.

# climaemet 1.2.0

Expand Down
42 changes: 30 additions & 12 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -168,33 +168,51 @@ knitr::kable(head(data_extremes))
We can also draw a "warming stripes" graph with the downloaded data from a
weather station. These functions returns `ggplot2` plots:

```{r climatestripes, fig.asp=0.7, eval=FALSE}
```{r climatestripes, fig.asp=0.7, eval=TRUE}
# Plot a climate stripes graph for a period of years for a station
library(ggplot2)
climatestripes_station("9434", start = 1980, end = 2020) +
theme(plot.title = element_text(size = 10))
# Example data
temp_data <- climaemet::climaemet_9434_temp
ggstripes(temp_data, plot_title = "Zaragoza Airport") +
labs(subtitle = "(1950-2020)")
```

Furthermore, we can draw the well-known Walter & Lieth climatic diagram for a
weather station and over a specified period of time:

```{r climatogram, fig.asp=0.7, eval=FALSE}
# Plot of a Walter & Lieth climatic diagram (normal climatology values) for a station
climatogram_normal("9434", labels = "en")
```{r climatogram, fig.asp=0.7, eval=TRUE}
# Plot of a Walter & Lieth climatic diagram for a station
# Example data
wl_data <- climaemet::climaemet_9434_climatogram
ggclimat_walter_lieth(wl_data,
alt = "249", per = "1981-2010",
est = "Zaragoza Airport"
)
```

Additionally, we may be interested in drawing the wind speed and direction over
a period of time for the data downloaded from a weather station.:

```{r windrose, fig.asp=0.7, eval=FALSE}
# Plot a windrose showing the wind speed and direction for a station over a days period.
windrose_days("9434",
start = "2010-01-01", end = "2020-12-31",
n_speeds = 5, speed_cuts = c(2.5, 5, 7.5, 10, 12.5, 15)
```{r windrose, fig.asp=0.7, eval=TRUE}
# Plot a windrose showing the wind speed and direction for a station
# Example data
wind_data <- climaemet::climaemet_9434_wind
speed <- wind_data$velmedia
direction <- wind_data$dir
ggwindrose(
speed = speed, direction = direction,
speed_cuts = seq(0, 16, 4), legend_title = "Wind speed (m/s)",
calm_wind = 0, n_col = 1, plot_title = "Zaragoza Airport"
) +
theme(plot.title = element_text(size = 10))
labs(subtitle = "2000-2020", caption = "Source: AEMET")
```

## ... and spatial!
Expand Down
74 changes: 49 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,16 @@ aemet_last_obs("9434")
#> # A tibble: 24 × 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-01-28 21:00:00 0 249 3.9 2.2 132 41.7 138
#> 2 9434 -1.00 2024-01-28 22:00:00 0 249 3.4 2.3 149 41.7 153
#> 3 9434 -1.00 2024-01-28 23:00:00 0 249 3.1 1.6 117 41.7 140
#> 4 9434 -1.00 2024-01-29 00:00:00 0 249 2.7 1.8 136 41.7 128
#> 5 9434 -1.00 2024-01-29 01:00:00 0 249 3.2 2.1 132 41.7 133
#> 6 9434 -1.00 2024-01-29 02:00:00 0 249 3.4 1.8 102 41.7 115
#> 7 9434 -1.00 2024-01-29 03:00:00 0 249 3.2 1.1 65 41.7 118
#> 8 9434 -1.00 2024-01-29 04:00:00 0 249 3.3 2.2 142 41.7 133
#> 9 9434 -1.00 2024-01-29 05:00:00 0 249 3 1.7 163 41.7 160
#> 10 9434 -1.00 2024-01-29 06:00:00 0 249 2.2 1.1 122 41.7 160
#> 1 9434 -1.00 2024-01-29 22:00:00 0 249 1.2 0.9 186 41.7 190
#> 2 9434 -1.00 2024-01-29 23:00:00 0 249 2 0.6 209 41.7 248
#> 3 9434 -1.00 2024-01-30 00:00:00 0 249 1.5 1.2 189 41.7 183
#> 4 9434 -1.00 2024-01-30 01:00:00 0 249 1.6 0.6 165 41.7 195
#> 5 9434 -1.00 2024-01-30 02:00:00 0 249 1.2 0.8 313 41.7 178
#> 6 9434 -1.00 2024-01-30 03:00:00 0 249 1.5 1 281 41.7 275
#> 7 9434 -1.00 2024-01-30 04:00:00 0 249 2.4 1.1 321 41.7 253
#> 8 9434 -1.00 2024-01-30 05:00:00 0 249 1.2 0.7 238 41.7 323
#> 9 9434 -1.00 2024-01-30 06:00:00 0 249 1.5 0.9 195 41.7 218
#> 10 9434 -1.00 2024-01-30 07:00:00 0 249 1.4 0.8 281 41.7 198
#> # ℹ 14 more rows
#> # ℹ 15 more variables: ubi <chr>, pres <dbl>, hr <dbl>, stdvv <dbl>, ts <dbl>,
#> # pres_nmar <dbl>, tamin <dbl>, ta <dbl>, tamax <dbl>, tpr <dbl>,
Expand Down Expand Up @@ -169,12 +169,12 @@ knitr::kable(head(data_observation))

| idema | lon | fint | prec | alt | vmax | vv | dv | lat | dmax | ubi | pres | hr | stdvv | ts | pres_nmar | tamin | ta | tamax | tpr | stddv | inso | tss5cm | pacutp | tss20cm |
|:------|----------:|:--------------------|-----:|----:|-----:|----:|----:|---------:|-----:|:--------------------|-------:|----:|------:|----:|----------:|------:|----:|------:|----:|------:|-----:|-------:|-------:|--------:|
| 9434 | -1.004167 | 2024-01-28 21:00:00 | 0 | 249 | 3.9 | 2.2 | 132 | 41.66056 | 138 | ZARAGOZA AEROPUERTO | 999.7 | 100 | 0.3 | 6.6 | 1030.8 | 6.6 | 6.6 | 7.2 | 6.5 | 11 | 0 | 8.3 | 0 | 8.7 |
| 9434 | -1.004167 | 2024-01-28 22:00:00 | 0 | 249 | 3.4 | 2.3 | 149 | 41.66056 | 153 | ZARAGOZA AEROPUERTO | 999.7 | 100 | 0.5 | 6.7 | 1030.7 | 6.5 | 6.7 | 6.7 | 6.7 | 10 | 0 | 8.1 | 0 | 8.7 |
| 9434 | -1.004167 | 2024-01-28 23:00:00 | 0 | 249 | 3.1 | 1.6 | 117 | 41.66056 | 140 | ZARAGOZA AEROPUERTO | 1000.1 | 100 | 0.2 | 5.8 | 1031.3 | 5.8 | 5.8 | 6.7 | 5.8 | 8 | 0 | 7.9 | 0 | 8.6 |
| 9434 | -1.004167 | 2024-01-29 00:00:00 | 0 | 249 | 2.7 | 1.8 | 136 | 41.66056 | 128 | ZARAGOZA AEROPUERTO | 1000.2 | 100 | 0.3 | 5.5 | 1031.4 | 5.5 | 5.5 | 5.9 | 5.5 | 8 | 0 | 7.8 | 0 | 8.6 |
| 9434 | -1.004167 | 2024-01-29 01:00:00 | 0 | 249 | 3.2 | 2.1 | 132 | 41.66056 | 133 | ZARAGOZA AEROPUERTO | 1000.2 | 100 | 0.2 | 4.7 | 1031.5 | 4.9 | 4.9 | 5.6 | 5.0 | 6 | 0 | 7.6 | 0 | 8.5 |
| 9434 | -1.004167 | 2024-01-29 02:00:00 | 0 | 249 | 3.4 | 1.8 | 102 | 41.66056 | 115 | ZARAGOZA AEROPUERTO | 1000.0 | 100 | 0.2 | 4.4 | 1031.3 | 4.5 | 4.5 | 4.9 | 4.5 | 8 | 0 | 7.2 | 0 | 8.5 |
| 9434 | -1.004167 | 2024-01-29 22:00:00 | 0 | 249 | 1.2 | 0.9 | 186 | 41.66056 | 190 | ZARAGOZA AEROPUERTO | 1002.4 | 94 | 0.2 | 7.2 | 1033.3 | 8.3 | 8.3 | 8.7 | 7.4 | 9 | 0 | 8.6 | 0 | 9.0 |
| 9434 | -1.004167 | 2024-01-29 23:00:00 | 0 | 249 | 2.0 | 0.6 | 209 | 41.66056 | 248 | ZARAGOZA AEROPUERTO | 1002.6 | 96 | 0.4 | 7.0 | 1033.6 | 8.0 | 8.0 | 8.3 | 7.4 | 44 | 0 | 8.4 | 0 | 9.0 |
| 9434 | -1.004167 | 2024-01-30 00:00:00 | 0 | 249 | 1.5 | 1.2 | 189 | 41.66056 | 183 | ZARAGOZA AEROPUERTO | 1002.6 | 97 | 0.2 | 7.4 | 1033.6 | 7.6 | 7.7 | 8.0 | 7.3 | 10 | 0 | 8.2 | 0 | 8.9 |
| 9434 | -1.004167 | 2024-01-30 01:00:00 | 0 | 249 | 1.6 | 0.6 | 165 | 41.66056 | 195 | ZARAGOZA AEROPUERTO | 1002.4 | 97 | 0.1 | 7.8 | 1033.4 | 7.7 | 7.9 | 7.9 | 7.4 | 9 | 0 | 8.2 | 0 | 8.9 |
| 9434 | -1.004167 | 2024-01-30 02:00:00 | 0 | 249 | 1.2 | 0.8 | 313 | 41.66056 | 178 | ZARAGOZA AEROPUERTO | 1002.5 | 95 | 0.1 | 8.3 | 1033.4 | 7.9 | 8.4 | 8.4 | 7.7 | 8 | 0 | 8.3 | 0 | 8.8 |
| 9434 | -1.004167 | 2024-01-30 03:00:00 | 0 | 249 | 1.5 | 1.0 | 281 | 41.66056 | 275 | ZARAGOZA AEROPUERTO | 1002.6 | 96 | 0.3 | 8.2 | 1033.5 | 8.4 | 8.4 | 8.5 | 7.8 | 7 | 0 | 8.3 | 0 | 8.8 |

``` r

Expand Down Expand Up @@ -235,31 +235,55 @@ a weather station. These functions returns `ggplot2` plots:

library(ggplot2)

climatestripes_station("9434", start = 1980, end = 2020) +
theme(plot.title = element_text(size = 10))
# Example data
temp_data <- climaemet::climaemet_9434_temp

ggstripes(temp_data, plot_title = "Zaragoza Airport") +
labs(subtitle = "(1950-2020)")
```

<img src="man/figures/README-climatestripes-1.png" width="100%" />

Furthermore, we can draw the well-known Walter & Lieth climatic diagram
for a weather station and over a specified period of time:

``` r
# Plot of a Walter & Lieth climatic diagram (normal climatology values) for a station
climatogram_normal("9434", labels = "en")
# Plot of a Walter & Lieth climatic diagram for a station

# Example data
wl_data <- climaemet::climaemet_9434_climatogram

ggclimat_walter_lieth(wl_data,
alt = "249", per = "1981-2010",
est = "Zaragoza Airport"
)
```

<img src="man/figures/README-climatogram-1.png" width="100%" />

Additionally, we may be interested in drawing the wind speed and
direction over a period of time for the data downloaded from a weather
station.:

``` r
# Plot a windrose showing the wind speed and direction for a station over a days period.
windrose_days("9434",
start = "2010-01-01", end = "2020-12-31",
n_speeds = 5, speed_cuts = c(2.5, 5, 7.5, 10, 12.5, 15)
# Plot a windrose showing the wind speed and direction for a station

# Example data
wind_data <- climaemet::climaemet_9434_wind

speed <- wind_data$velmedia
direction <- wind_data$dir

ggwindrose(
speed = speed, direction = direction,
speed_cuts = seq(0, 16, 4), legend_title = "Wind speed (m/s)",
calm_wind = 0, n_col = 1, plot_title = "Zaragoza Airport"
) +
theme(plot.title = element_text(size = 10))
labs(subtitle = "2000-2020", caption = "Source: AEMET")
```

<img src="man/figures/README-windrose-1.png" width="100%" />

## … and spatial!

Another major change in `v1.0.0` is the ability of return information on
Expand Down
4 changes: 2 additions & 2 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"codeRepository": "https://github.com/rOpenSpain/climaemet",
"issueTracker": "https://github.com/rOpenSpain/climaemet/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "1.2.0.9000",
"version": "1.2.1",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down Expand Up @@ -289,7 +289,7 @@
},
"applicationCategory": "Meteorology",
"isPartOf": "https://ropenspain.es/",
"fileSize": "698.724KB",
"fileSize": "702.67KB",
"citation": [
{
"@type": "SoftwareSourceCode",
Expand Down
2 changes: 1 addition & 1 deletion inst/schemaorg.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"url": "https://cran.r-project.org"
},
"runtimePlatform": "R version 4.3.2 (2023-10-31 ucrt)",
"version": "1.2.0.9000"
"version": "1.2.1"
},
{
"id": "https://doi.org/10.5281/zenodo.5205573",
Expand Down
Binary file modified man/figures/README-climatestripes-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-climatogram-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-windrose-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 15 additions & 16 deletions vignettes/climaemet.Rmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
title: "Get started with climaemet 1.0.0"
date: 2024-01-29
author: <a href="https://orcid.org/0000-0001-8457-4658">Diego Hernangómez <img alt="ORCID logo" src="https://info.orcid.org/wp-content/uploads/2019/11/orcid_24x24.png" width="16" height="16" /></a>
output: rmarkdown::html_vignette
vignette: >
Expand Down Expand Up @@ -88,22 +87,22 @@ See how a tibble is displayed:

aemet_last_obs("9434")
#> # A tibble: 24 × 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-01-28 21:00:00 0 249 3.9 2.2 132 41.7 138
#> 2 9434 -1.00 2024-01-28 22:00:00 0 249 3.4 2.3 149 41.7 153
#> 3 9434 -1.00 2024-01-28 23:00:00 0 249 3.1 1.6 117 41.7 140
#> 4 9434 -1.00 2024-01-29 00:00:00 0 249 2.7 1.8 136 41.7 128
#> 5 9434 -1.00 2024-01-29 01:00:00 0 249 3.2 2.1 132 41.7 133
#> 6 9434 -1.00 2024-01-29 02:00:00 0 249 3.4 1.8 102 41.7 115
#> 7 9434 -1.00 2024-01-29 03:00:00 0 249 3.2 1.1 65 41.7 118
#> 8 9434 -1.00 2024-01-29 04:00:00 0 249 3.3 2.2 142 41.7 133
#> 9 9434 -1.00 2024-01-29 05:00:00 0 249 3 1.7 163 41.7 160
#> 10 9434 -1.00 2024-01-29 06:00:00 0 249 2.2 1.1 122 41.7 160
#> idema lon fint prec alt vmax vv dv lat dmax ubi
#> <chr> <dbl> <dttm> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <chr>
#> 1 9434 -1.00 2024-01-29 22:00:00 0 249 1.2 0.9 186 41.7 190 ZARAGOZA …
#> 2 9434 -1.00 2024-01-29 23:00:00 0 249 2 0.6 209 41.7 248 ZARAGOZA …
#> 3 9434 -1.00 2024-01-30 00:00:00 0 249 1.5 1.2 189 41.7 183 ZARAGOZA …
#> 4 9434 -1.00 2024-01-30 01:00:00 0 249 1.6 0.6 165 41.7 195 ZARAGOZA …
#> 5 9434 -1.00 2024-01-30 02:00:00 0 249 1.2 0.8 313 41.7 178 ZARAGOZA …
#> 6 9434 -1.00 2024-01-30 03:00:00 0 249 1.5 1 281 41.7 275 ZARAGOZA …
#> 7 9434 -1.00 2024-01-30 04:00:00 0 249 2.4 1.1 321 41.7 253 ZARAGOZA …
#> 8 9434 -1.00 2024-01-30 05:00:00 0 249 1.2 0.7 238 41.7 323 ZARAGOZA …
#> 9 9434 -1.00 2024-01-30 06:00:00 0 249 1.5 0.9 195 41.7 218 ZARAGOZA …
#> 10 9434 -1.00 2024-01-30 07:00:00 0 249 1.4 0.8 281 41.7 198 ZARAGOZA …
#> # ℹ 14 more rows
#> # ℹ 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>
#> # ℹ 14 more variables: 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 Down
1 change: 0 additions & 1 deletion vignettes/climaemet.Rmd.orig
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
title: "Get started with climaemet 1.0.0"
date: `r Sys.Date()`
author: <a href="https://orcid.org/0000-0001-8457-4658">Diego Hernangómez <img alt="ORCID logo" src="https://info.orcid.org/wp-content/uploads/2019/11/orcid_24x24.png" width="16" height="16" /></a>
output: rmarkdown::html_vignette
vignette: >
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.
4 changes: 0 additions & 4 deletions vignettes/extending-climaemet.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ knitr::kable(get_metadata_aemet(today))

# Data
pred_today <- get_data_aemet(today)
#>
#> Returning raw results. MIME type: text/plain
```


Expand Down Expand Up @@ -130,8 +128,6 @@ knitr::kable(get_metadata_aemet(a_map))
```r

the_map <- get_data_aemet(a_map)
#>
#> Returning raw results. MIME type: image/gif


# Write as gif and include it
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 d120ff1

Please sign in to comment.