models

package
v0.0.0-...-2a5b822 Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ParseAcp121Full   = "021504 Jan 2006"
	FormatAcp121Full  = "021504MST Jan 2006"
	ParseAcp121Short  = "021504"
	FormatAcp121Short = "021504MST"
	Acp121Date        = "_2 Jan 2006"
	ParseAcp121Time   = "1504"
	FormatAcp121Time  = "1504MST"
)

Variables

View Source
var AcpTimeZonesByLetter = map[string]int{
	"A": 1, "B": 2, "C": 3, "D": 4, "E": 5, "F": 6, "G": 7, "H": 8, "I": 9, "K": 10, "L": 11, "M": 12,
	"N": -1, "O": -2, "P": -3, "Q": -4, "R": -5, "S": -6, "T": -7, "U": -8, "V": -9, "W": -10, "X": -11, "Y": -12,
	"Z": 0,
}
View Source
var AcpTimeZonesByOffset = map[int]string{
	1: "A", 2: "B", 3: "C", 4: "D", 5: "E", 6: "F", 7: "G", 8: "H", 9: "I", 10: "K", 11: "L", 12: "M",
	-1: "N", -2: "O", -3: "P", -4: "Q", -5: "R", -6: "S", -7: "T", -8: "U", -9: "V", -10: "W", -11: "X", -12: "Y",
	0: "Z",
}

Functions

func AcpLocation

func AcpLocation(offset int) *time.Location

func MgrsPrecision

func MgrsPrecision(mgrs string) (int, error)

func ParseAcpTimeZone

func ParseAcpTimeZone(tz string) (*time.Location, error)

Types

type AstroData

type AstroData struct {
	SunData
	MoonData
}

type CloudCover

type CloudCover string
const (
	Overcast  CloudCover = "OVC" // 8/8 cloud cover
	Broken    CloudCover = "BKN" // 5/8-7/8 cloud cover
	Scattered CloudCover = "SCT" // 3/8-5/8 cloud cover
	Few       CloudCover = "FEW" // 1/8-3/8 cloud cover
	Clear     CloudCover = "CLR" // <1/8 cloud cover
)

type DailyForecast

type DailyForecast struct {
	Conditions   string
	Description  string
	HighTemp     float64
	LowTemp      float64
	FeelsLikeMax float64
	FeelsLikeMin float64
	Hours        map[int]HourlyForecast
}

type Dtg

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

func DtgNow

func DtgNow(tzoffset int) Dtg

func ParseDtg

func ParseDtg(dtg string) (Dtg, error)

func ParseIsoDateTimeToDtg

func ParseIsoDateTimeToDtg(iso string, tzoffset int) (Dtg, error)

func ParseIsoDateToDtg

func ParseIsoDateToDtg(iso string) (Dtg, error)

func ParseTimeToDtg

func ParseTimeToDtg(t string, tzoffset int) (Dtg, error)

func (Dtg) Date

func (d Dtg) Date() string

func (Dtg) Full

func (d Dtg) Full() string

func (Dtg) Hour

func (d Dtg) Hour() int

func (Dtg) IsoDate

func (d Dtg) IsoDate() string

func (Dtg) Short

func (d Dtg) Short() string

func (Dtg) Time

func (d Dtg) Time() string

func (Dtg) Unix

func (d Dtg) Unix() int64

type HourlyForecast

type HourlyForecast struct {
	DateTime                 Dtg
	WindDirection            float64
	WindSpeed                float64
	WindGust                 float64
	Visibility               float64
	PrecipitationAmount      float64
	PrecipitationType        []PrecipitationType
	PrecipitationProbability float64
	CloudCover               CloudCover
	Temperature              float64
	FeelsLike                float64
	Dewpoint                 float64
	Pressure                 float64
}

type Location

type Location struct {
	Name      string
	Latitude  float64
	Longitude float64
	Precision int
}

func ParseLocationFromMgrs

func ParseLocationFromMgrs(name, mgrs string) (Location, error)

func (*Location) Mgrs

func (l *Location) Mgrs() string

type LunarPhase

type LunarPhase string
const (
	New            LunarPhase = "NEW"
	WaxingCrescent LunarPhase = "WXC"
	FirstQuarter   LunarPhase = "1ST"
	WaxingGibbous  LunarPhase = "WXG"
	Full           LunarPhase = "FUL"
	WaningGibbous  LunarPhase = "WNG"
	LastQuarter    LunarPhase = "LST"
	WaningCrescent LunarPhase = "WNC"
)

type MetocReport

type MetocReport struct {
	Dates     []Dtg
	Generated Dtg
	Location  Location
	TzOffset  int
	AstroData map[Dtg]AstroData
	Forecast  map[Dtg]DailyForecast
}

func NewMetocReport

func NewMetocReport(locationName, locationMgrs string, tzoffset int) (MetocReport, error)

func (*MetocReport) AddDateToMetocReport

func (m *MetocReport) AddDateToMetocReport(date Dtg)

type MoonData

type MoonData struct {
	Phase    LunarPhase
	MoonRise Dtg
	MoonSet  Dtg
}

type Plan

type Plan struct {
	Tzoffset  int            `yaml:"tzoffset"`
	Locations []PlanLocation `yaml:"locations"`
}

type PlanLocation

type PlanLocation struct {
	Name  string   `yaml:"name"`
	Mgrs  string   `yaml:"mgrs"`
	Dates []string `yaml:"dates"`
}

type PrecipitationIntensity

type PrecipitationIntensity string
const (
	HeavyPrecip    PrecipitationIntensity = "HEAVY"
	ModeratePrecip PrecipitationIntensity = "MODERATE"
	LightPrecip    PrecipitationIntensity = "LIGHT"
	NoPrecip       PrecipitationIntensity = "NONE"
)

func CalculatePrecipitationIntensity

func CalculatePrecipitationIntensity(precip float64) PrecipitationIntensity

type PrecipitationType

type PrecipitationType int
const (
	FreezingRain PrecipitationType = 0
	Hail         PrecipitationType = 1
	Snow         PrecipitationType = 2
	Rain         PrecipitationType = 3
)

type SunData

type SunData struct {
	Sunrise              Dtg
	Sunset               Dtg
	AstronomicalTwilight Twilight
	NauticalTwilight     Twilight
	CivilTwilight        Twilight
}

type TempRiskCategory

type TempRiskCategory string
const (
	ExtremeRisk  TempRiskCategory = "EXTREME"
	HighRisk     TempRiskCategory = "HIGH"
	ModerateRisk TempRiskCategory = "MODERATE"
	LowRisk      TempRiskCategory = "LOW"
	NoRisk       TempRiskCategory = "N/A"
)

func CalculateColdCategory

func CalculateColdCategory(windChill float64) TempRiskCategory

func CalculateHeatCategory

func CalculateHeatCategory(heatIndex float64) TempRiskCategory

type Twilight

type Twilight struct {
	Begin Dtg
	End   Dtg
}

Jump to

Keyboard shortcuts

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