Stochastic Environment#

class rocketpy.stochastic.StochasticEnvironment[source]#

A Stochastic Environment class that inherits from StochasticModel. This class is used to store an Environment object and the uncertainty of their parameters.

See also

Stochastic Model

Variables:
  • object (Environment) – Environment object to be used as a base for the stochastic model.

  • elevation (tuple, list, int, float) – Elevation of the launch site in meters.

  • gravity (tuple, list, int, float) – Gravitational acceleration in meters per second squared.

  • latitude (tuple, list, int, float) – Latitude of the launch site in degrees.

  • longitude (tuple, list, int, float) – Longitude of the launch site in degrees.

  • ensemble_member (list[int]) – List of integers representing the ensemble members to be selected.

  • date (list[tuple]) – List of dates, which are tuples of four elements (year, month, day, hour). This attribute can not be randomized.

  • datum (list[str]) – List of datum. This attribute can not be randomized.

  • timezone (list[pytz.timezone]) – List with the timezone. This attribute can not be randomized.

  • wind_velocity_x_factor (tuple, list, int, float) – Factor to multiply the wind velocity in the x direction. This should be used only when the wind velocity is defined as a constant value.

  • wind_velocity_y_factor (tuple, list, int, float) – Factor to multiply the wind velocity in the y direction. This should be used only when the wind velocity is defined as a constant value.

__init__(environment, elevation=None, gravity=None, latitude=None, longitude=None, ensemble_member=None, wind_velocity_x_factor=(1, 0), wind_velocity_y_factor=(1, 0))[source]#

Initializes the Stochastic Environment class.

See also

Stochastic Model

Parameters:
  • environment (Environment) – Environment object to be used for validation.

  • date (list, optional) – List of dates, which are tuples of four elements (year, month, day, hour).

  • elevation (int, float, tuple, list, optional) – Elevation of the launch site in meters.

  • gravity (int, float, tuple, list, optional) – Gravitational acceleration in meters per second squared.

  • latitude (int, float, tuple, list, optional) – Latitude of the launch site in degrees.

  • longitude (int, float, tuple, list, optional) – Longitude of the launch site in degrees.

  • ensemble_member (list, optional) – List of integers representing the ensemble member to be selected.

  • wind_velocity_x_factor (tuple, list, int, float, optional) – Factor to multiply the wind velocity in the x direction. This should be used only when the wind velocity is defined as a constant value.

  • wind_velocity_y_factor (tuple, list, int, float, optional) – Factor to multiply the wind velocity in the y direction. This should be used only when the wind velocity is defined as a constant value.

_validate_ensemble(ensemble_member, environment)[source]#

Validates the ensemble member input argument. If the environment does not have ensemble members, the ensemble member input argument must be None. If the environment has ensemble members, the ensemble member input argument must be a list of positive integers, and the integers must be in the range from 0 to the number of ensemble members minus one.

Parameters:
  • ensemble_member (list) – List of integers representing the ensemble members to be selected.

  • environment (Environment) – Environment object to be used for validation.

Return type:

None

Raises:

AssertionError – If the environment does not have ensemble members and the ensemble_member input argument is not None.

create_object()[source]#

Creates an Environment object from the randomly generated input arguments. The environment object is not recreated to avoid having to reestablish the atmospheric model. Instead, attributes are changed directly.

Parameters:

None

Returns:

Environment object with the randomly generated input arguments.

Return type:

Environment

Notes

This method is overwriting the create_object method from the StochasticModel class to handle the special case of the ensemble member attribute.