Read stereo32 txt files with python and merge with Swissgrid coordinates and elevations
Bas den Brok - mapping course



Understanding of python, some understanding of Dutch and only a little understanding of stereo32 required.


We want to read the stereo32 txt files with stereonet data (azimuth, dip etc. values), merge with SVG- and Swissgrid CH1903 coordinates and altutudes.

Stereo32 txt data files look like here below. They contain azimuth and dip in case of planes (P) or plunge in case of lineations or fold axes (L), outcrop number (e.g. 1.1 or 1.2), and after the slash an indication whether it concerns bedding (S0), first phase foliation (S or S1), second phase foliation (S2), deltalineation S0 on S1 or vise versa (delta lineation), and other specifications, the last of which is between curly braces the specification and color of the symbol plotted in the stereonet in stereo32:


Here is the entire Python file: leesstereo32txtfilesenkoordinatentoevoegen4.py (not for use! Only to help you write your own program.) It starts with reading the coordinates and elevations of the outcrops:


Here below is the datafile with the outcrop numbers (second column), the coordinates (3rd and 4rd colum SVG-coordinates, 5th and 6th colums Swissgrid CH1903 coordinates) and the elevation (7th column):


And the output on the screen like this:


The Python programm will make one txt file with all the measurements and separate txt files with data for bedding (S0), first phase foliation (S or S1), second phase foliation (S2) etc. as shown below:


First the stereo32 txt file will be parsed. First oart of the code looks like this. You have to study yourself what it does. Not too difficult:


On the screen the output will look like here below. You see that in this case 2027 outcrops with coordinates and elevations were read into the program, now first the stereo32 files with the structural data will be parsed. You see that sentences like "S0 in zandsteen parallel aan S" are cut into single words.


In this case 3073 measurements were read into the program of which 916 are bedding (S0) etc.


Text files with the measurements e.g. of the bedding (S0) onnly look like here below showing dip azimuth, dip, P indicating that it is a plane, outcrop number and S0 meaning it concerns bedding (S0). These files can directly be read into stereo32, they have the stereo32 format.


But the aim was to merge the structural data from the stereo32 file to coordinates and elevations of the outcrops. The Python code looks like this:


And the final result i.e. the txt file with the measuremenst and the coordinates (SVG coordinates, Swissgrid CH1903 coordinates and elevation) like here below. Also this file is in stereo32 format: