Skip to main content

The nautical package is able to lookup NOAA buoy data including swell and wave information.

Project description

Nautical

Author: Brent Barbachem
Alias: barbacbd
Date: May 18, 2019

Description

A python based web scraper to grab the buoy data from NOAA. The scraper utilizes kml parsing and BeautifulSoup to parse through data found online. NOAA is very kind in the fact that they allow the lookup of Buoy data very easily using the same url with the id of the buoy at the end of the url. We can grab all of the buoy ids, append the id to the url, and get several tables of output from the url. All of the data stored in the tables is updated in 30 minute increments.

Structure

error

The module contains the custom exception used in this package.

class NauticalError(Exception):

In the event of an error generated by this package, the user should except NauticalError.

io

The module contains the majority of the code where the user can read all buoy data, parse kml, parse beautiful soup html output, and grab some of the specific data from the tables that we are looking for.

location

The module contains a 3D Point class that can be used to store locations as well as determine distance to and from other points.

The module also provides the user with a simple distance function to provide distance between two points and a function to determine if the point is located within a specified area.

noaa

The module contains classes to store/utilize/manipulate swell and wave data read in from NOAA's website. There are also some extra functions such as getting the sea state based on the current wave height.

sea_state

Module to allow the user to estimate the current sea state based on wave heights.

Sea State Wave Height (meters)
0 0 - 0
1 0 - 0.1
2 0.1 - 0.5
3 0.5 - 1.25
4 1.25 - 2.5
5 2.5 - 4.0
6 4.0 - 6.0
7 6.0 - 9.0
8 9.0 - 14.0
9 14.0+

tests

The module contains the unit tests for the Nautical package.

The module contains the link to the executable to run all tests for the package with the executable named NauticalTests.

time

Time module to parse and store the time as it is represented from NOAA's webpages.

units

Utility package to provide the user with the easy ability to alter the units for the data.

The following display the supported unit types for each category:

Time
Seconds
Minutes
Hours
Days
Temperature
Fahrenheit
Celsius
Speed
Knots
Meters per second
Miles per hour
Kilometers per hour
Feet per second
Distance
Centimeters
Feet
Yards
Meters
Milometers
Miles
Nautical Miles

The user can convert values to a different unit IFF the units are in the same class.

from nautical.units.conversion import convert

def convert(value, init_units, final_units):
    """
    Convert the value given the current units to the new units. If the
    units are not in the same set of units then the value cannot be converted,
    and None will be returned.
    """

Examples

Sources

NOAA categorizes all buoys by a source. We can obtain all sources and the buoys the are cateogrized with each source with one function.

from nautical.io.sources import get_buoy_sources

sources = get_buoy_sources()

If this action was successful, sources will be a dictionary mapping the name of the source to the source object.

We can also obtain the information about each buoy contained in the source.

for _, source in sources.items():
    print(source)

    for buoy in source:
        print("\t{}".format(str(buoy)))

Buoy Location

In the previous example we were able to find all sources and their respective buoys. If we want to search through this list to find a buoy near or at a location we can.

for _, source in sources.items():
    for buoy in source
        location = buoy.location

        if location:
            # determine if the location meets criteria

Buoy Information

In the previous examples we were able to find all of the buoys that NOAA provides updated information about. If the user finds a buoy of interest. If we want to retrieve all of the information for a particular buoy including present and past recordings, we can utilize the tools below.

from nautical.io.buoy import create_buoy

buoy_id = "example_buoy_id"

buoy = create_buoy(buoy_id)

This will return a nautical.noaa.buoy.buoy.Buoy object.

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

nautical-2.2.2.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nautical-2.2.2-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

Details for the file nautical-2.2.2.tar.gz.

File metadata

  • Download URL: nautical-2.2.2.tar.gz
  • Upload date:
  • Size: 22.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for nautical-2.2.2.tar.gz
Algorithm Hash digest
SHA256 ca6698e7abd30c65692873f3b66fc4b8ad9df467647702704543a8aa71d34983
MD5 423c4c4770f27f5b9460785a8a38cf3a
BLAKE2b-256 1fa7bf1edad3c60ed258230450f62d01dfc65840b306f6b405f6598c24664d9e

See more details on using hashes here.

File details

Details for the file nautical-2.2.2-py3-none-any.whl.

File metadata

  • Download URL: nautical-2.2.2-py3-none-any.whl
  • Upload date:
  • Size: 22.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for nautical-2.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 03fa88e94687b540a1c5634e351a41e9dc1dd2493195b84e23b5b8ddc0f81b39
MD5 a91116d28fa82325a620082d352f5435
BLAKE2b-256 627624d1bdc352d1df10a0c222569bae14c89c3a009ce3fdfe476befbf5d062c

See more details on using hashes here.

Supported by

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