forecast

package
v0.0.0-...-d9421b2 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package forecast access the National Digital Forecast Database.

The service has 12 exposed functions, NDFDgen, NDFDgenLatLonList, NDFDgenByDay, NDFDgenByDayLatLonList, LatLonListSubgrid, LatLonListLine, LatLonListZipCode, CornerPoints, LatLonListSquare, GmlLatLonList, GmlTimeSeries, and LatLonListCityNames. For the NDFDgen function, the client needs to provide a latitude and longitude pair and the product type. The Unit will default to U.S. Standard (english) unless Metric is chosen by client. The client also needs to provide the start and end time (Local) of the period that it wants data for (if shorter than the 7 days is wanted). For the time-series product, the client needs to provide an array of boolean values corresponding to which NDFD values are desired. For the NDFDgenByDay function, the client needs to provide a latitude and longitude pair, the date (Local) it wants to start retrieving data for and the number of days worth of data. The Unit will default to U.S. Standard (english) unless Metric is chosen by client. The client also needs to provide the format that is desired. For the multi point versions, NDFDgenLatLonList and NDFDgenByDayLatLonList a space delimited list of latitude and longitude pairs are substituted for the single latitude and longitude input. Each latitude and longitude pair is composed of a latitude and longitude delimited by a comma. For the LatLonListSubgrid, the user provides a comma delimited latitude and longitude pair for the lower left and for the upper right corners of a rectangular subgrid. The function can also take a integer resolution to reduce the number of grid points returned. The service then returns a list of latitude and longitude pairs for all the grid points contained in the subgrid. weather values should appear in the time series product. For the LatLonListLine, The inputs are the same as the function NDFDgen except the latitude and longitude pair is replaced by two latitude and longitude pairs, one for each end point a line. The two points are delimited with a space. The service then returns data for all the NDFD points on the line formed by the two points. For the LatLonListZipCode function, the input is the same as the NDFDgen function except the latitude and longitude values are relaced by a zip code for the 50 United States and Puerto Rico. For the LatLonListSquare function, the input is the same as the NDFDgen function except the latitude and longitude values are relaced by a zip code for the 50 United States and Puerto Rico. For the CornerPoints function, the service requires a valid NDFD grid name. The function returns a list of four latitude and longitude pairs, one for each corner of the NDFD grid. The function also returns the minimum resolution required to return the entire grid below the maximum points threshold. For the GmlLatLonList function, the service requires a list of latitude and longitude pairs, the time (UTC) the user wants data for, the GML feature type and the array of boolean values corresponding to which NDFD values are desired. For the GmlTimeSeries function, the service requires a list of latitude and longitude pairs, the start and end time (UTC) the user wants data for, a comparison type (IsEqual, Between, GreaterThan, GreaterThan, GreaterThanEqualTo, LessThan, and LessThanEqualTo), the GML feature type and The input variable "propertyName" contains a comma delimited string of NDFD element to indicate which weather parameters are being requested. For the LatLonListCityNames function, the services requires a detail level that that ranges from 1 to 4. Level 1 generally represents large main cities. Level 2 represents progressively smaller cities or large cities that are close to another even larger city. Levels 3 and 4 are part one and two of a list of cities that help increase the areal coverage of the cities dataset. This functions returns a list of latitude and longitude values along with a seperate list of city name for those point.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	HTTPClient   *http.Client
	ResponseHook func(*http.Response) *http.Response
	RequestHook  func(*http.Request) *http.Request
}

func NewClient

func NewClient() *Client

func (*Client) CornerPoints

func (c *Client) CornerPoints(ctx context.Context, sector Sector) (ListLatLon, error)

Returns four latitude and longitude pairs for corners of an NDFD grid and the minimum resolution that will return the entire grid

func (*Client) GmlLatLonList

func (c *Client) GmlLatLonList(ctx context.Context, v GmlLatLonListRequest) (string, error)

Returns National Weather Service digital weather forecast data encoded in GML for a single time

func (*Client) GmlTimeSeries

func (c *Client) GmlTimeSeries(ctx context.Context, v GmlTimeSeriesRequest) (string, error)

Returns National Weather Service digital weather forecast data encoded in GML for a time period

func (*Client) LatLonListCityNames

func (c *Client) LatLonListCityNames(ctx context.Context, displayLevel DisplayLevel) (ListCityNames, error)

Returns a list of latitude and longitude pairs paired with the city names they correspond to

func (*Client) LatLonListLine

func (c *Client) LatLonListLine(ctx context.Context, v LatLonListLineRequest) (ListLatLon, error)

Returns a list of latitude and longitude pairs along a line defined by the latitude and longitude of the 2 endpoints

func (*Client) LatLonListSquare

func (c *Client) LatLonListSquare(ctx context.Context, v LatLonListSquareRequest) (ListLatLon, error)

Returns a list of latitude and longitude pairs in a rectangle defined by a central point and distance from that point in the latitudinal and longitudinal directions

func (*Client) LatLonListSubgrid

func (c *Client) LatLonListSubgrid(ctx context.Context, v LatLonListSubgridRequest) (ListLatLon, error)

Returns a list of latitude and longitude pairs in a rectangular subgrid defined by the lower left and upper right points

func (*Client) LatLonListZipCode

func (c *Client) LatLonListZipCode(ctx context.Context, zipCodeList ZipCodeList) (ListLatLon, error)

Returns a list of latitude and longitude pairs with each pair corresponding to an input zip code.

func (*Client) NDFDgen

func (c *Client) NDFDgen(ctx context.Context, v NDFDgenRequest) (string, error)

Returns National Weather Service digital weather forecast data

func (*Client) NDFDgenByDay

func (c *Client) NDFDgenByDay(ctx context.Context, v NDFDgenByDayRequest) (string, error)

Returns National Weather Service digital weather forecast data summarized over either 24- or 12-hourly periods

func (*Client) NDFDgenByDayLatLonList

func (c *Client) NDFDgenByDayLatLonList(ctx context.Context, v NDFDgenByDayLatLonListRequest) (string, error)

Returns National Weather Service digital weather forecast data summarized over either 24- or 12-hourly periods

func (*Client) NDFDgenLatLonList

func (c *Client) NDFDgenLatLonList(ctx context.Context, v NDFDgenLatLonListRequest) (string, error)

Returns National Weather Service digital weather forecast data

type CompType

type CompType string

May be one of IsEqual, Between, GreaterThan, GreaterThanEqualTo, LessThan, LessThanEqualTo

type DisplayLevel

type DisplayLevel int

May be one of 1, 2, 3, 4, 12, 34, 1234

type FeatureType

type FeatureType string

May be one of Forecast_Gml2Point, Forecast_Gml2AllWx, Forecast_GmlsfPoint, Forecast_GmlObs, NdfdMultiPointCoverage, Ndfd_KmlPoint

type Format

type Format string

May be one of 24 hourly, 12 hourly

type GmlLatLonListRequest

type GmlLatLonListRequest struct {
	ListLatLon        ListLatLon
	RequestedTime     time.Time
	FeatureType       FeatureType
	WeatherParameters WeatherParameters
}

type GmlTimeSeriesRequest

type GmlTimeSeriesRequest struct {
	ListLatLon   ListLatLon
	StartTime    time.Time
	EndTime      time.Time
	CompType     CompType
	FeatureType  FeatureType
	PropertyName string
}

type LatLonListLineRequest

type LatLonListLineRequest struct {
	EndPoint1Lat float64
	EndPoint1Lon float64
	EndPoint2Lat float64
	EndPoint2Lon float64
}

type LatLonListSquareRequest

type LatLonListSquareRequest struct {
	CenterPointLat float64
	CenterPointLon float64
	DistanceLat    float64
	DistanceLon    float64
	Resolution     float64
}

type LatLonListSubgridRequest

type LatLonListSubgridRequest struct {
	LowerLeftLatitude   float64
	LowerLeftLongitude  float64
	UpperRightLatitude  float64
	UpperRightLongitude float64
	Resolution          float64
}

type LatLonPair

type LatLonPair string

Must match the pattern [\-]?\d{1,2}\.\d+,[\-]?\d{1,3}\.\d+

type ListCityNames

type ListCityNames string

Must match the pattern [a-zA-Z'\-]*( ?[a-zA-Z'\-]*)*,[A-Z][A-Z](\|[a-zA-Z'\-]*( ?[a-zA-Z'\-]*)*,[A-Z][A-Z])*

type ListLatLon

type ListLatLon string

Must match the pattern [\-]?\d{1,2}\.\d+,[\-]?\d{1,3}\.\d+( [\-]?\d{1,2}\.\d+,[\-]?\d{1,3}\.\d+)*

type NDFDgenByDayLatLonListRequest

type NDFDgenByDayLatLonListRequest struct {
	ListLatLon ListLatLon
	StartDate  time.Time
	NumDays    int
	Unit       Unit
	Format     Format
}

type NDFDgenByDayRequest

type NDFDgenByDayRequest struct {
	Latitude  float64
	Longitude float64
	StartDate time.Time
	NumDays   int
	Unit      Unit
	Format    Format
}

type NDFDgenLatLonListRequest

type NDFDgenLatLonListRequest struct {
	ListLatLon        ListLatLon
	Product           Product
	StartTime         time.Time
	EndTime           time.Time
	Unit              Unit
	WeatherParameters WeatherParameters
}

type NDFDgenRequest

type NDFDgenRequest struct {
	Latitude          float64
	Longitude         float64
	Product           Product
	StartTime         time.Time
	EndTime           time.Time
	Unit              Unit
	WeatherParameters WeatherParameters
}

type Product

type Product string

May be one of time-series, glance

type Sector

type Sector string

May be one of conus, nhemi, alaska, guam, hawaii, puertori, npacocn

type Unit

type Unit string

May be one of e, m

type WeatherParameters

type WeatherParameters struct {
	Maxt         bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd maxt"`
	Mint         bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd mint"`
	Temp         bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd temp"`
	Dew          bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd dew"`
	Pop12        bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd pop12"`
	Qpf          bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd qpf"`
	Sky          bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd sky"`
	Snow         bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd snow"`
	Wspd         bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd wspd"`
	Wdir         bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd wdir"`
	Wx           bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd wx"`
	Waveh        bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd waveh"`
	Icons        bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd icons"`
	Rh           bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd rh"`
	Appt         bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd appt"`
	Incw34       bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd incw34"`
	Incw50       bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd incw50"`
	Incw64       bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd incw64"`
	Cumw34       bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd cumw34"`
	Cumw50       bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd cumw50"`
	Cumw64       bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd cumw64"`
	Critfireo    bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd critfireo"`
	Dryfireo     bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd dryfireo"`
	Conhazo      bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd conhazo"`
	Ptornado     bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd ptornado"`
	Phail        bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd phail"`
	Ptstmwinds   bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd ptstmwinds"`
	Pxtornado    bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd pxtornado"`
	Pxhail       bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd pxhail"`
	Pxtstmwinds  bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd pxtstmwinds"`
	Ptotsvrtstm  bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd ptotsvrtstm"`
	Pxtotsvrtstm bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd pxtotsvrtstm"`
	Tmpabv14d    bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd tmpabv14d"`
	Tmpblw14d    bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd tmpblw14d"`
	Tmpabv30d    bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd tmpabv30d"`
	Tmpblw30d    bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd tmpblw30d"`
	Tmpabv90d    bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd tmpabv90d"`
	Tmpblw90d    bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd tmpblw90d"`
	Prcpabv14d   bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd prcpabv14d"`
	Prcpblw14d   bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd prcpblw14d"`
	Prcpabv30d   bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd prcpabv30d"`
	Prcpblw30d   bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd prcpblw30d"`
	Prcpabv90d   bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd prcpabv90d"`
	Prcpblw90d   bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd prcpblw90d"`
	Precipar     bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd precipa_r"`
	Skyr         bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd sky_r"`
	Tdr          bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd td_r"`
	Tempr        bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd temp_r"`
	Wdirr        bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd wdir_r"`
	Wspdr        bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd wspd_r"`
	Wwa          bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd wwa"`
	Wgust        bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd wgust"`
	Iceaccum     bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd iceaccum"`
	Maxrh        bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd maxrh"`
	Minrh        bool `xml:"http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd minrh"`
}

type ZipCode

type ZipCode string

Must match the pattern \d{5}(\-\d{4})?

type ZipCodeList

type ZipCodeList string

Must match the pattern \d{5}(\-\d{4})?( \d{5}(\-\d{4})?)*

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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