Documentation
¶
Overview ¶
Package meteomatics is a client library for the Meteomatics API. See https://www.meteomatics.com/en/api/overview/.
Index ¶
- Constants
- Variables
- type CSVRegionResponse
- type CSVResponse
- type CSVRouteResponse
- type CSVRouteRow
- type CSVRow
- type Client
- func (c *Client) Request(ctx context.Context, ts TimeStringer, ps ParameterStringer, ...) ([]byte, error)
- func (c *Client) RequestCSV(ctx context.Context, ts TimeStringer, ps ParameterStringer, ...) (*CSVResponse, error)
- func (c *Client) RequestCSVRegion(ctx context.Context, ts TimeStringer, ps ParameterStringer, ...) (*CSVRegionResponse, error)
- func (c *Client) RequestCSVRoute(ctx context.Context, ts TimeStringer, ps ParameterStringer, ...) (*CSVRouteResponse, error)
- func (c *Client) RequestJSON(ctx context.Context, ts TimeStringer, ps ParameterStringer, ...) (*JSONResponse, error)
- func (c *Client) RequestJSONRoute(ctx context.Context, ts TimeStringer, ps ParameterStringer, ...) (*JSONRouteResponse, error)
- type ClientOption
- type Error
- type Format
- type FormatString
- type FormatStringer
- type Interval
- type IntervalString
- type IntervalStringer
- type JSONCoordinates
- type JSONData
- type JSONDate
- type JSONResponse
- type JSONRouteData
- type JSONRouteParameter
- type JSONRouteResponse
- type LevelCentimeters
- type LevelHectopascals
- type LevelMeters
- type LevelString
- type LevelStringer
- type Line
- type LocationSlice
- type LocationString
- type LocationStringer
- type NowOffset
- type Parameter
- type ParameterName
- type ParameterSlice
- type ParameterString
- type ParameterStringer
- type Point
- type PointList
- type Polyline
- type PolylineSegment
- type Postal
- type PrecipType
- type RectangleN
- type RectangleRes
- type RequestOptions
- type Time
- type TimePeriod
- type TimeRange
- type TimeSlice
- type TimeString
- type TimeStringer
- type TransportMethod
- type TransportOptions
- type Units
Constants ¶
const DefaultBaseURL = "https://api.meteomatics.com"
DefaultBaseURL is the default base URL.
Variables ¶
var ( FormatGrads = Format{ // contains filtered or unexported fields } FormatCSV = Format{ // contains filtered or unexported fields } FormatHTML = Format{ // contains filtered or unexported fields } FormatHTMLMap = Format{ // contains filtered or unexported fields } FormatJSON = Format{ // contains filtered or unexported fields } FormatNetCDF = Format{ // contains filtered or unexported fields } FormatPNG = Format{ // contains filtered or unexported fields } FormatPNGDefault = Format{ // contains filtered or unexported fields } FormatPNGJet = Format{ // contains filtered or unexported fields } FormatPNGJetSegmented = Format{ // contains filtered or unexported fields } FormatPNGBlueToRed = Format{ // contains filtered or unexported fields } FormatPNGBlueMagenta = Format{ // contains filtered or unexported fields } FormatPNGBlues = Format{ // contains filtered or unexported fields } FormatPNGGray = Format{ // contains filtered or unexported fields } FormatPNGPeriodic = Format{ // contains filtered or unexported fields } FormatPNGPlasma = Format{ // contains filtered or unexported fields } FormatPNGPrism = Format{ // contains filtered or unexported fields } FormatPNGReds = Format{ // contains filtered or unexported fields } FormatPNGSeismic = Format{ // contains filtered or unexported fields } FormatXML = Format{ // contains filtered or unexported fields } )
Formats.
Functions ¶
This section is empty.
Types ¶
type CSVRegionResponse ¶
type CSVRegionResponse struct {
ValidDate time.Time
Parameter ParameterString
Lats []float64
Lons []float64
Values [][]float64
}
A CSVRegionResponse is a response to a CSV region request.
type CSVResponse ¶
type CSVResponse struct {
Parameters []ParameterString
Rows []CSVRow
}
A CSVResponse is a response to a CSV request.
type CSVRouteResponse ¶
type CSVRouteResponse struct {
Parameters []ParameterString
Rows []CSVRouteRow
}
A CSVRouteResponse is a response to a CSV route request.
type CSVRouteRow ¶
A CSVRouteRow is a CSV route row.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
A Client is a Client.
func NewClient ¶
func NewClient(options ...ClientOption) *Client
NewClient returns a new Client with options set.
func (*Client) Request ¶
func (c *Client) Request(ctx context.Context, ts TimeStringer, ps ParameterStringer, ls LocationStringer, fs FormatStringer, options *RequestOptions) ([]byte, error)
Request performs a raw request. It is the caller's responsibility to interpret the []byte returned.
func (*Client) RequestCSV ¶
func (c *Client) RequestCSV(ctx context.Context, ts TimeStringer, ps ParameterStringer, ls LocationStringer, options *RequestOptions) (*CSVResponse, error)
RequestCSV requests a forecast in CSV format.
func (*Client) RequestCSVRegion ¶
func (c *Client) RequestCSVRegion(ctx context.Context, ts TimeStringer, ps ParameterStringer, ls LocationStringer, options *RequestOptions) (*CSVRegionResponse, error)
RequestCSVRegion requests a region forecast in CSV format.
func (*Client) RequestCSVRoute ¶
func (c *Client) RequestCSVRoute(ctx context.Context, ts TimeStringer, ps ParameterStringer, ls LocationStringer, options *RequestOptions) (*CSVRouteResponse, error)
RequestCSVRoute requests a region forecast in CSV format.
func (*Client) RequestJSON ¶
func (c *Client) RequestJSON(ctx context.Context, ts TimeStringer, ps ParameterStringer, ls LocationStringer, options *RequestOptions) (*JSONResponse, error)
RequestJSON requests a forecast in JSON format.
func (*Client) RequestJSONRoute ¶
func (c *Client) RequestJSONRoute(ctx context.Context, ts TimeStringer, ps ParameterStringer, ls LocationStringer, options *RequestOptions) (*JSONRouteResponse, error)
RequestJSONRoute requests a forecast in JSON format.
type ClientOption ¶
type ClientOption func(*Client)
A ClientOption sets an option on a Client.
func WithBasicAuth ¶
func WithBasicAuth(username, password string) ClientOption
WithBasicAuth sets the username and password for basic authentication.
func WithBearerAuth ¶
func WithBearerAuth(token string) ClientOption
WithBearerAuth adds bearer token header
func WithHTTPClient ¶
func WithHTTPClient(httpClient *http.Client) ClientOption
WithHTTPClient sets the http.Client.
func WithTransportMethod ¶
func WithTransportMethod(method TransportMethod) ClientOption
type Format ¶
type Format struct {
// contains filtered or unexported fields
}
A Format is a format.
func (Format) ContentType ¶
ContentType returns f's content type.
func (Format) FormatString ¶
func (f Format) FormatString() FormatString
FormatString returns f as a FormatString.
type FormatStringer ¶
type FormatStringer interface {
ContentType() string
FormatString() FormatString
}
A FormatStringer is something that can behave as a format.
type Interval ¶
An Interval is a time.Duration.
func (Interval) IntervalString ¶
func (i Interval) IntervalString() IntervalString
IntervalString returns i as an IntervalString.
type IntervalString ¶
type IntervalString string
An IntervalString is a string representation of an interval.
const ( Interval5Min IntervalString = "5min" Interval10Min IntervalString = "10min" Interval15Min IntervalString = "15min" Interval30Min IntervalString = "30min" Interval1H IntervalString = "1h" Interval3H IntervalString = "3h" Interval6H IntervalString = "6h" Interval12H IntervalString = "12h" Interval24H IntervalString = "24h" )
Intervals.
func (IntervalString) IntervalString ¶
func (s IntervalString) IntervalString() IntervalString
IntervalString returns s as an IntervalString.
type IntervalStringer ¶
type IntervalStringer interface {
IntervalString() IntervalString
}
An IntervalStringer can be converted to an IntervalString.
type JSONCoordinates ¶
type JSONCoordinates struct {
Dates []JSONDate `json:"dates"`
Lat float64 `json:"lat"`
Lon float64 `json:"lon"`
StationID string `json:"station_id"`
}
A JSONCoordinates is a series of values.
type JSONData ¶
type JSONData struct {
Coordinates []JSONCoordinates `json:"coordinates"`
Parameter ParameterString `json:"parameter"`
}
A JSONData is a parameter measured at a coordinate.
type JSONResponse ¶
type JSONResponse struct {
Version string `json:"version"`
User string `json:"user"`
DateGenerated time.Time `json:"dateGenerated"`
Status string `json:"status"`
Data []JSONData `json:"data"`
}
A JSONResponse is a JSON response.
func (*JSONResponse) Error ¶
func (r *JSONResponse) Error() string
type JSONRouteData ¶
type JSONRouteData struct {
Lat float64 `json:"lat"`
Lon float64 `json:"lon"`
Date time.Time `json:"date"`
Parameters []JSONRouteParameter `json:"parameters"`
}
A JSONRouteData is a JSON route data.
type JSONRouteParameter ¶
type JSONRouteParameter struct {
Parameter ParameterString `json:"parameter"`
Value float64 `json:"value"`
}
A JSONRouteParameter is a JSON route parameter.
type JSONRouteResponse ¶
type JSONRouteResponse struct {
Version string `json:"version"`
User string `json:"user"`
DateGenerated time.Time `json:"dateGenerated"`
Status string `json:"status"`
Data []JSONRouteData `json:"data"`
}
A JSONRouteResponse is a response to a JSON route request.
func (*JSONRouteResponse) Error ¶
func (r *JSONRouteResponse) Error() string
type LevelCentimeters ¶
type LevelCentimeters int
A LevelCentimeters is level in centimeters.
func (LevelCentimeters) LevelString ¶
func (l LevelCentimeters) LevelString() LevelString
LevelString returns l as a LevelString.
type LevelHectopascals ¶
type LevelHectopascals int
A LevelHectopascals is level in hectopascals.
func (LevelHectopascals) LevelString ¶
func (l LevelHectopascals) LevelString() LevelString
LevelString returns l as a LevelString.
type LevelMeters ¶
type LevelMeters int
A LevelMeters is level in meters.
func (LevelMeters) LevelString ¶
func (l LevelMeters) LevelString() LevelString
LevelString returns l as a LevelString.
type LevelStringer ¶
type LevelStringer interface {
LevelString() LevelString
}
A LevelStringer can be converted to a LevelString.
type Line ¶
A Line is a line.
func (Line) LocationString ¶
func (l Line) LocationString() LocationString
LocationString returns l as a LocationString.
type LocationSlice ¶
type LocationSlice []LocationStringer
A LocationSlice is a slice of LocationStringers.
func (LocationSlice) LocationString ¶
func (s LocationSlice) LocationString() LocationString
LocationString returns s as a LocationString.
type LocationString ¶
type LocationString string
A LocationString is a string representing a location.
const ( LocationWorld LocationString = "world" LocationGlobal LocationString = "global" LocationAfrica LocationString = "africa" LocationAsia LocationString = "asia" LocationAustralia LocationString = "australia" LocationEurope LocationString = "europe" LocationNorthAmerica LocationString = "north-america" LocationSouthAmerica LocationString = "south-america" )
Location shortcuts.
func (LocationString) LocationString ¶
func (s LocationString) LocationString() LocationString
LocationString returns s as a LocationString.
type LocationStringer ¶
type LocationStringer interface {
LocationString() LocationString
}
A LocationStringer can be converted to a LocationString.
type NowOffset ¶
A NowOffset is a time relative to now.
func (NowOffset) TimeString ¶
func (o NowOffset) TimeString() TimeString
TimeString returns o as a TimeString.
type Parameter ¶
type Parameter struct {
Name ParameterName
Level LevelStringer
Interval IntervalStringer
Units Units
}
A Parameter is a parameter.
func (Parameter) ParameterString ¶
func (p Parameter) ParameterString() ParameterString
ParameterString returns p as a ParameterString.
type ParameterName ¶
type ParameterName string
A ParameterName is a parameter name.
const ( ParameterTemperature ParameterName = "t" ParameterTemperatureMean ParameterName = "t_mean" ParameterTemperatureMin ParameterName = "t_min" ParameterTemperatureMax ParameterName = "t_max" ParameterRelativeHumidity ParameterName = "relative_humidity" ParameterAbsoluteHumidity ParameterName = "absolute_humidity" ParameterDewPoint ParameterName = "dew_point" ParameterPressureMSL ParameterName = "msl_pressure" ParameterPressureSurface ParameterName = "sfc_pressure" ParameterPressure ParameterName = "pressure" ParameterAirDensity ParameterName = "air_density" ParameterWindSpeed ParameterName = "wind_speed" ParameterWindDirection ParameterName = "wind_direction" ParameterWindSpeedU ParameterName = "wind_speed_u" ParameterWindSpeedV ParameterName = "wind_speed_v" ParameterWindGusts ParameterName = "wind_gusts" ParameterCloudCoverLow ParameterName = "low_cloud_cover" ParameterCloudCoverMedium ParameterName = "medium_cloud_cover" ParameterCloudCoverHigh ParameterName = "high_cloud_cover" ParameterCloudCoverTotal ParameterName = "total_cloud_cover" ParameterCloudCoverEffective ParameterName = "effective_cloud_cover" ParameterPrecipitation ParameterName = "precip" ParameterPrecipitationType ParameterName = "precip_type" ParameterPrecipitationProbability ParameterName = "prob_precip" ParameterHail ParameterName = "hail" ParameterEvaporation ParameterName = "evaporation" ParameterCAPE ParameterName = "cape" ParameterLiftedIndex ParameterName = "lifted_index" ParameterThunderstormProbablility ParameterName = "prob_tstorm" ParameterFrostDepth ParameterName = "frost_depth" ParameterSnowMelt ParameterName = "snow_melt" ParameterSnowDepth ParameterName = "snow_depth" ParameterSnowLine ParameterName = "snow_line" ParameterFreezingLevel ParameterName = "freezing_level" ParameterFreezingLevelAGL ParameterName = "freezing_level_agl" ParameterGeopotentialHeight ParameterName = "geopotential_height" ParameterRadiationClearSky ParameterName = "clear_sky_rad" ParameterEnergyClearSky ParameterName = "clear_sky_energy" ParameterRadiationDiffuse ParameterName = "diffuse_rad" ParameterRadiationDirect ParameterName = "direct_rad" ParameterRadiationGlobal ParameterName = "global_rad" ParameterPolarVortex ParameterName = "polar_vortex" )
Parameter names.
type ParameterSlice ¶
type ParameterSlice []ParameterStringer
A ParameterSlice is a slice of ParameterStringers.
func (ParameterSlice) ParameterString ¶
func (s ParameterSlice) ParameterString() ParameterString
ParameterString returns s as a ParameterString.
type ParameterString ¶
type ParameterString string
A ParameterString is a string representing a parameter.
func (ParameterString) ParameterString ¶
func (s ParameterString) ParameterString() ParameterString
ParameterString returns s as a ParameterString.
type ParameterStringer ¶
type ParameterStringer interface {
ParameterString() ParameterString
}
A ParameterStringer can be converted to a ParameterString.
type Point ¶
A Point is a point.
func (Point) LocationString ¶
func (p Point) LocationString() LocationString
LocationString returns p as a LocationString.
type PointList ¶
type PointList []Point
A PointList is a list of Points.
func (PointList) LocationString ¶
func (l PointList) LocationString() LocationString
LocationString returns l as a LocationString.
type Polyline ¶
type Polyline struct {
Start Point
Segments []PolylineSegment
}
A Polyline is a polyline.
func (Polyline) LocationString ¶
func (p Polyline) LocationString() LocationString
LocationString returns p as a LocationString.
type PolylineSegment ¶
A PolylineSegment is a segment of a Polyline.
type Postal ¶
A Postal is a country code and a ZIP code.
func (Postal) LocationString ¶
func (p Postal) LocationString() LocationString
LocationString returns p as a LocationString.
type PrecipType ¶
type PrecipType int
PrecipType is a type of precipitation.
const ( PrecipNone PrecipType = 0 PrecipRain PrecipType = 1 PrecipRainAndSnowMixed PrecipType = 2 PrecipSnow PrecipType = 3 PrecipSleet PrecipType = 4 PrecipFreezingRain PrecipType = 5 )
Precipitation types.
type RectangleN ¶
A RectangleN is a rectangle with a number of points.
func (RectangleN) LocationString ¶
func (r RectangleN) LocationString() LocationString
LocationString returns r as a LocationString.
type RectangleRes ¶
A RectangleRes is a rectangle with a resolution.
func (RectangleRes) LocationString ¶
func (r RectangleRes) LocationString() LocationString
LocationString returns r as a LocationString.
type RequestOptions ¶
type RequestOptions struct {
Source string
TemporalInterpolation string
EnsembleSelect string
ClusterSelect string
Timeout int
Route bool
}
RequestOptions are per-request options.
func (*RequestOptions) Values ¶
func (o *RequestOptions) Values() url.Values
Values returns the url.Values that set the request options defined by o.
type Time ¶
A Time is a time.
func (Time) TimeString ¶
func (t Time) TimeString() TimeString
TimeString returns t as a TimeString.
type TimePeriod ¶
A TimePeriod is a time period.
func (TimePeriod) TimeString ¶
func (p TimePeriod) TimeString() TimeString
TimeString returns p as a TimeString.
type TimeRange ¶
A TimeRange is a range of times.
func (TimeRange) TimeString ¶
func (r TimeRange) TimeString() TimeString
TimeString returns r as a TimeString.
type TimeSlice ¶
type TimeSlice []TimeStringer
A TimeSlice is a slice of TimeStringers.
func (TimeSlice) TimeString ¶
func (s TimeSlice) TimeString() TimeString
TimeString returns s as a TimeString.
type TimeString ¶
type TimeString string
A TimeString is a string representing a time.
const ( TimeNow TimeString = "now" TimeTomorrow TimeString = "tomorrow" TimeYesterday TimeString = "yesterday" )
Time shortcuts.
func (TimeString) TimeString ¶
func (s TimeString) TimeString() TimeString
TimeString returns s as a TimeString.
type TimeStringer ¶
type TimeStringer interface {
TimeString() TimeString
}
A TimeStringer can be converted to a TimeString.
type TransportMethod ¶
type TransportMethod string
const ( MethodGet TransportMethod = http.MethodGet MethodPost TransportMethod = http.MethodPost )
type TransportOptions ¶
type TransportOptions struct {
Method string
}
type Units ¶
type Units string
A Units is a string representing a unit.
const ( UnitsBeaufort Units = "bft" UnitsCelsius Units = "C" UnitsDegrees Units = "d" UnitsFahrenheit Units = "F" UnitsGramsPerCubicMeter Units = "gm3" UnitsHectopascals Units = "hPa" UnitsIndex Units = "idx" UnitsJoules Units = "J" UnitsJoulesPerKilogram Units = "JKg" UnitsKelvin Units = "K" UnitsKilometersPerHour Units = "kmh" UnitsKilogramsPerCubicMeter Units = "kgm3" UnitsKnots Units = "kn" UnitsMeters Units = "m" UnitsMillimeters Units = "mm" UnitsMetersPerSecond Units = "ms" UnitsOctas Units = "octas" UnitsPercentage Units = "p" UnitsPascals Units = "Pa" UnitsWattsPerSquareMeter Units = "W" UnitsWattHoursPerSquareMeter Units = "Wh" UnitsWattSecondsPerSquareMeter Units = "Ws" )
Units.
