How WeatherNext Handles Different Geographical Regions: Technical Deep Dive

WeatherNext handles different geographical regions by dynamically selecting local sub-grids around cyclone centers, using geodesic disc-based bounding boxes that automatically adjust for latitude-dependent Earth's curvature and enforce hard limits near the poles.

WeatherNext's approach to regional variability is rooted in its cyclone tracking pipeline, which must operate robustly across tropical and extratropical zones alike. Rather than processing fixed global tiles, the system adapts its spatial window to each storm's instantaneous latitude-longitude position. This design ensures consistent tracking performance whether a cyclone spins in the Bay of Bengal, the Caribbean, or the South Pacific.

Core Mechanism: Dynamic Sub-Grid Selection

When tracking begins, WeatherNext computes a bounding box that fully encloses a geodesic disc of configurable radius (in kilometers) around the storm center. This local window becomes the working region for all subsequent analysis—scalar variable estimation, mean center computation, and probability-of-existence calculations.

Latitude-Aware Bounding Box Conversion

The conversion from kilometers to degrees happens in weathernext/cyclones/direct_tracker.py via the _get_bounding_box_sides_in_degrees function. This routine accounts for Earth's geometry in two stages:

  1. Latitude side: Uses the Earth's meridian length (~111.32 km/degree) to convert the disc radius directly to latitude degrees.

  2. Longitude side: Adjusts by the cosine of the center latitude, since meridians converge toward the poles. The result is capped at 360° using np.nanmin([... , utils.LON_DEG_RANGE]) to handle wrap-around gracefully.


# Simplified view of the bounding box logic from direct_tracker.py

def _get_bounding_box_sides_in_degrees(self, disc_radius_km, center_latitude):
    # Convert km to latitude degrees (constant ~111.32 km/degree)

    lat_side_degrees = disc_radius_km / EARTH_MERIDIAN_LENGTH_KM
    
    # Adjust longitude side based on latitude (cosine correction)

    lon_side_degrees = lat_side_degrees / np.cos(np.radians(center_latitude))
    
    # Guard against pathological values near poles or extreme radii

    lon_side_degrees = np.nanmin([lon_side_degrees, LON_DEG_RANGE])
    
    return lat_side_degrees, lon_side_degrees

The actual implementation spans lines 87–134 in direct_tracker.py, with additional safety checks for numerical stability.

Regional Constraints and Data Availability

Hard Latitude Limits

WeatherNext enforces a maximum absolute latitude of 80° (MAX_ABSOLUTE_LATITUDE = 80 in weathernext/cyclones/constants.py). This constraint appears at lines 78–81 of direct_tracker.py and reflects the limits of reliable IBTrACS (International Best Track Archive for Climate Stewardship) data. Beyond this threshold, historical storm observations become sparse and unreliable, so the tracker deliberately excludes these regions.

Anti-Meridian and Polar Handling

The bounding-box logic explicitly guards against several edge cases:

  • Longitude wrap-around: Near 180°W/180°E, the np.nanmin clipping ensures computed box widths never exceed valid longitude ranges.
  • Extreme disc radii: Large radii that would span more than the full longitude range are automatically truncated.
  • Polar proximity: As latitude approaches 90°, the cosine correction would produce unbounded longitude spans; the nanmin operation prevents this.

Configurable Regional Parameters

The DirectTracker class exposes multiple disc radii for different analytical purposes, allowing region-specific tuning:

from weathernext.cyclones.direct_tracker import DirectTracker

tracker = DirectTracker(
    # Primary radius for extracting scalar variables (wind, pressure) around center

    disc_radius_scalar_variables_km=200.0,
    
    # Smaller radius for mean position computation (reduces noise)

    disc_radius_mean_latlon_km=150.0,
    
    # Tightest radius for mode-based center updates (highest confidence)

    disc_radius_mode_latlon_km=100.0,
    
    # Intermediate radius for existence probability averaging

    disc_radius_mean_probability_of_existence_km=120.0,
    
    # Specialized radius for genesis detection refinement

    disc_radius_cyclogenesis_refinement_km=80.0,
    
    # Tracking strategy: use mode first, then refine with mean

    tracking_mode="mode_then_mean",
    
    # Minimum separation between simultaneous cyclone candidates

    min_disc_radius_between_cyclogenesis_candidates_km=50.0,
)

# Apply to a probability field with dimensions (time, lat, lon)

tracked_cyclones = tracker.track(prob_grid)

Each radius can be adjusted independently for regional characteristics—larger values for sprawling monsoon depressions, smaller values for compact hurricane eyes.

Supporting Infrastructure

Several auxiliary modules reinforce WeatherNext's geographical adaptability:

File Regional Function
weathernext/cyclones/constants.py Defines MAX_ABSOLUTE_LATITUDE, Earth geometry constants, and degree-to-km conversion factors
weathernext/utils/cyclone_utils.py Provides latlon_to_cartesian and cartesian_to_latlon for accurate centroid averaging across the anti-meridian
weathernext/utils/sharding.py Splits global grids into hardware-efficient shards while preserving regional locality

The sharding system deserves particular mention: it enables distributed processing of arbitrarily large domains without requiring fixed regional boundaries. This matters for operational deployments where a single inference run might cover the entire tropics.

Summary

  • Dynamic sub-grids: WeatherNext selects local windows per storm using geodesic disc radii, not fixed tiles.
  • Latitude-aware geometry: The _get_bounding_box_sides_in_degrees function in direct_tracker.py applies cosine correction for longitude spans and clips at 360°.
  • Data-driven limits: MAX_ABSOLUTE_LATITUDE = 80° enforces IBTrACS reliability boundaries.
  • Configurable precision: Multiple disc radii allow region-appropriate tuning for different analytical stages.
  • Robust edge cases: Explicit handling of anti-meridian crossings, polar proximity, and extreme radii.

Frequently Asked Questions

What is the maximum latitude WeatherNext can process?

WeatherNext hard-limits cyclone tracking to 80°N and 80°S via MAX_ABSOLUTE_LATITUDE. This restriction reflects the availability and quality of IBTrACS historical data, which becomes unreliable at extreme latitudes. The limit is enforced in weathernext/cyclones/direct_tracker.py before any bounding box computation occurs.

How does WeatherNext handle storms near the International Date Line?

The longitude side calculation uses np.nanmin([... , utils.LON_DEG_RANGE]) to cap box widths at 360°. This prevents numerical overflow when cosine-adjusted spans would otherwise exceed valid longitude ranges. Additionally, cyclone_utils.py provides coordinate transformation utilities that correctly average positions across the 180° boundary.

Can the regional window sizes be customized per ocean basin?

Yes. The DirectTracker constructor accepts five independent disc radius parameters (lines 87–134 region in direct_tracker.py). Operational deployments might use larger radii for the Northwest Pacific's sprawling typhoons versus compact Mediterranean hurricanes. All radii are specified in kilometers and automatically converted to degrees appropriate for each storm's latitude.

Why does WeatherNext use geodesic discs instead of fixed grid tiles?

Geodesic discs preserve consistent physical distances regardless of latitude. A 200 km radius at 60°N covers the same storm-interaction distance as 200 km at the equator, despite spanning fewer longitude degrees. This ensures comparable analysis quality across all permissible geographical regions without manual regional tuning.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →