View Source NOAA.Observations (NOAA Observations v0.4.38)
Fetches weather observations for a US state/territory code.
Link to this section Summary
Functions
Fetches weather observations for a US state/territory code
.
Link to this section Functions
Link to this function
fetch( code, 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.code(), Keyword.t()) :: {:ok, [NOAA.Observations.Station.observation()]} | {:error, String.t()}
Fetches weather observations for a US state/territory code
.
Returns either tuple {:ok, [observation]}
or tuple {:error, text}
.
Parameters
code
- 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