Stratoballoon Analysis Procedure

In my last two posts, Stratoballoon Flight in Google Earth and Stratoballoon Flight in Data, I glossed over the process used to go from the raw data recorded by the instrument pack:

150413,-38.94,9867,15869.9,4155.8759,8455.2460

150414,-38.88,9821,15895.2,4155.8745,8455.2441

150415,-38.44,9588,16024.8,4155.8745,8455.2431

150416,-37.88,9386,16139.2,4155.8745,8455.2412

150417,-37.81,9947,15826.1,4155.8750,8455.2392

150418,-38.00,9928,15836.5,4155.8750,8455.2373

into the graphs shown.  The data couldn’t be simply pumped through Excel or Google Earth raw.  There was a bit of massaging needed to make all of that work.  I’ll be covering that in today’s post.

The raw data was recorded as text onto the SD card, one line per reading.  A typical line looked like this:

133338,22.81,97999,280.6,4200.7055,8526.6914

The data is comma-delimited, and breaks down as follows:

  • Timestamp: in UTC military time, from the GPS receiver.  In this example, the time can be read as 13:33:37, which would be 1:33:37 PM UTC, or 9:33:37 AM Eastern.
  • The temperature, in degrees Celsius.
  • The pressure, in kiloPascals.
  • The altitude, calcuted from the pressure, and in meters.  The calculation we used to go from pressure to altitude is described in Stratoballoon, Altitude and Pressure vs. Time.
  • The latitude.  The first two digits are the degrees of arc.  The remaining digits are the arc minutes (whole and fractional).  For example, "4214.345" would break down into 42° 14.345′
  • The longitude.  This has the same format as the latitude.

Most of the data from the flight was in one text file, but there were 50 additional files created on the SD card – most of them empty, but the rest had a handful of readings included.  My first step was to combine all of this data together, sorted by timestamp.  Then, I brought it into Excel, where I could move columns around, and perform some calculations on it. 

For Google Earth, I extracted the latitude, longitude, and altitude columns, added headings of "Latitude", "Longitude", and "Altitude", and then split the data into the ascent and descent data points.  I then saved this data out as comma-separated files.

Next, I went to GPS Visualizer, and selected "Google Earth KML”.  I copied my data, headings and all, into the box on the right.  To get the "curtain" effect in the graphs, I found I had to change a few of the default settings:

  • Track Opacity: 100%
  • Extrusion Opacity: 70%
  • Colorize by: Altitude/Elevation
  • Altitude Mode: Extruded

I clicked the "Create KML File", and downloaded the file to my machine.  Once I installed Google Earth, I could double-click on the KML files, and see the images.

10

The next thing I wanted to do was link the photos in.  Each datapoint in the KML file corresponded to a particular point in time during the flight, and I could match up the key photos to those points.  Once I identified the photos that I wanted to link, and the datapoints to link them to, I opened the KML file in a text editor.  There are probably tools out there, but this seemed simple enough that I didn’t bother searching for them.

First, I needed to add a small block of XML near the top of the file:

    <Style id="camera_icon">
        <IconStyle>
            <scale>1.1</scale>
            <Icon>
                <href>files/camera.png</href>
            </Icon>
            <hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
        </IconStyle>
    </Style>

There was already a <Style> tag near the top, so I added mine right below it.  This defines a style that can be applied to the photo blocks that I would add later, and they would make the camera icon appear.  (I got the icon itself from a site that was offering royalty free clipart.)

I then created a folder called "files" at the same level as my KML file, and dropped my camera.png file into it.

Now it was time for the photos themselves.  I started by adding them to the "files" folder.  Then, I found the datapoints that they would be matched up to.  Each datapoint was represented in the KML file as a <Placemark> block.  Within that block, I added the following for each photo:

    <Placemark>
        <name><![CDATA[<span style="color:#e60000">trkpt 3</span>]]></name>
        …

        <description><![CDATA[<img src="files/img_3298.jpg" />]]></description>
        <styleUrl>#camera_icon</styleUrl>
        <Point>
            <coordinates>-85.444806667,42.011766667,291.6</coordinates>
        </Point>
    </Placemark>

Let’s break this down piece by piece:

  1. First, I edited the <name> block to remove the <span> tag, leaving just its contents ("trkpt 3", in this example).  I found that if I left the <span> tag it, it would render on the page as the label for the icon, and when I got more than a dozen of them on a page they were all overwriting each other.
  2. I added a <description> block that contains the <img> tag that will be the photo itself.  This is surrounded in a CDATA block so the angle brackets for the <img> tag don’t mess up the ones for the <description> block.
  3. I added a <styleUrl> block that contains a reference to my camera icon style.  The style is denoted by a pound sign (#), followed by the ID of the <Style> block shown above.
  4. Finally, I added a <Point> block that contains the coordinates to show the picture at.  These values were copied from another part of the <Placemark> block:

        <Placemark>
            <name><![CDATA[<span style="color:#e60000">trkpt 3</span>]]></name>
            …
            <LineString>
                <extrude>1</extrude>
                <tessellate>0</tessellate>
                <altitudeMode>absolute</altitudeMode>
                <coordinates>-85.444806667,42.011766667,291.6 -85.444806667,42.011766667,297.6 </coordinates>
            </LineString>
            <description><![CDATA[<img src="files/img_3298.jpg" />]]></description>
            <styleUrl>#camera_icon</styleUrl>
            <Point>
                <coordinates>-85.444806667,42.011766667,291.6</coordinates>
            </Point>
        </Placemark>

I saved and closed the KML file, and created a ZIP with it and the "files" folder.  I renamed that ZIP file to a KMZ file.  Google Earth would read the KML file contained in it, but now that I had my references to the photos in the "files" folder, it would render those as well.

This is one of the simplest things you can do with KML.  There is much more documented at https://developers.google.com/kml/documentation/kml_tut.

For a text file containing all of the raw data captured by the stratoballoon instrument pack (Consolidated Raw.txt), as well as the Excel spreadsheet I used to massage that data into the forms needed for the graphs and Google Earth (Analysis.xlsx), visit http://tinyurl.com/StratoballoonAnalysis.

Advertisements