waterdata

package
v0.0.0-...-7203b7e Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2025 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// Corresponds to TimeSeries.Variable.VariableCode[?].Value
	GageHeightFeet string = "00065"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// Allow the URL to be overridden for testing
	BaseURL *url.URL
	Client  *http.Client
	Logger  *slog.Logger
}

Client is a type that represents a Waterdata Service client

func NewClient

func NewClient(l *slog.Logger) (*Client, error)

NewClient is a function that returns a new Client

func (*Client) GetInstantaneousValues

func (c *Client) GetInstantaneousValues(sites []string) (*GetInstantaneousValuesResponse, error)

GetInstantaneousValues is a method that returns values using the InstantaneousValues Service https://waterservices.usgs.gov/nwis/iv/?format=json&sites=12150400&modifiedSince=PT1H&siteStatus=all Constants applied to HTTP requests format=json sites=site1,site2,... modifiedSince=PT1H (ISO 8601 Duration: See https://en.wikipedia.org/wiki/ISO_8601#Durations) siteStatus=all

type Criteria

type Criteria struct {
	LocationParam string `json:"locationParam"`
	VariableParam string `json:"variableParam"`
}

type GetInstantaneousValuesResponse

type GetInstantaneousValuesResponse struct {
	Name            string `json:"name"`
	DeclaredType    string `json:"declaredType"`
	Scope           string `json:"scope"`
	Value           Value  `json:"value"`
	Nil             bool   `json:"nil"`
	GlobalScope     bool   `json:"globalScope"`
	TypeSubstituted bool   `json:"typeSubstituted"`
}

type Note

type Note struct {
	Value string `json:"value"`
	Title string `json:"title"`
}

type QueryInfo

type QueryInfo struct {
	QueryURL string   `json:"queryURL"`
	Criteria Criteria `json:"criteria"`
	Note     []Note   `json:"note"`
}

type SiteCode

type SiteCode struct {
	Value      string `json:"value"`
	Network    string `json:"network"`
	AgencyCode string `json:"AgencyCode"`
}

type SourceInfo

type SourceInfo struct {
	SiteName string     `json:"siteName"`
	SiteCode []SiteCode `json:"siteCode"`
}

type TimeSeries

type TimeSeries struct {
	SourceInfo SourceInfo         `json:"sourceInfo"`
	Variable   Variable           `json:"variable"`
	Values     []TimeSeries_Value `json:"values"`
	Name       string             `json:"name"`
}

type TimeSeries_Value

type TimeSeries_Value struct {
	Value []TimeSeries_Value_Value `json:"value"`
}

type TimeSeries_Value_Value

type TimeSeries_Value_Value struct {
	Value      string   `json:"value"`
	Qualifiers []string `json:"qualifiers"`
	DateTime   string   `json:"dateTime"`
}

type Value

type Value struct {
	QueryInfo  QueryInfo    `json:"queryInfo"`
	TimeSeries []TimeSeries `json:"timeSeries"`
}

type Variable

type Variable struct {
	VariableCode []VariableCode `json:"variableCode"`
	VariableName string         `json:"variableName"`
}

func (*Variable) Contains

func (x *Variable) Contains(value string) bool

type VariableCode

type VariableCode struct {
	Value      string `json:"value"`
	Network    string `json:"network"`
	Vocabulary string `json:"vocabulary"`
	VariableID int    `json:"variableID"`
	Default    bool   `json:"default"`
}

Jump to

Keyboard shortcuts

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