Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/OdintheDoggo/GodotNWS/llms.txt

Use this file to discover all available pages before exploring further.

Current observations provide real-time conditions reported by the nearest NWS observation station for your configured location. Unlike forecast data, observations reflect what is actually happening right now: temperature, wind, pressure, humidity, precipitation, and cloud cover. Requires location_setup_complete to have fired before calling.

Method

fetch_current_observations(fetch_icon: bool)

Fetches the latest observation from the NWS zone observation feed and emits observations_fetched with an ObservationPacket resource. Not all fields in ObservationPacket are guaranteed to be present — the NWS API omits measurements that are not available at the reporting station.
fetch_icon
bool
required
When true, the current condition icon is fetched and stored in ObservationPacket.icon as an ImageTexture. The signal fires only after the icon has loaded. When false, ObservationPacket.icon is null but ObservationPacket.iconUrl is still populated if an icon URL was returned by the API.

Signal

observations_fetched(observations: ObservationPacket)

Emitted when the observation data — and the condition icon, if requested — is ready.
This signal emits null when the NWS observation feed returns no data for the zone. Always null-check the observations argument before accessing any of its properties.
observations
ObservationPacket
An ObservationPacket resource containing current conditions, or null if observations are unavailable. The packet exposes the following fields:
All measurements use metric units as returned directly by the NWS API: temperature in Celsius, wind speed in m/s, pressure in Pascals, precipitation in meters, visibility in meters, and cloud height in meters. Convert as needed before displaying to users.

Code Example

extends Node

func _ready() -> void:
    Nws.location_setup_complete.connect(_on_ready)
    Nws.setup(39.7456, -97.0892)

func _on_ready() -> void:
    Nws.observations_fetched.connect(_on_observations)
    Nws.fetch_current_observations(true)

func _on_observations(obs: ObservationPacket) -> void:
    if obs == null:
        print("Observations unavailable for this location.")
        return

    print("Station: ", obs.station)
    print("Conditions: ", obs.textDescription)
    print("Temperature: %.1f°C" % obs.temperature)

    if obs.windSpeed > 0.0:
        print("Wind: %.1f m/s from %d°" % [obs.windSpeed, obs.windDirection])

    if obs.icon:
        $WeatherIcon.texture = obs.icon

Build docs developers (and LLMs) love