Skip to main content

A Python wrapper for the NSW Government's Beachwatch API.

Project description

beachwatch 🏖️

Testing versions License

beachwatch is a Python wrapper for the NSW Government's Beachwatch API.

In their own words:

"Beachwatch and our partners monitor water quality at swim sites to ensure that recreational water environments are managed as safely as possible so that as many people as possible can benefit from using the water."

With this package you can retrieve data about a NSW beach's water pollution forecast, water quality rating, coordinates and more.

Installation

pip install beachwatch

Usage

There is only one function - get_beaches() function, which returns Beach objects:

>>> get_beaches() # Returns a list of all Beach objects.
>>> get_beaches("Bondi Beach") # Returns a list with the specified beach.
>>> get_beaches("Bondi Beach", "Whale Beach") # Returns a list with the specifies beaches.

The Beach object:

class Beach:
    """A NSW beach.

    Attributes
    ----------
    identifier : str
         Unknown but likely a unique ID within the Beachwatch database.
    name : str
         The name of the beach.
    pollution_forecast : str
         The latest water quality pollution forecast.
    pollution_forecast_timestamp : datetime.datetime
         What time the forecast was issued by Beachwatch.
    latest_result : str
         A water quality rating based on the number of bacteria (enterococci)
         in the most recent water sample.
    latest_result_rating : int
        The latest water quality result, rated from 1 to 4 to indicate
        suitability for swimming.
    latest_result_observation_timestamp : datetime.datetime
         The most recent sampling date.
    geometry : dict
         A GeoJSON feature with the coordinates of the beach.
    """

Note that the Beach object is not meant to be instantiated directly.

Example

>>> bondi = get_beaches("Bondi Beach")[0]
>>> bondi.pollution_forecast
    'Good'

Important

Beachwatch notes on their website that forecasts "are predictions of water quality only and are not 100% accurate. Beachwatch cannot guarantee the accuracy of any of the results or outputs from this model. Any reliance you place on such information is strictly at your own risk."

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

beachwatch-0.1.2.tar.gz (5.2 kB view hashes)

Uploaded Source

Built Distribution

beachwatch-0.1.2-py3-none-any.whl (5.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page