{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 492,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 493,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1       21.079909\n",
       "2       21.079909\n",
       "3       21.079909\n",
       "4       21.079909\n",
       "5       21.079909\n",
       "          ...    \n",
       "1362    21.080085\n",
       "1363    21.080085\n",
       "1364    21.080085\n",
       "1365    21.080085\n",
       "1366    21.080085\n",
       "Name: longitude, Length: 1366, dtype: float64"
      ]
     },
     "execution_count": 493,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_csv('data/simulations/11km.txt', sep='\\t', encoding='latin')\n",
    "df = df.drop([0], axis=0)\n",
    "df = df.astype(float)\n",
    "\n",
    "df['longitude']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 494,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1       67.885478\n",
       "2       67.885478\n",
       "3       67.885478\n",
       "4       67.885478\n",
       "5       67.885478\n",
       "          ...    \n",
       "1362    67.959101\n",
       "1363    67.959101\n",
       "1364    67.959101\n",
       "1365    67.959101\n",
       "1366    67.959101\n",
       "Name: latitude, Length: 1366, dtype: float64"
      ]
     },
     "execution_count": 494,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['latitude']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 495,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1       67.750940\n",
       "2       67.750940\n",
       "3       67.750940\n",
       "4       67.750940\n",
       "5       67.750940\n",
       "          ...    \n",
       "1362    67.824918\n",
       "1363    67.824918\n",
       "1364    67.824918\n",
       "1365    67.824918\n",
       "1366    67.824918\n",
       "Name: declination, Length: 1366, dtype: float64"
      ]
     },
     "execution_count": 495,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['declination']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 496,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "8.20214666930979e-13 -1.51393643837011e-12 -2.40063988328838e-12\n"
     ]
    }
   ],
   "source": [
    "print(df.at[2, 'x_FL'], df.at[2, 'y_FL'], df.at[2, 'z_FL'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 497,
   "metadata": {},
   "outputs": [],
   "source": [
    "df = pd.read_csv('data/simulations/raw/Resultmin20.txt', sep='\\t')\n",
    "\n",
    "# Result_Exporte -> 19km\n",
    "# Resultadd10 -> 16km\n",
    "# Resultmin10 -> 23km\n",
    "# Resultmin20 ->"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 498,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0       X-Acceleration w/o Gravity of STAHR_Rocket in ...\n",
       "1                                         Meter/Second**2\n",
       "2                                    9.67852498145304E+00\n",
       "3                                    9.67852498145304E+00\n",
       "4                                    9.67852498145304E+00\n",
       "                              ...                        \n",
       "1715                                 9.79985543156082E+00\n",
       "1716                                 9.81624939319664E+00\n",
       "1717                                 9.82432436318236E+00\n",
       "1718                                 9.82407348573446E+00\n",
       "1719                                 9.82407348573446E+00\n",
       "Name: acceleration_without_gravity_x~STAHR_Rocket#B~STAHR_Rocket@STAHR_Rocket, Length: 1720, dtype: object"
      ]
     },
     "execution_count": 498,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['acceleration_without_gravity_x~STAHR_Rocket#B~STAHR_Rocket@STAHR_Rocket']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 499,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('Phase', nan)\n",
      "('acceleration_without_gravity_east~STAHR_Rocket#L~STAHR_Rocket:Earth@STAHR_Rocket', 'Meter/Second**2')\n",
      "('acceleration_without_gravity_north~STAHR_Rocket#L~STAHR_Rocket:Earth@STAHR_Rocket', 'Meter/Second**2')\n",
      "('acceleration_without_gravity_radial~STAHR_Rocket#L~STAHR_Rocket:Earth@STAHR_Rocket', 'Meter/Second**2')\n",
      "('acceleration_without_gravity_x~STAHR_Rocket#B~STAHR_Rocket@STAHR_Rocket', 'Meter/Second**2')\n",
      "('acceleration_without_gravity_y~STAHR_Rocket#B~STAHR_Rocket@STAHR_Rocket', 'Meter/Second**2')\n",
      "('acceleration_without_gravity_z~STAHR_Rocket#B~STAHR_Rocket@STAHR_Rocket', 'Meter/Second**2')\n",
      "('acceleration_without_gravity~STAHR_Rocket', 'Meter/Second**2')\n",
      "('acceleration_x~STAHR_Rocket#J2000@Earth', 'Meter/Second**2')\n",
      "('acceleration_y~STAHR_Rocket#J2000@Earth', 'Meter/Second**2')\n",
      "('acceleration_z~STAHR_Rocket#J2000@Earth', 'Meter/Second**2')\n",
      "('acceleration~STAHR_Rocket#J2000@Earth', 'Meter/Second**2')\n",
      "('acc_aero_east~STAHR_Rocket#L~STAHR_Rocket:Earth@STAHR_Rocket', 'Meter/Second**2')\n",
      "('acc_aero_north~STAHR_Rocket#L~STAHR_Rocket:Earth@STAHR_Rocket', 'Meter/Second**2')\n",
      "('acc_aero_r~STAHR_Rocket#L~STAHR_Rocket:Earth@STAHR_Rocket', 'Meter/Second**2')\n",
      "('acc_aero~STAHR_Rocket', 'Meter/Second**2')\n",
      "('acc_normal~STAHR_Rocket', 'Meter/Second**2')\n",
      "('acc_thrust_east~STAHR_Rocket#L~STAHR_Rocket:Earth@STAHR_Rocket', 'Meter/Second**2')\n",
      "('acc_thrust_north~STAHR_Rocket#L~STAHR_Rocket:Earth@STAHR_Rocket', 'Meter/Second**2')\n",
      "('acc_thrust_r~STAHR_Rocket#L~STAHR_Rocket:Earth@STAHR_Rocket', 'Meter/Second**2')\n",
      "('acc_thrust~STAHR_Rocket', 'Meter/Second**2')\n",
      "('aero_area_ref~STAHR_Rocket', 'Meter^2')\n",
      "('aero_bank_angle~STAHR_Rocket', 'Degree')\n",
      "('aero_roll_angle~STAHR_Rocket', 'Degree')\n",
      "('airpath_angle~STAHR_Rocket#LD~STAHR_Rocket:Earth', 'Degree')\n",
      "('airpath_angle~STAHR_Rocket#L~STAHR_Rocket:Earth', 'Degree')\n",
      "('AIRPATH_BANK_ANGLE~Esrange#A~Esrange:Earth', 'Radian')\n",
      "('AIRPATH_BANK_ANGLE~STAHR_Rocket#A~STAHR_Rocket:Earth', 'Radian')\n",
      "('airpath_heading~STAHR_Rocket#LD~STAHR_Rocket:Earth', 'Degree')\n",
      "('airpath_heading~STAHR_Rocket#L~STAHR_Rocket:Earth', 'Degree')\n",
      "('airpath_speed~STAHR_Rocket', 'Kilo-Meter/Second')\n",
      "('altitude_apoapsis~STAHR_Rocket@Earth', 'Kilo-Meter')\n",
      "('altitude_periapsis~STAHR_Rocket@Earth', 'Kilo-Meter')\n",
      "('altitude~STAHR_Rocket@Earth', 'Kilo-Meter')\n",
      "('angle1~IB3:STAHR_Rocket#B~STAHR_Rocket', 'Radian')\n",
      "('angle1~IB3:STAHR_Rocket#J2000', 'Radian')\n",
      "('angle1~STAHR:STAHR_Rocket#B~STAHR_Rocket', 'Radian')\n",
      "('angle1~STAHR:STAHR_Rocket#J2000', 'Radian')\n",
      "('angle2~IB3:STAHR_Rocket#B~STAHR_Rocket', 'Radian')\n",
      "('angle2~IB3:STAHR_Rocket#J2000', 'Radian')\n",
      "('angle2~STAHR:STAHR_Rocket#B~STAHR_Rocket', 'Radian')\n",
      "('angle2~STAHR:STAHR_Rocket#J2000', 'Radian')\n",
      "('angle3~IB3:STAHR_Rocket#B~STAHR_Rocket', 'Radian')\n",
      "('angle3~IB3:STAHR_Rocket#J2000', 'Radian')\n",
      "('angle3~STAHR:STAHR_Rocket#B~STAHR_Rocket', 'Radian')\n",
      "('angle3~STAHR:STAHR_Rocket#J2000', 'Radian')\n",
      "('angle_body_and_local_vertical~STAHR_Rocket#L~STAHR_Rocket:Earth', 'Degree')\n",
      "('angle_of_attack_rate~STAHR_Rocket#A~STAHR_Rocket:Earth', 'Degree/Second')\n",
      "('ANGLE_OF_ATTACK~Esrange#A~Esrange:Earth', 'Radian')\n",
      "('angle_of_attack~STAHR_Rocket#A~STAHR_Rocket:Earth', 'Degree')\n",
      "('angular_velocity~STAHR_Rocket#B~STAHR_Rocket', 'Degree/Second')\n",
      "('arc_length~STAHR_Rocket', 'Kilo-Meter')\n",
      "('ascending_node_rel~STAHR_Rocket#TOD~Earth', 'Degree')\n",
      "('ascending_node~STAHR_Rocket#J2000', 'Degree')\n",
      "('ascending_node~STAHR_Rocket#TOD~Earth', 'Degree')\n",
      "('asymptote_decl~STAHR_Rocket#J2000', 'Degree')\n",
      "('asymptote_decl~STAHR_Rocket#TOD~Earth', 'Degree')\n",
      "('asymptote_right_ascension~STAHR_Rocket#J2000', 'Degree')\n",
      "('asymptote_right_ascension~STAHR_Rocket#TOD~Earth', 'Degree')\n",
      "('atmos_density~STAHR_Rocket', 'Kilogram/Meter**3')\n",
      "('atmos_pressure~STAHR_Rocket', 'Pascal')\n",
      "('atmos_temperature~STAHR_Rocket', 'Kelvin')\n",
      "('bank_angle_rate~STAHR_Rocket#A~STAHR_Rocket:Earth', 'Degree/Second')\n",
      "('bank_angle~STAHR_Rocket#A~STAHR_Rocket:Earth', 'Degree')\n",
      "('bending_moment~STAHR_Rocket', 'Pascal*Radian')\n",
      "('burn_time~IB3:STAHR_Rocket', 'Second')\n",
      "('cross_range~STAHR_Rocket', 'Kilo-Meter')\n",
      "('declination~STAHR_Rocket#J2000@Earth', 'Degree')\n",
      "('declination~STAHR_Rocket#PCPF~Earth@Earth', 'Degree')\n",
      "('declination~STAHR_Rocket#TOD~Earth@Earth', 'Degree')\n",
      "('DECL~STAHR_Rocket', 'Radian')\n",
      "('dimension_x~STAHR_Rocket', 'Meter')\n",
      "('dimension_y~STAHR_Rocket', 'Meter')\n",
      "('dimension_z~STAHR_Rocket', 'Meter')\n",
      "('down_range~STAHR_Rocket', 'Kilo-Meter')\n",
      "('drag_acc~STAHR_Rocket', 'Meter/Second**2')\n",
      "('drag_coeff~STAHR_Rocket', nan)\n",
      "('drag~STAHR_Rocket', 'Kilo-Newton')\n",
      "('dummy_altitude', 'Meter')\n",
      "('dummy_declination', 'Degree')\n",
      "('dummy_latitude', 'Degree')\n",
      "('dummy_longitude', 'Degree')\n",
      "('dummy_radius', 'Meter')\n",
      "('dynamic_pressure~STAHR_Rocket', 'Pascal')\n",
      "('dyn_viscosity~STAHR_Rocket', 'Pascal*Second')\n",
      "('eccentricity~STAHR_Rocket@Earth', nan)\n",
      "('eccentric_anomaly~STAHR_Rocket@Earth', 'Degree')\n",
      "('energy_total~STAHR_Rocket@Earth', 'Kilo-Joule/Kilogram')\n",
      "('equinoctial_f~STAHR_Rocket#TOD~Earth', nan)\n",
      "('equinoctial_g~STAHR_Rocket#TOD~Earth', nan)\n",
      "('equinoctial_h~STAHR_Rocket#TOD~Earth', nan)\n",
      "('equinoctial_k~STAHR_Rocket#TOD~Earth', nan)\n",
      "('equinoctial_l~STAHR_Rocket#TOD~Earth', 'Degree')\n",
      "('equinoctial_p~STAHR_Rocket@Earth', 'Kilo-Meter')\n",
      "('excess_velocity~STAHR_Rocket@Earth', 'Kilo-Meter/Second')\n",
      "('flightpath_angle~STAHR_Rocket#LD~STAHR_Rocket:Earth', 'Degree')\n",
      "('flightpath_angle~STAHR_Rocket#L~STAHR_Rocket:Earth', 'Degree')\n",
      "('flightpath_heading~STAHR_Rocket#LD~STAHR_Rocket:Earth', 'Degree')\n",
      "('flightpath_heading~STAHR_Rocket#L~STAHR_Rocket:Earth', 'Degree')\n",
      "('flightpath_speed~STAHR_Rocket', 'Kilo-Meter/Second')\n",
      "('flightpath_vertical~STAHR_Rocket#L~STAHR_Rocket:Earth', 'Degree')\n",
      "('flight_time', 'Second')\n",
      "('flight_time~STAHR_Rocket', 'Second')\n",
      "('force_aero_axial~STAHR_Rocket#B~STAHR_Rocket@STAHR_Rocket', 'Kilo-Newton')\n",
      "('force_aero_east~STAHR_Rocket#L~STAHR_Rocket:Earth@STAHR_Rocket', 'Kilo-Newton')\n",
      "('force_aero_lateral~STAHR_Rocket#B~STAHR_Rocket@STAHR_Rocket', 'Kilo-Newton')\n",
      "('force_aero_normal~STAHR_Rocket#B~STAHR_Rocket@STAHR_Rocket', 'Kilo-Newton')\n",
      "('force_aero_north~STAHR_Rocket#L~STAHR_Rocket:Earth@STAHR_Rocket', 'Kilo-Newton')\n",
      "('force_aero_r~STAHR_Rocket#L~STAHR_Rocket:Earth@STAHR_Rocket', 'Kilo-Newton')\n",
      "('gps_time', 'Second')\n",
      "('gravity_force_x~STAHR_Rocket#B~STAHR_Rocket@STAHR_Rocket', 'Newton')\n",
      "('gravity_force_y~STAHR_Rocket#B~STAHR_Rocket@STAHR_Rocket', 'Newton')\n",
      "('gravity_force_z~STAHR_Rocket#B~STAHR_Rocket@STAHR_Rocket', 'Newton')\n",
      "('gravity_potential~Esrange', 'Kilo-Joule/Kilogram')\n",
      "('gravity_potential~STAHR_Rocket@Earth', 'Kilo-Joule/Kilogram')\n",
      "('gravity~STAHR_Rocket', 'Meter/Second**2')\n",
      "('great_circle_distance~STAHR_Rocket', 'Kilo-Meter')\n",
      "('heat_flux_density~STAHR_Rocket', 'Kilo-Watt/Meter**2')\n",
      "('hload_lift~STAHR_Rocket', nan)\n",
      "('inclination~STAHR_Rocket#J2000', 'Degree')\n",
      "('inclination~STAHR_Rocket#TOD~Earth', 'Degree')\n",
      "('inertial_flightpath_vertical~STAHR_Rocket#L~STAHR_Rocket:Earth', 'Degree')\n",
      "('inertial_flightpath~STAHR_Rocket#L~STAHR_Rocket:Earth', 'Degree')\n",
      "('inertial_heading~STAHR_Rocket#L~STAHR_Rocket:Earth', 'Degree')\n",
      "('inertial_speed~STAHR_Rocket', 'Kilo-Meter/Second')\n",
      "('inertia_xx~STAHR_Rocket', 'Kilogram*Meter**2')\n",
      "('inertia_xy~STAHR_Rocket', 'Kilogram*Meter**2')\n",
      "('inertia_xz~STAHR_Rocket', 'Kilogram*Meter**2')\n",
      "('inertia_yy~STAHR_Rocket', 'Kilogram*Meter**2')\n",
      "('inertia_yz~STAHR_Rocket', 'Kilogram*Meter**2')\n",
      "('inertia_zz~STAHR_Rocket', 'Kilogram*Meter**2')\n",
      "('isp_vacuum~IB3:STAHR_Rocket', 'Second')\n",
      "('isp~IB3:STAHR_Rocket', 'Second')\n",
      "('julian_date_tt', 'Day')\n",
      "('julian_date_utc', 'Day')\n",
      "('knudsen_number~STAHR_Rocket', nan)\n",
      "('latitude~STAHR_Rocket#PCPF~Earth@Earth', 'Degree')\n",
      "('lift_acc~STAHR_Rocket', 'Meter/Second**2')\n",
      "('lift_coeff~STAHR_Rocket', nan)\n",
      "('lift_drag_ratio~STAHR_Rocket', nan)\n",
      "('lift~STAHR_Rocket', 'Kilo-Newton')\n",
      "('load_factor_axial~STAHR_Rocket', nan)\n",
      "('load_factor_cross~STAHR_Rocket', nan)\n",
      "('load_factor_normal~STAHR_Rocket', nan)\n",
      "('load_factor~STAHR_Rocket', nan)\n",
      "('local_central_body_radius~STAHR_Rocket', 'Kilo-Meter')\n",
      "('longitude~STAHR_Rocket#PCPF~Earth@Earth', 'Degree')\n",
      "('LONG~STAHR_Rocket', 'Radian')\n",
      "('mach~STAHR_Rocket', nan)\n",
      "('magnetic_flux_density_east~STAHR_Rocket#L~STAHR_Rocket:Earth@STAHR_Rocket', 'Nano-Tesla')\n",
      "('magnetic_flux_density_north~STAHR_Rocket#L~STAHR_Rocket:Earth@STAHR_Rocket', 'Nano-Tesla')\n",
      "('magnetic_flux_density_radial~STAHR_Rocket#L~STAHR_Rocket:Earth@STAHR_Rocket', 'Nano-Tesla')\n",
      "('magnetic_flux_density_x~STAHR_Rocket#B~STAHR_Rocket@STAHR_Rocket', 'Nano-Tesla')\n",
      "('magnetic_flux_density_y~STAHR_Rocket#B~STAHR_Rocket@STAHR_Rocket', 'Nano-Tesla')\n",
      "('magnetic_flux_density_z~STAHR_Rocket#B~STAHR_Rocket@STAHR_Rocket', 'Nano-Tesla')\n",
      "('magnetic_flux_density~STAHR_Rocket#L~STAHR_Rocket:Earth@STAHR_Rocket', 'Nano-Tesla')\n",
      "('mass_flow~IB3:STAHR_Rocket', 'Kilogram/Second')\n",
      "('mass_total~STAHR_Rocket', 'Mega-Gram')\n",
      "('mean_anomaly~STAHR_Rocket@Earth', 'Degree')\n",
      "('mean_local_time_of_the_ascending_node~STAHR_Rocket', 'Hour')\n",
      "('mean_motion~STAHR_Rocket@Earth', 'Radian/Second')\n",
      "('mission_time', 'Second')\n",
      "('moment_aero_x~STAHR_Rocket#B~STAHR_Rocket', 'Newton*Meter')\n",
      "('moment_aero_y~STAHR_Rocket#B~STAHR_Rocket', 'Newton*Meter')\n",
      "('moment_aero_z~STAHR_Rocket#B~STAHR_Rocket', 'Newton*Meter')\n",
      "('Norm_Indep_Var', nan)\n",
      "('nozzle_area~IB3:STAHR_Rocket', 'Meter^2')\n",
      "('OMEGA_X~STAHR_Rocket', 'Radian/Second')\n",
      "('omega_x~STAHR_Rocket#B~STAHR_Rocket', 'Degree/Second')\n",
      "('OMEGA_Y~STAHR_Rocket', 'Radian/Second')\n",
      "('omega_y~STAHR_Rocket#B~STAHR_Rocket', 'Degree/Second')\n",
      "('OMEGA_Z~STAHR_Rocket', 'Radian/Second')\n",
      "('omega_z~STAHR_Rocket#B~STAHR_Rocket', 'Degree/Second')\n",
      "('orbital_period~STAHR_Rocket@Earth', 'Second')\n",
      "('periapsis_argument~STAHR_Rocket#J2000', 'Degree')\n",
      "('periapsis_argument~STAHR_Rocket#TOD~Earth', 'Degree')\n",
      "('pitch_rate~STAHR_Rocket#J2000', 'Degree/Second')\n",
      "('pitch_rate~STAHR_Rocket#LO~STAHR_Rocket:Earth', 'Degree/Second')\n",
      "('pitch_rate~STAHR_Rocket#L~STAHR_Rocket:Earth', 'Degree/Second')\n",
      "('PITCH~Esrange#L~Esrange:Earth', 'Radian')\n",
      "('PITCH~STAHR_Rocket', 'Radian')\n",
      "('pitch~STAHR_Rocket#J2000', 'Degree')\n",
      "('pitch~STAHR_Rocket#LD~STAHR_Rocket:Earth', 'Degree')\n",
      "('pitch~STAHR_Rocket#LO~STAHR_Rocket:Earth', 'Degree')\n",
      "('pitch~STAHR_Rocket#L~STAHR_Rocket:Earth', 'Degree')\n",
      "('pitch~STAHR_Rocket#N~STAHR_Rocket', 'Degree')\n",
      "('pitch~STAHR_Rocket#TOD~Earth', 'Degree')\n",
      "('PROP_MASS~STAHR:STAHR_Rocket', 'Kilogram')\n",
      "('quaternion_w~Earth#J2000', nan)\n",
      "('quaternion_w~IB3:STAHR_Rocket#B~STAHR_Rocket', nan)\n",
      "('quaternion_w~STAHR:STAHR_Rocket#B~STAHR_Rocket', nan)\n",
      "('quaternion_w~STAHR_Rocket#J2000', nan)\n",
      "('quaternion_w~STAHR_Rocket#L~STAHR_Rocket:Earth', nan)\n",
      "('quaternion_x~Earth#J2000', nan)\n",
      "('quaternion_x~IB3:STAHR_Rocket#B~STAHR_Rocket', nan)\n",
      "('quaternion_x~STAHR:STAHR_Rocket#B~STAHR_Rocket', nan)\n",
      "('quaternion_x~STAHR_Rocket#J2000', nan)\n",
      "('quaternion_x~STAHR_Rocket#L~STAHR_Rocket:Earth', nan)\n",
      "('quaternion_y~Earth#J2000', nan)\n",
      "('quaternion_y~IB3:STAHR_Rocket#B~STAHR_Rocket', nan)\n",
      "('quaternion_y~STAHR:STAHR_Rocket#B~STAHR_Rocket', nan)\n",
      "('quaternion_y~STAHR_Rocket#J2000', nan)\n",
      "('quaternion_y~STAHR_Rocket#L~STAHR_Rocket:Earth', nan)\n",
      "('quaternion_z~Earth#J2000', nan)\n",
      "('quaternion_z~IB3:STAHR_Rocket#B~STAHR_Rocket', nan)\n",
      "('quaternion_z~STAHR:STAHR_Rocket#B~STAHR_Rocket', nan)\n",
      "('quaternion_z~STAHR_Rocket#J2000', nan)\n",
      "('quaternion_z~STAHR_Rocket#L~STAHR_Rocket:Earth', nan)\n",
      "('radius_apoapsis~STAHR_Rocket@Earth', 'Kilo-Meter')\n",
      "('radius_periapsis~STAHR_Rocket@Earth', 'Kilo-Meter')\n",
      "('radius~STAHR_Rocket@Earth', 'Kilo-Meter')\n",
      "('reynolds_number~STAHR_Rocket', nan)\n",
      "('right_ascension~STAHR_Rocket#J2000@Earth', 'Degree')\n",
      "('right_ascension~STAHR_Rocket#TOD~Earth@Earth', 'Degree')\n",
      "('roll_rate~STAHR_Rocket#J2000', 'Degree/Second')\n",
      "('roll_rate~STAHR_Rocket#LO~STAHR_Rocket:Earth', 'Degree/Second')\n",
      "('roll_rate~STAHR_Rocket#L~STAHR_Rocket:Earth', 'Degree/Second')\n",
      "('ROLL~Esrange#L~Esrange:Earth', 'Radian')\n",
      "('ROLL~STAHR_Rocket', 'Radian')\n",
      "('roll~STAHR_Rocket#J2000', 'Degree')\n",
      "('roll~STAHR_Rocket#LD~STAHR_Rocket:Earth', 'Degree')\n",
      "('roll~STAHR_Rocket#LO~STAHR_Rocket:Earth', 'Degree')\n",
      "('roll~STAHR_Rocket#L~STAHR_Rocket:Earth', 'Degree')\n",
      "('roll~STAHR_Rocket#N~STAHR_Rocket', 'Degree')\n",
      "('roll~STAHR_Rocket#TOD~Earth', 'Degree')\n",
      "('R~STAHR_Rocket', 'Meter')\n",
      "('semimajor~STAHR_Rocket@Earth', 'Kilo-Meter')\n",
      "('sideslip_rate~STAHR_Rocket#A~STAHR_Rocket:Earth', 'Degree/Second')\n",
      "('sideslip~STAHR_Rocket#A~STAHR_Rocket:Earth', 'Degree')\n",
      "('side_force~STAHR_Rocket', 'Kilo-Newton')\n",
      "('SIDE_SLIP_ANGLE~Esrange#A~Esrange:Earth', 'Radian')\n",
      "('SIDE_SLIP_ANGLE~STAHR_Rocket#A~STAHR_Rocket:Earth', 'Radian')\n",
      "('solar_beta_angle~STAHR_Rocket#PF~STAHR_Rocket:Earth', 'Degree')\n",
      "('sonic_velocity~STAHR_Rocket', 'Meter/Second')\n",
      "('static_stability_x~STAHR_Rocket#B~STAHR_Rocket@STAHR_Rocket', 'Meter')\n",
      "('thrust_to_ew~STAHR_Rocket', nan)\n",
      "('thrust_vacuum~IB3:STAHR_Rocket', 'Kilo-Newton')\n",
      "('thrust_x~STAHR_Rocket#J2000', 'Kilo-Newton')\n",
      "('thrust_y~STAHR_Rocket#J2000', 'Kilo-Newton')\n",
      "('thrust_z~STAHR_Rocket#J2000', 'Kilo-Newton')\n",
      "('thrust~IB3:STAHR_Rocket', 'Kilo-Newton')\n",
      "('thrust~STAHR_Rocket', 'Kilo-Newton')\n",
      "('Time', 'Second')\n",
      "('torque_x~IB3:STAHR_Rocket#B~STAHR_Rocket@STAHR_Rocket', 'Newton*Meter')\n",
      "('torque_x~STAHR_Rocket#B~STAHR_Rocket', 'Newton*Meter')\n",
      "('torque_y~IB3:STAHR_Rocket#B~STAHR_Rocket@STAHR_Rocket', 'Newton*Meter')\n",
      "('torque_y~STAHR_Rocket#B~STAHR_Rocket', 'Newton*Meter')\n",
      "('torque_z~IB3:STAHR_Rocket#B~STAHR_Rocket@STAHR_Rocket', 'Newton*Meter')\n",
      "('torque_z~STAHR_Rocket#B~STAHR_Rocket', 'Newton*Meter')\n",
      "('total_angle_of_attack_slope_normal_coefficient~STAHR_Rocket#TA~STAHR_Rocket@STAHR_Rocket', 'None/Degree')\n",
      "('total_angle_of_attack~STAHR_Rocket#A~STAHR_Rocket:Earth', 'Degree')\n",
      "('total_lift~STAHR_Rocket', 'Kilo-Newton')\n",
      "('total_solar_irradiance_at_earth~STAHR_Rocket', 'Watt/Meter**2')\n",
      "('TRAJ_SMOOTHNESS~STAHR_Rocket', 'Radian^2/Second')\n",
      "('true_anomaly~STAHR_Rocket@Earth', 'Degree')\n",
      "('u_length~STAHR_Rocket#LO~STAHR_Rocket:Earth', nan)\n",
      "('u_length~STAHR_Rocket#L~STAHR_Rocket:Earth', nan)\n",
      "('u_n~STAHR_Rocket#LO~STAHR_Rocket:Earth', nan)\n",
      "('u_r~STAHR_Rocket#LO~STAHR_Rocket:Earth', nan)\n",
      "('u_t~STAHR_Rocket#LO~STAHR_Rocket:Earth', nan)\n",
      "('u_x~STAHR_Rocket#L~STAHR_Rocket:Earth', nan)\n",
      "('u_y~STAHR_Rocket#L~STAHR_Rocket:Earth', nan)\n",
      "('u_z~STAHR_Rocket#L~STAHR_Rocket:Earth', nan)\n",
      "('velocity_east~STAHR_Rocket#L~STAHR_Rocket:Earth@STAHR_Rocket', 'Kilo-Meter/Second')\n",
      "('velocity_north~STAHR_Rocket#L~STAHR_Rocket:Earth@STAHR_Rocket', 'Kilo-Meter/Second')\n",
      "('velocity_rel_apoapsis~STAHR_Rocket@Earth', 'Kilo-Meter/Second')\n",
      "('velocity_rel_east~STAHR_Rocket#L~STAHR_Rocket:Earth@STAHR_Rocket', 'Kilo-Meter/Second')\n",
      "('velocity_rel_periapsis~STAHR_Rocket@Earth', 'Kilo-Meter/Second')\n",
      "('velocity_r~STAHR_Rocket#L~STAHR_Rocket:Earth@STAHR_Rocket', 'Kilo-Meter/Second')\n",
      "('VI_EAST~STAHR_Rocket', 'Meter/Second')\n",
      "('VI_NORTH~STAHR_Rocket', 'Meter/Second')\n",
      "('VI_RADIAL~STAHR_Rocket', 'Meter/Second')\n",
      "('vload_lift~STAHR_Rocket', nan)\n",
      "('vx~STAHR_Rocket#J2000@Earth', 'Kilo-Meter/Second')\n",
      "('vx~STAHR_Rocket#TOD~Earth@Earth', 'Kilo-Meter/Second')\n",
      "('vy~STAHR_Rocket#J2000@Earth', 'Kilo-Meter/Second')\n",
      "('vy~STAHR_Rocket#TOD~Earth@Earth', 'Kilo-Meter/Second')\n",
      "('vz~STAHR_Rocket#J2000@Earth', 'Kilo-Meter/Second')\n",
      "('vz~STAHR_Rocket#TOD~Earth@Earth', 'Kilo-Meter/Second')\n",
      "('wind_gust_p~STAHR_Rocket#L~STAHR_Rocket:Earth@STAHR_Rocket', 'Degree/Second')\n",
      "('wind_gust_q~STAHR_Rocket#L~STAHR_Rocket:Earth@STAHR_Rocket', 'Degree/Second')\n",
      "('wind_gust_r~STAHR_Rocket#L~STAHR_Rocket:Earth@STAHR_Rocket', 'Degree/Second')\n",
      "('wind_velocity_east~STAHR_Rocket#L~STAHR_Rocket:Earth@STAHR_Rocket', 'Meter/Second')\n",
      "('wind_velocity_north~STAHR_Rocket#L~STAHR_Rocket:Earth@STAHR_Rocket', 'Meter/Second')\n",
      "('wind_velocity_r~STAHR_Rocket#L~STAHR_Rocket:Earth@STAHR_Rocket', 'Meter/Second')\n",
      "('x_offset_CoM~Esrange', 'Meter')\n",
      "('x_offset_CoM~Main_Stage:STAHR_Rocket', 'Meter')\n",
      "('x_offset_CoM~STAHR_Rocket', 'Meter')\n",
      "('x_offset_CoP~STAHR_Rocket', 'Meter')\n",
      "('x_offset~IB3:STAHR_Rocket', 'Meter')\n",
      "('x_offset~STAHR:STAHR_Rocket', 'Meter')\n",
      "('x~Earth#J2000@SSB', 'Kilo-Meter')\n",
      "('x~STAHR_Rocket#J2000@Earth', 'Kilo-Meter')\n",
      "('x~STAHR_Rocket#TOD~Earth@Earth', 'Kilo-Meter')\n",
      "('x~Sun#L~STAHR_Rocket:Earth@STAHR_Rocket', 'Kilo-Meter')\n",
      "('yaw_rate~STAHR_Rocket#J2000', 'Degree/Second')\n",
      "('yaw_rate~STAHR_Rocket#LO~STAHR_Rocket:Earth', 'Degree/Second')\n",
      "('yaw_rate~STAHR_Rocket#L~STAHR_Rocket:Earth', 'Degree/Second')\n",
      "('YAW~Esrange#L~Esrange:Earth', 'Radian')\n",
      "('YAW~STAHR_Rocket', 'Radian')\n",
      "('yaw~STAHR_Rocket#J2000', 'Degree')\n",
      "('yaw~STAHR_Rocket#LD~STAHR_Rocket:Earth', 'Degree')\n",
      "('yaw~STAHR_Rocket#LO~STAHR_Rocket:Earth', 'Degree')\n",
      "('yaw~STAHR_Rocket#L~STAHR_Rocket:Earth', 'Degree')\n",
      "('yaw~STAHR_Rocket#N~STAHR_Rocket', 'Degree')\n",
      "('yaw~STAHR_Rocket#TOD~Earth', 'Degree')\n",
      "('y_offset_CoM~Esrange', 'Meter')\n",
      "('y_offset_CoM~Main_Stage:STAHR_Rocket', 'Meter')\n",
      "('y_offset_CoM~STAHR_Rocket', 'Meter')\n",
      "('y_offset_CoP~STAHR_Rocket', 'Meter')\n",
      "('y_offset~IB3:STAHR_Rocket', 'Meter')\n",
      "('y_offset~STAHR:STAHR_Rocket', 'Meter')\n",
      "('y~Earth#J2000@SSB', 'Kilo-Meter')\n",
      "('y~STAHR_Rocket#J2000@Earth', 'Kilo-Meter')\n",
      "('y~STAHR_Rocket#TOD~Earth@Earth', 'Kilo-Meter')\n",
      "('y~Sun#L~STAHR_Rocket:Earth@STAHR_Rocket', 'Kilo-Meter')\n",
      "('z_offset_CoM~Esrange', 'Meter')\n",
      "('z_offset_CoM~Main_Stage:STAHR_Rocket', 'Meter')\n",
      "('z_offset_CoM~STAHR_Rocket', 'Meter')\n",
      "('z_offset_CoP~STAHR_Rocket', 'Meter')\n",
      "('z_offset~IB3:STAHR_Rocket', 'Meter')\n",
      "('z_offset~STAHR:STAHR_Rocket', 'Meter')\n",
      "('z~Earth#J2000@SSB', 'Kilo-Meter')\n",
      "('z~STAHR_Rocket#J2000@Earth', 'Kilo-Meter')\n",
      "('z~STAHR_Rocket#TOD~Earth@Earth', 'Kilo-Meter')\n",
      "('z~Sun#L~STAHR_Rocket:Earth@STAHR_Rocket', 'Kilo-Meter')\n",
      "('z~Sun#L~STAHR_Rocket:Earth@STAHR_Rocket.1', 'Kilo-Meter')\n"
     ]
    }
   ],
   "source": [
    "print('\\n'.join(map(str, zip(df.columns.values, df.loc[1]))))\n",
    "\n",
    "df = df.drop([0, 1], axis=0)\n",
    "df = df.astype(float)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 500,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2.16807271758589"
      ]
     },
     "execution_count": 500,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "max(df['mach~STAHR_Rocket'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 501,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2       67.885478\n",
       "3       67.885478\n",
       "4       67.885478\n",
       "5       67.885478\n",
       "6       67.885478\n",
       "          ...    \n",
       "1715    68.072499\n",
       "1716    68.072499\n",
       "1717    68.072499\n",
       "1718    68.072499\n",
       "1719    68.072499\n",
       "Name: latitude~STAHR_Rocket#PCPF~Earth@Earth, Length: 1718, dtype: float64"
      ]
     },
     "execution_count": 501,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['latitude~STAHR_Rocket#PCPF~Earth@Earth']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 502,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2       67.750938\n",
       "3       67.750938\n",
       "4       67.750938\n",
       "5       67.750938\n",
       "6       67.750938\n",
       "          ...    \n",
       "1715    67.938856\n",
       "1716    67.938856\n",
       "1717    67.938856\n",
       "1718    67.938856\n",
       "1719    67.938856\n",
       "Name: declination~STAHR_Rocket#PCPF~Earth@Earth, Length: 1718, dtype: float64"
      ]
     },
     "execution_count": 502,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['declination~STAHR_Rocket#PCPF~Earth@Earth']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 503,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2       21.079909\n",
       "3       21.079909\n",
       "4       21.079909\n",
       "5       21.079909\n",
       "6       21.079909\n",
       "          ...    \n",
       "1715    21.080786\n",
       "1716    21.080786\n",
       "1717    21.080786\n",
       "1718    21.080786\n",
       "1719    21.080786\n",
       "Name: longitude~STAHR_Rocket#PCPF~Earth@Earth, Length: 1718, dtype: float64"
      ]
     },
     "execution_count": 503,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['longitude~STAHR_Rocket#PCPF~Earth@Earth']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 504,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x1a034d71a90>]"
      ]
     },
     "execution_count": 504,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 29556 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "df['altitude~STAHR_Rocket@Earth'] * 1000\n",
    "\n",
    "plt.plot(df['Time'], df['altitude~STAHR_Rocket@Earth'] * 1000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 505,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "318.99999999906896"
      ]
     },
     "execution_count": 505,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.at[2, 'altitude~STAHR_Rocket@Earth'] * 1000"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 506,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 36596 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 27348 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 27540 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 23836 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 24476 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 30912 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 24152 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 19724 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 21812 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import numpy as np\n",
    "\n",
    "from spatz.dataset import T1, T2, T3\n",
    "from math import pi\n",
    "\n",
    "# Rename the columns\n",
    "df = df.rename({\n",
    "    'acceleration_without_gravity_x~STAHR_Rocket#B~STAHR_Rocket@STAHR_Rocket': 'ax_B',\n",
    "    'acceleration_without_gravity_y~STAHR_Rocket#B~STAHR_Rocket@STAHR_Rocket': 'ay_B',\n",
    "    'acceleration_without_gravity_z~STAHR_Rocket#B~STAHR_Rocket@STAHR_Rocket': 'az_B',\n",
    "    'latitude~STAHR_Rocket#PCPF~Earth@Earth': 'latitude',\n",
    "    'longitude~STAHR_Rocket#PCPF~Earth@Earth': 'longitude',\n",
    "    'declination~STAHR_Rocket#PCPF~Earth@Earth': 'declination',\n",
    "    'altitude~STAHR_Rocket@Earth': 'altitude',\n",
    "    'pitch~STAHR_Rocket#L~STAHR_Rocket:Earth': 'pitch_l',\n",
    "    'yaw~STAHR_Rocket#L~STAHR_Rocket:Earth': 'yaw_l',\n",
    "    'roll~STAHR_Rocket#L~STAHR_Rocket:Earth': 'roll_l',\n",
    "    'atmos_pressure~STAHR_Rocket': 'atmos_pressure',\n",
    "    'atmos_temperature~STAHR_Rocket': 'atmos_temperature',\n",
    "    'sonic_velocity~STAHR_Rocket': 'sonic_velocity',\n",
    "    'OMEGA_X~STAHR_Rocket': 'OMEGA_X',\n",
    "    'OMEGA_Y~STAHR_Rocket': 'OMEGA_Y',\n",
    "    'OMEGA_Z~STAHR_Rocket': 'OMEGA_Z',\n",
    "    'drag~STAHR_Rocket': 'drag',\n",
    "    'flightpath_speed~STAHR_Rocket': 'flightpath_speed',\n",
    "    'mass_total~STAHR_Rocket': 'mass_total',\n",
    "    'mach~STAHR_Rocket': 'mach'\n",
    "}, axis=1)\n",
    "\n",
    "g = 9.81\n",
    "t0 = df.at[2, 'Time']\n",
    "\n",
    "vel = np.array([0, 0, 0], dtype='float64')\n",
    "pos = np.array([318.99999999906896, 0, 0], dtype='float64')\n",
    "time = t0\n",
    "\n",
    "init_latitude = df.at[2, 'latitude']\n",
    "init_longitude = df.at[2, 'longitude']\n",
    "\n",
    "t0 = df.at[2, 'Time']\n",
    "omega_E = (2*pi) / (24*60*60)\n",
    "\n",
    "altitudes = [318.99999999906896]\n",
    "velocities = [0]\n",
    "acc_total = [0]\n",
    "\n",
    "pitch, yaw, roll = df.at[2, 'pitch_l'] * pi / 180, df.at[2, 'yaw_l'] * pi / 180, df.at[2, 'roll_l'] * pi / 180\n",
    "decl = df.at[2, 'declination']\n",
    "\n",
    "B_to_L = T1(yaw) @ T2(pi / 2 - pitch) @ T1(-roll)\n",
    "L_to_G = np.linalg.inv(T2(-decl) @ T3(init_longitude + omega_E * t0))\n",
    "G_to_LF = T2(-pi/2 - init_latitude) @ T3(init_longitude)\n",
    "L_to_LF = G_to_LF @ L_to_G\n",
    "\n",
    "x_FL, y_FL, z_FL = [8.20214666930979e-13], [-1.51393643837011e-12], [-2.40063988328838e-12]\n",
    "vx_FL, vy_FL, vz_FL = [0], [0], [0]\n",
    "\n",
    "for i in range(3, len(df)+2):\n",
    "    dt = df.at[i, 'Time'] - df.at[i-1, 'Time']\n",
    "\n",
    "    # Fetch values for the current time step.\n",
    "    acc = np.array([df.at[i, 'ax_B'], df.at[i, 'ay_B'], df.at[i, 'az_B']])\n",
    "    pitch, yaw, roll = df.at[i, 'pitch_l'] * pi / 180, df.at[i, 'yaw_l'] * pi / 180, df.at[i, 'roll_l'] * pi / 180\n",
    "    decl = df.at[i, 'declination']\n",
    "    long = df.at[i, 'longitude']\n",
    "\n",
    "    B_to_L = T1(yaw) @ T2(pi / 2 - pitch) @ T1(-roll)\n",
    "    L_to_G = np.linalg.inv(T2(-decl) @ T3(long + omega_E * t0))\n",
    "    G_to_LF = T2(-pi/2 - init_latitude) @ T3(init_longitude)\n",
    "    L_to_LF = G_to_LF @ L_to_G\n",
    "\n",
    "    acc_L = B_to_L @ acc + np.array([-g, 0, 0])\n",
    "    pos += dt * vel + 1/2*dt**2 * acc_L\n",
    "    vel += dt * acc_L\n",
    "\n",
    "    pos_LF = -(L_to_LF @ pos)\n",
    "    vel_LF = -(L_to_LF @ vel)\n",
    "\n",
    "    x_FL.append(pos_LF[0])\n",
    "    y_FL.append(pos_LF[1])\n",
    "    z_FL.append(pos_LF[2])\n",
    "\n",
    "    vx_FL.append(vel_LF[0])\n",
    "    vy_FL.append(vel_LF[1])\n",
    "    vz_FL.append(vel_LF[2])\n",
    "\n",
    "    altitudes.append(pos[0])\n",
    "    velocities.append(np.sqrt(vel[0]**2 + vel[1]**2 + vel[2]**2))\n",
    "    acc_total.append(np.sqrt(acc[0]**2 + acc[1]**2 + acc[2]**2))\n",
    "\n",
    "plt.plot(df['Time'], df['altitude'] * 1000, label='true')\n",
    "\n",
    "plt.plot(df['Time'], altitudes, label='integrated')\n",
    "plt.legend()\n",
    "plt.show()\n",
    "\n",
    "plt.plot(df['Time'], velocities, label='velocity')\n",
    "plt.legend()\n",
    "plt.show()\n",
    "\n",
    "plt.plot(df['Time'], np.array(velocities) / 340, label='mach')\n",
    "plt.legend()\n",
    "plt.show()\n",
    "\n",
    "plt.plot(df['Time'], x_FL)\n",
    "plt.show()\n",
    "\n",
    "plt.plot(df['Time'], y_FL)\n",
    "plt.show()\n",
    "\n",
    "plt.plot(df['Time'], z_FL)\n",
    "plt.show()\n",
    "\n",
    "plt.plot(df['Time'], vx_FL)\n",
    "plt.show()\n",
    "\n",
    "plt.plot(df['Time'], vy_FL)\n",
    "plt.show()\n",
    "\n",
    "plt.plot(df['Time'], vz_FL)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 507,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "7.766996294563251"
      ]
     },
     "execution_count": 507,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "max(np.array(acc_total) / g)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 508,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2       319.000000\n",
       "3       319.000000\n",
       "4       319.000000\n",
       "5       319.000000\n",
       "6       319.000000\n",
       "           ...    \n",
       "1715      9.558576\n",
       "1716      6.360338\n",
       "1717      3.162590\n",
       "1718     -0.034668\n",
       "1719     -0.034668\n",
       "Name: altitude, Length: 1718, dtype: float64"
      ]
     },
     "execution_count": 508,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['altitude'] * 1000"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 509,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "28850.044718887697"
      ]
     },
     "execution_count": 509,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "max(df['altitude'] * 1000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 510,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2         0.000000\n",
       "3         0.025000\n",
       "4         0.050000\n",
       "5         0.050000\n",
       "6         0.050000\n",
       "           ...    \n",
       "1715    637.534465\n",
       "1716    638.073041\n",
       "1717    638.611618\n",
       "1718    639.150194\n",
       "1719    639.150194\n",
       "Name: Time, Length: 1718, dtype: float64"
      ]
     },
     "execution_count": 510,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['Time']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 511,
   "metadata": {},
   "outputs": [],
   "source": [
    "df.insert(0, 'x_FL', np.array(x_FL) / 1000)\n",
    "df.insert(0, 'y_FL', np.array(y_FL) / 1000)\n",
    "df.insert(0, 'z_FL', np.array(z_FL) / 1000)\n",
    "\n",
    "df.insert(0, 'vx_FL', np.array(vx_FL) / 1000)\n",
    "df.insert(0, 'vy_FL', np.array(vy_FL) / 1000)\n",
    "df.insert(0, 'vz_FL', np.array(vz_FL) / 1000)\n",
    "\n",
    "df.insert(0, 'acc_total', np.array(acc_total))\n",
    "\n",
    "df_new = df[[\n",
    "    'Time',\n",
    "    'Phase',\n",
    "    'declination',\n",
    "    'longitude',\n",
    "    'latitude',\n",
    "    'altitude',\n",
    "    'x_FL',\n",
    "    'y_FL',\n",
    "    'z_FL',\n",
    "    'vx_FL',\n",
    "    'vy_FL',\n",
    "    'vz_FL',\n",
    "    'pitch_l',\n",
    "    'yaw_l',\n",
    "    'roll_l',\n",
    "    'atmos_pressure',\n",
    "    'atmos_temperature',\n",
    "    'sonic_velocity',\n",
    "    'mach',\n",
    "    'OMEGA_X',\n",
    "    'OMEGA_Y',\n",
    "    'OMEGA_Z',\n",
    "    'mass_total',\n",
    "    'flightpath_speed', \n",
    "    'acc_total', \n",
    "    'drag'\n",
    "]]\n",
    "\n",
    "descriptions = pd.DataFrame.from_dict({\n",
    "    'Time': ['Second'],\n",
    "    'Phase': [None],\n",
    "    'declination': ['Degree'],\n",
    "    'longitude': ['Degree'],\n",
    "    'latitude': ['Degree'],\n",
    "    'altitude': ['Kilo-Meter'],\n",
    "    'x_FL': ['Kilo-Meter'],\n",
    "    'y_FL': ['Kilo-Meter'],\n",
    "    'z_FL': ['Kilo-Meter'],\n",
    "    'vx_FL': ['Kilo-Meter / Second'],\n",
    "    'vy_FL': ['Kilo-Meter / Second'],\n",
    "    'vz_FL': ['Kilo-Meter / Second'],\n",
    "    'pitch_l': ['Degree'],\n",
    "    'yaw_l': ['Degree'],\n",
    "    'roll_l': ['Degree'],\n",
    "    'atmos_pressure': ['Pascal'],\n",
    "    'atmos_temperature': ['Kelvin'],\n",
    "    'sonic_velocity': ['Meter / Second'],\n",
    "    'mach': [None],\n",
    "    'OMEGA_X': ['Radian / Second'],\n",
    "    'OMEGA_Y': ['Radian / Second'],\n",
    "    'OMEGA_Z': ['Radian / Second'],\n",
    "    'mass_total': ['Mega-Gram'],\n",
    "    'flightpath_speed': ['Kilo-Meter / Second'], \n",
    "    'acc_total': ['Meter/Second**2'], \n",
    "    'drag': ['Kilo-Newton']\n",
    "}, dtype=str)\n",
    "\n",
    "df_new = pd.concat([descriptions, df_new], axis=0)\n",
    "df_new.to_csv('data/simulations/28km.txt', sep='\\t')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "'Time', yes\n",
    "\n",
    "'Phase', yes\n",
    "\n",
    "'declination', yes\n",
    "\n",
    "'longitude', yes\n",
    "\n",
    "'latitude', yes\n",
    "\n",
    "'altitude', yes\n",
    "\n",
    "'mach', yes\n",
    "\n",
    "'sonic_velocity', yes\n",
    "\n",
    "'x_FL', yes\n",
    "\n",
    "'y_FL', yes\n",
    "\n",
    "'z_FL', yes\n",
    "\n",
    "'vx_FL', yes\n",
    "\n",
    "'vy_FL', yes\n",
    "\n",
    "'vz_FL', yes\n",
    "\n",
    "'OMEGA_X', yes\n",
    "\n",
    "'OMEGA_Y', yes\n",
    "\n",
    "'OMEGA_Z', yes\n",
    "\n",
    "'pitch_l', yes\n",
    "\n",
    "'yaw_l', yes\n",
    "\n",
    "'roll_l', yes\n",
    "\n",
    "'flightpath_speed', yes\n",
    "\n",
    "'acc_total',\n",
    "\n",
    "'atmos_pressure', yes\n",
    "\n",
    "'atmos_temperature', yes\n",
    "\n",
    "'drag', yes\n",
    "\n",
    "'mass_total', yes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
