envcan

package
v0.0.0-...-bb3eb04 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2021 License: MIT Imports: 13 Imported by: 0

README

envcan

This package provides a service for interfacing with the Environment Canad Weather Office service. It needs to be bootstrapped by running the getstations tool to initialize the list of locations and URLs to retrieve weather data from; once setup the envcan.Service implementation can be used as a weather service for Canadian locations.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidDate is returned if an invalid date qualifier is supplied.
	ErrInvalidDate = errors.New("invalid date supplied")
)

Functions

This section is empty.

Types

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is a very basic weather feed provided by Environment Canada

func NewService

func NewService(logger *zap.Logger, api *weather.API, weatherStationFile string) (*Service, error)

NewService creates a new weather feed for Environment Canada.

type Station

type Station struct {
	URL   string `json:"url"`
	Title string `json:"title"`

	Latitude         float64 `json:"latitude"`
	Longitude        float64 `json:"longitude"`
	SiteType         string  `json:"site_type"`
	SiteProvinceCode string  `json:"site_province_code"`
	// contains filtered or unexported fields
}

Station contains the data about a single weather location reported on by Environment Canada

func (*Station) GetForecast

func (s *Station) GetForecast(ctx context.Context) ([]*weather.WeatherForecast, error)

GetForecast returns the forecast for this station

func (*Station) GetReport

func (s *Station) GetReport(ctx context.Context) (*weather.WeatherReport, error)

GetReport returns the current weather report for this station.

func (*Station) Name

func (s *Station) Name() string

Name returns the printable name of this weather station

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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