mevv

package
v0.27.4 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: Apache-2.0 Imports: 19 Imported by: 1

Documentation

Overview

Package mevv is for accessing "MacroExpert VillĂĄmVilĂĄg" service.

Index

Constants

View Source
const (
	V0 = Version("v0")
	V1 = Version("v1")
	V2 = Version("v2")
	V3 = Version("v3")
)
View Source
const (
	MacroExpertURLv3Test = `https://frontend-test.macrometeo.hu/webapi/query-civil`
)

Variables

View Source
var ErrAuth = errors.New("authentication error")

Functions

func ReadUserPassw

func ReadUserPassw(filename string) (string, string, error)

ReadUserPassw reads the user/passw from the given file.

Types

type Options

type Options struct {
	Since, Till                      time.Time `json:"-"`
	At                               time.Time `json:"eventDate"`
	Address                          string    `json:"address"`
	ContractID                       string    `json:"referenceNo"`
	URL                              string    `json:"-"`
	Lat                              float64   `json:"locationLat"`
	Lng                              float64   `json:"locationLon"`
	Interval                         int       `json:"interval"`
	NeedThunders, NeedIce, NeedWinds bool      `json:"-"`
	NeedRains, NeedRainsIntensity    bool      `json:"-"`
	NeedTemperature                  bool      `json:"-"`
	ExtendedLightning                bool      `json:"extendedRange"`
	NeedPDF, NeedData                bool      `json:"-"`
	WithStatistics                   bool      `json:"withStatistic"`
	Hourly                           bool      `json:"-"`
}

Options are the space/time coordinates and the required details.

func (Options) Prepare added in v0.26.11

func (opt Options) Prepare() Options

type V3DailyBool added in v0.27.2

type V3DailyBool struct {
	Date  string `json:"dateString"`
	Value bool   `json:"value"`
}

type V3DailyFloat added in v0.27.2

type V3DailyFloat struct {
	Date  string  `json:"dateString"`
	Value float64 `json:"value"`
}

type V3DailyLightning added in v0.27.2

type V3DailyLightning struct {
	EventDateUTC time.Time   `json:"eventDateUtc"`
	EventDate    time.Time   `json:"eventDate"`
	Zone         json.Number `json:"zone"`
	// Type               json.Number `json:"lightningType"`
	Index              int     `json:"index"`
	Altitude           float64 `json:"altitude"`
	CurrentIntensity   float64 `json:"currentIntensity"`
	DistanceFromOrigin float64 `json:"distanceFromOrigin"`
	Inaccuracy         float64 `json:"inaccuracy"`
}

type V3DailyMinMax added in v0.27.2

type V3DailyMinMax struct {
	Date     string  `json:"dateString"`
	MinValue float64 `json:"minValue"`
	MaxValue float64 `json:"maxValue"`
	Value    string  `json:"value"`
}

type V3DailyWind added in v0.27.2

type V3DailyWind struct {
	V3DailyMinMax
	Code float64 `json:"code"`
}

type V3Drought added in v0.26.11

type V3Drought struct {
	FromDate       string
	ToDate         string `json:"toDate"`
	Index1, Index2 bool
}

type V3Error added in v0.26.11

type V3Error struct {
	Field   string `json:"fieldName"`
	Code    string `json:"errorCode"`
	Message string `json:"errorMessage"`
	Serious bool   `json:"isSerious"`
}

func (V3Error) Error added in v0.26.11

func (ve V3Error) Error() string

type V3File added in v0.26.11

type V3File struct {
	UUID        string `json:"uuid"`
	Name        string `json:"fileName"`
	ContentType string `json:"contentType"`
	Data        []byte `json:"data"`
}

type V3Hourly added in v0.27.2

type V3Hourly struct {
	Date string `json:"dateString"`
	Hour string `json:"hour"`
	// Code               json.Number     `json:"code"`
	Settlement string `json:"settlementText"`
	// Value              json.RawMessage `json:"value"`
	Altitude           float64 `json:"altitude"`
	DistanceFromOrigin float64 `json:"distanceFromOrigin"`
}

func (V3Hourly) Time added in v0.27.2

func (h V3Hourly) Time() time.Time

type V3HourlyPrecip added in v0.27.2

type V3HourlyPrecip struct {
	V3Hourly
	Precipitation float64 `json:"precipitation"`
}

type V3HourlyTemp added in v0.27.2

type V3HourlyTemp struct {
	V3Hourly
	MinValue float64 `json:"minValue"`
	MaxValue float64 `json:"maxValue"`
}

type V3HourlyWind added in v0.27.2

type V3HourlyWind struct {
	V3Hourly
	MaxGustKmH float64 `json:"maxgustKmh"`
	Direction  string  `json:"directionCode"`
}

type V3MeasureTemp added in v0.27.2

type V3MeasureTemp struct {
	V3Measurement
}

type V3MeasureWind added in v0.27.2

type V3MeasureWind struct {
	V3Measurement
	Direction  string  `json:"directionCode"`
	MaxGustKmH float64 `json:"maxGustKmH"`
}

type V3Measurement added in v0.26.11

type V3Measurement struct {
	Date               string          `json:"dateString"`
	Hour               string          `json:"hour"`
	Code               json.Number     `json:"code"`
	Settlement         string          `json:"settlementText"`
	Value              json.RawMessage `json:"value"`
	Altitude           float64         `json:"altitude"`
	DistanceFromOrigin float64         `json:"distanceFromOrigin"`
	PrecipitationMax   float64         `json:"precipitationMax"`
	TemperatureMin     float64         `json:"temperatureMin"`
	TemperatureMax     float64         `json:"temperatureMax"`
	MinValue           float64         `json:"minValue"`
	MaxValue           float64         `json:"maxValue"`
	DroughtIndex1      bool            `json:"droughtIndex"`
	DroughtIndex2      bool            `json:"droughtIndex2"`
}

type V3Query added in v0.26.11

type V3Query struct {
	ResultTypes        []string `json:"resultTypes"`
	SelectedOperations []string `json:"selectedOperations"`
	Options
}

func (V3Query) Prepare added in v0.26.11

func (req V3Query) Prepare() V3Query

type V3Request added in v0.26.11

type V3Request struct {
	Query V3Query `json:"query"`
}

type V3Response added in v0.26.11

type V3Response struct {
	Data        V3ResultData `json:"resultData"`
	File        V3File       `json:"file"`
	Errors      []V3Error    `json:"errors"`
	OperationID int          `json:"operationId"`
	Successful  bool         `json:"isSuccessful"`
}

type V3ResultData added in v0.26.11

type V3ResultData struct {
	DateFrom                        time.Time          `json:"dateFrom"`
	DateTo                          time.Time          `json:"dateTo"`
	EventDate                       time.Time          `json:"eventDate"`
	Address                         string             `json:"address"`
	ReferenceNo                     string             `json:"referenceNo"`
	DailyListWind                   []V3DailyWind      `json:"dailyListWind"`
	DailyListPrecipitation          []V3DailyFloat     `json:"dailyListPrecipitation"`
	DailyListPrecipitationIntensity []V3DailyBool      `json:"dailyListPrecipitationIntensity"`
	DailyListIce                    []V3DailyBool      `json:"dailyListIce"`
	DailyListTemperature            []V3DailyMinMax    `json:"dailyListTemperature"`
	LightningList                   []V3DailyLightning `json:"lightingList"`
	ByStationPrecipList             []V3HourlyPrecip   `json:"byStationPrecList"`
	ByStationTempList               []V3HourlyTemp     `json:"byStationTempList"`
	ByStationWindList               []V3HourlyWind     `json:"byStationWindList"`
	AgroFrostList                   []V3Measurement    `json:"agroFrostList"`
	AgroExtendedList                []V3Measurement    `json:"agroFrostExtendedList"`
	Drought                         []V3Drought        `json:"agroDroughtList"`
	DroughtExtendedList             []V3Measurement    `json:"agroDroughtExtendedList"`
	Statistics                      []V3Statistic      `json:"statisticsList"`
	Raw                             json.RawMessage    `json:"-"`
	Lat                             float64            `json:"locationLat"`
	Lon                             float64            `json:"locationLon"`
	Interval                        int                `json:"interval"`
	LightningRadius                 int                `json:"lightningRadius"`
	Visibility                      V3Visibility       `json:"visibility"`
}

type V3Statistic added in v0.26.11

type V3Statistic struct {
	OperationTypeName string  `json:"operationTypeName"`
	Sum               float64 `json:"sum"`
}

type V3Visibility added in v0.26.11

type V3Visibility struct {
	Daily                       bool `json:"hasDailyData"`
	DailyWind                   bool `json:"hasDailyData_Wind"`
	DailyPrecipitation          bool `json:"hasDailyData_Precipitation"`
	DailyPrecipitationIntensity bool `json:"hasDailyData_PrecipitationIntensity"`
	DailyIce                    bool `json:"hasDailyData_Ice"`
	DailyTemperature            bool `json:"hasDailyData_Temperature"`
	Lightning                   bool `json:"hasLightingData"`
	ByStationTemperature        bool `json:"hasByStationTemperature"`
	ByStationPrecipitation      bool `json:"hasByStationPrecipitation"`
	ByStationWind               bool `json:"hasByStationWind"`
	AgroFrost                   bool `json:"hasAgroFrost"`
	AgroFrostExtended           bool `json:"hasAgroFrostExtended"`
	AgroDrought                 bool `json:"hasAgroDrought"`
	AgroDroughtExtended         bool `json:"hasAgroDroughtExtended"`
	Statistic                   bool `json:"hasStatistic"`
}

type Version

type Version string

func (Version) GetPDF

func (V Version) GetPDF(
	ctx context.Context,
	username, password string,
	opt Options,
) (rc io.ReadCloser, fileName, mimeType string, err error)

GetPDF returns the meteorological data in PDF form.

address M varchar(45) Keresett cím håzszåmmal lat M float(8,5) SzÊlessÊg pl.: �47.17451� lng M float(8,5) Hosszúsåg pl.: �17.04234� from_date M date(YYYY-MM-DD) Kezd� datum pl.: �2014-11-25� to_date M date(YYYY-MM-DD) Zåró datum pl.: �2014-11-29� contr_id O varchar(25) Kårszåm pl.: �KSZ-112233� needThunders O varchar(1) Villåm adatokat kÊrek �1��kÊrem, �0�-nem needRains O varchar(1) CsapadÊk adatokat kÊrek �1��kÊrem, �0�-nem needWinds O varchar(1) SzÊl adatokat kÊrek �1� � kÊrem, �0�-nem needRainsInt O varchar(1) Fix - �0� language O varchar(2) Fix - �hu�

func (Version) GetPDFData added in v0.27.2

func (V Version) GetPDFData(
	ctx context.Context,
	username, password string,
	opt Options,
) (data V3ResultData, r io.ReadCloser, fileName, mimeType string, err error)

func (Version) LatKey added in v0.26.10

func (V Version) LatKey() string

func (Version) LngKey

func (V Version) LngKey() string

func (Version) RefKey

func (V Version) RefKey() string

func (Version) URL

func (V Version) URL() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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