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 temeperature and air pressure. Weather balloons collect many data. With a good understanding of athmospheric 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 start with a simple method for calculating the air temperature in various height and check it against the measurements of a real weather balloon. And you can repeat this experiment yourself with many ballon 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 German Weather Service (Deutscher Wetterdienst) provides data from it's radio sondes on the web. The following cell fetches these recent data from the Idar-Oberstein weather station for you to work with. "
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.
In the subsequent chapters we discuss some mathematical models of the atmosphere. In order to compare the predictions of these models with the data from the weather balloons, the following 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()temp=flight.dataPoints('height','temperature')press=flight.dataPoints('height','pressure')
Ready to analyze 119 data points from one flight on 30.09.2020.
Part I: Temperature
Temperature is one of the basic properties of any gas. Air temperature is easy to determine with a thermometer.
There is a simple model describing the decrease of temperature when the balloon gets higher up. Usin this model requires some understanding of linear functions. Don't forget to answer the questions!
People climbing mountains early noted that the air gets colder as they climb up. Based on measurements with thermometers scientists carried uphill, scientist calculated that the air temperature t(x) decreases by 6.5°C if height is increased by 1000 m (a so-called Lapse Rate) .
Let's assume a temperature of 15°C on the ground (we may change that later): T(0)=t0=15. What would be the temperature at a height of 7500 m according to this model? You can calculate that using the standard lapse rate ls=1000−6.5=−0.0065 of change in °/m.
The temperature at a height of 7500 m is, according to our model. -33.75°C.
Modify the cell above to calculate the temperature at 9200 m by replacing in line 4 7500 with 9200! Depending upon the context where you read this, you need to select Run from the Cell menu or press Shift+Return or click the Execute button to evaluate the cell for the new height.
Play around and calculate the expected air temperature at various heights; vary also the ground temperature t_0!
Let's plot this function - the temperature should decrease as we get higher up :
It seems to get pretty cold up there. That diagram would be more intuitive if the Height axes goes upward (on the ordinates) and the Temperature values are written horizontally (on the abscissae). We can get that presentation when we interchange the role of height and temperature, i.e. we let the height depend upon the temperature (do you think that is weird?), i.e. we plot the inverse functionTinv of our temperature function T.
Oops, that doesn't look like what our model predicted.
We observe, that the development of air temperature with height on this day has three phases.
Up to 4000 m the air temperature behaves somewhat irregularly
in the range between 4000 m and 12000 m it decreases more or less linearly - the curve is almost a straight line, similar to our model
it increases and oscillates again above 12000 m
Let's call the upper region of oscillating temeperature - here above 12000 m - Tropopause and the region below it Troposphere.
Clearly, our simple linear model does not work in the Tropopause, but perhaps it works in the upper region of the Troposphere? Let's check!
This region is between 4000 m and 12000 m for the default flight, it may be different for other flights!
# Adapt these two values if you are not using the default flightlinMin=4000linMax=12000print("Range of presumed linear temperature descent defined.")
Range of presumed linear temperature descent defined.
As we don't have the real temperature at height 0, we have to redefine our model function T(x) by using the temperature at a another height ht.
Instead of defining the linear function such that T(0)=t0 we define T such that T(ht)=th for some data point (ht,th) from our flight. We chose this data point as the first measurement in the height region we are interested in, i. e. the first data point at a height above 4000 m.
i=0whiletemp[i]<linMin:i+=1h_t=temp[i];t_h=temp[i];i_h=iprint("The first data point above %i m is at a height of %i m with an air temperature of %f°C."%(linMin,h_t,t_h))
The first data point above 4000 m is at a height of 4119 m with an air temperature of -3.700000°C.
When we know that T(ht)=ls⋅ht+t0=th, where t0 is the unknown temperature at sea level, then t0=th−ls⋅ht and we have our new model T(x)=lsx+t0.
We need to define T(x) such that T(4119)=−3.7. Let's calculate t0 as described above.
A side remark on accuracy in case you wonder why there are so many zeros:
Our computer calculates with a limited precision and the number of trailing zeros indicates the precision that is actually used. Real data, as those from the weather balloons, have a much lower accuracy and so many of the trailing decimals cannot be taken seriously. Nevertheless we use the calculated data with all their digits in order to avoid accumulating rounding errors and to keep the code simple.
Let's now compare the data from our model with the data from our balloon - recall that we have to compare the balloon data with the inverse function Tinv. We combine the previous plot of the balloon data with the plot of our model function inverse.
That's not a very good match! The simple linear model predicts a more strong decrease of temperature than shown by the measurement. Well, that may be due to particular conditions at this day at this place and we need to analyse more balloon reports. At least, the adequate laps rate may vary from day to day - but by how much?
Improving the Model
In order to get an indication for a better model, we may try to find a linear function that provides the best fit to the data between 4000 m and 12000 m.
This can be achieved by a mathematical method called Linear Regression. We can use Linear Regression to find a better model and plot it against the balloon data.
That fits much better than the original model. To get the real temperature lapse rate in the upper troposphere, we have to convert the fitting function by taking its inverse.
show((1/aLin)*x-(bLin/aLin))lapse=round((-1000/aLin),1)print((1/aLin)*x-(bLin/aLin))print("The temperature decreases in the upper part of the troposphere by about",str(lapse)+"° each 1000 m.")
-0.007920374121066309*x + 29.47669274560618
The temperature decreases in the upper part of the troposphere by about 7.9° each 1000 m.
We see, that in fact the air temperature decreases by 7.9°C every 1000 m!
We have started with the hypothesis that the air temperature decreases by 6.5°C when the height increases by 1000 m. This has led us to establish a linear model for the development of air temperature.
Looking at the data from one radio balloon flight suggests that the development of air temperature follows different laws in the lower and in the upper part of the atmosphere travelled by the balloon, providing indications for at least three layers of the atmosphere. In the upper and in the lower layer, not even the linear form of our model is adequate, while in the middle layer a linear model fits well, but we have to adjust the cofficients of our model to make it fit to the data.
Criticism: Climate data can depend upon many factors, e.g. geographic location and season of the year. In order to evaluate our claims, they need to be checked against many weather balloon data. Only then may we have a chance to understand the various factors influencing and changing our climate.
ToDo: Look for answers to the following questions.
Can these claims be confirmed by other balloon flights? You can try this by modifying the first code cell above to load the data from a random balloon flight from the Idar-Oberstein weather station.
How do the coefficients of the model vary between different flights? What might be values for the coefficients of the linear model that provide an optimal fit for all flights?
How does the season of the year and the time of day, with their different intensity of sun light, influence the development of the air temperature? This notebook has all the data required, but answering the question will require some programming.
How may other properties of the athmosphere depend upon each other? For instance, how does pressure depend upon height? How does temperature depend on pressure? (Note: Data points for pressure can be obtained at flight.dataPoints('height','pressure'). This requires some adaptation of the code in this notebook.
Which model may describe the oscillation of temperature in the Tropopause? How can these be explained?
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.