NOAA.Observations (NOAA Observations v0.4.33) View Source
Fetches weather observations for a US state/territory.
Link to this section Summary
Functions
Fetches weather observations for a US state
/territory.
Link to this section Functions
Link to this function
fetch(state, url_templates \\ [state: "https://w1.weather.gov/xml/current_obs/seek.php?state=<%=state%>&Find=Find", station: "https://w1.weather.gov/xml/current_obs/display.php?stid=<%=station%>"])
View SourceSpecs
fetch(NOAA.Observations.State.t(), Keyword.t()) :: {:ok, [NOAA.Observations.Station.obs()]} | {:error, String.t()}
Fetches weather observations for a US state
/territory.
Returns a tuple of either {:ok, [obs]}
or {:error, text}
.
Parameters
state
- US state/territory codeurl_templates
- URL templates (keyword)
URL templates
:state
- URL template for a state (EEx string):station
- URL template for a station (EEx string)
Examples
iex> alias NOAA.Observations
iex> {:ok, observations} = Observations.fetch("vt")
iex> Enum.all?(observations, &is_map/1) and length(observations) > 0
true