Skip to content

Wind

Wind

A base class for creating Wind. Wind direction and velocity by down-range distance.

Attributes:

Name Type Description
velocity Velocity

speed of wind

direction_from Angular

0 is blowing from behind shooter. 90 degrees is blowing from shooter's left towards right.

until_distance Distance

until which distance the specified wind blows

MAX_DISTANCE_FEET float

Optional custom max wind distance

Parameters:

Name Type Description Default
velocity Optional[Union[float, Velocity]]

speed of wind

None
direction_from Optional[Union[float, Angular]]

0 is blowing from behind shooter. 90 degrees is blowing from shooter's left towards right.

None
until_distance Optional[Union[float, Distance]]

until which distance the specified wind blows

None
max_distance_feet Optional[float]

Optional custom max wind distance

cMaxWindDistanceFeet
Example

This is how you can create a wind

from py_ballisticcalc import Wind
wind = Wind(
    velocity=Unit.FPS(2700),
    direction_from=Unit.Degree(20)
)

Source code in py_ballisticcalc\conditions.py
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
def __init__(self,
             velocity: Optional[Union[float, Velocity]] = None,
             direction_from: Optional[Union[float, Angular]] = None,
             until_distance: Optional[Union[float, Distance]] = None,
             *,
             max_distance_feet: Optional[float] = cMaxWindDistanceFeet):
    """
    Create a new wind instance with given parameters

    Args:
        velocity: speed of wind
        direction_from: 0 is blowing from behind shooter.
            90 degrees is blowing from shooter's left towards right.
        until_distance: until which distance the specified wind blows
        max_distance_feet: Optional custom max wind distance

    Example:
        This is how you can create a wind
        ```python
        from py_ballisticcalc import Wind
        wind = Wind(
            velocity=Unit.FPS(2700),
            direction_from=Unit.Degree(20)
        )
        ```
    """

    self.MAX_DISTANCE_FEET = float(max_distance_feet or cMaxWindDistanceFeet)
    self.velocity = PreferredUnits.velocity(velocity or 0)
    self.direction_from = PreferredUnits.angular(direction_from or 0)
    self.until_distance = PreferredUnits.distance(until_distance or Distance.Foot(self.MAX_DISTANCE_FEET))

velocity instance-attribute

velocity: Velocity = velocity(velocity or 0)

direction_from instance-attribute

direction_from: Angular = angular(direction_from or 0)

until_distance instance-attribute

until_distance: Distance = distance(until_distance or Foot(MAX_DISTANCE_FEET))

MAX_DISTANCE_FEET class-attribute instance-attribute

MAX_DISTANCE_FEET: float = float(max_distance_feet or cMaxWindDistanceFeet)