Environment Class

class rocketpy.Environment.Environment(railLength, gravity=9.80665, date=None, latitude=0, longitude=0, elevation=0, datum='SIRGAS2000', timeZone='UTC')[source]

Keeps all environment information stored, such as wind and temperature conditions, as well as gravity and rail length.

Constants
earthRadius

Value of Earth’s Radius = 6.3781e6 m.

Type

float

airGasConstant

Value of Air’s Gas Constant = 287.05287 J/K/Kg

Type

float

Gravity and Launch Rail Length
rl

Launch rail length in meters.

Type

float

g

Positive value of gravitational acceleration in m/s^2.

Type

float

Coordinates and Date
lat

Launch site latitude.

Type

float

lon

Launch site longitude.

Type

float

datum

The desired reference ellipsoide model, the following options are available: “SAD69”, “WGS84”, “NAD83”, and “SIRGAS2000”. The default is “SIRGAS2000”, then this model will be used if the user make some typing mistake

Type

string

initialEast

Launch site East UTM coordinate

Type

float

initialNorth

Launch site North UTM coordinate

Type

float

initialUtmZone

Launch site UTM zone number

Type

int

initialUtmLetter

Launch site UTM letter, to keep the latitude band and describe the UTM Zone

Type

string

initialHemisphere

Launch site S/N hemisphere

Type

string

initialEW

Launch site E/W hemisphere

Type

string

elevation

Launch site elevation.

Type

float

date

Date time of launch in UTC.

Type

datetime

localDate

Date time of launch in the local time zone, defined by Environment.timeZone.

Type

datetime

timeZone

Local time zone specification. See pytz for time zone info.

Type

string

Topographic information
elevLonArray

Unidimensional array containing the longitude coordinates

Type

array

elevLatArray

Unidimensional array containing the latitude coordinates

Type

array

elevArray

Two-dimensional Array containing the elevation information

Type

array

topographicProfileActivated

True if the user already set a topographic plofile

Type

bool

Atmosphere Static Conditions
maxExpectedHeight

Maximum altitude in meters to keep weather data. Used especially for plotting range. Can be altered as desired.

Type

float

pressureISA

Air pressure in Pa as a function of altitude as defined by the International Standard Atmosphere ISO 2533. Only defined after load Environment.loadInternationalStandardAtmosphere has been called. Can be accessed as regular array, or called as a function. See Function for more information.

Type

Function

temperatureISA

Air temperature in K as a function of altitude as defined by the International Standard Atmosphere ISO 2533. Only defined after load Environment.loadInternationalStandardAtmosphere has been called. Can be accessed as regular array, or called as a function. See Function for more information.

Type

Function

pressure

Air pressure in Pa as a function of altitude. Can be accessed as regular array, or called as a function. See Function for more information.

Type

Function

temperature

Air temperature in K as a function of altitude. Can be accessed as regular array, or called as a function. See Function for more information.

Type

Function

speedOfSound

Speed of sound in air in m/s as a function of altitude. Can be accessed as regular array, or called as a function. See Function for more information.

Type

Function

density

Air density in kg/m³ as a function of altitude. Can be accessed as regular array, or called as a function. See Function for more information.

Type

Function

dynamicViscosity

Air dynamic viscosity in Pa s as a function of altitude. Can be accessed as regular array, or called as a function. See Function for more information.

Type

Function

Atmosphere Wind Conditions
windSpeed

Wind speed in m/s as a function of altitude. Can be accessed as regular array, or called as a function. See Function for more information.

Type

Function

windDirection

Wind direction (from which the wind blows) in degrees relative to north (positive clockwise) as a function of altitude. Can be accessed as regular array, or called as a function. See Function for more information.

Type

Function

windHeading

Wind heading (direction towards which the wind blows) in degrees relative to north (positive clockwise) as a function of altitude. Can be accessed as regular array, or called as a function. See Function for more information.

Type

Function

windVelocityX

Wind U, or X (east) component of wind velocity in m/s as a function of altitude. Can be accessed as regular array, or called as a function. See Function for more information.

Type

Function

windVelocityY

Wind V, or Y (east) component of wind velocity in m/s as a function of altitude. Can be accessed as regular array, or called as a function. See Function for more information.

Type

Function

Atmospheric Model Details
atmosphericModelType

Describes the atmospheric model which is being used. Can only assume the following values: ‘StandardAtmosphere’, ‘CustomAtmosphere’, ‘WyomingSounding’, ‘NOAARucSounding’, ‘Forecast’, ‘Reanalysis’, ‘Ensemble’.

Type

string

atmosphericModelFile

Address of the file used for the atmospheric model being used. Only defined for ‘WyomingSounding’, ‘NOAARucSounding’, ‘Forecast’, ‘Reanalysis’, ‘Ensemble’

Type

string

atmosphericModelDict

Dictionary used to properly interpret netCDF and OPeNDAP files. Only defined for ‘Forecast’, ‘Reanalysis’, ‘Ensemble’.

Type

dictionary

atmosphericModelInitDate

Datetime object instance of first availabe date in netCDF and OPeNDAP files when using ‘Forecast’, ‘Reanalysis’ or ‘Ensemble’.

Type

datetime

atmosphericModelEndDate

Datetime object instance of last availabe date in netCDF and OPeNDAP files when using ‘Forecast’, ‘Reanalysis’ or ‘Ensemble’.

Type

datetime

atmosphericModelInterval

Hour step between weather condition used in netCDF and OPeNDAP files when using ‘Forecast’, ‘Reanalysis’ or ‘Ensemble’.

Type

int

atmosphericModelInitLat

Latitude of vertex just before the launch site in netCDF and OPeNDAP files when using ‘Forecast’, ‘Reanalysis’ or ‘Ensemble’.

Type

float

atmosphericModelEndLat

Latitude of vertex just after the launch site in netCDF and OPeNDAP files when using ‘Forecast’, ‘Reanalysis’ or ‘Ensemble’.

Type

float

atmosphericModelInitLon

Longitude of vertex just before the launch site in netCDF and OPeNDAP files when using ‘Forecast’, ‘Reanalysis’ or ‘Ensemble’.

Type

float

atmosphericModelEndLon

Longitude of vertex just after the launch site in netCDF and OPeNDAP files when using ‘Forecast’, ‘Reanalysis’ or ‘Ensemble’.

Type

float

Atmospheric Model Storage
latArray

Defined if netCDF or OPeNDAP file is used, for Forecasts, Reanalysis and Ensembles. 2x2 matrix for each pressure level of latitudes corresponding to the vertices of the grid cell which surrounds the launch site.

Type

array

lonArray

Defined if netCDF or OPeNDAP file is used, for Forecasts, Reanalysis and Ensembles. 2x2 matrix for each pressure level of longitudes corresponding to the vertices of the grid cell which surrounds the launch site.

Type

array

lonIndex

Defined if netCDF or OPeNDAP file is used, for Forecasts, Reanalysis and Ensembles. Index to a grid longitude which is just over the launch site longitude, while lonIndex - 1 points to a grid longitude which is just under the launch site longitude.

Type

int

latIndex

Defined if netCDF or OPeNDAP file is used, for Forecasts, Reanalysis and Ensembles. Index to a grid latitude which is just over the launch site latitude, while lonIndex - 1 points to a grid latitude which is just under the launch site latitude.

Type

int

geopotentials

Defined if netCDF or OPeNDAP file is used, for Forecasts, Reanalysis and Ensembles. 2x2 matrix for each pressure level of geopotential heights corresponding to the vertices of the grid cell which surrounds the launch site.

Type

array

windUs

Defined if netCDF or OPeNDAP file is used, for Forecasts, Reanalysis and Ensembles. 2x2 matrix for each pressure level of wind U (east) component corresponding to the vertices of the grid cell which surrounds the launch site.

Type

array

windVs

Defined if netCDF or OPeNDAP file is used, for Forecasts, Reanalysis and Ensembles. 2x2 matrix for each pressure level of wind V (north) component corresponding to the vertices of the grid cell which surrounds the launch site.

Type

array

levels

Defined if netCDF or OPeNDAP file is used, for Forecasts, Reanalysis and Ensembles. List of pressure levels available in the file.

Type

array

temperatures

Defined if netCDF or OPeNDAP file is used, for Forecasts, Reanalysis and Ensembles. 2x2 matrix for each pressure level of temperatures corresponding to the vertices of the grid cell which surrounds the launch site.

Type

array

timeArray

Defined if netCDF or OPeNDAP file is used, for Forecasts, Reanalysis and Ensembles. Array of dates available in the file.

Type

array

height

Defined if netCDF or OPeNDAP file is used, for Forecasts, Reanalysis and Ensembles. List of geometric height corresponding to launch site location.

Type

array

Atmospheric Model Ensemble Specific Data
levelEnsemble

Only defined when using Ensembles.

Type

array

heightEnsemble

Only defined when using Ensembles.

Type

array

temperatureEnsemble

Only defined when using Ensembles.

Type

array

windUEnsemble

Only defined when using Ensembles.

Type

array

windVEnsemble

Only defined when using Ensembles.

Type

array

windHeadingEnsemble

Only defined when using Ensembles.

Type

arrray

windDirectionEnsemble

Only defined when using Ensembles.

Type

array

windSpeedEnsemble

Only defined when using Ensembles.

Type

array

numEnsembleMembers

Number of ensemble members. Only defined when using Ensembles.

Type

int

ensembleMember

Current selected ensemble member. Only defined when using Ensembles.

Type

int

Initialize Environment class, saving launch rail length, launch date, location coordinates and elevation. Note that by default the standard atmosphere is loaded until another atmospheric model is used. See Environment.setAtmosphericModel for details.

Parameters
  • railLength (scalar) – Length in which the rocket will be attached to the rail, only moving along a fixed direction, that is, the line parallel to the rail.

  • gravity (scalar, optional) – Surface gravitational acceleration. Positive values point the acceleration down. Default value is 9.80665.

  • date (array, optional) – Array of length 4, stating (year, month, day, hour (UTC)) of rocket launch. Must be given if a Forecast, Reanalysis or Ensemble, will be set as an atmospheric model.

  • latitude (float, optional) – Latitude in degrees (ranging from -90 to 90) of rocket launch location. Must be given if a Forecast, Reanalysis or Ensemble will be used as an atmospheric model or if Open-Elevation will be used to compute elevation.

  • longitude (float, optional) – Longitude in degrees (ranging from -180 to 360) of rocket launch location. Must be given if a Forecast, Reanalysis or Ensemble will be used as an atmospheric model or if Open-Elevation will be used to compute elevation.

  • elevation (float, optional) – Elevation of launch site measured as height above sea level in meters. Alternatively, can be set as ‘Open-Elevation’ which uses the Open-Elevation API to find elevation data. For this option, latitude and longitude must also be specified. Default value is 0.

  • datum (string) – The desired reference ellipsoide model, the following options are available: “SAD69”, “WGS84”, “NAD83”, and “SIRGAS2000”. The default is “SIRGAS2000”, then this model will be used if the user make some typing mistake.

  • timeZone (string, optional) – Name of the time zone. To see all time zones, import pytz and run

Returns

Return type

None

setDate(date, timeZone='UTC')[source]

Set date and time of launch and update weather conditions if date dependent atmospheric model is used.

Parameters
  • date (Datetime) – Datetime object specifying launch date and time.

  • timeZone (string, optional) – Name of the time zone. To see all time zones, import pytz and run

  • Default time zone is "UTC". (print(pytz.all_timezones)) –

Returns

Return type

None

setLocation(latitude, longitude)[source]

Set latitude and longitude of launch and update atmospheric conditions if location dependent model is being used.

Parameters
  • latitude (float) – Latitude of launch site. May range from -90 to 90 degrees.

  • longitude (float) – Longitude of launch site. Either from 0 to 360 degrees or from -180 to 180 degrees.

Returns

Return type

None

setElevation(elevation='Open-Elevation')[source]

Set elevation of launch site given user input or using the Open-Elevation API.

Parameters

elevation (float, string, optional) – Elevation of launch site measured as height above sea level in meters. Alternatively, can be set as ‘Open-Elevation’ which uses the Open-Elevation API to find elevation data. For this option, latitude and longitude must have already been specified. See Environment.setLocation for more details.

Returns

Return type

None

getElevationFromTopograghicProfile(lat, lon)[source]

Function which receives as inputs the coordinates of a point and finds its elevation in the provided Topographic Profile

Parameters
  • lat (float) – latitude of the point.

  • lon (float) – longitude of the point.

Returns

elevation – Elevation provided by the topographic data, in meters.

Return type

float

Raises
  • ValueError – [description]

  • ValueError – [description]

setAtmosphericModel(type, file=None, dictionary=None, pressure=None, temperature=None, wind_u=0, wind_v=0)[source]

Defines an atmospheric model for the Environment. Supported functionality includes using data from the International Standard Atmosphere, importing data from weather reanalysis, forecasts and ensemble forecasts, importing data from upper air soundings and inputing data as custom functions, arrays or csv files.

Parameters
  • type (string) –

    One of the following options: - ‘StandardAtmosphere’: sets pressure and temperature profiles corresponding to the International Standard Atmosphere defined by ISO 2533 and ranging from -2 km to 80 km of altitude above sea level. Note that the wind profiles are set to zero when this type is chosen.

    • ’WyomingSounding’: sets pressure, temperature, wind-u

    and wind-v profiles and surface elevation obtained from an upper air sounding given by the file parameter through an URL. This URL should point to a data webpage given by selecting plot type as text: list, a station and a time at http://weather.uwyo.edu/upperair/sounding.html. An example of a valid link would be: http://weather.uwyo.edu/cgi-bin/sounding?region=samer&TYPE=TEXT%3ALIST&YEAR=2019&MONTH=02&FROM=0200&TO=0200&STNM=82599

    • ’NOAARucSounding’: sets pressure, temperature, wind-u

    and wind-v profiles and surface elevation obtained from an upper air sounding given by the file parameter through an URL. This URL should point to a data webpage obtained through NOAA’s Ruc Sounding servers, which can be accessed in https://rucsoundings.noaa.gov/. Selecting ROABs as the initial data source, specifying the station through it’s WMO-ID and opting for the ASCII (GSD format) button, the following example URL opens up: https://rucsoundings.noaa.gov/get_raobs.cgi?data_source=RAOB&latest=latest&start_year=2019&start_month_name=Feb&start_mday=5&start_hour=12&start_min=0&n_hrs=1.0&fcst_len=shortest&airport=83779&text=Ascii%20text%20%28GSD%20format%29&hydrometeors=false&start=latest Any ASCII GSD format page from this server can be read, so information from virtual soundings such as GFS and NAM can also be imported.

    • ’Forecast’: sets pressure, temperature, wind-u and wind-v

    profiles and surface elevation obtained from a weather forecast file in netCDF format or from an OPeNDAP URL, both given through the file parameter. When this type is chosen, the date and location of the launch should already have been set through the date and location parameters when initializing the Environment. The netCDF and OPeNDAP datasets must contain at least geopotential height or geopotential, temperature, wind-u and wind-v profiles as a function of pressure levels. If surface geopotential or geopotential height is given, elevation is also set. Otherwise, elevation is not changed. Profiles are interpolated bi-linearly using supplied latitude and longitude. The date used is the nearest one to the date supplied. Furthermore, a dictionary must be supplied through the dictionary parameter in order for the dataset to be accurately read. Lastly, the dataset must use a rectangular grid sorted in either ascending or descending order of latitude and longitude.

    • ’Reanalysis’: sets pressure, temperature, wind-u and wind-v

    profiles and surface elevation obtained from a weather forecast file in netCDF format or from an OPeNDAP URL, both given through the file parameter. When this type is chosen, the date and location of the launch should already have been set through the date and location parameters when initializing the Environment. The netCDF and OPeNDAP datasets must contain at least geopotential height or geopotential, temperature, wind-u and wind-v profiles as a function of pressure levels. If surface geopotential or geopotential height is given, elevation is also set. Otherwise, elevation is not changed. Profiles are interpolated bi-linearly using supplied latitude and longitude. The date used is the nearest one to the date supplied. Furthermore, a dictionary must be supplied through the dictionary parameter in order for the dataset to be accurately read. Lastly, the dataset must use a rectangular grid sorted in either ascending or descending order of latitude and longitude.

    • ’Ensemble’: sets pressure, temperature, wind-u and wind-v

    profiles and surface elevation obtained from a weather forecast file in netCDF format or from an OPeNDAP URL, both given through the file parameter. When this type is chosen, the date and location of the launch should already have been set through the date and location parameters when initializing the Environment. The netCDF and OPeNDAP datasets must contain at least geopotential height or geopotential, temperature, wind-u and wind-v profiles as a function of pressure levels. If surface geopotential or geopotential height is given, elevation is also set. Otherwise, elevation is not changed. Profiles are interpolated bi-linearly using supplied latitude and longitude. The date used is the nearest one to the date supplied. Furthermore, a dictionary must be supplied through the dictionary parameter in order for the dataset to be accurately read. Lastly, the dataset must use a rectangular grid sorted in either ascending or descending order of latitude and longitude. By default the first ensemble forecast is activated. To activate other ensemble forecasts see Environment.selectEnsembleMemberMember().

    • ’CustomAtmosphere’: sets pressure, temperature, wind-u

    and wind-v profiles given though the pressure, temperature, wind-u and wind-v parameters of this method. If pressure or temperature is not given, it will default to the International Standard Atmosphere. If the wind components are not given, it will default to 0.

  • file (string, optional) –

    String that must be given when type is either ‘WyomingSounding’, ‘Forecast’, ‘Reanalysis’ or ‘Ensemble’. It specifies the location of the data given, either through a local file address or a URL. If type is ‘Forecast’, this parameter can also be either ‘GFS’, ‘FV3’, ‘RAP’ or ‘NAM’ for latest of these forecasts. References: GFS: Global - 0.25deg resolution - Updates every 6 hours, forecast for 81 points spaced by 3 hours

    FV3: Global - 0.25deg resolution - Updates every 6 hours, forecast for 129 points spaced by 3 hours RAP: Regional USA - 0.19deg resolution - Updates hourly, forecast for 40 points spaced hourly NAM: Regional CONUS Nest - 5 km resolution - Updates every 6 hours, forecast for 21 points spaced by 3 hours

    If type is ‘Ensemble’, this parameter can also be either ‘GEFS’, or ‘CMC’ for the latest of these ensembles. References: GEFS: Global, bias-corrected, 0.5deg resolution, 21 forecast members, Updates every 6 hours, forecast for 65 points spaced by 4 hours

    CMC: Global, 0.5deg resolution, 21 forecast members, Updates every 12 hours, forecast for 65 points spaced by 4 hours

  • dictionary (dictionary, string, optional) –

    Dictionary that must be given when type is either ‘Forecast’, ‘Reanalysis’ or ‘Ensemble’. It specifies the dictionary to be used when reading netCDF and OPeNDAP files, allowing the correct retrieval of data. Acceptable values include ‘ECMWF’, ‘NOAA’ and ‘UCAR’ for default dictionaries which can generally be used to read datasets from these institutes. Alternatively, a dictionary structure can also be given, specifying the short names used for time, latitude, longitude, pressure levels, temperature profile, geopotential or geopotential height profile, wind-u and wind-v profiles in the dataset given in the file parameter. Additionally, ensemble dictionaries must have the ensemble as well. An example is the following dictionary, used for ‘NOAA’:

    {‘time’: ‘time’,

    ’latitude’: ‘lat’,

    ’longitude’: ‘lon’,

    ’level’: ‘lev’,

    ’ensemble’: ‘ens’,

    ’temperature’: ‘tmpprs’,

    ’surface_geopotential_height’: ‘hgtsfc’,
    ’geopotential_height’: ‘hgtprs’,
    ’geopotential’: None,

    ’u_wind’: ‘ugrdprs’, ‘v_wind’: ‘vgrdprs’}

  • pressure (float, string, array, callable, optional) – This defines the atmospheric pressure profile. Should be given if the type parameter is ‘CustomAtmosphere’. If not, than the the Standard Atmosphere pressure will be used. If a float is given, it will define a constant pressure profile. The float should be in units of Pa. If a string is given, it should point to a .CSV file containing at most one header line and two columns of data. The first column must be the geometric height above sea level in meters while the second column must be the pressure in Pa. If an array is given, it is expected to be a list or array of coordinates (height in meters, pressure in Pa). Finally, a callable or function is also accepted. The function should take one argument, the height above sea level in meters and return a corresponding pressure in Pa.

  • temperature (float, string, array, callable, optional) – This defines the atmospheric temperature profile. Should be given if the type parameter is ‘CustomAtmosphere’. If not, than the the Standard Atmosphere temperature will be used. If a float is given, it will define a constant temperature profile. The float should be in units of K. If a string is given, it should point to a .CSV file containing at most one header line and two columns of data. The first column must be the geometric height above sea level in meters while the second column must be the temperature in K. If an array is given, it is expected to be a list or array of coordinates (height in meters, temperature in K). Finally, a callable or function is also accepted. The function should take one argument, the height above sea level in meters and return a corresponding temperature in K.

  • wind_u (float, string, array, callable, optional) – This defines the atmospheric wind-u profile, corresponding the the magnitude of the wind speed heading East. Should be given if the type parameter is ‘CustomAtmosphere’. If not, it will be assumed to be constant and equal to 0. If a float is given, it will define a constant wind-u profile. The float should be in units of m/s. If a string is given, it should point to a .CSV file containing at most one header line and two columns of data. The first column must be the geometric height above sea level in meters while the second column must be the wind-u in m/s. If an array is given, it is expected to be an array of coordinates (height in meters, wind-u in m/s). Finally, a callable or function is also accepted. The function should take one argument, the height above sea level in meters and return a corresponding wind-u in m/s.

  • wind_v (float, string, array, callable, optional) – This defines the atmospheric wind-v profile, corresponding the the magnitude of the wind speed heading North. Should be given if the type parameter is ‘CustomAtmosphere’. If not, it will be assumed to be constant and equal to 0. If a float is given, it will define a constant wind-v profile. The float should be in units of m/s. If a string is given, it should point to a .CSV file containing at most one header line and two columns of data. The first column must be the geometric height above sea level in meters while the second column must be the wind-v in m/s. If an array is given, it is expected to be an array of coordinates (height in meters, wind-v in m/s). Finally, a callable or function is also accepted. The function should take one argument, the height above sea level in meters and return a corresponding wind-v in m/s.

Returns

Return type

None

processStandardAtmosphere()[source]

Sets pressure and temperature profiles corresponding to the International Standard Atmosphere defined by ISO 2533 and ranging from -2 km to 80 km of altitude above sea level. Note that the wind profiles are set to zero.

Parameters

None

Returns

Return type

None

processCustomAtmosphere(pressure=None, temperature=None, wind_u=0, wind_v=0)[source]

Import pressure, temperature and wind profile given by user.

Parameters
  • pressure (float, string, array, callable, optional) – This defines the atmospheric pressure profile. Should be given if the type parameter is ‘CustomAtmosphere’. If not, than the the Standard Atmosphere pressure will be used. If a float is given, it will define a constant pressure profile. The float should be in units of Pa. If a string is given, it should point to a .CSV file containing at most one header line and two columns of data. The first column must be the geometric height above sea level in meters while the second column must be the pressure in Pa. If an array is given, it is expected to be a list or array of coordinates (height in meters, pressure in Pa). Finally, a callable or function is also accepted. The function should take one argument, the height above sea level in meters and return a corresponding pressure in Pa.

  • temperature (float, string, array, callable, optional) – This defines the atmospheric temperature profile. Should be given if the type parameter is ‘CustomAtmosphere’. If not, than the the Standard Atmosphere temperature will be used. If a float is given, it will define a constant temperature profile. The float should be in units of K. If a string is given, it should point to a .CSV file containing at most one header line and two columns of data. The first column must be the geometric height above sea level in meters while the second column must be the temperature in K. If an array is given, it is expected to be a list or array of coordinates (height in meters, temperature in K). Finally, a callable or function is also accepted. The function should take one argument, the height above sea level in meters and return a corresponding temperature in K.

  • wind_u (float, string, array, callable, optional) – This defines the atmospheric wind-u profile, corresponding the the magnitude of the wind speed heading East. Should be given if the type parameter is ‘CustomAtmosphere’. If not, it will be assumed constant and 0. If a float is given, it will define a constant wind-u profile. The float should be in units of m/s. If a string is given, it should point to a .CSV file containing at most one header line and two columns of data. The first column must be the geometric height above sea level in meters while the second column must be the wind-u in m/s. If an array is given, it is expected to be an array of coordinates (height in meters, wind-u in m/s). Finally, a callable or function is also accepted. The function should take one argument, the height above sea level in meters and return a corresponding wind-u in m/s.

  • wind_v (float, string, array, callable, optional) – This defines the atmospheric wind-v profile, corresponding the the magnitude of the wind speed heading North. Should be given if the type parameter is ‘CustomAtmosphere’. If not, it will be assumed constant and 0. If a float is given, it will define a constant wind-v profile. The float should be in units of m/s. If a string is given, it should point to a .CSV file containing at most one header line and two columns of data. The first column must be the geometric height above sea level in meters while the second column must be the wind-v in m/s. If an array is given, it is expected to be an array of coordinates (height in meters, wind-v in m/s). Finally, a callable or function is also accepted. The function should take one argument, the height above sea level in meters and return a corresponding wind-v in m/s.

Returns

Return type

None

processWyomingSounding(file)[source]

Import and process the upper air sounding data from Wyoming Upper Air Soundings database given by the url in file. Sets pressure, temperature, wind-u, wind-v profiles and surface elevation.

Parameters

file (string) – URL of an upper air sounding data output from Wyoming Upper Air Soundings database. Example: http://weather.uwyo.edu/cgi-bin/sounding?region=samer&TYPE=TEXT%3ALIST&YEAR=2019&MONTH=02&FROM=0200&TO=0200&STNM=82599 More can be found at: http://weather.uwyo.edu/upperair/sounding.html.

Returns

Return type

None

processNOAARUCSounding(file)[source]

Import and process the upper air sounding data from NOAA Ruc Soundings database (https://rucsoundings.noaa.gov/) given as ASCII GSD format pages passed by its url to the file parameter. Sets pressure, temperature, wind-u, wind-v profiles and surface elevation.

Parameters

file (string) – URL of an upper air sounding data output from NOAA Ruc Soundings in ASCII GSD format. Example: https://rucsoundings.noaa.gov/get_raobs.cgi?data_source=RAOB&latest=latest&start_year=2019&start_month_name=Feb&start_mday=5&start_hour=12&start_min=0&n_hrs=1.0&fcst_len=shortest&airport=83779&text=Ascii%20text%20%28GSD%20format%29&hydrometeors=false&start=latest More can be found at: https://rucsoundings.noaa.gov/.

Returns

Return type

None

selectEnsembleMember(member=0)[source]

Activates ensemble member, meaning that all atmospheric variables read from the Environment instance will correspond to the desired ensemble member.

Parameters

member (int) – Ensemble member to be activated. Starts from 0.

Returns

Return type

None

loadInternationalStandardAtmosphere()[source]

Defines the pressure and temperature profile functions set by ISO 2533 for the International Standard atmosphere and saves them as self.pressureISA and self.temperatureISA.

Parameters

None

Returns

Return type

None

calculateDensityProfile()[source]

Compute the density of the atmosphere as a function of height by using the formula rho = P/(RT). This function is automatically called whenever a new atmospheric model is set.

Parameters

None

Returns

Return type

None

calculateSpeedOfSoundProfile()[source]

Compute the speed of sound in the atmosphere as a function of height by using the formula a = sqrt(gamma*R*T). This function is automatically called whenever a new atmospheric model is set.

Parameters

None

Returns

Return type

None

calculateDynamicViscosity()[source]

Compute the dynamic viscosity of the atmosphere as a function of height by using the formula given in ISO 2533 u = B*T^(1.5)/(T+S). This function is automatically called whenever a new atmospheric model is set.

Parameters

None

Returns

Return type

None

addWindGust(windGustX, windGustY)[source]

Adds a function to the current stored wind profile, in order to simulate a wind gust.

Parameters
  • windGustX (float, callable) – Callable, function of altitude, which will be added to the x velocity of the current stored wind profile. If float is given, it will be considered as a constant function in altitude.

  • windGustY (float, callable) – Callable, function of altitude, which will be added to the y velocity of the current stored wind profile. If float is given, it will be considered as a constant function in altitude.

Returns

Return type

None

info()[source]

Prints most important data and graphs available about the Environment.

Parameters

None

Returns

Return type

None

allInfo()[source]

Prints out all data and graphs available about the Environment.

Parameters

None

Returns

Return type

None

allPlotInfoReturned()[source]

Returns a dictionary with all plot information available about the Environment.

Parameters

None

Returns

plotInfo – Dict of data relevant to plot externally

Return type

Dict

allInfoReturned()[source]

Returns as dicts all data available about the Environment.

Parameters

None

Returns

info – Information relevant about the Environment class.

Return type

Dict

geodesicToUtm(lat, lon, datum)[source]

Function which converts geodetic coordinates, i.e. lat/lon, to UTM projection coordinates. Can be used only for latitudes between -80.00° and 84.00°

Parameters
  • lat (float) – The latitude coordinates of the point of analysis, must be contained between -80.00° and 84.00°

  • lon (float) – The longitude coordinates of the point of analysis, must be contained between -180.00° and 180.00°

  • datum (string) – The desired reference ellipsoide model, the following options are available: “SAD69”, “WGS84”, “NAD83”, and “SIRGAS2000”. The default is “SIRGAS2000”, then this model will be used if the user make some typing mistake

Returns

  • x (float) – East coordinate, always positive

  • y – North coordinate, always positive

  • utmZone (int) – The number of the UTM zone of the point of analysis, can vary between 1 and 60

  • utmLetter (string) – The letter of the UTM zone of the point of analysis, can vary between C and X, omitting the letters “I” and “O”

  • hemis (string) – Returns “S” for southern hemisphere and “N” for Northern hemisphere

  • EW (string) – Returns “W” for western hemisphere and “E” for eastern hemisphere

utmToGeodesic(x, y, utmZone, hemis, datum)[source]

Function to convert UTM coordinates to geodesic coordinates (i.e. latitude and longitude). The latitude should be between -80° and 84°

Parameters
  • x (float) – East UTM coordinate in meters

  • y (float) – North UTM coordinate in meters

  • utmZone (int) – The number of the UTM zone of the point of analysis, can vary between 1 and 60

  • hemis (string) – Equals to “S” for southern hemisphere and “N” for Northern hemisphere

  • datum (string) – The desired reference ellipsoide model, the following options are available: “SAD69”, “WGS84”, “NAD83”, and “SIRGAS2000”. The default is “SIRGAS2000”, then this model will be used if the user make some typing mistake

Returns

  • lat (float) – latitude of the analysed point

  • lon (float) – latitude of the analysed point

calculateEarthRadius(lat, datum)[source]

Simple function to calculate the Earth Radius at a specific latitude based on ellipsoidal reference model (datum). The earth radius here is assumed as the distance between the ellipsoid’s center of gravity and a point on ellipsoid surface at the desired Pay attention: The ellipsoid is an approximation for the earth model and will obviously output an estimate of the perfect distance between earth’s relief and its center of gravity.

Parameters
  • lat (float) – latitude in which the Earth radius will be calculated

  • datum (string) – The desired reference ellipsoide model, the following options are available: “SAD69”, “WGS84”, “NAD83”, and “SIRGAS2000”. The default is “SIRGAS2000”, then this model will be used if the user make some typing mistake

Returns

Earth Radius at the desired latitude in meters

Return type

float

decimalDegressToArcSeconds(angle)[source]
Function to convert an angle in decimal degrees to deg/min/sec.

Converts (°) to (° ‘ “)

Parameters

angle (float) – The angle that you need convert to deg/min/sec. Must be given in decimal degrees.

Returns

  • deg (float) – The degrees.

  • min (float) – The arc minutes. 1 arc-minute = (1/60)*degree

  • sec (float) – The arc Seconds. 1 arc-second = (1/3600)*degree

printEarthDetails()[source]

[UNDER CONSTRUCTION] Function to print information about the Earth Model used in the Environment Class