GithubHelp home page GithubHelp logo

hillr's Introduction

hillr

A R package for interacting with a Hilltop time series server.
More information on using Hilltop Servers can be found here This package implements many of the features available on a Hilltop server, but not all options are available.

Features

Usage

List of Sites

To get a list of sites available from the endpoint

sites <- getHilltopSites(endpoint = "https://data.hbrc.govt.nz/Envirodata/EMARDiscrete.hts?")

Measurements At A Site

To get a list of measurements at a site

measurements <- getHilltopMeasurements(endpoint = "https://data.hbrc.govt.nz/Envirodata/EMARDiscrete.hts?",
                                                   site = "Maraetotara Lagoon")

Data

To get some data for a site you'll need to know the Hilltop server endpoint, site name, and measurement. The getHilltopData function does basic requests, but to request multiple sites and or measurements, and to get additional metadata you'll need to use the fullGetHilltopData function.

Generally the fullGetHilltopData function is the preferred option.

Discrete (Sample Data)

eColi <- getHilltopData(endpoint = "https://data.hbrc.govt.nz/Envirodata/EMARDiscrete.hts?",
                       site = "Maraetotara Lagoon",
                       measurement = "E. Coli",
                       from = "1/1/2018",
                       to = "1/10/2018")

To get all the metadata for a measurement, or to get data from multiple sites and measurements

data <- fullGetHilltopData(endpoint = "https://data.hbrc.govt.nz/Envirodata/EMARDiscrete.hts?",
                           sites = c("Maraetotara Lagoon", "Ngaruroro River at Fernhill"),
                           measurements = c("E. Coli", "Nitrate Nitrogen"),
                           from = "1/1/2017",
                           to = "1/10/2017",
                           option = "WQ")

Requirements

Installation

In R make sure that you have devtools installed. Remove any preinstalled versions of hillr, then run

devtools::install_github("jeffcnz/hillr")

Authors

  • Jeff Cooke

License

This project is licensed under the MIT License

hillr's People

Contributors

jeffcnz avatar

Stargazers

Mike Taves avatar Elwan avatar

Watchers

James Cloos avatar  avatar Mark Coetzee avatar

Forkers

mjfear elwan3

hillr's Issues

Connection timed out

I was testing the hillr package to download available discharge observations during cyclone Gabrielle and the R package returns a connection timeout when running the list of sites command from the README:

sites <- getHilltopSites(endpoint = "https://data.hbrc.govt.nz/Envirodata/EMARDiscrete.hts?")

Screenshot 2023-05-12 at 16 45 55

does the server need a registration or something?

Gap Tolerance not able to be set in request

For continuous data where there is a gap marked in the data the aggregation may not get done. Hilltop Server can accept a GapTolerance interval to allow it to provide data if the gap is less than the specified interval.
Implementing this functionality would be useful.

Date for summary stats can be confusing

The date returned when an interval is specified and a statistic is the end of the interval, so monthly totals would be timestamped as the first of the following month, daily totals would be timestamped as the following day (the result is for the preceeding interval).
The server can return data with just a date, rather than a date and a time and this date is the last day in the interval, ie more intuitive.
Would be good to implement this functionality.

fullGetHilltopData() Error and not returning a dataframe when given invalid site name

When using fullGetHilltopData(), providing the sites argument with a string vector containing a string that is not a valid request-able site, will result in an error and no data frame returned. Even if you have other valid sites in the sites vector.

githubIssue

`
library(hillr)

wSites<- c("Waiiti Stream at Waihau Road","Waihau Stream at Waihau Road","Mohaka River D/S Ripia River","TEST1")
wMeasurements <- c("Total Nitrogen", "Turbidity (Field)","Total Phosphorus")

webService <- "http://data.hbrc.govt.nz/Envirodata/EMARtest.hts?"

requestData <- fullGetHilltopData(endpoint = webService, sites = wSites, measurements = wMeasurements, option = "WQ")
`

In the above code, "TEST1" is not a valid site to request.

Producing:

"Error in subset.default(wqSampDf, select = -c(Site, Measurement, Units)) :
argument "subset" is missing, with no default"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.