Buoyant
Buoyant is a Python wrapper for grabbing buoy data from the National Buoy Data Center. It parses CSV from the SDF endpoint and images from the BuoyCam service.
The NBDC provides a list and a map of active buoys.
Hello buoy example:
> from buoyant import Buoy
> buoy = Buoy(13010)
Construct the Buoy object with the station ID. It's an alphanumeric code. If its numeric, an integer works fine.
More examples:
> from buoyant import Buoy
> buoy = Buoy('0Y2W3')
> buoy.air_pressure_at_sea_level
Observation(1014.1, 'hPa')
```
Get buoy location.
```python
> buoy.coords
(44.794, -87.313)
```
Get the time the measurements were made. This can be some time ago!
```python
> buoy.air_pressure_at_sea_level.datetime
datetime.datetime(2015, 8, 18, 11, 40, tzinfo=<UTC>)
```
Not all stations report all data at all times. Be prepared to handle empty attributes.
```python
> buoy.wave_height
None
```
Clear the buoy object's data dictionary. This isn't very useful, since the buoys update only every hour or so.
```
> buoy.refresh()
The Observation object is numeric value (a float) with two additional attributes, unit and value. Generally unit this is an abbreviation for a metric unit or composition of units. You can use Observations just like numeric objects, and use the value or unit field when formatting:
> pressure = buoy.air_pressure_at_sea_level
Observation(1014.1, 'hPa')
> min(pressure, 1020)
Observation(1014.1, 'hPa')
> '{0.value} [{0.unit}]'.format(pressure)
'1014.1 [hPa]'
Images
Some buoys have cameras! If the buoy doesn't have an active camera, a placeholder image provided by the NBDC will be returned.
> station = Buoy(41009)
> station.image_url
'http://www.ndbc.noaa.gov/images/buoycam/Z14C_2014_11_01_2200.jpg'
Save image as a file 'out.jpg'
> station.write_image('out.jpg')
Get raw image as a BytesIO object
> station.image
<_io.BytesIO object>
> station.url
'http://www.ndbc.noaa.gov/station_page.php?station=41009'
No data
There are two ways to a buoy can be missing a certain data field. Either there's no recent observation, or that buoy doesn't observe that datum.
> buoy = Buoy('0Y2W3')
> buoy.winds
# None, because while this is usually recorded, it hasn't been lately.
> sturgeon.waves
None
Measurements included
- air_pressure_at_sea_level
- air_temperature
- currents
- sea_floor_depth_below_sea_surface
- sea_water_electrical_conductivity
- sea_water_salinity
- sea_water_temperature
- waves
- winds
Currents and Waves and Wind
Wave and wind data have multiple data points, the are returned as dicts.
Currents data is returned as a list of dicts with current information at different times/depths. It's not well-documented on the NBDC site, so good luck!
Compatibility
Buoyant is compatible with Python 3.5+.
License
Buoyant is licensed under the GPL.
Metadata
Release files for buoyant 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| buoyant-0.7.0.macosx-10.13-x86_64.tar.gz | 9.7 kB | Without provenance | Details for buoyant-0.7.0.macosx-10.13-x86_64.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| buoyant-0.7.0-py3-none-any.whl | Python 3 | none | any | Details for buoyant-0.7.0-py3-none-any.whl |
Total release size: 29.0 kB
Release files / buoyant-0.7.0.macosx-10.13-x86_64.tar.gz
| Download URL | buoyant-0.7.0.macosx-10.13-x86_64.tar.gz |
|---|---|
| Size | 9.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d3038f7619348cc1cd1609252cacb2958d67d1d070b2c4740f18078bdbef611d
|
|
BLAKE2b-256 checksum How to use checksums |
28e58cef7bfd175e00348c55c668a511498609ad6fb99f479a55ee5d77c8ac2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.6
|
Release files / buoyant-0.7.0-py3-none-any.whl
| Download URL | buoyant-0.7.0-py3-none-any.whl |
|---|---|
| Size | 19.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
13813fa94c5008e9d5bc4fc067cb7c798e37192f82fbc112356f908509c725ef
|
|
BLAKE2b-256 checksum How to use checksums |
72de52be470db5cb72f075f52c71ec2612fe04e2e509343827c9a4c913e59dda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.6
|
Security for buoyant 0.7.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.