User Tools

Site Tools


atmos:citation:research:thermosonde

NASA USIP 2016-2018: Thermosonde

The 2016-2018 NASA Undergraduate Student Instrument Project (USIP) aims to develop a digital thermosonde instrument for measuring temperature differences between two platinum wire probes (2 um diameter) and relate that to the refractive index structure parameter Cn2. This project is a cooperative effort between the Atmospheric Sciences, Space Studies, and Electrical Engineering departments at UND, with the Electrical Engineering department members responsible for building the thermosonde instrument, the Atmospheric Sciences department members responsible for analyzing the data to calculate optical turbulence profiles, and the Space Studies department members responsible for coordinating the balloon launching procedures.

Project Codes

readsounding.py

readsounding.py is a pseudo-universal sounding reading module that reads in a sounding and returns a dictionary containing standard sounding data (p,t,z,spd,dir,u,v) as well as name information for the sounding. This module is part of ADPAA and is located in $ADPAA_DIR/srcpython_lib/. The returned dictionary contains the following data:

S['NAME']  : file title containing the year, month, day, hour, and type of sounding
S['TITLE'] : Plot title containing the location, year, month, day, and UTC hour of sounding
S['LABEL'] : Plot label containing the type, date, location, and hour of sounding
S['PRESS'] : pressure (in hPa)
S['ALT']   : altitude (in m)
S['TEMP']  : temperature (in degC)
S['DP']    : dew point temperature (in degC)
S['SPD']   : wind speed (in kts)
S['DIR']   : wind direction (in degrees)
S['U']     : zonal wind speed (in kts)
S['V']     : meridional wind speed (in kts)

If a GRAW RTS table is being read, it will also contain:

S['TIME']  : seconds from the start of the flight (seconds)
S['UTC']   : UTC seconds from midnight (seconds)
Compatible Sounding Types

readsounding works with many sounding types.

Graw RTS and Profile Data Tables

These files are generated by the Graw radiosondes used by the Atmospheric Sciences department. The RTS tables contain all of the radiosonde data, while the Profile Data Tables contain only the essential data. For more information, see Radiosonde

Usage

To import all functions from readsounding:

>>> from readsounding import *

To read in a sounding:

>>> a = readsounding('sounding file')
Example

To read in sounding data from a sounding named MCR_8_Aug_1000a_1.txt:

>>> S = readsounding('MCR_8_Aug_1000a_1.txt')

To access the data in the returned dictionary:

>>> S['TEMP']
array([ 28. ,  27.5,  27.2, ..., -37.8, -37.5, -37.4])
>>> S['PRESS']
array([ 1012.5 ,  1010.5 ,  1007.09, ...,    11.56,    11.5 ,    11.45])

compare_cn2.py

compare_cn2.py is a program with characteristics of a module and an executable program that is used to compare the refractive index structure parameter profiles for sets of radiosonde, thermosonde, and model data.

Script Usage

To run compare_cn2.py as a script to compare the refractive index structure parameter profiles for thermosonde, radiosonde, and model data:

./compare_cn2.py <radiosonde data> <model data> <thermosonde data>
Module Usage

Compare_cn2.py contains functions that may be imported into other python programs. To import all functions from compare_cn2.py, use:

>>> from compare_cn2 import *

These functions in compare_cn2 are written for use with the dictionary returned from readsounding.py. See the readsounding section above for more information.

trop_calc

trop_calc is a function that finds the pressure level of the tropopause for profiles of pressure, temperature, and altitude from a set of sounding data. To use trop_calc, use this syntax:

>>> trop_pres = trop_calc(<pressure array>, <temperature array>, <altitude array>)

The tropopause pressure is returned from the function into variable trop_pres.

smooth

smooth applies an 11-point smoother to a set of sounding data containing pressure, temperature, altitude, and u and v wind. There are two ways to call the function. The first way is to pass a dictionary containing pressure, temperature, altitude, u wind, and v wind as the only argument. This dictionary can be easily created using the readsounding function from $ADPAA_DIR/src/python_lib/readsounding.py. The other way is to pass five separate arrays (pressure, temperature, altitude, u wind, and v wind) to the function.

The function returns a dictionary containing the smoothed data. If a dictionary was passed to the function, the data arrays in the dictionary are updated with the smoothed data and the same dictionary is returned, containing any other data the original dictionary had. If individual arrays were passed, a dictionary containing only the smoothed data will be passed back.

To smooth the data in dictionary A, which was generated with readsounding, use:

>>> A = smooth(A)

The pressure, temperature, altitude, and u/v wind data is replaced with the smoothed data.

To smooth five individual arrays of pressure, temperature, altitude, and u/v wind data, use:

>>> A = smooth(<pressure array>, <temperature array>, <altitude array>, <u array>, <v array>)

A now contains the smoothed data from the five arrays in a single dictionary.

cn2_calc_thermo

cn2_calc_thermo calculates the refractive index structure parameter for thermosonde data. This function needs the temperature difference data measured by the thermosonde as well as associated pressure and temperature data from the radiosonde in the thermosonde package.

There are two ways to call the function. The first way is to pass an array of temperature differences and a dictionary containing pressure and temperature as the second argument. While the dictionary can contain other data as well, it must contain at least pressure and temperature. This dictionary can be easily created using the readsounding function from $ADPAA_DIR/src/python_lib/readsounding.py. The other way is to pass the temperature difference array and two separate arrays (pressure and temperature) to the function.

To run cn2_calc_thermo with a dictionary A (generated with readsounding) and an array of temperature difference measurements TEMPDIFF, use:

>>> A = cn2_calc_thermo(TEMPDIFF, A)

This updates dictionary A with the calculated cn2 data and adds in the temperature difference data from TEMPDIFF.

To run cn2_calc_thermo with individual arrays of temperature differences (TEMPDIFF), pressure (PRESS), and temperature (TEMP), use:

>>> A = cn2_calc_thermo(TEMPDIFF, PRESS, TEMP)

This returns a dictionary containing the calculated cn2 data, temperature differences, pressures, and temperatures from the other arrays.

cn2_calc

cn2_calc calculates the refractive index structure parameter for a given set of sounding data. This function may be called by passing a dictionary containing pressure, temperature, altitude, u wind, and v wind as the only argument or by passing five individual arrays containing the data listed above. The dictionary can be easily created using the readsounding module in $ADPAA_DIR/src/python_lib/readsounding.py (see readsounding section above).

By default, this function assumes that a radiosonde file is being compared to a model file, so the sounding levels directly above and below the current level are used to calculate lapse rates and wind shear. By adding another argument to the function call, method=“thermo”, the function will use the levels 150 meters above and below the current level to calculate lapse rates and wind shear. However, this requires high resolution soundings such as GRAW sounding files.

If a dictionary was passed to the function, that dictionary is updated to hold the cn2 data as well as the trimmed sounding data; to account for the cn2 calculation, the first and last elements of each sounding data array are deleted. If individual arrays are passed, a new dictionary is created to hold the data.

USAGE:

To calculate cn2 for a sounding in dictionary A (created with readsounding) using the levels directly above and below each level:

>>> A = cn2_calc(A)

This assumes that sounding A is relatively small. If A is high resolution, the resulting Cn2 data is very noisy.

To calculate cn2 for sounding data in dictionary A (created with readsounding) using the levels 150 meters above and below each level:

>>> A = cn2_calc(A, method="thermo")

For high-resolution soundings (defined as having at least 600 levels), this creates a cleaner Cn2 profile.

To calculate cn2 for a set of arrays containing sounding data:

>>> A = cn2_calc(PRESS, TEMP, ALT, U, V)

A dictionary containing all of this data as well as the Cn2 data is returned to A.

plot_cn2

plot_cn2 creates a figure for plotting cn2 profiles. Due to the large range of the Cn2 data (10^-13 near the surface decreasing to 10^-19 in the stratosphere), the x axis is plotted in logarithmic units.

Optional arguments may be passed to the function. Any arguments are assumed to be dictionaries (formatted in readsounding format) that contain cn2 data. If arguments have been passed, the data will be plotted on the graph and the graph will be displayed. Up to 8 individual soundings may be plotted on the graph, but the graphs tend to get messy and hard to understand after 5 lines.

USAGE:

To only generate a figure on which cn2 data may be plotted later:

>>> plot_cn2()

To generate the figure and plot cn2 data from dictionary A, which contains Cn2 data after been run through cn2_calc:

>>> plot_cn2(A)

A figure will appear with the Cn2 profile.

To generate a figure with multiple Cn2 profiles from multiple dictionaries:

>> plot_cn2(A,B,C)

A figure will appear with the Cn2 profiles from dictionaries A, B, and C.

Examples

The modular format of readsounding and compare_cn2 provide a user-friendly method to calculate and plot Cn2 data. It only takes 5 lines of code (including import statements) to read in sounding data from a file and generate a Cn2 plot, 6 lines if the sounding is high-resolution. Here are the lines to use in the Python interactive prompt to make a Cn2 plot with sounding data from the GRAW high-resolution sounding /nas/Radiosonde/20170503/170503_204757_GFK_GRAW.txt:

>>> from compare_cn2 import *
>>> from readsounding import *
>>> A = readsounding('/nas/Radiosonde/20170503/170503_204757_GFK_GRAW.txt')
>>> A = smooth(A)
>>> A = cn2_calc(A)
>>> plot_cn2(A)
atmos/citation/research/thermosonde.txt · Last modified: 2020/01/29 17:25 by 127.0.0.1