🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

get-weather-api

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-weather-api

A simple API key example package

0.1.5
PyPI
Maintainers
1

📦 Weather Data Client

This package includes a function to fetch and preprocess historical weather data from Weatherunderground.com.

🔧 Setup

  • Create a .env file with your API key:

    echo "API_KEY=your_actual_api_key_here" > .env
    
  • Install the package:

    pip install .
    
  • (Optional) Install dev dependencies:

    pip install .[dev]
    

📘 Usage

import getweatherunderground.client as gwu
import os
os.environ["API_KEY"] = "ADD_API_KEY"

df = gwu.get_weather_data(
    weather_station="RJAA",
    country_code="JP",
    startDate="20190201",
    endDate="20190301",
    timezone="US/Pacific"
)
print(df.head())
Dataframe Sample
FeatureTypeExample
Timedatetime2019-01-31 00:00:00
tempffloat32.0
dewPtint32
rhint100
wdir_cardinalstringNNW
wspdfloat9.0
gustint0
pressurefloat29.47
precipfloat0.0
wx_phrasestringLight Snow Shower

Parameters

Parameters can be obtained from https://www.wunderground.com/. For a desired location follow these steps.

  • Search locations in the upper right. For example Manila, Philippines.
  • Click the history tab and identify the weather station which would be the last parameter in the URL:
    https://www.wunderground.com/history/daily/ph/manila/RPLL
    
    Here it would be RPLL.
  • The country code would be the third to the last parameter: PH
  • Timezone would be what you want the data to be encoded in, for Manila it would be 'Asia/Manila'
  • Start and end dates must be strings in the form of YYYYMMDD. The minimum window should be 1 month. i.e., 20201001 to 20201101.

Thus the arguments you would use would be: df = get_weather_data(weather_station="RPLL", country_code="PH", startDate="20201001", endDate="20201101", timezone="Asia/Manila")

📊 Weather Feature Descriptions

ColumnDescription
TimeThe timestamp of the weather observation, converted from GMT to your specified timezone. This is usually reported in hourly intervals and used as the index for the DataFrame.
tempfAir temperature in degrees Fahrenheit at the time of observation.
dewPtDew point in degrees Fahrenheit – the temperature at which air becomes saturated and dew can form. Used to assess humidity.
rhRelative Humidity in percentage (%). Indicates how much moisture is in the air compared to the maximum possible at that temperature.
wdir_cardinalWind direction as a cardinal compass point (e.g., "N", "NE", "W"). Reflects the direction from which the wind is blowing.
wspdWind speed in miles per hour (mph). Average wind speed during the observation window.
gustWind gust in mph. Peak wind speed recorded during the observation window. May be missing or zero if conditions were calm.
pressureAtmospheric pressure in inches of mercury (inHg). Often used in weather forecasting (e.g., identifying high/low pressure systems).
precipTotal precipitation during the hour in inches (rain, snow water equivalent, etc.). May be "0.0" if no measurable precipitation occurred.
wx_phraseTextual weather summary, e.g., "Partly Cloudy", "Rain Showers", "Snow", etc. Useful for quick human-readable interpretation of the weather conditions.

These fields provide a well-rounded snapshot of surface-level atmospheric conditions and are commonly used in:

  • Climate studies
  • Forecast verification
  • Event-driven analyses (e.g., during storm events)
  • Transportation or agriculture modeling

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts