ropensci / wateRinfo

R package to download time series data from waterinfo.be
https://docs.ropensci.org/wateRinfo
MIT License
13 stars 3 forks source link

Improved handling `return_fields` #15

Open stijnvanhoey opened 6 years ago

stijnvanhoey commented 6 years ago

Currently, the return-fields for each of the calls are hard-coded in the package

in get_variables:

    return_fields <- c("station_name", "station_no", "ts_id",
                       "ts_name", "parametertype_name",
                       "stationparameter_name")

in get_timeseries_tsid:

    # define the date fields we require
    return_fields <- c("Timestamp", "Value", "Quality Code")

and in get_stations:

    custom_attributes <- c("dataprovider")
    return_fields <- c("custom_attributes", "station_id", "station_no",
                       "station_name", "stationparameter_name",
                       "ts_unitsymbol", "parametertype_name", "ts_id")

together with the defaults station_latitude and station_longitude.

The decision to keep these has been a (deliberated) decision during the implementation based on the available information.

Still, more flexibility for the user (while keeping proper defaults) could improve the workflow. As an example, the API supports the md_returnfields: station_cartnorthing and station_carteasting as input as well, returning the coordinates in Lambert 72 instead of the default WGS84. Altough conversion can be done in R as well (see for example this function), the argument usage would simplify the workflow.

However, I do not have information or access to the possible arguments (either custom_attributes or md_returnfields) and the waterinfo documentation does not provide an overview as well. @WillemMaetens, is there such an overview available somewhere?

WillemMaetens commented 6 years ago

Info on the various call parameters and options can be found here: http://download.waterinfo.be/tsmdownload/KiWIS/KiWIS?datasource=0&service=kisters&type=queryServices&request=getrequestinfo

stijnvanhoey commented 5 years ago

@WillemMaetens is there an update of your previous link, as the link seems to be broken for the moment?

stijnvanhoey commented 5 years ago

Note to self: http://download.waterinfo.be/tsmdownload/KiWIS/KiWIS?service=kisters&type=queryServices&request=getGroupList&datasource=1&format=html can be used to retrieve the different time series groups.

Full documentation update: http://download.waterinfo.be/tsmdownload/KiWIS/KiWIS?datasource=1&service=kisters&type=queryServices&request=getrequestinfo (matter of adjusting the datasource to 1)