MCPcopy Index your code
hub / github.com/MatthewFlamm/pynws

github.com/MatthewFlamm/pynws @v2.1.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.1.0 ↗ · + Follow
149 symbols 741 edges 18 files 80 documented · 54%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

pynws

A python library to asynchronously retrieve weather observation from NWS/NOAA.

PyPI - Downloads

Example

See example.py for a runnable example.

PHILLY = (39.95, -75.16)
USERID = "testing@address.xyz"

async def example():
    async with aiohttp.ClientSession() as session:
        nws = pynws.SimpleNWS(*PHILLY, USERID, session)
        await nws.set_station()
        await nws.update_observation()
        await nws.update_forecast()
        await nws.update_alerts_forecast_zone()
        print(nws.observation)
        print(nws.forecast[0])
        print(nws.alerts_forecast_zone)

Functionality

pynws exposes the ability to retrieve raw data using raw_data module. Nws class offers ability to retrieve minimally processed data for a single location. SimpleNWS class offers data caching and several other helpers for interpreting output.

Units for Observations in SimpleNWS

NWS API does not expose all possible units for observations. Known units are converted to the following:

unit type known NWS units pynws unit
temperature degF, degC Celsius
pressure Pa Pascal
speed m_s-1, km_h-1 km_h-1
percent percent percent
angle degree_(angle) degrees
distance m meter

Core symbols most depended-on inside this repo

setup_app
called by 54
tests/helpers.py
set_station
called by 16
src/pynws/simple_nws.py
update_observation
called by 13
src/pynws/simple_nws.py
update_forecast_hourly
called by 9
src/pynws/simple_nws.py
get_points
called by 9
src/pynws/nws.py
call_with_retry
called by 8
src/pynws/simple_nws.py
get_header
called by 8
src/pynws/raw_data.py
_make_request
called by 8
src/pynws/raw_data.py

Shape

Function 89
Method 51
Class 9

Languages

Python100%

Modules by API surface

tests/test_simple_nws.py36 symbols
src/pynws/simple_nws.py35 symbols
src/pynws/nws.py16 symbols
tests/test_nws.py13 symbols
src/pynws/raw_data.py11 symbols
src/pynws/forecast.py9 symbols
tests/test_raw.py8 symbols
src/pynws/urls.py8 symbols
src/pynws/backports/enum.py4 symbols
tests/helpers.py3 symbols
src/pynws/units.py2 symbols
src/pynws/const.py2 symbols

For agents

$ claude mcp add pynws \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact