Environment Analysis Class Usage#

Welcome to RocketPy’s Environment Analysis!

This notebook intends to present you a brief description of what is possible to be done by using the most recent class of RocketPy library. Analyzing weather historical data is of upmost importance for rocket launch operations, specially with regards to range closure decision which may impact safety and rocket flight performance, therefore the results presented here may be useful to support your launch operation design.

In this case we are going to use the Spaceport America location to perform an historical analysis over the last 20 years (i.e. from 2002 to 2021). However, Environment Analysis allows for both different location and time range to be analyzed as well.

Initializing class and loading files#

Let’s start by importing the required libraries for our work:

[1]:
%load_ext autoreload
%autoreload 2
[2]:
%matplotlib inline
[2]:
from rocketpy import EnvironmentAnalysis
from datetime import datetime
import matplotlib.pyplot as plt
import numpy as np

The next cell will capture the dataset file previous downloaded. For more details about how to get .nc files for another specific time and location, please consult the following thread:

[3]:
env_analysis = EnvironmentAnalysis(
    start_date=datetime(2002, 6, 15),  # (Year, Month, Day)
    end_date=datetime(2021, 6, 30),  # (Year, Month, Day)
    start_hour=6,
    end_hour=18,
    latitude=32.990629,
    longitude=-106.976097,
    surface_data_file="../../../data/weather/spaceport_america_single_level_reanalysis_2002_2021.nc",
    pressure_level_data_file="../../../data/weather/spaceport_america_pressure_levels_reanalysis_2002_2021.nc",
    timezone="America/Denver",
    unit_system="imperial",
)

Overview of .nc files#

Running the EnvironmentAnalysis class requires two NETcdf(.nc) files. NETcdf is a data format that storages climate data easily accessible only through libraries such as netCDF4. In RocketPy we will use these datasets to get variables such as temperature and wind speed at specific times and locations. The first one, SurfaceDataFile, must be an .nc file containing environment information about the surface temperature, U and V components of the wind at 10 and 100 meters from the surface etc, that can be found, for example, in ERA5 hourly data on single levels files (https://cds.climate.copernicus.eu/cdsapp#!/dataset/reanalysis-era5-single-levels). The second one, pressureLevelDataFile, must be an .nc file containing the geopotential, U and V components of wind and temperature for each pressure level. These variables can be found, for example, in ERA5 hourly data on pressure levels files (https://cds.climate.copernicus.eu/cdsapp#!/dataset/reanalysis-era5-pressure-levels).

Surface level Analysis#

At this first section we are looking for at the surface level. Data from surface analysis usually come with bigger amounts of information and therefore are important to give us a complete understanding of the scenario faced at the place and time that we are analysing.

Average and record values#

A good start on our analysis is by checking numerical values that are critical for the selected time range.

[4]:
env_analysis.prints.all()
Dataset Information:
Time Period: From 2002-06-15 00:00:00-06:00 to 2021-06-30 00:00:00-06:00
Available hours: From 6 to 18
Surface Data File Path:  ../../../data/weather/spaceport_america_single_level_reanalysis_2002_2021.nc
Latitude Range: From  33.5 ° to  32.5 °
Longitude Range: From  -107.5 ° to  -106.5 °
Pressure Data File Path:  ../../../data/weather/spaceport_america_pressure_levels_reanalysis_2002_2021.nc
Latitude Range: From  33.5 ° To  32.5 °
Longitude Range: From  -107.5 ° To  -106.5 °

Launch Site Details
Launch Site Latitude: 32.99063°
Launch Site Longitude: -106.97610°
Surface Elevation (from surface data file): 4872.7 ft
Max Expected Altitude:  None   ft

Pressure Information
Average Pressure at surface: 25.16 ± 0.08 inHg
Average Pressure at 1000 ft: 24.89 ± 0.11 inHg
Average Pressure at 10000 ft: 22.62 ± 0.11 inHg
Average Pressure at 30000 ft: 18.11 ± 0.11 inHg

Temperature Information
Historical Maximum Temperature: 105.04 degF
Historical Minimum Temperature: 59.55 degF
Average Daily Maximum Temperature: 93.89 degF
Average Daily Minimum Temperature: 70.97 degF

Elevated Wind Speed Information (33 ft above ground)
Historical Maximum Wind Speed: 28.04 mph
Historical Minimum Wind Speed: 0.14 mph
Average Daily Maximum Wind Speed: 11.38 mph
Average Daily Minimum Wind Speed: 2.61 mph

Sustained Surface Wind Speed Information (328 ft above ground)
Historical Maximum Wind Speed: 37.37 mph
Historical Minimum Wind Speed: 0.07 mph
Average Daily Maximum Wind Speed: 14.19 mph
Average Daily Minimum Wind Speed: 3.82 mph

Wind Gust Information
Historical Maximum Wind Gust: 49.24 mph
Average Daily Maximum Wind Gust: 22.38 mph

Precipitation Information
Percentage of Days with Precipitation: 0.3%
Maximum Precipitation in a day: 0.5 in
Average Precipitation in a day: 0.0 in

Cloud Base Height Information
Average Cloud Base Height: 12966.10 ft
Minimum Cloud Base Height: 1150.19 ft
Percentage of Days Without Clouds: 46.8 %

It’s also important to look at the variation of temperature and wind distribution throught a typical day, which can be easily done by running the next code cells:

[5]:
env_analysis.plots.average_surface_temperature_evolution()
../../_images/notebooks_environment_environment_analysis_class_usage_16_0.png

We can also take a look at sustained surface wind and wind gust plots!

[6]:
env_analysis.plots.average_surface10m_wind_speed_evolution()
../../_images/notebooks_environment_environment_analysis_class_usage_18_0.png
[7]:
env_analysis.plots.average_surface100m_wind_speed_evolution()
../../_images/notebooks_environment_environment_analysis_class_usage_19_0.png
[8]:
env_analysis.plots.animate_wind_gust_distribution()
[8]:
[9]:
env_analysis.plots.wind_gust_distribution_grid()
../../_images/notebooks_environment_environment_analysis_class_usage_21_0.png

The next cell will plot wind gust distribution summarized by every date and every hour available in the source file

[10]:
env_analysis.plots.wind_gust_distribution()
../../_images/notebooks_environment_environment_analysis_class_usage_23_0.png

Wind Roses#

Finally, we can use the previous informations to generate a graphic known as Wind Rose. A Wind Rose is commonly used by meteorologists to identify how wind speed and direction are typically distributed at a particular location. Using a polar coordinate system of gridding, the frequency of winds over a time period is plotted by wind direction, with color bands showing wind speed ranges. These color bands follow the Beaufort wind force scale. The direction of the longest spoke shows the wind direction with the greatest frequency.

Note: Wind Roses plot wind direction, which means the direction from which the wind is blowing, not to be confused with wind heading, which is the direction to which the wind blows.

[11]:
env_analysis.plots.animate_average_wind_rose(filename="wind_rose.gif")
[12]:
env_analysis.plots.average_wind_rose_grid()
../../_images/notebooks_environment_environment_analysis_class_usage_27_0.png
[13]:
# In case you need to plot only a singe windrose with regards to a specific hour
# env_analysis.plots.average_wind_rose_specific_hour(12)

Pressure Level Analysis#

At this section, we guide our analysis through pressure profile data available on our dataset. It means we are now stopping to see just surface information and start better understaand how the meteorology varies while the altitude increases.

Average wind profiles#

Moreover, we can see an animation of how the wind speed profile varies during an average day at Spaceport Location:

[14]:
env_analysis.plots.animate_wind_speed_profile()
[14]: