{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "62c192cb-802d-4a0f-8d20-31c061621baa", "metadata": {}, "outputs": [], "source": [ "#Plot sounding data from 9/8/2020 balloon launches\n", "# One of the most severe wind events to happen along the Wasatch Front occurred\n", "# on September 8, 2020\n", "# Undregrads launched a weather balloon carrying sensors to meaure weather conditions\n", "# including wind\n", "\n", "# The objective of this assignment is to read the data and then plot the vertical\n", "# profile of wind speed and direction observed at 7 AM MDT September 8 2020" ] }, { "cell_type": "code", "execution_count": 2, "id": "b1c8bc28-b4a6-4c48-9de9-7509f2623ea6", "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import matplotlib.pyplot as plt\n", "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 3, "id": "0c2256c3-311b-4431-b66a-10b9e0c01ee9", "metadata": {}, "outputs": [], "source": [ "# 1) look at the data file sonde_09_08_13utc.csv\n", "\n", "# The columns: are height (meters), pressure (hPa), temperature (C), relative humidity (%), wind speed (m/s), direction (degrees)\n", "# here are the \n", "\n", "# 2) Create a panda data frame, sounding, using only the columns: height, wind speed, and direction\n", "# hints: there are no headers in the file, so you need to say so using an option \"None\"\n", "# hints: you can define what columns to use by referring to them as a list of the columns you want to use\n", " " ] }, { "cell_type": "code", "execution_count": 4, "id": "a0303099-648b-403d-afc6-5eb680641786", "metadata": {}, "outputs": [], "source": [ "#3) define a list, headers, that contains the headers for these three columns: \"HGHT\", \"SPED\", \"DRCT\"\n", "\n", "\n", "#4 add the columns headers using something of the form \"sounding.columns =\"\n", "\n", "#5 Have 'HGHT' be the index\n", "\n", "#6 Drop the HGHT column from the sounding dataframe\n", "\n", "#at this point HGHT should be the index and SPED and DRCT are the columns" ] }, { "cell_type": "code", "execution_count": 5, "id": "52f8a8b2-43b7-4e05-ba5e-2224a3c12bdc", "metadata": {}, "outputs": [], "source": [ "#7) create a figure of size 5 wide by 10 tall with the axis \"ax\"\n", "\n", "# create a duplicate axis, ax1, to plot a second variable using the same y axis\n", "# look at pg. 153 but think about which axis is being \"twinned\"\n", "\n", "\n", "#8 plot on axis ax the speed on the x axis vs height (the index) on the y axis\n", "# with a red line of width 1\n", "\n", "\n", "#9 using the ax1, overlay direction on the x axis vs height on the y axis\n", "# no line, a balck square marker of size 2 \n", "\n", "#10 add labels on the x and y axes using 14 pt font\n", "# the labels should be\n", "#'Wind Speed m/s' (on the bottom)\n", "# 'Direction ($^\\circ$)' (on the top)\n", "# \"Height AGL (m)\" (on the side)\n", "# add a title with your name and unid using fontsize 20\n", "\n", "\n", "#11 save the plot as \"red_butte_09_08_22_1300utc.png\"\n" ] }, { "cell_type": "code", "execution_count": 6, "id": "8faa5515-2551-4b14-b76f-0d2693898ef9", "metadata": {}, "outputs": [], "source": [ "#12 use the \"describe\" function to obtain info on the speed and direction values\n" ] }, { "cell_type": "code", "execution_count": 7, "id": "f93458f7-2436-4010-a1aa-9acacdaf23b7", "metadata": {}, "outputs": [], "source": [ "# 13) use the concepts shown in the Chapter2 stats code to find the height where the\n", "# wind speed is a max in the pandas data frame (look for idxmax). \n", "# there are many ways to do this but it can be done in two lines of code\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.9.13" } }, "nbformat": 4, "nbformat_minor": 5 }