Documentation ¶
Index ¶
- func AppendBoundsParams(params map[string]string, b *Bounds) map[string]string
- func Degrees(angle_radians float64) float64
- func KmToNm(km float64) float64
- func NmToKm(nm float64) float64
- func Pm25ToAqi(pm25 float64) int
- func PointFromLocRadial(lat1 float64, lon1 float64, distance_km float64, bearing_rad float64) (float64, float64)
- func Radians(angle_degrees float64) float64
- func SamplesJson(samples []Sample) ([]byte, error)
- type ApiError
- type Bounds
- type Client
- func (c Client) BuildUrl(endpoint string, params map[string]string) string
- func (c Client) GetSensors(params map[string]string) (*Sensors, error)
- func (c Client) KeysValid() (bool, error)
- func (c Client) NewGetRequest(endpoint string, params map[string]string) *http.Request
- func (c Client) SensorsToSamples(timestamp uint, fields []string, data [][]*float32) []Sample
- type Location
- type Sample
- type Sensors
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendBoundsParams ¶
func PointFromLocRadial ¶
func PointFromLocRadial(lat1 float64, lon1 float64, distance_km float64, bearing_rad float64) (float64, float64)
http://edwilliams.org/avform147.htm A point {lat,lon} is a distance distance_km out on the bearing_rad radial from point 1 updated this formula to have west longitudes be negative
func SamplesJson ¶
Types ¶
type ApiError ¶
type ApiError int64
const ( Undefined ApiError = iota ApiKeyMissingError //403 No API key was found in the request. ApiKeyTypeMismatchError //403 The provided key was of the wrong type (READ or WRITE). ApiKeyInvalidError //403 The provided key was not valid. ApiKeyRestrictedError //403 The provided API key is restricted to certain hosts or referrers. ApiDisabledError //403 API calls to this endpoint have been restricted for your key. Please try again later or contact PurpleAir for more information. InvalidTokenError //403 The provided token was not valid. )
type Client ¶
func (Client) NewGetRequest ¶
func (Client) SensorsToSamples ¶
*float32 parameter is used to support null values in response json This happens when a field is requested from the api that a sensor doesn't provide so we don't include that field in our sensor data map for that sensor
type Sample ¶
type Sensors ¶
type Sensors struct { APIVersion string `json:"api_version"` TimeStamp uint `json:"time_stamp"` DataTimeStamp uint `json:"data_time_stamp"` LocationType Location `json:"location_type"` MaxAge uint `json:"max_age"` FirmwareDefaultVersion string `json:"firmware_default_version"` Fields []string `json:"fields"` Data [][]*float32 `json:"data"` }
Click to show internal directories.
Click to hide internal directories.