gocean

command module
v0.0.0-...-43c2a68 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2021 License: MIT Imports: 4 Imported by: 0

README

gocean

Go Report Card Maintainability

gocean is a set of NOAA API wrappers and tools written in Go. It is currently under active, initial development.

Table of Contents

Installation

To use the library:

go get -u github.com/webercoder/gocean

To install the binary (assuming GOPATH/bin is in your PATH):

go install github.com/webercoder/gocean

Command-Line Usage

CO-OPS Stations API

The operations below use the following command-line parameter structure (in Go flag syntax):

-begin-date string
    The begin date for the data set.
-count int
    The number of results to display. Only works with the pretty format. (default -1)
-datum string
    The datum to query. Possible values: [CRD IGLD LWD MHHW MHW MTL MSL MLW MLLW NAVD STND] (default "MLLW")
-end-date string
    The end date for the data set.
-format string
    The output format of the results. Possible values: [json xml csv pretty] (default "pretty")
-hours int
    The offset from the start time. (default 24)
-station string
    The station to query.
-time-zone-format string
    The time zone format. Possible values: [gmt lst lst_ldt] (default "lst_ldt")
-units string
    Either english or metric. Possible values: [english metric] (default "english")
Air Gap
gocean coops air_gap

Example:

$ gocean coops air_gap -station 8545556 -count 5
Air gap readings for station 8545556:

2021-05-31 06:48: 130.945ft (Sigma: 0.039, Flags: 0,0,0,0)
2021-05-31 06:54: 130.938ft (Sigma: 0.030, Flags: 0,0,0,0)
2021-05-31 07:00: 130.997ft (Sigma: 0.020, Flags: 0,0,0,0)
2021-05-31 07:06: 131.037ft (Sigma: 0.023, Flags: 0,0,0,0)
2021-05-31 07:12: 131.106ft (Sigma: 0.030, Flags: 0,0,0,0)
Air Pressure
gocean coops air_pressure

Example:

$ gocean coops air_pressure -station 9410230 -count 5
Air pressure readings for station 9410230:

2021-05-31 06:48: 1014.6mbar (Flags: 0,0,0)
2021-05-31 06:54: 1014.6mbar (Flags: 0,0,0)
2021-05-31 07:00: 1014.7mbar (Flags: 0,0,0)
2021-05-31 07:06: 1014.7mbar (Flags: 0,0,0)
2021-05-31 07:12: 1014.7mbar (Flags: 0,0,0)
Air Temperatures
gocean coops air_temperature

Example:

$ gocean coops air_temperature --station 9410230 --count 5
Air temperature readings for station 9410230:

2021-05-31 06:48: 60.3°f
2021-05-31 06:54: 60.1°f
2021-05-31 07:00: 60.3°f
2021-05-31 07:06: 60.1°f
2021-05-31 07:12: 60.1°f
Conductivity
gocean coops conductivity

Example:

$ gocean coops conductivity -station 8447386 -count 5
Conductivity readings for station 8447386:

2021-05-31 06:48: 35.81mS/cm (Flags: 0,0,0)
2021-05-31 06:54: 36.23mS/cm (Flags: 0,0,0)
2021-05-31 07:00: 36.44mS/cm (Flags: 0,0,0)
2021-05-31 07:06: 36.51mS/cm (Flags: 0,0,0)
2021-05-31 07:12: 35.84mS/cm (Flags: 0,0,0)
Visibility
gocean coops visiblity

Example:

$ gocean coops visibility -station 8447412 -count 5
Visibility readings for station 8447412:

2021-05-31 06:48: 1.86nmi (Flags: 0,0,0)
2021-05-31 06:54: 1.86nmi (Flags: 0,0,0)
2021-05-31 07:00: 1.90nmi (Flags: 0,0,0)
2021-05-31 07:06: 3.34nmi (Flags: 0,0,0)
2021-05-31 07:12: 3.38nmi (Flags: 0,0,0)
Tide Predictions
gocean coops predictions

Example:

$ gocean coops predictions -station 9414523 -count 5
Tide predictions for station 9414523:

2021-06-01 06:42: 6.551ft
2021-06-01 06:48: 6.472ft
2021-06-01 06:54: 6.387ft
2021-06-01 07:00: 6.296ft
2021-06-01 07:06: 6.200ft
Water Levels
gocean coops water_level

Example:

$ gocean coops water_level -station 9410230 -count 5
Tide water levels for station 9410230:

2021-05-31 06:48: 0.362ft (Quality: Preliminary, Flags: 1,0,0,0)
2021-05-31 06:54: 0.289ft (Quality: Preliminary, Flags: 1,0,0,0)
2021-05-31 07:00: 0.234ft (Quality: Preliminary, Flags: 1,0,0,0)
2021-05-31 07:06: 0.168ft (Quality: Preliminary, Flags: 1,0,0,0)
2021-05-31 07:12: 0.076ft (Quality: Preliminary, Flags: 1,0,0,0)
Water Temperatures
gocean coops water_temperature

Example:

$ gocean coops water_temperature --station 9410230 --count 5
Water temperature readings for station 9410230:

2021-05-31 06:48: 66.7°f
2021-05-31 06:54: 66.7°f
2021-05-31 07:00: 66.7°f
2021-05-31 07:06: 66.7°f
2021-05-31 07:12: 66.7°f
Wind
gocean coops wind

Example:

$ gocean coops wind -station 9410230 -count 5
Wind readings for station 9410230:

2021-05-31 06:48: 3.89kn from the SW (218.00) with gusts of 5.25kn
2021-05-31 06:54: 2.92kn from the SSW (206.00) with gusts of 5.25kn
2021-05-31 07:00: 2.14kn from the SSW (196.00) with gusts of 4.47kn
2021-05-31 07:06: 5.05kn from the S (188.00) with gusts of 6.61kn
2021-05-31 07:12: 4.67kn from the SSW (198.00) with gusts of 7.00kn
Stations Info API

This isn't an official NOAA API, but it uses the stations list to provide additional information.

Get the Nearest Station
gocean stations

Supported parameters (using Go flag syntax):

-postcode string
    Find stations near this postcode

Example:

$ gocean stations -postcode 94087
Finding nearest station to 94087
The nearest Station is "Redwood City" (ID: 9414523), which is 23.072995 kms away from 94087.

$ gocean stations -postcode 92101
Finding nearest station to 92101
The nearest Station is "San Diego, San Diego Bay" (ID: 9410170), which is 1.130777 kms away from 92101.

Code Structure

Directory Description
/command Command-line options for the main program.
/src/coops Libraries for connecting to the NOAA CO-OPS API.
/src/stations Libraries for retrieving NOAA oceanic station data.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
src
lib

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL