nwsattrs

package module
v0.0.0-...-7966a6e Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2014 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IMGWIDTH           = 600
	IMGHEIGHT          = 550
	MILESPERPIXHEIGHT  = IMGHEIGHT
	NMPERDEGLATEQUATOR = 60.10774
)
View Source
const (
	STORMCELLREG      = "[A-Z][0-9][ ]+[0-9]+/( *|[0-9])[0-9]+"
	MESOCELLREG       = "[0-9]+/[ ]*[0-9]+ +[0-9]?[0-9][L| ]"
	TVSCELLREG        = "[A-Z][0-9][ ]+[0-9]+/[ ]*[0-9]+"
	WARNINGFILEREGEXP = "warnings_[0-9]+_[0-9]+\\.txt"
)
View Source
const (
	TORNREPORTURL = "http://www.spc.noaa.gov/climo/reports/today_torn.csv"
	WINDREPORTURL = "http://www.spc.noaa.gov/climo/reports/today_wind.csv"
	HAILREPORTURL = "http://www.spc.noaa.gov/climo/reports/today_hail.csv"
)
View Source
const (
	NEW      WarningStatus = "O.NEW"
	EXPIRED                = "O.EXP"
	CONTINUE               = "O.CON"
	CANCEL                 = "O.CAN"
)
View Source
const (
	WATCHREGEX      = "<strong>.*watch/ww(.*)\\.html"
	WATCHNUMREGEXP  = "WWP(.*)"
	LATLONREGEXP    = "[0-9]{8}"
	WATCHTYPEREGEXP = "\n\n(.*WATCH)"
	EXPIREREGEXP    = "- ([0-9]{6})Z"
)

Variables

View Source
var Stations map[string]*StationLocation

var Stations map[string][]interface{}

Functions

func Bearing

func Bearing(point, otherPoint IPoint) float64

func Contains

func Contains(poly IPolygon, point IPoint) bool

func Distance

func Distance(point, otherPoint IPoint) float64

func GetWarningTexts

func GetWarningTexts(url string, number int) (warningTexts []string, err error)

Types

type Cache

type Cache struct {
	Cacher

	*sync.Mutex
	// contains filtered or unexported fields
}

func NewCache

func NewCache(c Cacher, cacheDuration time.Duration, timeToLive time.Duration) *Cache

func (*Cache) GetCachedData

func (c *Cache) GetCachedData() (interface{}, bool, error)

func (*Cache) Reset

func (c *Cache) Reset()

type Cacher

type Cacher interface {
	GetLatest() (interface{}, error)
}

type CellData

type CellData struct {
	StormCellData *StormCellData
	MesoCellData  *MesoCellData
	TvsCellData   *TvsCellData
}

type HailReport

type HailReport struct {
	Report
	Size string
}

func GetHailReports

func GetHailReports() (hailReports []HailReport, err error)

type HailReportsCacher

type HailReportsCacher struct{}

func (HailReportsCacher) GetLatest

func (rt HailReportsCacher) GetLatest() (interface{}, error)

type IPoint

type IPoint interface {
	Degrees() LatLng
}

type IPolygon

type IPolygon interface {
	//Needs to be a polygon that has the points in order to draw a polygon.
	//For instance, with four points, they would go: Nw Ne Se Sw to draw a rectangle
	GetPolygon() []LatLng
}

type IProductInfo

type IProductInfo interface {
	ScanDuration() time.Duration
	GetDate() time.Time
	IsDue() bool
	IsOld() bool
}

type LatLng

type LatLng struct {
	Lat, Lng float64
}

func Radians

func Radians(point IPoint) LatLng

func (LatLng) Degrees

func (ll LatLng) Degrees() LatLng

type LatLngBounds

type LatLngBounds struct {
	Sw, Ne LatLng
}

func (*LatLngBounds) GetPolygon

func (llb *LatLngBounds) GetPolygon() []LatLng

type MesoCell

type MesoCell struct {
	StationId, Strength, StormId, LowLevelRotationalVelocity, LowLevelDeltaVelocity,
	Base, Depth, Hgt, StrmRelPercent, MaxRotationalVelocity, Msi, FcstDir, FcstSpeed string
	PointLatLng LatLng
	LatLng
	ProductTime time.Time
}

type MesoCellData

type MesoCellData struct {
	Cells []MesoCell
	IProductInfo
}

type MovementVector

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

type Mover

type Mover interface {
	Movement() MovementVector
}

type ProductDescriptionBlock

type ProductDescriptionBlock struct {
	Divider              int16 //-1
	LatitudeOfRadar      int32 //Latitude*1000, + is north
	LongitudeOfRadar     int32 //Longitude*1000, + is east
	HeightAboveSea       int16 //In Feet
	ProductCode          int16 //Radar Product Number
	OperationalMode      int16 // 0=Maintenance 1=Clear air, 2=Precipitation/Severe Weather
	VolumeScanPattern    int16 //RDA volume coverage pattern
	SequenceNumber       int16 // Sequence number of the request that generated the product
	VolumeScanNumber     int16 //Counter, cycles 1 to 80
	VolumeScanDate       int16
	VolumeScanTime       int32
	ProductGenDate       int16
	ProductGenTime       int32
	P1                   int16 //Product Specific Code
	P2                   int16 //Product Specific Code
	ElevNum              int16 //Elevation scan within volume scan
	P3                   int16
	DataThreshold        [32]byte //Data Thresholds 16, 2 byte halfwords
	P4                   int16
	P5                   int16
	P6                   int16
	P7                   int16
	P8                   int16
	P9                   int16
	P10                  int16
	NumberOfMaps         int16
	OffsetSymbologyBlock int32 //Number of halfwords (2 bytes) from start of product to block
	OffsetGraphicBlock   int32
	OffsetTabularBlock   int32
}

func (*ProductDescriptionBlock) GetProductGenDate

func (pd *ProductDescriptionBlock) GetProductGenDate() time.Time

func (*ProductDescriptionBlock) GetVolumeScanDate

func (pd *ProductDescriptionBlock) GetVolumeScanDate() time.Time

type RadarHeaderBlock

type RadarHeaderBlock struct {
	MessageCode     int16
	Days            int16 //Number of days since 1 Jan 1970
	MidnightHours   int32 // Number of seconds since midnight
	LengthOfMessage int32
	SourceID        int16
	DestinationID   int16
	NumberOfBlocks  int16
	ProductDescriptionBlock
}

func GetRadarHeader

func GetRadarHeader(data []byte) (*RadarHeaderBlock, error)

func (*RadarHeaderBlock) GetDate

func (rh *RadarHeaderBlock) GetDate() time.Time

func (*RadarHeaderBlock) IsDue

func (rh *RadarHeaderBlock) IsDue() bool

func (*RadarHeaderBlock) IsOld

func (rh *RadarHeaderBlock) IsOld() bool

func (*RadarHeaderBlock) ScanDuration

func (rh *RadarHeaderBlock) ScanDuration() time.Duration
	Source wikipedia https://en.wikipedia.org/wiki/NEXRAD
	about Volume Coverage Patterns (VCP)
	11: Has the best overall volume converage
	211: Improves range-obscured velocity data over VCP 11
	12: Focuses on lower elevations to better sample the lower levels of storms.
	212: Improves range-obscured velocity data over VCP 12
	121: Scans lower cuts multiple times with varying pulse repetition to greatly
		 enhance velocity data
    21: Rarely used for convenction due to sparse elevation data and long completion time
	221: Improves range-obscured velocity data over VCP 121
	31: Long-pulse
	32: Short-pulse

type RadarStation

type RadarStation struct {
	Id                      string
	LeftEdgeLon, TopEdgeLat float64
	LatLng
	// contains filtered or unexported fields
}

func NewRadarStation

func NewRadarStation(stationId string) (*RadarStation, error)

func (RadarStation) Degrees

func (rs RadarStation) Degrees() LatLng

func (RadarStation) GetLatest

func (rs RadarStation) GetLatest() (interface{}, error)

This will retrieve all of the station's storm cell data and return it as a celldata this will implement the Cacher interface

func (*RadarStation) ParseMesoCells

func (rs *RadarStation) ParseMesoCells() (*MesoCellData, error)

func (*RadarStation) ParseStormCells

func (rs *RadarStation) ParseStormCells() (*StormCellData, error)

TODO: Maybe include the radar status message? from http://weather.noaa.gov/pub/SL.us008001/DF.of/DC.radar/DS.75ftm/

func (*RadarStation) ParseTvsCells

func (rs *RadarStation) ParseTvsCells() (*TvsCellData, error)

type Report

type Report struct {
	Time     time.Time
	Location string
	County   string
	State    string
	*LatLng
	Comments string
	SpecAttr string `json:"-"`
}

func GetReports

func GetReports(reportUrl string) (reports []Report, err error)

type SortByWarningName

type SortByWarningName []Warning

func (SortByWarningName) Len

func (w SortByWarningName) Len() int

func (SortByWarningName) Less

func (w SortByWarningName) Less(i, j int) bool

func (SortByWarningName) Swap

func (w SortByWarningName) Swap(i, j int)

type StationLocation

type StationLocation struct {
	LatLng
	LatLngBounds
}

type StormCell

type StormCell struct {
	CellId, StationId, Az, Ran, Tvs, Meso, Posh, Poh, MaxSize,
	Vil, VilDensity, MaxDbz, Hgt, Top, FcstDir, FcstSpeed string
	PointLatLng LatLng
	LatLng
	ProductTime time.Time
}

type StormCellData

type StormCellData struct {
	Cells []StormCell
	IProductInfo
}

type TornadoReport

type TornadoReport struct {
	Report
	FScale string
}

func GetTornadoReports

func GetTornadoReports() (tornadoReports []TornadoReport, err error)

type TornadoReportsCacher

type TornadoReportsCacher struct{}

func (TornadoReportsCacher) GetLatest

func (rt TornadoReportsCacher) GetLatest() (interface{}, error)

type TvsCell

type TvsCell struct {
	StationId, StormId, AverageDeltaVelocity, LowLevelDeltaVelocity, MaxDeltaVelocity, Hgt,
	Depth, Base, Top, MaxShear string
	LatLng
	ProductTime time.Time
}

type TvsCellData

type TvsCellData struct {
	Cells []TvsCell
	IProductInfo
}

type Warning

type Warning struct {
	ExpireTime                            string
	WarningName, WarningType, Description string
	Polygon                               []LatLng
}

func GetNWSWarnings

func GetNWSWarnings() []Warning

func (Warning) GetPolygon

func (w Warning) GetPolygon() []LatLng

type WarningCache

type WarningCache struct{}

func (WarningCache) GetLatest

func (wc WarningCache) GetLatest() (interface{}, error)

type WarningStatus

type WarningStatus string

func GetWarningStatus

func GetWarningStatus(text string) WarningStatus

type Watch

type Watch struct {
	Type        string
	Description string
	Polygon     []LatLng
	ExpireTime  string
}

func GetNWSWatches

func GetNWSWatches() []Watch

func (Watch) GetPolygon

func (self Watch) GetPolygon() []LatLng

type WatchCache

type WatchCache struct{}

func (WatchCache) GetLatest

func (w WatchCache) GetLatest() (interface{}, error)

type WindReport

type WindReport struct {
	Report
	Speed string
}

func GetWindReports

func GetWindReports() (windReports []WindReport, err error)

type WindReportsCacher

type WindReportsCacher struct{}

func (WindReportsCacher) GetLatest

func (rt WindReportsCacher) GetLatest() (interface{}, error)

Jump to

Keyboard shortcuts

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