Skip to content

Commit

Permalink
Typo and textual corrections + link to lubridate/ggplot2
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdesmet committed Jul 31, 2019
1 parent 396986e commit c0ef6f3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ If you want to know the supported variables, ask for the supported variables:
supported_variables("en")
```

Listing the available air_pressure stations:
Listing the available air pressure stations:

```{r station_listing}
get_stations("air_pressure")
Expand All @@ -59,7 +59,7 @@ overpelt_pressure <- get_timeseries_tsid("78124042",
head(overpelt_pressure)
```

Making a plot of the data with ggplot:
Making a plot of the data with [`ggplot2`](https://ggplot2.tidyverse.org/):

```{r plot_pressure, echo = TRUE, eval = FALSE}
library(ggplot2)
Expand Down Expand Up @@ -108,7 +108,7 @@ More detailed tutorials are available in the package vignettes!

The amount of data downloaded from waterinfo.be is limited via a credit system. You do not need to get a token right away to download data. For limited and irregular downloads, a token will not be required.

When you require more extended data requests, please request a download token from the waterinfo.be site administrators via the e-mail adress <hydrometrie@waterinfo.be> with a statement of which data and how frequently you would like to download data. You will then receive a client-credit code that can be used to obtain a token that is valid for 24 hours, after which the token can be refreshed with the same client-credit code.
When you require more extended data requests, please request a download token from the waterinfo.be site administrators via the e-mail address <hydrometrie@waterinfo.be> with a statement of which data and how frequently you would like to download data. You will then receive a client-credit code that can be used to obtain a token that is valid for 24 hours, after which the token can be refreshed with the same client-credit code.

Get token with client-credit code: (limited client-credit code for testing purposes)

Expand Down
8 changes: 4 additions & 4 deletions vignettes/define_date_periods.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ The package will both except valid date strings as well as valid date objects (`
* "2017-01"
* "2017"

According to the `lubridate` package, these orders are accepted: ymd_hms, ymd, ym, y. As a result, also "2017/01/01", "2017 01 01" or "20170101" are valid date string inputs. Make sure the order of year-month-day is respected. For example, "01/01/2017", "01-01-2017" and "01-2017" are NOT valid.
According to the [`lubridate`](https://lubridate.tidyverse.org/) package, these orders are accepted: `ymd_hms`, `ymd`, `ym`, `y`. As a result, also `"2017/01/01"`, `"2017 01 01"` or `"20170101"` are valid date string inputs. Make sure the order of year-month-day is respected. For example, `"01/01/2017"`, `"01-01-2017"` and `"01-2017"` are NOT valid.

## How to define the period

The period string provides a flexible way to extract a time period starting (in combination with `from`) or ending (in combination with `to`) at a given moment. Moreover, by using only the `period` as argument, it will cover all cases where one is interesed in *the last x days/months/years/...*.
The period string provides a flexible way to extract a time period starting (in combination with `from`) or ending (in combination with `to`) at a given moment. Moreover, by using only the `period` as argument, it will cover all cases where one is interested in *the last x days/months/years/...*.

Some examples are:

Expand All @@ -59,15 +59,15 @@ In general, the period string should be provided as `P#Y#M#DT#H#M#S`, where P de
* `M` - minutes
* `S` - seconds

`T` is required if codes about sub-day resolution (day, minutes, hours) is part of the period string. Furthermore, `D` and `W` are mutually exclusive.
`T` is required if codes about sub-day resolution (day, minutes, hours) is part of the period string. Furthermore, `D` and `W` are mutually exclusive.

More examples of valid period strings are:

* `P1DT12H` : period of 1 day and 12 hours
* `P2WT12H` : period of 2 weeks and 12 hours
* `P1Y6M3DT4H20M30S`: period of 1 year, six months, 3 days, 4 hours, 20 minutes and 30 seconds

## Example applications
## Examples

```{r loadlibrary, warning = FALSE}
library(wateRinfo)
Expand Down
12 changes: 6 additions & 6 deletions vignettes/wateRinfo.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The [waterinfo.be](https://www.waterinfo.be) API uses a system of identifiers, c
library(wateRinfo)
```

## Downloading with known `ts` identifier
## Download with known `ts` identifier

In case you already know the `ts_id` identifier that defines your time serie, the package provides the function `get_timeseries_tsid()` to download a specific period of the time series.

Expand All @@ -44,13 +44,13 @@ As such, knowing the identifier is the most straightforward way of downloading a

## Search identifier based on variable name

For a number of variables, the [documentation of the waterinfo.be API](https://www.waterinfo.be/download/9f5ee0c9-dafa-46de-958b-7cac46eb8c23?dl=0) provides a direct overview option of all available VMM measurement stations, using the so-called `Timeseriesgroup_id`. For these variables, the package provides the function `get_stations` to download an overview of available measurement stations and the related `ts_id` identifiers. The latter can be used to [download the time series](#Downloading-with-known-ts-identifier).
For a number of variables, the [documentation of the waterinfo.be API](https://www.waterinfo.be/download/9f5ee0c9-dafa-46de-958b-7cac46eb8c23?dl=0) provides a direct overview option of all available VMM measurement stations, using the so-called `Timeseriesgroup_id`. For these variables, the package provides the function `get_stations()` to download an overview of available measurement stations and the related `ts_id` identifiers. The latter can be used to [download the time series](#download-with-known-ts-identifier).

```{r statofvar}
get_stations("air_pressure")
```

By default, the expected frequency is the 15 min frequency of the time series. However, for some of the variables, multiple frequencies are supported by the API. The package provides a check on the supported variables and frequencies. An overview of the currently supported variables can be requested with the command `supported_variables()` (either in dutch, `nl`, or in english, `en`). Actually, more variables are available with the API (see next section), but for each of these variables the `get_stations` function is supported (i.e. the `Timeseriesgroup_id` is documented by VMM).
By default, the expected frequency is the 15 min frequency of the time series. However, for some of the variables, multiple frequencies are supported by the API. The package provides a check on the supported variables and frequencies. An overview of the currently supported variables can be requested with the command `supported_variables()` (either in Dutch, `nl`, or in English, `en`). Actually, more variables are available with the API (see next section), but for each of these variables the `get_stations()` function is supported (i.e. the `Timeseriesgroup_id` is documented by VMM).

```{r suppvar}
supported_variables("en") %>%
Expand Down Expand Up @@ -78,7 +78,7 @@ subset_of_columns <- stations %>% select(ts_id, station_no, station_name,
knitr::kable(subset_of_columns)
```

When interesed in the data of `Herentals_ME`, we can use the corresponding `ts_id` to download the time series of PET with a yearly frequency and make a plot with `ggplot`:
When interested in the data of `Herentals_ME`, we can use the corresponding `ts_id` to download the time series of PET with a yearly frequency and make a plot with `ggplot`:

```{r yearly_pet, fig.width = 7}
pet_yearly <- get_timeseries_tsid("94526042", period = "P10Y")
Expand All @@ -96,7 +96,7 @@ pet_yearly %>%

## Search identifier based on station name

Apart from the option to check the measurement stations that can provide data for a given variable, the package provides the function `get_variables` to get an overview of the available variables for a given station, using the `station_no`. The advantage compared to the `ts_id` is that these `station_no` names are provided by the waterinfo.be website itself when exploring the data. When clicking on a measurement station on the map and checking the time series graph, the `station_no` is provided in the upper left corner in between brackets.
In addition to the option to check the measurement stations that can provide data for a given variable, the package provides the function `get_variables()` to get an overview of the available variables for a given station, using the `station_no`. The advantage compared to the `ts_id` is that these `station_no` names are provided by the waterinfo.be website itself when exploring the data. When clicking on a measurement station on the map and checking the time series graph, the `station_no` is provided in the upper left corner in between brackets.

![Waterinfo.be example printscreen of time series](./waterinfo_screen.png)

Expand All @@ -108,7 +108,7 @@ available_variables %>% select(ts_id, station_name, ts_name,
parametertype_name)
```

The available number of variables depends on the measurement station. The representation is not standardized and depends also from the type of [`meetnet`](http://www.waterinfo.be/default.aspx?path=NL/HIC/Recent_toelichting). Nevertheless, one can derive the required `ts_id` from the list when interpreting the field names. Remark that the datasource can be 4 instead of 1 for specific `meetnetten` (networks). The datasource to use is printed when asking the variables for a station.
The available number of variables depends on the measurement station. The representation is not standardized and also depends on the type of [`meetnet`](http://www.waterinfo.be/default.aspx?path=NL/HIC/Recent_toelichting). Nevertheless, one can derive the required `ts_id` from the list when interpreting the field names. Remark that the datasource can be 4 instead of 1 for specific `meetnetten` (networks). The datasource to use is printed when asking the variables for a station.

In order to download the 10 min time series water level data for the station in Sint-Amands tij/Zeeschelde, the `ts_id = 55419010` can be used in the `get_timeseries_tsid()` function, taking into account the `datasource = 4` (default is 1):

Expand Down

0 comments on commit c0ef6f3

Please sign in to comment.