# Part I: Temperature

By Ingo Dahn, (Koblenz, Germany dahn@dahn-research.eu) and Ambjörn Naeve (Stockholm, Sweden amb@kth.se)

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 .

## Launching the Balloons

Let's go to the weather station in Idar-Oberstein/Germany. It is located 105 km (ca 65 miles) southwest of Frankfur/Main at a height of 376 m.

Or fly high up with a weather balloon in this video from Overlook Horizon:

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.

## Part I: Temperature

Temperature is one of the basic properties of any gas. Air temperature is easy to determine with a thermometer.

### Cool

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) . $T(x+1000)=T(x)-6.5$

Using such a lapse rate and a given temperature on the ground we can use this to calculate the temperature at any height.

Try to answer such a question by yourself. If you find it difficult, look at the written example, that comes with the question. If you have problems entering a formula, have a look at the .

Let's assume a temperature of 15°C on the ground (we may change that later): $T(0)= t_0 =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 $l_s=\frac{-6.5}{1000}=-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 function $T_{inv}$ of our temperature function $T$.

Can you calculate the inverse of our function $T$?

If not, look at the video that comes with the following question.

Now let's plot $T_{inv}$. You can play with the lapse rate lrand the ground temperature t_0 using your mouse or arrow keys to explore effects of their change.

That looks much more natural. Now we are ready for a reality test.

### Really Cool

Let's see, what the balloon actually measured up in the air!

Let us plot the temperature that our balloon has measured at the various heights. As in the previous plots, we draw the inverse function to direct the height axis upwards.

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!

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 $h_t$.

Instead of defining the linear function such that $T(0)=t_0$ we define $T$ such that $T(h_t)=t_h$ for some data point $(h_t,t_h)$ 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.

When we know that $T(h_t)=l_s\cdot h_t+t_0=t_h$, where $t_0$ is the unknown temperature at sea level, then $t_0=t_h-l_s\cdot h_t$ and we have our new model $T(x)=l_s x+t_0$. We need to define $T(x)$ such that $T(4119)=-3.7$. Let's calculate $t_0$ as described above.

Try a similar problem yourself!
We now calculate a new model function for the new balloon temperature data, as you did in the last question.

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 $T_{inv}$. 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.

We see, that in fact the air temperature decreases by 7.9°C every 1000 m!

### Temperature Summary

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.