nautical.noaa.buoy package

Submodules

nautical.noaa.buoy.buoy module

class nautical.noaa.buoy.buoy.Buoy(station, description: Optional[str] = None, location=None)[source]

Bases: object

__eq__(other)[source]

The stations are considered equal if their station ID is the same as the station IDs are meant to be unique. The special case is SHIP.

Parameters

other – Buoy object to compare to this instance.

Returns

True when the two objects are the same

__hash__()[source]

The reason behind a private station and description is that they are used for the hash function. The hash shouldn’t be able to change during execution.

Returns

hash of the station combined with the hash of the description.

__init__(station, description: Optional[str] = None, location=None) None[source]
Parameters
  • station – ID of the station

  • description – snippet of information to describe this station

  • location – nautical.location.point.Point [optional]

__ne__(other)[source]

See __eq__ for more information.

Returns

The opposite of __eq__ (==)

__str__()[source]

If the location of this buoy is known return the location and the name, otherwise just return the name

Returns

string representation of this Buoy

_update_past(past_data)[source]

Attempt to update the past data, but make sure that this particular NOAA data does not already have a time entry that matches.

Parameters

p – Buoy Data attempting to be added to the past information.

property data

Copy of present Property. This is an expansion function for use when the past was deprecated.

Returns

Copy of the present data stored in this instance

from_dict(buoy_dict)[source]

Fill this instance from a dictionary

static from_json(json_dict)[source]

Return a Buoy object created from a json dictionary

property location

Location Property

Returns

Copy of the location (Point)

property past

Past Property.

Returns

all past instances of Buoy Data objects stored in this instance.

property present

Present Property, the present data stored in this instance. This is the most recent set of buoy data that was retrieved.

Returns

Copy of the present data stored in this instance

to_json()[source]

Create a json dictionary representation of this instance

nautical.noaa.buoy.buoy_data module

class nautical.noaa.buoy.buoy_data.BuoyData[source]

Bases: object

Class to contain all information included in a NOAA data point for a buoy. A buoy can also include weather stations.

__contains__(item)[source]

Returns True when the value exists and is set

__iter__()[source]

Provide a user friendly mapping of variable names to values stored in this Buoy Data Object

apd
atmp
chill
clcon
cond
dd
depth
dewp
dpd
property epoch_time

Epoch time property. Converts the nautical time to the epoch time. The function assumes that the data is in UTC time.

Returns

Seconds since the epoch in UTC, 0 on failure

from_dict(buoy_data_dict: Dict[str, Any])[source]

Fill this object from the data stored in a dictionary where the key should match a slot or object variable

Parameters

buoy_data_dict – Dictionary containing the data about this buoy

static from_json(json_data)[source]

Fill an instance from the json_data.

gst
heat
lwrad
mm
mwd
nmi
o2pct
o2ppm
otmp
ph
pres
ptdy
sal
set(key, value)[source]

Set a key, value pair. This function is intended to replace __setattr__ for simplcity. The function will also attempt to convert the noaa time to a formatted time that is readable.

Parameters
  • key – the internal variable name

  • value – the value we wish to set the variable to

srad1
steepness
swd
swh
swp
swrad
tide
time
to_json()[source]

Return the object as a json dict

turb
vis
wdir
wspd
wspd10m
wspd20m
wtmp
wvht
wwd
wwh
wwp
year
nautical.noaa.buoy.buoy_data._find_parameter_units(key: str) str[source]

Function that will attempt to find the units associated with the key. If no units are found, None is returned.

Parameters

key – Name of the parameter

Returns

string of the type of units if there are units associated with the parameter.

nautical.noaa.buoy.source module

class nautical.noaa.buoy.source.Source(name: str, description: Optional[str] = None)[source]

Bases: object

The source is a grouping or categorization of buoy sources.

__contains__(item)[source]

Determine if the item buoy exists in our dictionary. When item is a Buoy, check if the hash of the item is in the dict. when item is an int, assume this is the hash and check for it in the dict. When item is a str, assume this is the station name check if its in the dict.

Parameters

item – should be a Buoy, String or int

Returns

True when the item is found in this instance.

__copy__()[source]

Override the copy function to only keep specific values. Notice that the buoys are not kept

__deepcopy__(memo)[source]

Override the deepcopy for this instance to include all private variables

__eq__(other)[source]

Determine if this instance is the same as the other source

Returns

True if name and description match

__init__(name: str, description: Optional[str] = None)[source]
Parameters
  • name – Name of the data source or grouping of data

  • description – Description tag of the data source

__iter__()[source]

Override iterate to provide the user with the buoys in this instance. Yield the Buoy objects in this instance.

__len__()[source]

Return the number of buoys in this source

__ne__(other)[source]

See __eq__ for more information

Returns

True if the name or description do not match

__str__()[source]

String representation of this instance

Returns

string representation of the source

add_buoy(buoy)[source]

Add a buoy to this instance

Note

Buoy names are case sensitive to ensure they are unique

Parameters

buoy – buoy to be added to the list of buoys.

Returns

True if the buoy was added to the list of buoys

property buoys

Buoys Property for this instance

Returns

Copy of the current set of buoys contained in this instance

from_dict(source_dict)[source]

Fill in instance from a dictionary

static from_json(json_dict)[source]

Create/Fill/Return an instance from a json dictionary

get_buoy(station)[source]

Get a buoy where the station matches the station of the Buoy

Note

Buoy names are case sensitive to ensure they are unique

Parameters

station – name of the buoy station

Returns

Buoy with a matching station, None if one was not found.

to_json()[source]

Convert this instance to a json dictionary

class nautical.noaa.buoy.source.SourceType(value)[source]

Bases: Enum

An enumeration.

ALL = 0
INTERNATIONAL_PARTNERS = 1
IOOS_PARTNERS = 2
MARINE_METAR = 3
NDBC_METEOROLOGICAL_OCEAN = 4
NERRS = 5
NOS_CO_OPS = 6
SHIPS = 7
TAO = 8
TSUNAMI = 9
classmethod as_strings(source_type)[source]

Get the string value based on the type of source

Parameters

source_type – Type of source from the enumeration

Returns

List of strings that match the source type

Module contents

class nautical.noaa.buoy.Buoy(station, description: Optional[str] = None, location=None)[source]

Bases: object

__eq__(other)[source]

The stations are considered equal if their station ID is the same as the station IDs are meant to be unique. The special case is SHIP.

Parameters

other – Buoy object to compare to this instance.

Returns

True when the two objects are the same

__hash__()[source]

The reason behind a private station and description is that they are used for the hash function. The hash shouldn’t be able to change during execution.

Returns

hash of the station combined with the hash of the description.

__init__(station, description: Optional[str] = None, location=None) None[source]
Parameters
  • station – ID of the station

  • description – snippet of information to describe this station

  • location – nautical.location.point.Point [optional]

__ne__(other)[source]

See __eq__ for more information.

Returns

The opposite of __eq__ (==)

__str__()[source]

If the location of this buoy is known return the location and the name, otherwise just return the name

Returns

string representation of this Buoy

_update_past(past_data)[source]

Attempt to update the past data, but make sure that this particular NOAA data does not already have a time entry that matches.

Parameters

p – Buoy Data attempting to be added to the past information.

property data

Copy of present Property. This is an expansion function for use when the past was deprecated.

Returns

Copy of the present data stored in this instance

from_dict(buoy_dict)[source]

Fill this instance from a dictionary

static from_json(json_dict)[source]

Return a Buoy object created from a json dictionary

property location

Location Property

Returns

Copy of the location (Point)

property past

Past Property.

Returns

all past instances of Buoy Data objects stored in this instance.

property present

Present Property, the present data stored in this instance. This is the most recent set of buoy data that was retrieved.

Returns

Copy of the present data stored in this instance

to_json()[source]

Create a json dictionary representation of this instance

class nautical.noaa.buoy.BuoyData[source]

Bases: object

Class to contain all information included in a NOAA data point for a buoy. A buoy can also include weather stations.

__contains__(item)[source]

Returns True when the value exists and is set

__iter__()[source]

Provide a user friendly mapping of variable names to values stored in this Buoy Data Object

apd
atmp
chill
clcon
cond
dd
depth
dewp
dpd
property epoch_time

Epoch time property. Converts the nautical time to the epoch time. The function assumes that the data is in UTC time.

Returns

Seconds since the epoch in UTC, 0 on failure

from_dict(buoy_data_dict: Dict[str, Any])[source]

Fill this object from the data stored in a dictionary where the key should match a slot or object variable

Parameters

buoy_data_dict – Dictionary containing the data about this buoy

static from_json(json_data)[source]

Fill an instance from the json_data.

gst
heat
lwrad
mm
mwd
nmi
o2pct
o2ppm
otmp
ph
pres
ptdy
sal
set(key, value)[source]

Set a key, value pair. This function is intended to replace __setattr__ for simplcity. The function will also attempt to convert the noaa time to a formatted time that is readable.

Parameters
  • key – the internal variable name

  • value – the value we wish to set the variable to

srad1
steepness
swd
swh
swp
swrad
tide
time
to_json()[source]

Return the object as a json dict

turb
vis
wdir
wspd
wspd10m
wspd20m
wtmp
wvht
wwd
wwh
wwp
year
class nautical.noaa.buoy.Source(name: str, description: Optional[str] = None)[source]

Bases: object

The source is a grouping or categorization of buoy sources.

__contains__(item)[source]

Determine if the item buoy exists in our dictionary. When item is a Buoy, check if the hash of the item is in the dict. when item is an int, assume this is the hash and check for it in the dict. When item is a str, assume this is the station name check if its in the dict.

Parameters

item – should be a Buoy, String or int

Returns

True when the item is found in this instance.

__copy__()[source]

Override the copy function to only keep specific values. Notice that the buoys are not kept

__deepcopy__(memo)[source]

Override the deepcopy for this instance to include all private variables

__eq__(other)[source]

Determine if this instance is the same as the other source

Returns

True if name and description match

__init__(name: str, description: Optional[str] = None)[source]
Parameters
  • name – Name of the data source or grouping of data

  • description – Description tag of the data source

__iter__()[source]

Override iterate to provide the user with the buoys in this instance. Yield the Buoy objects in this instance.

__len__()[source]

Return the number of buoys in this source

__ne__(other)[source]

See __eq__ for more information

Returns

True if the name or description do not match

__str__()[source]

String representation of this instance

Returns

string representation of the source

add_buoy(buoy)[source]

Add a buoy to this instance

Note

Buoy names are case sensitive to ensure they are unique

Parameters

buoy – buoy to be added to the list of buoys.

Returns

True if the buoy was added to the list of buoys

property buoys

Buoys Property for this instance

Returns

Copy of the current set of buoys contained in this instance

from_dict(source_dict)[source]

Fill in instance from a dictionary

static from_json(json_dict)[source]

Create/Fill/Return an instance from a json dictionary

get_buoy(station)[source]

Get a buoy where the station matches the station of the Buoy

Note

Buoy names are case sensitive to ensure they are unique

Parameters

station – name of the buoy station

Returns

Buoy with a matching station, None if one was not found.

to_json()[source]

Convert this instance to a json dictionary

class nautical.noaa.buoy.SourceType(value)[source]

Bases: Enum

An enumeration.

ALL = 0
INTERNATIONAL_PARTNERS = 1
IOOS_PARTNERS = 2
MARINE_METAR = 3
NDBC_METEOROLOGICAL_OCEAN = 4
NERRS = 5
NOS_CO_OPS = 6
SHIPS = 7
TAO = 8
TSUNAMI = 9
classmethod as_strings(source_type)[source]

Get the string value based on the type of source

Parameters

source_type – Type of source from the enumeration

Returns

List of strings that match the source type