Skip to main content
Glama

wind_model_simple

Calculate wind speeds at different altitudes using logarithmic or power law models for flight planning and aviation operations.

Instructions

Calculate wind speeds at different altitudes using logarithmic or power law models.

Args: altitudes_m: List of altitudes in meters surface_wind_speed_ms: Wind speed at 10m reference height in m/s surface_wind_direction_deg: Wind direction at surface in degrees (0=North, 90=East) model_type: Wind model type ('logarithmic' or 'power_law') roughness_length_m: Surface roughness length in meters

Returns: Formatted string with wind profile data

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
altitudes_mYes
surface_wind_speed_msNo
surface_wind_direction_degNo
model_typeNologarithmic
roughness_length_mNo

Implementation Reference

  • The MCP tool handler for wind_model_simple. Imports core logic from integrations.atmosphere, computes wind profile, formats as table with JSON, handles errors.
    def wind_model_simple(
        altitudes_m: list[float],
        surface_wind_speed_ms: float = 5.0,
        surface_wind_direction_deg: float = 270.0,
        model_type: Literal["logarithmic", "power_law"] = "logarithmic",
        roughness_length_m: float = 0.03,
    ) -> str:
        """Calculate wind speeds at different altitudes using logarithmic or power law models.
    
        Args:
            altitudes_m: List of altitudes in meters
            surface_wind_speed_ms: Wind speed at 10m reference height in m/s
            surface_wind_direction_deg: Wind direction at surface in degrees (0=North, 90=East)
            model_type: Wind model type ('logarithmic' or 'power_law')
            roughness_length_m: Surface roughness length in meters
    
        Returns:
            Formatted string with wind profile data
        """
        try:
            from ..integrations.atmosphere import wind_model_simple as _wind_model
    
            wind_profile = _wind_model(
                altitudes_m,
                surface_wind_speed_ms,
                surface_wind_direction_deg,
                model_type,
                roughness_length_m,
            )
    
            # Format response
            result_lines = [f"Wind Profile ({model_type} model)", "=" * 50]
            result_lines.extend(
                [
                    f"Surface Reference: {surface_wind_speed_ms:.1f} m/s @ {surface_wind_direction_deg:.0f}Β° (10m height)",
                    f"Roughness Length: {roughness_length_m:.3f} m",
                    "",
                    f"{'Alt (m)':>8} {'Speed (m/s)':>12} {'Dir (deg)':>10} {'Gust Factor':>12}",
                ]
            )
            result_lines.append("-" * 50)
    
            for point in wind_profile:
                result_lines.append(
                    f"{point.altitude_m:8.0f} {point.wind_speed_ms:12.1f} {point.wind_direction_deg:10.0f} "
                    f"{point.gust_factor:12.2f}"
                )
    
            # Add JSON data
            json_data = json.dumps([p.model_dump() for p in wind_profile], indent=2)
            result_lines.extend(["", "JSON Data:", json_data])
    
            return "\n".join(result_lines)
    
        except ImportError:
            return "Wind modeling not available - atmospheric integration required"
        except Exception as e:
            logger.error(f"Wind model error: {str(e)}", exc_info=True)
            return f"Wind model error: {str(e)}"
  • Registers wind_model_simple as an MCP tool.
    mcp.tool(wind_model_simple)
  • Core wind profile computation using logarithmic or power-law models, produces list of WindPoint dataclass instances.
    def wind_model_simple(
        altitudes_m: list[float],
        surface_wind_mps: float,
        surface_altitude_m: float = 0.0,
        model: str = "logarithmic",
        roughness_length_m: float = 0.1,
        reference_height_m: float = 10.0,
    ) -> list[WindPoint]:
        """
        Simple wind profile models for low-altitude studies.
    
        Args:
            altitudes_m: Altitude points for wind calculation
            surface_wind_mps: Wind speed at reference height
            surface_altitude_m: Surface elevation
            model: "logarithmic" or "power" law
            roughness_length_m: Surface roughness length (for logarithmic)
            reference_height_m: Height of surface wind measurement
    
        Returns:
            List of WindPoint objects with wind speeds
        """
        if model not in ["logarithmic", "power"]:
            raise ValueError(f"Unknown wind model: {model}. Use 'logarithmic' or 'power'")
    
        results = []
    
        for altitude in altitudes_m:
            height_agl = altitude - surface_altitude_m
    
            if height_agl < 0:
                wind_speed = 0.0  # Below ground
            elif height_agl < reference_height_m:
                # Linear interpolation below reference height
                wind_speed = surface_wind_mps * (height_agl / reference_height_m)
            else:
                if model == "logarithmic":
                    # Logarithmic wind profile
                    if roughness_length_m <= 0:
                        raise ValueError("Roughness length must be positive")
    
                    wind_speed = surface_wind_mps * (
                        math.log(height_agl / roughness_length_m)
                        / math.log(reference_height_m / roughness_length_m)
                    )
                else:  # power law
                    # Power law with typical exponent
                    alpha = 0.143  # Typical for open terrain
                    wind_speed = (
                        surface_wind_mps * (height_agl / reference_height_m) ** alpha
                    )
    
            results.append(
                WindPoint(
                    altitude_m=altitude,
                    wind_speed_mps=max(0.0, wind_speed),  # Ensure non-negative
                )
            )
    
        return results
  • Pydantic BaseModel defining the structure of wind profile points returned by the core wind_model_simple function.
    class WindPoint(BaseModel):
        """Single wind profile point."""
    
        altitude_m: float = Field(..., description="Altitude in meters")
        wind_speed_mps: float = Field(..., description="Wind speed in m/s")
        wind_direction_deg: float | None = Field(
            None, description="Wind direction in degrees"
        )

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cheesejaguar/aerospace-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server