Weather balloons are a simple, but important mean to explore the atmosphere. They carry radiosondes high up in the air (how high?) These radiosondes measure several parameters of the atmosphere during their flight, for instance air temperature and air pressure. Weather balloons collect many data. With a good understanding of atmospheric phenomena, we should be able to predict these data to a certain extent. Can you do it?
This notebook lets you perform your own experiments with real weather balloons. We started in Part I with a simple method for calculating the air temperature in various height and check it against the measurements of a real weather balloon. In this Part II we analyze the data on air pressure, measured by the balloon. And you can repeat this experiments yourself with many balloon risings! Can you come up with a better model?
This notebook is made of a sequence of cells:
Text cells, explaining what we do. The text cells analyze a specific default balloon flight. They do not change and, depending on your working environment, you may not be able to change the content of text cells.
Code cells with Sage code. You must _execute_ these cells to actually run the code. Depending on your environment, you execute cells by pressing the Execute button, by clicking into the cell and pressing Shift+Return or by selecting a Run item from the Cell menu. You can modify the content of code cells and you should do this in the places indicated in order to perform your own live experiments with real weather data! Note: Code cell calculations mostly use the results of calculations of previous cells. Therefore it is important that they are executed in the given order.
Hovering the mouse over the SageMath icon will reveal some additional explanations on the code - try it
Interactive questions from Wamap. Many of these questions come with written examples, explaining the underlying Math.
Don't worry if you don't understand the content of the code cells! We start simple and so you don't need to know a lot of Math, Physics or Programming - just go and experiment! Whenever you run into trouble - have a look at our .
The following cell prepares the environment by downloading data from weather balloon flights "
If it has in line 2 `randomBalloon=False` (the default) it uses a specific sample balloon flight which is discussed in the comments. You may change it to `randomBalloon=True` in order to select data from a randomly selected balloon flight.
This cell must be executed first.
# Change the value of randomBalloon to True in order to select a flight by chancerandomBalloon=Falseload('https://raw.githubusercontent.com/ingodahn/sageutils/master/weather.py')station=station()ifrandomBalloon:flight=station.getFlight('random')else:flight=station.getFlight()press=flight.dataPoints('height','pressure')temp=flight.dataPoints('height','temperature')
Ready to analyze 119 data points from one flight on 30.09.2020.
Note: Different notebooks use distinct computational environments. Therefore, if you use a randomly selected flight in this book, it is probably different from a flight you used in part 1. If you want to continue working with the same flight, you should paste the output of the last code cell from of Part I into the following cell and execute it.
#Paste status below this line# Paste status above this lineprint('Status restored')
Part II: Pressure
Pressure is, beside temperature and volume, one of the basic properties of any gas.
From the daily weather reports we know how important regions of high or low pressures are for understanding the development of the weather. For example, wind is nothing but air streaming from a region of higher pressure to a region of lower pressure.
But what is pressure? Watch this video from finsciencedemos to get a basic understanding of what air pressure is and how You can measure it can be measured.
The Weight of the Air
Evenif you don't notice it, 1 liter of air weighs about 1.3 g.
Side-Question: How can we know this?. Above your head there is a column of air which is several kilometers high. That should sum up to something! At sea level that approximately causes as much pressure as a column of 10 m of water.
Atmospheric pressure, also known as barometric pressure (after the barometer), is the pressure within the atmosphere of Earth. The standard atmosphere (symbol: atm) is a unit of pressure defined as 101,325 Pa (1,013.25 hPa; 1,013.25 mbar), which is equivalent to 760 mm Hg, 29.9212 inches Hg, or 14.696 psi. The atm unit is roughly equivalent to the mean sea-level atmospheric pressure on Earth, that is, the Earth's atmospheric pressure at sea level is approximately 1 atm.
The mean sea-level pressure is 1013.25 mbar. mbar (millibar) is the unit in which our weather balloon measures the pressure. Pilots use the air pressure to determine their height. In order to get correct values during the flight it is crucial that they calibrate their barometric altimeter at the departure airport, which deviates from sea-level pressure as the airport is usually above sea level. Similarly, our calculations have to take into account, that our weather station in Idar-Oberstein is located 376 m above sea level.
Let's explore atmospheric pressure with our weather balloon from Idar-Oberstein in order to develop a model for the dependency of pressure from height.
What would you expect? Does air pressure decrease linearly with height?
That's a nice, rather smooth decrease of pressure, but it is not linear. We have to consider more complex formulas to model the decrease of air pressure with height. We note, that for the minimal height of the ballon the pressure is slightly below 1000 mbar, as it was to be expected.
As we want to explore the dependency of pressure from height, let's turn around the diagram.
These points can probably be connected by a regular curve described by a function. If we could find a formula (i.e. a mathematical model) for calculating this function, we could predict the pressure at a particular height.
From a first look it seems that this function is injective (1-1), i.e. it has an inverse function, allowing us to calculate the height from the pressure of the air. That provides a simple method for a balloon or airplane pilot to determine his height. In fact that was the main way to determine height before Radar and GPS devices became so small that they could be used anywhere.
Preparing the Pressure Model
Can you guess, which function might describe such a curve?
It has a non-zero value at height 0, then a steep descend until it levels out towards 0. Similar curves are the function graphs of exponential functions ae−cx for c>0.
In this way we can determine an exponential function through two data points - but that's not necessary the best fit w.r.t. all data points!
Exponential Regression attempts to find an exponential function that optimally fits a given set of data. It is an iterative procedure that starts with an initial guess for the parameters a and c and then adapts these parameters step by step to minimize the difference between the data points and the graph of the exponential function.
Unfortunately, as many iterative procedures, exponential regression can go wrong if the initially guessed values are too far from the optimal ones - which we don't know yet.
Since for our model P(x)=ae−kx of the pressure a=P(0), it is probably a good guess to take the mean pressure at sea level of 1013.5 mbar as starting value for a.To get an initial guess for k, we can take the pressure at another height and calculate k for the function passing through this data point as well, as we have seen working on the previous question.
Let's take for this other data point some point pressInv[i] in the middle of our data series:
i=round(len(press)/2)x1=0y1=1013.25x2=press[i]y2=press[i]a0=y1k0=ln(y2/y1)/(x1-x2)print("Let's start with an initial guess of a=%f and k=%f"%(a0,k0))
Let's start with an initial guess of a=1013.250000 and k=0.000136
We use exponential regression to determine an exponential function that fits best to the data:
That doesn't look bad, but how good is our model really? If a pilot would rely on our model to calculate the altitude of her plane - how would it deviate from the professional height measurement in the weather balloon using GPS?
Our function P(x) calculates the pressure from the height - the pilot would need the inverse of P.
Our pilot starts at the right of the diagram, with a pressure of ca. 1000 mbar, and moves up. Initially, our model predicts a height which is about 300 m too high, then it becomes better and for pressure between 750 mbar and 250 mbar the height given by our model is up to 250 m too low. Below that, the error of the model grows of up to 3.5 km - we still have a lot to learn!
Obviously, having data from a single weather balloon flight isn't enough for a pilot to calculate height from pressure. Maybe there is too much influence of the local conditions when we rely on experimental data only? In order to get a calculation with more solid foundations, we shall need a bit more theory.
So far we have considered temperature (in Part I) and pressure (in this part) alone. But they are not independent. Perhaps you recall from your home (or from a physics lesson) that the pressure in a vessel rises when it's content is heated up and that gas under pressure, that is released from a spray dose is rather cool.
Let us see whether we can gain new insights when we explore the relation between temperature and pressure in Part III !
The following cell prints some basic status data from this notebook for re-use in other notebooks. Execute it and copy it's output into the input cell of another notebook, designated by a green border, or save it for later use in a text file.