49
tephi Documentation Release 0.1.0 British Crown Copyright 2014, Met Office January 16, 2015

Release 0.1.0 British Crown Copyright 2014, Met Office · It is a graphical representation of the obervations of pressure, temperature and humidity, made in a vertical sounding of

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

tephi DocumentationRelease 0.1.0

British Crown Copyright 2014, Met Office

January 16, 2015

Contents

1 User guide table of contents 31.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.2 Tephigram plotting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91.3 Tephigram customisation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171.4 Tephigram barbs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351.5 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

i

ii

tephi Documentation, Release 0.1.0

This user guide gives a brief introduction to the tephigram plotting capability provided by tephi.

Warning: This module is currently in beta release and is liable to change.

Contents 1

tephi Documentation, Release 0.1.0

2 Contents

CHAPTER 1

User guide table of contents

1.1 Introduction

The tephigram is a thermodynamic or energy diagram, devised in 1915 by Sir William Napier Shaw, a former Director-General of the Met Office.

It is a graphical representation of the obervations of pressure, temperature and humidity, made in a vertical soundingof the atmosphere, typically from radiosondes.

The axis of the tephigram are temperature (T) and entropy (𝜑), hence the name “T-𝜑-gram”. The axes and lines of thetephigram are shown in Figure 1: The tephigram..

Figure 1.1: Figure 1: The tephigram.

3

tephi Documentation, Release 0.1.0

1.1.1 Axes and lines of the tephigram

At first glance the tephigram appears to be a confusing mass of lines. However, on closer inspection five differenttypes of lines can be identified, all of which are now described.

Isotherms

Isotherms are lines of constant temperature, measured in units of oC. They are straight and parallel, running at 45o

across the tephigram from bottom left to top right of the plot.

The line representing the 0oC isotherm has a thick black dashed line-style.

Figure 1.2: Figure 2: The isotherm lines.

The axis ticks to the left of the plot show the temperature values of each individual isotherm line.

Dry adiabats

Dry adiabats are lines of constant potential temperature, measured in units of oC. They are straight and parallel, runningat 45o across the tephigram from the top left to the bottom right of the plot.

The dry adiabats represent the rate at which unsaturated air will cool when rising or warm when sinking. The dryadiabatic lapse rate (DALR) is the rate at which cooling occurs if there are no other factors increasing or decreasingthe temperature of a parcel as it rises.

The axis ticks at the bottom and to the right of the plot show the potential temperature value of each individual dryadiabat line.

4 Chapter 1. User guide table of contents

tephi Documentation, Release 0.1.0

Figure 1.3: Figure 3: The dry adiabat lines.

1.1. Introduction 5

tephi Documentation, Release 0.1.0

Note that, as temperature (T) and entropy (𝜑) are the axes of the tephigram, the isotherms and dry adiabats perpendic-ularly bisect each other, and are not skewed.

Figure 1.4: Figure 4: Relationship between the isotherm and dry adiabat lines.

Isobars

Isobars are lines of constant pressure, measured in units of millibars or hectopascals. They are almost horizontal andstraight and their vertical spacing increases as their value decreases. The highest valued isobar is at the bottom of theplot and the lowest valued isobar is at the top, akin to our atmosphere.

The value of each individual isobar line is always shown within the plot beside the isobar line. By default, isobar linesand text values are blue.

Humidity mixing ratio

Humidity mixing ratio lines are lines of constant saturation mixing ratio with respect to a plane water surface, measuredin units of g kg-1. They run diagonally across the plot from bottom left to top right.

A humidity mixing ratio line represents the number of grams of water required to saturate 1 kg of air at a particulartemperature and pressure.

The value of each humidity mixing ratio line is always shown within the plot beside the line. By default, humiditymixing ratio lines and text values are green.

6 Chapter 1. User guide table of contents

tephi Documentation, Release 0.1.0

Figure 1.5: Figure 5: The isobar lines.

1.1. Introduction 7

tephi Documentation, Release 0.1.0

Figure 1.6: Figure 6: The humidity mixing ratio lines.

8 Chapter 1. User guide table of contents

tephi Documentation, Release 0.1.0

Pseudo saturated wet adiabats

Saturated adiabats are lines of constant equivalent potential temperature for saturated air parcels, measured in unitsoC. They run as vertically curved lines across the plot from top to bottom.

The saturated adiabats represent the rate at which saturated air will cool when rising i.e. the saturated adiabatic lapserate (SALR).

Figure 1.7: Figure 7: The saturated adiabat lines.

The value of each saturated adiabat line is always shown within the plot beside the line. By default, saturated adiabatlines are text values are orange.

1.2 Tephigram plotting

This section describes how to visualise one or more data sets as a tephigram.

1.2.1 Tephigram data

Throughout this user guide we will make use of three data sets to plot temperature profiles on a tephigram.

Currently, the tephigram module can only plot data from ascii text files. These files may contain pressure, temperature,wind speed and wind direction data sets. Here pressure is measured in units of millibars or hectopascals, temperatureis measured in units of degrees celsius, wind speed is measured in knots and wind direction is measured in degreesfrom north.

1.2. Tephigram plotting 9

tephi Documentation, Release 0.1.0

Note that the data set must consist of one or more pressure and temperature paired values, and optionally one windspeed and wind direction pair for each pressure value. Thus any temperature value must be paired with a pressurevalue, and wind speed and wind direction pairs must be paired with a pressure value.

Data from the text files is loaded into one collections.namedtuple() instance per text file. Each column ofdata representing a given phenomenon in a text file is loaded into a single named tuple. The name of each tuple is setusing a list of strings passed to the loader. If not specified, the names default to (pressure, temperature).

For our example tephigram data sets we have a 2-dimensional dew-point data set:

>>> print dewstephidata(

pressure=array([ 1006., 924., 900., 850., 800., 755., 710., 700.,600., 500., 470., 459., 400., 300., 250.], dtype=float32)

temperature=array([ 26.39999962, 20.29999924, 19.79999924, 14.5 ,12.89999962, 8.30000019, -5. , -5.0999999 ,

-11.19999981, -8.30000019, -12.10000038, -12.5 ,-32.90000153, -46. , -53. ], dtype=float32))

And a 2-dimensional dry-bulb data set, with each named tuple printed individually:

>>> print temps.pressure[ 1006. 924. 900. 850. 800. 755. 710. 700. 600. 500.

470. 459. 400. 300. 250. 210. 200. 186. 178. 159.151. 150. 129. 117. 107. 100. 82. 80. 60. 54.50.]

>>> print temps.temperature[ 30. 22. 21. 18. 16. 12. 12. 11. 4. -4. -7. -7. -13. -29. -38.-47. -51. -56. -57. -63. -63. -64. -69. -77. -79. -77. -78. -78. -72. -71.-69.]

A convenience function, as introduced above, has been provided to assist with loading one or more text files ofpressure, temperature, wind speed and wind direction data; see tephi.loadtxt(). Here it is used to load the thirdexample data set that contains four columns of data, being pressure, temperature, wind speed and wind direction:

>>> import os.path>>> import tephi>>> winds = os.path.join(tephi.DATA_DIR, ’barbs.txt’)>>> columns = (’pressure’, ’dewpoint’, ’wind_speed’, ’wind_direction’)>>> barbs = tephi.loadtxt(winds, column_titles=columns)>>> barbstephidata(

pressure=array([ 1006., 924., 900., 850., 800., 755., 710., 700.,600., 500., 470., 459., 400., 300., 250.], dtype=float32)

dewpoint=array([ 26.39999962, 20.29999924, 19.79999924, 14.5 ,12.89999962, 8.30000019, -5. , -5.0999999 ,

-11.19999981, -8.30000019, -12.10000038, -12.5 ,-32.90000153, -46. , -53. ], dtype=float32)

wind_speed=array([ 0., 1., 5., 5., 7., 10., 12., 15., 25., 35., 40.,43., 45., 50., 55.], dtype=float32)

wind_direction=array([ 0., 15., 25., 30., 60., 90., 105., 120., 180.,240., 270., 285., 300., 330., 359.], dtype=float32))

Note: WMO upper-level pressure, temperature, humidity, and wind reports FM 35-IX Ext. TEMP, FM 36-IX Ext.TEMP SHIP, FM 37-IX Ext. TEMP DROP and FM 38-IX Ext. MOBIL are currently not supported.

10 Chapter 1. User guide table of contents

tephi Documentation, Release 0.1.0

1.2.2 Plotting tephigram data

Note: Tephigram subplots are currently not supported.

Plotting a single data set

The temperature profile of a single tephigram data set can easily be plotted.

import matplotlib.pyplot as pltimport os.path

import tephi

dew_point = os.path.join(tephi.DATA_DIR, ’dews.txt’)dew_data = tephi.loadtxt(dew_point, column_titles=(’pressure’, ’dewpoint’))dews = zip(dew_data.pressure, dew_data.dewpoint)tpg = tephi.Tephigram()tpg.plot(dews)plt.show()

1.2. Tephigram plotting 11

tephi Documentation, Release 0.1.0

θ=30.0

θ=45.0

θ=60.0

θ=75.0

θ=90.0

θ=0.0

θ=15.0

T=−6

0.0

T=−4

5.0

T=−3

0.0

T=−1

5.0

200

400

1000

600

800

300

900

700

100

500

50

32

16

4

8

44

12

28

48

40

20

24

56

36

60

52

2

50

38

6

10

34

14

18

58

46

22

26

54

42

30

1.0

20.0

52.0

0.1

7.0

3.0

36.0

0.4

12.0

80.0

0.01

2.0

5.0

9.0

16.0

28.0

44.0

0.03

60.0

0.002

0.6

0.2

Plotting multiple data sets

Plotting more than one data set is achieved by over-plotting each data set individually onto the tephigram.

import matplotlib.pyplot as pltimport os.path

import tephi

dew_point = os.path.join(tephi.DATA_DIR, ’dews.txt’)dry_bulb = os.path.join(tephi.DATA_DIR, ’temps.txt’)column_titles = [(’pressure’, ’dewpoint’), (’pressure’, ’temperature’)]dew_data, temp_data = tephi.loadtxt(dew_point, dry_bulb, column_titles=column_titles)dews = zip(dew_data.pressure, dew_data.dewpoint)

12 Chapter 1. User guide table of contents

tephi Documentation, Release 0.1.0

temps = zip(temp_data.pressure, temp_data.temperature)

tpg = tephi.Tephigram()tpg.plot(dews)tpg.plot(temps)plt.show()

θ=60.0

θ=90.0

θ=120.0

θ=150.0

θ=180.0

θ=210.0

θ=0.0

θ=30.0

T=−1

25.0

T=−1

00.0

T=−7

5.0

T=−5

0.0

T=−2

5.0

200

400

1000

600

800

300

900

700

100

500

50

32

16

4

8

44

12

28

48

40

20

24

56

36

60

52

1.0

20.0

52.0

0.1

7.0

3.0

36.0

0.4

12.0

80.0

0.01

Note that, by default the tephigram will automatically center the plot so that all temperature profiles are visible, alsosee Anchoring a plot.

Customising a temperature profile

All keyword arguments passed to tephi.Tephigram.plot() are simply passed through tomatplotlib.pyplot.plot().

1.2. Tephigram plotting 13

tephi Documentation, Release 0.1.0

This transparency allows full control when plotting a temperature profile on the tephigram.

import matplotlib.pyplot as pltimport os.path

import tephi

dew_point = os.path.join(tephi.DATA_DIR, ’dews.txt’)dew_data = tephi.loadtxt(dew_point, column_titles=(’pressure’, ’dewpoint’))dews = zip(dew_data.pressure, dew_data.dewpoint)tpg = tephi.Tephigram()tpg.plot(dews, label=’Dew-point temperature’, color=’blue’, linewidth=2, linestyle=’--’, marker=’s’)plt.show()

θ=30.0

θ=45.0

θ=60.0

θ=75.0

θ=90.0

θ=0.0

θ=15.0

T=−6

0.0

T=−4

5.0

T=−3

0.0

T=−1

5.0

200

400

1000

600

800

300

900

700

100

500

50

32

16

4

8

44

12

28

48

40

20

24

56

36

60

52

2

50

38

6

10

34

14

18

58

46

22

26

54

42

30

1.0

20.0

52.0

0.1

7.0

3.0

36.0

0.4

12.0

80.0

0.01

2.0

5.0

9.0

16.0

28.0

44.0

0.03

60.0

0.002

0.6

0.2

Dew-point temperature

14 Chapter 1. User guide table of contents

tephi Documentation, Release 0.1.0

Tephigram axis ticks

By default the isotherm and dry adiabat axis ticks are automatically located and scaled based on the tephigram plotand zoom level, which may be changed interactively.

However, fixed axis tick locations can easily be configured for either axis if required.

import matplotlib.pyplot as pltimport os.path

import tephi

dew_point = os.path.join(tephi.DATA_DIR, ’dews.txt’)dew_data = tephi.loadtxt(dew_point, column_titles=(’pressure’, ’dewpoint’))dews = zip(dew_data.pressure, dew_data.dewpoint)tpg = tephi.Tephigram(isotherm_locator=tephi.Locator(10), dry_adiabat_locator=tephi.Locator(20))tpg.plot(dews)plt.show()

1.2. Tephigram plotting 15

tephi Documentation, Release 0.1.0

θ=40

θ=60

θ=80

θ=0

θ=20

T=−6

0

T=−5

0

T=−4

0

T=−3

0

T=−2

0

T=−1

0

200

400

1000

600

800

300

900

700

100

500

50

32

16

4

8

44

12

28

48

40

20

24

56

36

60

52

2

50

38

6

10

34

14

18

58

46

22

26

54

42

30

1.0

20.0

52.0

0.1

7.0

3.0

36.0

0.4

12.0

80.0

0.01

2.0

5.0

9.0

16.0

28.0

44.0

0.03

60.0

0.002

0.6

0.2

The above may also be achieved without using a tephi.Locator:

tpg = tephi.Tephigram(isotherm_locator=10, dry_adiabat_locator=20)

Anchoring a plot

By default, the tephigram will automatically center the plot around all temperature profiles. This behaviour may notbe desirable when comparing separate tephigram plots against one another.

To fix the extent of a plot, simply specify an anchor point to the tephigram.

import matplotlib.pyplot as pltimport os.path

16 Chapter 1. User guide table of contents

tephi Documentation, Release 0.1.0

import tephi

dew_point = os.path.join(tephi.DATA_DIR, ’dews.txt’)dew_data = tephi.loadtxt(dew_point, column_titles=(’pressure’, ’dewpoint’))dews = zip(dew_data.pressure, dew_data.dewpoint)tpg = tephi.Tephigram(anchor=[(1000, 0), (300, 0)])tpg.plot(dews)plt.show()

θ=60.0

θ=75.0

θ=90.0

θ=105.0

θ=0.0

θ=15.0

θ=30.0

θ=45.0

T=−4

5.0

T=−3

0.0

T=−1

5.0

T=0.0

200

400

1000

600

800

300

900

700

100

500

50

32

16

4

8

44

12

28

48

40

20

24

56

36

60

52

2

50

38

6

10

34

14

18

58

46

22

26

54

42

301.0

20.0

52.0

0.1

7.0

3.0

36.0

0.4

12.0

80.0

0.01

2.0

5.0

9.0

16.0

28.0

44.0

0.03

60.0

0.002

0.6

0.2

1.3 Tephigram customisation

This section discusses how finer control of the tephigram isobars, saturated adiabats and humidity mixing ratio linesand text can be achieved.

1.3. Tephigram customisation 17

tephi Documentation, Release 0.1.0

1.3.1 Isobar control

Isobar lines

The default behaviour of the tephigram isobar line is controlled by the tephi.ISOBAR_LINE dictionary:

>>> print tephi.ISOBAR_LINE{’color’: ’blue’, ’linewidth’: 0.5, ’clip_on’: True}

This is a dictionary of key and value pairs that are passed through as keyword arguments tomatplotlib.pyplot.plot().

Updating the ISOBAR_LINE dictionary will subsequently change the default behaviour of how the tephigram isobarlines are plotted.

import matplotlib.pyplot as pltimport os.path

import tephi

dew_point = os.path.join(tephi.DATA_DIR, ’dews.txt’)dew_data = tephi.loadtxt(dew_point, column_titles=(’pressure’, ’dewpoint’))dews = zip(dew_data.pressure, dew_data.dewpoint)tephi.ISOBAR_LINE.update({’color’: ’purple’, ’linewidth’: 3, ’linestyle’: ’--’})tpg = tephi.Tephigram()tpg.plot(dews)plt.show()

18 Chapter 1. User guide table of contents

tephi Documentation, Release 0.1.0

θ=30.0

θ=45.0

θ=60.0

θ=75.0

θ=90.0

θ=0.0

θ=15.0

T=−6

0.0

T=−4

5.0

T=−3

0.0

T=−1

5.0

200

400

1000

600

800

300

900

700

100

500

50

32

16

4

8

44

12

28

48

40

20

24

56

36

60

52

2

50

38

6

10

34

14

18

58

46

22

26

54

42

30

1.0

20.0

52.0

0.1

7.0

3.0

36.0

0.4

12.0

80.0

0.01

2.0

5.0

9.0

16.0

28.0

44.0

0.03

60.0

0.002

0.6

0.2

Isobar text

Similarly, the default behaviour of the tephigram isobar text is controlled by the tephi.ISOBAR_TEXT dictionary:

>>> print tephi.ISOBAR_TEXT{’color’: ’blue’, ’va’: ’bottom’, ’ha’: ’right’, ’clip_on’: True, ’size’: 8}

This is a dictionary of key and value pairs that are passed through as keyword arguments tomatplotlib.pyplot.text().

Updating the ISOBAR_TEXT dictionary will change the default behaviour of how the tephigram isobar text is plotted.

import matplotlib.pyplot as pltimport os.path

1.3. Tephigram customisation 19

tephi Documentation, Release 0.1.0

import tephi

dew_point = os.path.join(tephi.DATA_DIR, ’dews.txt’)dew_data = tephi.loadtxt(dew_point, column_titles=(’pressure’, ’dewpoint’))dews = zip(dew_data.pressure, dew_data.dewpoint)tephi.ISOBAR_TEXT.update({’color’: ’purple’, ’size’: 12})tpg = tephi.Tephigram()tpg.plot(dews)plt.show()

θ=30.0

θ=45.0

θ=60.0

θ=75.0

θ=90.0

θ=0.0

θ=15.0

T=−6

0.0

T=−4

5.0

T=−3

0.0

T=−1

5.0

200

400

1000

600

800

300

900

700

100

500

50

32

16

4

8

44

12

28

48

40

20

24

56

36

60

52

2

50

38

6

10

34

14

18

58

46

22

26

54

42

30

1.0

20.0

52.0

0.1

7.0

3.0

36.0

0.4

12.0

80.0

0.01

2.0

5.0

9.0

16.0

28.0

44.0

0.03

60.0

0.002

0.6

0.2

Isobar frequency

The frequency at which isobar lines are plotted on the tephigram is controlled by the tephi.ISOBAR_SPEC list:

20 Chapter 1. User guide table of contents

tephi Documentation, Release 0.1.0

>>> print tephi.ISOBAR_SPEC[(25, 0.03), (50, 0.1), (100, 0.25), (200, 1.5)]

This line specification is a sequence of one or more tuple pairs that contain an isobar pressure line step and a zoomlevel.

For example, (25, 0.03) states that all isobar lines that are a multiple of 25 mb will be plotted i.e. visible, whenthe zoom level is at or below 0.03.

The overall range of isobar pressure levels that may be plotted is controlled by the tephi.MIN_PRESSURE andtephi.MAX_PRESSURE variables:

>>> print tephi.MIN_PRESSURE50>>> print tephi.MAX_PRESSURE1000

Note that, it is possible to set a fixed isobar pressure line step for a tephigram plot by setting the associated zoom levelto None. This is opposed to relying on the plot zoom level of the tephigram to control line visibility.

For example, to always show isobar lines that are a multiple of 50 mb, irrespective of the zoom level,

import matplotlib.pyplot as pltimport os.path

import tephi

dew_point = os.path.join(tephi.DATA_DIR, ’dews.txt’)dew_data = tephi.loadtxt(dew_point, column_titles=(’pressure’, ’dewpoint’))dews = zip(dew_data.pressure, dew_data.dewpoint)tephi.ISOBAR_SPEC = [(50, None)]tpg = tephi.Tephigram()tpg.plot(dews)plt.show()

1.3. Tephigram customisation 21

tephi Documentation, Release 0.1.0

θ=30.0

θ=45.0

θ=60.0

θ=75.0

θ=90.0

θ=0.0

θ=15.0

T=−6

0.0

T=−4

5.0

T=−3

0.0

T=−1

5.0

800

450

100

150

550

200

650

300

50

750

400

1000

850

500

950

600

900

250

700

350

32

16

4

8

44

12

28

48

40

20

24

56

36

60

52

2

50

38

6

10

34

14

18

58

46

22

26

54

42

30

1.0

20.0

52.0

0.1

7.0

3.0

36.0

0.4

12.0

80.0

0.01

2.0

5.0

9.0

16.0

28.0

44.0

0.03

60.0

0.002

0.6

0.2

It is also possible to control which individual isobar lines should be fixed via the tephi.ISOBAR_FIXED list:

>>> print tephi.ISOBAR_FIXED[50, 1000]

By default, the isobar lines at 50 mb and 1000 mb will always be plotted.

Isobar line extent

The extent of each tephigram isobar line is controlled by the tephi.MIN_THETA and tephi.MAX_THETA vari-ables:

>>> print tephi.MIN_THETA0

22 Chapter 1. User guide table of contents

tephi Documentation, Release 0.1.0

>>> print tephi.MAX_THETA250

For example, to change the isobar line extent behaviour to be between 15 oC and 60 oC,

import matplotlib.pyplot as pltimport os.path

import tephi

dew_point = os.path.join(tephi.DATA_DIR, ’dews.txt’)dew_data = tephi.loadtxt(dew_point, column_titles=(’pressure’, ’dewpoint’))dews = zip(dew_data.pressure, dew_data.dewpoint)tephi.MIN_THETA = 15tephi.MAX_THETA = 60tpg = tephi.Tephigram()tpg.plot(dews)plt.show()

1.3. Tephigram customisation 23

tephi Documentation, Release 0.1.0

θ=30.0

θ=45.0

θ=60.0

θ=75.0

θ=90.0

θ=0.0

θ=15.0

T=−6

0.0

T=−4

5.0

T=−3

0.0

T=−1

5.0

200

400

1000

600

800

300

900

700

100

500

50

32

16

4

8

44

12

28

48

40

20

24

56

36

60

52

2

50

38

6

10

34

14

18

58

46

22

26

54

42

30

1.0

20.0

52.0

0.1

7.0

3.0

36.0

0.4

12.0

80.0

0.01

2.0

5.0

9.0

16.0

28.0

44.0

0.03

60.0

0.002

0.6

0.2

1.3.2 Saturated adiabat control

Saturated adiabat lines

The default behaviour of the tephigram pseudo saturated wet adiabat line is controlled by thetephi.WET_ADIABAT_LINE dictionary:

>>> print .WET_ADIABAT_LINE{’color’: ’orange’, ’linewidth’: 0.5, ’clip_on’: True}

This is a dictionary of key and value pairs that are passed through as keyword arguments tomatplotlib.pyplot.plot().

Updating the WET_ADIABAT_LINE dictionary will change the default behaviour of all saturated adiabat line plotting.

24 Chapter 1. User guide table of contents

tephi Documentation, Release 0.1.0

import matplotlib.pyplot as pltimport os.path

import tephi

dew_point = os.path.join(tephi.DATA_DIR, ’dews.txt’)dew_data = tephi.loadtxt(dew_point, column_titles=(’pressure’, ’dewpoint’))dews = zip(dew_data.pressure, dew_data.dewpoint)tephi.WET_ADIABAT_LINE.update({’color’: ’purple’, ’linewidth’: 3, ’linestyle’: ’--’})tpg = tephi.Tephigram()tpg.plot(dews)plt.show()

θ=30.0

θ=45.0

θ=60.0

θ=75.0

θ=90.0

θ=0.0

θ=15.0

T=−6

0.0

T=−4

5.0

T=−3

0.0

T=−1

5.0

200

400

1000

600

800

300

900

700

100

500

50

32

16

4

8

44

12

28

48

40

20

24

56

36

60

52

2

50

38

6

10

34

14

18

58

46

22

26

54

42

30

1.0

20.0

52.0

0.1

7.0

3.0

36.0

0.4

12.0

80.0

0.01

2.0

5.0

9.0

16.0

28.0

44.0

0.03

60.0

0.002

0.6

0.2

1.3. Tephigram customisation 25

tephi Documentation, Release 0.1.0

Saturated adiabat text

The default behavour of the tephigram saturated adiabat text is controlled by the tephi.WET_ADIABAT_TEXTdictionary:

>>> print .WET_ADIABAT_TEXT{’color’: ’orange’, ’va’: ’bottom’, ’ha’: ’left’, ’clip_on’: True, ’size’: 8}

This is a dictionary of key and value pairs that are passed through as keyword arguments tomatplotlib.pyplot.text().

Updating the WET_ADIABAT_TEXT dictionary will change the default behaviour of how the text of associated satu-rated adiabat lines are plotted.

import matplotlib.pyplot as pltimport os.path

import tephi

dew_point = os.path.join(tephi.DATA_DIR, ’dews.txt’)dew_data = tephi.loadtxt(dew_point, column_titles=(’pressure’, ’dewpoint’))dews = zip(dew_data.pressure, dew_data.dewpoint)tephi.WET_ADIABAT_TEXT.update({’color’: ’purple’, ’size’: 12})tpg = tephi.Tephigram()tpg.plot(dews)plt.show()

26 Chapter 1. User guide table of contents

tephi Documentation, Release 0.1.0

θ=30.0

θ=45.0

θ=60.0

θ=75.0

θ=90.0

θ=0.0

θ=15.0

T=−6

0.0

T=−4

5.0

T=−3

0.0

T=−1

5.0

200

400

1000

600

800

300

900

700

100

500

50

32

16

4

8

44

12

28

48

40

20

24

56

36

60

52

2

50

38

6

10

34

14

18

58

46

22

26

54

42

30

1.0

20.0

52.0

0.1

7.0

3.0

36.0

0.4

12.0

80.0

0.01

2.0

5.0

9.0

16.0

28.0

44.0

0.03

60.0

0.002

0.6

0.2

Saturated adiabat line frequency

The frequency at which saturated adiabat lines are plotted on the tephigram is controlled by thetephi.WET_ADIABAT_SPEC list:

>>> print .WET_ADIABAT_SPEC[(1, 0.05), (2, 0.15), (4, 1.5)]

This line specification is a sequence of one or more tuple pairs that contain a saturated adiabat temperature line stepand a zoom level.

For example, (2, 0.15) states that all saturated adiabat lines that are a multiple of 2 oC will be plotted i.e. visible,when the zoom level is at or below 0.15.

1.3. Tephigram customisation 27

tephi Documentation, Release 0.1.0

The overall range of saturated adiabat levels that may be plotted is controlled by the tephi.MIN_WET_ADIABATand tephi.MAX_WET_ADIABAT variables:

>>> print tephi.MIN_WET_ADIABAT1>>> print tephi.MAX_WET_ADIABAT60

Note that, it is possible to set a fixed saturated adiabat temperature line step for a tephigram plot by setting theassociated zoom level to None.

For example, to always show saturated adiabat lines that are a multiple of 5 oC, irrespective of the zoom level,

import matplotlib.pyplot as pltimport os.path

import tephi

dew_point = os.path.join(tephi.DATA_DIR, ’dews.txt’)dew_data = tephi.loadtxt(dew_point, column_titles=(’pressure’, ’dewpoint’))dews = zip(dew_data.pressure, dew_data.dewpoint)tephi.WET_ADIABAT_SPEC = [(5, None)]tpg = tephi.Tephigram()tpg.plot(dews)plt.show()

28 Chapter 1. User guide table of contents

tephi Documentation, Release 0.1.0

θ=30.0

θ=45.0

θ=60.0

θ=75.0

θ=90.0

θ=0.0

θ=15.0

T=−6

0.0

T=−4

5.0

T=−3

0.0

T=−1

5.0

200

400

1000

600

800

300

900

700

100

500

50

35

5

40

10

45

15

50

20

55

25

60

30

1.0

20.0

52.0

0.1

7.0

3.0

36.0

0.4

12.0

80.0

0.01

2.0

5.0

9.0

16.0

28.0

44.0

0.03

60.0

0.002

0.6

0.2

It is also possible to control which individual saturated adiabat lines should be fixed via thetephi.WET_ADIABAT_FIXED variable:

>>> print tephi.WET_ADIABAT_FIXEDNone

By default, no saturated adiabat lines are fixed. To force saturated adiabat lines with a temperature of 15 oC and 17oC always to be plotted,

import matplotlib.pyplot as pltimport os.path

import tephi

dew_point = os.path.join(tephi.DATA_DIR, ’dews.txt’)dew_data = tephi.loadtxt(dew_point, column_titles=(’pressure’, ’dewpoint’))

1.3. Tephigram customisation 29

tephi Documentation, Release 0.1.0

dews = zip(dew_data.pressure, dew_data.dewpoint)tephi.WET_ADIABAT_FIXED = [15, 17]tpg = tephi.Tephigram()tpg.plot(dews)plt.show()

θ=30.0

θ=45.0

θ=60.0

θ=75.0

θ=90.0

θ=0.0

θ=15.0

T=−6

0.0

T=−4

5.0

T=−3

0.0

T=−1

5.0

200

400

1000

600

800

300

900

700

100

500

50

32

16

4

8

44

12

28

48

40

20

24

56

36

60

52

2

50

38

6

10

34

14

18

58

46

22

26

54

42

30

15

17

1.0

20.0

52.0

0.1

7.0

3.0

36.0

0.4

12.0

80.0

0.01

2.0

5.0

9.0

16.0

28.0

44.0

0.03

60.0

0.002

0.6

0.2

1.3.3 Humidity mixing ratio control

Humidity mixing ratio lines

The default behaviour of the tephigram humidity mixing ratio line is controlled by thetephi.MIXING_RATIO_LINE dictionary:

30 Chapter 1. User guide table of contents

tephi Documentation, Release 0.1.0

>>> print tephi.MIXING_RATIO_LINE{’color’: ’green’, ’linewidth’: 0.5, ’clip_on’: True}

This is a dictionary of key and value pairs that are passed through as keyword arguments tomatplotlib.pyplot.plot().

Updating the MIXING_RATIO_LINE dictionary will change the default behaviour of all humidity mixing ratio lineplotting.

import matplotlib.pyplot as pltimport os.path

import tephi

dew_point = os.path.join(tephi.DATA_DIR, ’dews.txt’)dew_data = tephi.loadtxt(dew_point, column_titles=(’pressure’, ’dewpoint’))dews = zip(dew_data.pressure, dew_data.dewpoint)tephi.MIXING_RATIO_LINE.update({’color’: ’purple’, ’linewidth’: 3, ’linestyle’: ’--’})tpg = tephi.Tephigram()tpg.plot(dews)plt.show()

1.3. Tephigram customisation 31

tephi Documentation, Release 0.1.0

θ=30.0

θ=45.0

θ=60.0

θ=75.0

θ=90.0

θ=0.0

θ=15.0

T=−6

0.0

T=−4

5.0

T=−3

0.0

T=−1

5.0

200

400

1000

600

800

300

900

700

100

500

50

32

16

4

8

44

12

28

48

40

20

24

56

36

60

52

2

50

38

6

10

34

14

18

58

46

22

26

54

42

30

1.0

20.0

52.0

0.1

7.0

3.0

36.0

0.4

12.0

80.0

0.01

2.0

5.0

9.0

16.0

28.0

44.0

0.03

60.0

0.002

0.6

0.2

Humidity mixing ratio text

The default behaviour of the tephigram humidity mixing ratio text is controlled by thetephi.MIXING_RATIO_TEXT dictionary:

>>> print tephi.MIXING_RATIO_TEXT{’color’: ’green’, ’va’: ’bottom’, ’ha’: ’right’, ’clip_on’: True, ’size’: 8}

This is a dictionary of key and value pairs that are passed through as keyword arguments tomatplotlib.pyplot.text().

Updating the MIXING_RATIO_TEXT dictionary will change the default behaviour of how the text of associatedhumidity mixing ratio lines are plotted.

32 Chapter 1. User guide table of contents

tephi Documentation, Release 0.1.0

import matplotlib.pyplot as pltimport os.path

import tephi

dew_point = os.path.join(tephi.DATA_DIR, ’dews.txt’)dew_data = tephi.loadtxt(dew_point, column_titles=(’pressure’, ’dewpoint’))dews = zip(dew_data.pressure, dew_data.dewpoint)tephi.MIXING_RATIO_TEXT.update({’color’: ’purple’, ’size’: 12})tpg = tephi.Tephigram()tpg.plot(dews)plt.show()

θ=30.0

θ=45.0

θ=60.0

θ=75.0

θ=90.0

θ=0.0

θ=15.0

T=−6

0.0

T=−4

5.0

T=−3

0.0

T=−1

5.0

200

400

1000

600

800

300

900

700

100

500

50

32

16

4

8

44

12

28

48

40

20

24

56

36

60

52

2

50

38

6

10

34

14

18

58

46

22

26

54

42

30

1.0

20.0

52.0

0.1

7.0

3.0

36.0

0.4

12.0

80.0

0.01

2.0

5.0

9.0

16.0

28.0

44.0

0.03

60.0

0.002

0.6

0.2

1.3. Tephigram customisation 33

tephi Documentation, Release 0.1.0

Humidity mixing ratio line frequency

The frequency at which humidity mixing ratio lines are plotted on the tephigram is controlled by thetephi.MIXING_RATIO_SPEC list:

>>> print tephi.MIXING_RATIO_SPEC[(1, 0.05), (2, 0.18), (4, 0.3), (8, 1.5)]

This line specification is a sequence of one or more tuple pairs that contain a humidity mixing ratio line step and azoom level.

For example, (4, 0.3) states that every fourth humidity mixing ratio line will be plotted i.e. visible, when the zoomlevel is at or below 0.3.

The overall range of humidity mixing ratio levels that may be plotted is controlled by the tephi.MIXING_RATIOSlist:

>>> print tephi.MIXING_RATIOS[0.001, 0.002, 0.005, 0.01, 0.02, 0.03, 0.05, 0.1, 0.15, 0.2, 0.3, 0.4, 0.5, 0.6, 0.8, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 12.0, 14.0, 16.0, 18.0, 20.0, 24.0, 28.0, 32.0, 36.0, 40.0, 44.0, 48.0, 52.0, 56.0, 60.0, 68.0, 80.0]

Note that, it is possible to control which individual humidity mixing ratio lines should be fixed i.e. always visible, viathe tephi.MIXING_RATIO_FIXED variable:

>>> print tephi.MIXING_RATIO_FIXEDNone

By default, no humidity mixing ratio lines are fixed. To force humidity mixing ratio lines 4.0 g kg-1 and 6.0 gkg-1always to be plotted independent of the zoom level,

import matplotlib.pyplot as pltimport os.path

import tephi

dew_point = os.path.join(tephi.DATA_DIR, ’dews.txt’)dew_data = tephi.loadtxt(dew_point, column_titles=(’pressure’, ’dewpoint’))dews = zip(dew_data.pressure, dew_data.dewpoint)tephi.MIXING_RATIO_FIXED = [4.0, 6.0]tpg = tephi.Tephigram()tpg.plot(dews)plt.show()

34 Chapter 1. User guide table of contents

tephi Documentation, Release 0.1.0

θ=30.0

θ=45.0

θ=60.0

θ=75.0

θ=90.0

θ=0.0

θ=15.0

T=−6

0.0

T=−4

5.0

T=−3

0.0

T=−1

5.0

200

400

1000

600

800

300

900

700

100

500

50

32

16

4

8

44

12

28

48

40

20

24

56

36

60

52

2

50

38

6

10

34

14

18

58

46

22

26

54

42

30

1.0

20.0

52.0

0.1

7.0

3.0

36.0

0.4

12.0

80.0

0.01

2.0

5.0

9.0

16.0

28.0

44.0

0.03

60.0

0.002

0.6

0.2

4.0

6.0

1.4 Tephigram barbs

This section discusses how wind barbs may be plotted on a tephigram.

1.4.1 Wind barbs

Tephigram plots may be decorated with barbs to indicate wind speed and wind direction at specific pressure levels.The following barb symbology has been adopted, as defined and used by the Met Office since 1 January 1955. SeeMet Office National Meteorological Library and Archive, Fact Sheet No. 11 - Interpreting weather charts.

1.4. Tephigram barbs 35

tephi Documentation, Release 0.1.0

Calm

1-2 knots

3-7 knots

8-12 knots

13-17 knots

18-22 knots

23-27 knots

28-32 knots

33-37 knots

38-42 knots

43-47 knots

48-52 knots

53-57 knots

58-62 knots

63-67 knots

68-72 knots

73-77 knots

78-82 knots

83-87 knots

88-92 knots

93-97 knots

98-102 knots

Wind direction is indicated by the orientation of the barb on the plot, where north is 0o, east is 90o, south is 180oandwest is 270o.

1.4.2 Plotting barbs

A profile must be first plotted before the barbs are associated with that profile.

import matplotlib.pyplot as pltimport os.path

import tephi

dew_point = os.path.join(tephi.DATA_DIR, ’dews.txt’)dew_data = tephi.loadtxt(dew_point, column_titles=(’pressure’, ’dewpoint’))dews = zip(dew_data.pressure, dew_data.dewpoint)tpg = tephi.Tephigram()profile = tpg.plot(dews)barbs = [(0, 0, 900), (1, 30, 850), (5, 60, 800),

(10, 90, 750), (15, 120, 700), (20, 150, 650),(25, 180, 600), (30, 210, 550), (35, 240, 500),(40, 270, 450), (45, 300, 400), (50, 330, 350),(55, 360, 300)]

profile.barbs(barbs)plt.show()

36 Chapter 1. User guide table of contents

tephi Documentation, Release 0.1.0

θ=30.0

θ=45.0

θ=60.0

θ=75.0

θ=90.0

θ=0.0

θ=15.0

T=−6

0.0

T=−4

5.0

T=−3

0.0

T=−1

5.0

200

400

1000

600

800

300

900

700

100

500

50

32

16

4

8

44

12

28

48

40

20

24

56

36

60

52

2

50

38

6

10

34

14

18

58

46

22

26

54

42

30

1.0

20.0

52.0

0.1

7.0

3.0

36.0

0.4

12.0

80.0

0.01

2.0

5.0

9.0

16.0

28.0

44.0

0.03

60.0

0.002

0.6

0.2

A single barb is specified using a triple denoting the wind speed, wind direction and pressure level. For example, thefollowing triple (10, 90, 750) represents a wind speed of 10 knots, directly from the east, and at an atmosphericpressure of 750 mb.

Note that, the barbs default to the same colour as their associated profile.

import matplotlib.pyplot as pltimport os.path

import tephi

dew_point = os.path.join(tephi.DATA_DIR, ’dews.txt’)dry_bulb = os.path.join(tephi.DATA_DIR, ’temps.txt’)column_titles = [(’pressure’, ’dewpoint’), (’pressure’, ’temperature’)]dew_data, temp_data = tephi.loadtxt(dew_point, dry_bulb, column_titles=column_titles)dews = zip(dew_data.pressure, dew_data.dewpoint)

1.4. Tephigram barbs 37

tephi Documentation, Release 0.1.0

temps = zip(temp_data.pressure, temp_data.temperature)

tpg = tephi.Tephigram()dprofile = tpg.plot(dews)dbarbs = [(0, 0, 900), (15, 120, 600), (35, 240, 300)]dprofile.barbs(dbarbs)tprofile = tpg.plot(temps)tbarbs = [(10, 15, 900), (21, 45, 600), (25, 135, 300)]tprofile.barbs(tbarbs)plt.show()

θ=60.0

θ=90.0

θ=120.0

θ=150.0

θ=180.0

θ=210.0

θ=0.0

θ=30.0

T=−1

25.0

T=−1

00.0

T=−7

5.0

T=−5

0.0

T=−2

5.0

200

400

1000

600

800

300

900

700

100

500

50

32

16

4

8

44

12

28

48

40

20

24

56

36

60

52

1.0

20.0

52.0

0.1

7.0

3.0

36.0

0.4

12.0

80.0

0.01

Barbs may also be plotted using wind speed and wind direction data (associated with a pressure level) in a text file.

import matplotlib.pyplot as pltimport os.path

38 Chapter 1. User guide table of contents

tephi Documentation, Release 0.1.0

import tephi

winds = os.path.join(tephi.DATA_DIR, ’barbs.txt’)column_titles = (’pressure’, ’dewpoint’, ’wind_speed’, ’wind_direction’)barb_data = tephi.loadtxt(winds, column_titles=column_titles)dews = zip(barb_data.pressure, barb_data.dewpoint)barbs = zip(barb_data.wind_speed, barb_data.wind_direction, barb_data.pressure)tpg = tephi.Tephigram()profile = tpg.plot(dews)profile.barbs(barbs)plt.show()

θ=30.0

θ=45.0

θ=60.0

θ=75.0

θ=90.0

θ=0.0

θ=15.0

T=−6

0.0

T=−4

5.0

T=−3

0.0

T=−1

5.0

200

400

1000

600

800

300

900

700

100

500

50

32

16

4

8

44

12

28

48

40

20

24

56

36

60

52

2

50

38

6

10

34

14

18

58

46

22

26

54

42

30

1.0

20.0

52.0

0.1

7.0

3.0

36.0

0.4

12.0

80.0

0.01

2.0

5.0

9.0

16.0

28.0

44.0

0.03

60.0

0.002

0.6

0.2

1.4. Tephigram barbs 39

tephi Documentation, Release 0.1.0

1.4.3 Controlling the barbs

All keyword arguments passed to tephi.isopleths.Profile.barbs() are simply passed through tomatplotlib.pyplot.barbs().

This transparency allows full control when plotting barbs on the tephigram.

import matplotlib.pyplot as pltimport os.path

import tephi

dew_point = os.path.join(tephi.DATA_DIR, ’dews.txt’)dew_data = tephi.loadtxt(dew_point, column_titles=(’pressure’, ’dewpoint’))dews = zip(dew_data.pressure, dew_data.dewpoint)tpg = tephi.Tephigram()profile = tpg.plot(dews)barbs = [(0, 0, 900), (1, 30, 850), (5, 60, 800),

(10, 90, 750), (15, 120, 700), (20, 150, 650),(25, 180, 600), (30, 210, 550), (35, 240, 500),(40, 270, 450), (45, 300, 400), (50, 330, 350),(55, 360, 300)]

profile.barbs(barbs, length=8, pivot=’middle’, color=’green’, linewidth=3)plt.show()

40 Chapter 1. User guide table of contents

tephi Documentation, Release 0.1.0

θ=30.0

θ=45.0

θ=60.0

θ=75.0

θ=90.0

θ=0.0

θ=15.0

T=−6

0.0

T=−4

5.0

T=−3

0.0

T=−1

5.0

200

400

1000

600

800

300

900

700

100

500

50

32

16

4

8

44

12

28

48

40

20

24

56

36

60

52

2

50

38

6

10

34

14

18

58

46

22

26

54

42

30

1.0

20.0

52.0

0.1

7.0

3.0

36.0

0.4

12.0

80.0

0.01

2.0

5.0

9.0

16.0

28.0

44.0

0.03

60.0

0.002

0.6

0.2

1.4.4 Moving the gutter

By default, the barbs are plotted on the right hand side of the tephigram. The position of the barb gutter can easily becontrolled via the gutter keyword argument to tephi.isopleths.Profile.barbs().

import matplotlib.pyplot as pltimport os.path

import tephi

dew_point = os.path.join(tephi.DATA_DIR, ’dews.txt’)dew_data = tephi.loadtxt(dew_point, column_titles=(’pressure’, ’dewpoint’))dews = zip(dew_data.pressure, dew_data.dewpoint)tpg = tephi.Tephigram()

1.4. Tephigram barbs 41

tephi Documentation, Release 0.1.0

profile = tpg.plot(dews)barbs = [(0, 0, 900), (1, 30, 850), (5, 60, 800),

(10, 90, 750), (15, 120, 700), (20, 150, 650),(25, 180, 600), (30, 210, 550), (35, 240, 500),(40, 270, 450), (45, 300, 400), (50, 330, 350),(55, 360, 300)]

profile.barbs(barbs, gutter=0.9)plt.show()

θ=30.0

θ=45.0

θ=60.0

θ=75.0

θ=90.0

θ=0.0

θ=15.0

T=−6

0.0

T=−4

5.0

T=−3

0.0

T=−1

5.0

200

400

1000

600

800

300

900

700

100

500

50

32

16

4

8

44

12

28

48

40

20

24

56

36

60

52

2

50

38

6

10

34

14

18

58

46

22

26

54

42

30

1.0

20.0

52.0

0.1

7.0

3.0

36.0

0.4

12.0

80.0

0.01

2.0

5.0

9.0

16.0

28.0

44.0

0.03

60.0

0.002

0.6

0.2

The gutter keyword argument represents the proportion of the plot width that the barb gutter is offset from the righthand side axis. By default the gutter is set to 0.1.

42 Chapter 1. User guide table of contents

tephi Documentation, Release 0.1.0

1.5 Glossary

Anchor A sequence of two (pressure, temperature) pairs that specify the bottom left-hand corner and the top right-hand corner of the plot. The pressure data points must be in units of mb or hPa, and the temperature data pointsmust be in units of oC.

Dry adiabat A line of constant potential temperature, measured in units of oC. The zeroth dry adiabat line is an axisof the tephigram, see Dry adiabats.

Humidity mixing ratio A line of constant saturation mixing ratio with respect to a plane water surface, measured ing kg-1, see Humidity mixing ratio.

Isobar A line of constant pressure, measured in millibars or hectopascals, see Isobars.

Isotherm A line of constant temperature, measured in oC. The zeroth isotherm line is an axis of the tephigram, seeIsotherms.

Line specification A sequence of one or more tuple pairs containing a line step value and a zoom level value. Usedto control the frequency at which the tephigram plots isobar lines, humidity mixing ratio lines, and saturatedadiabat lines. Note that, specifying a zoom level of None forces the associated lines always to be visible.

Line step The first value in the tuple pair of a line specification. An integer that denotes Nth step multiples. i.e. a linestep of 25 denotes all lines that are a multiple of 25, or every 25th item from an enumerated list of values.

Pseudo saturated wet adiabat A line of constant equivalent potential temperature for saturated air parcels, measuredin units of oC, see Pseudo saturated wet adiabats.

Saturated adiabat See pseudo saturated wet adiabat.

Zoom level An inverted zoom level fraction that is a ratio of current tephigram plot display width over the originalplot display width.

1.5. Glossary 43

tephi Documentation, Release 0.1.0

44 Chapter 1. User guide table of contents

Index

AAnchor, 43

DDry adiabat, 43

HHumidity mixing ratio, 43

IIsobar, 43Isotherm, 43

LLine specification, 43Line step, 43

PPseudo saturated wet adiabat, 43

SSaturated adiabat, 43

ZZoom level, 43

45