Savannah Tracking


In [15]:
from astropy.io import ascii
from astropy.table import Table,Column

In [79]:
zebra = ascii.read('data/ST2010-3506 Grey Zebra Kalama.csv')

In [53]:
animal


Out[53]:
<Table masked=False length=2242>
collaridDATETIMELATITUDELONGITUDEHEADINGSPEEDALTITUDE
string88string128float64float64int32float64int32
st2010-350201/01/2015 00:000.24214737.39176200.01730
st2010-350201/01/2015 01:000.22613537.39955600.01730
st2010-350201/01/2015 02:000.22611437.3994661370.01724
st2010-350201/01/2015 03:000.23284637.40668800.01716
st2010-350201/01/2015 04:000.23342537.406788270.01711
st2010-350201/01/2015 05:000.23346837.40675700.01709
st2010-350201/01/2015 06:000.23344137.406736500.01709
st2010-350201/01/2015 07:000.23376237.40674153.41707
st2010-350201/01/2015 08:000.23467737.4087812170.01705
st2010-350201/01/2015 09:000.234937.40915200.01714
.....................
st2010-350205/04/2015 00:000.22874537.431195880.01693
st2010-350205/04/2015 01:000.22403137.4375751180.01693
st2010-350205/04/2015 02:000.23349637.4404731660.01693
st2010-350205/04/2015 03:000.24235837.4663291330.01700
st2010-350205/04/2015 10:000.24140437.472093180.01661
st2010-350205/04/2015 11:000.24137137.4723781390.01679
st2010-350205/04/2015 12:000.24125537.4724311690.01674
st2010-350205/04/2015 13:000.24134537.4723572490.01672
st2010-350205/04/2015 14:000.24137337.472306920.01668
st2010-350205/04/2015 15:000.24133937.472282650.01680

In [55]:
count = 0
for row in animal:
    if (row[2] !='--'):
        if (count==0):
            animal_filtered=Table(row)
        else:
            animal_filtered.add_row(row)
        count=count+1
animal_filtered


Out[55]:
<Table masked=False length=2242>
collaridDATETIMELATITUDELONGITUDEHEADINGSPEEDALTITUDE
string88string128float64float64int32float64int32
st2010-350201/01/2015 00:000.24214737.39176200.01730
st2010-350201/01/2015 01:000.22613537.39955600.01730
st2010-350201/01/2015 02:000.22611437.3994661370.01724
st2010-350201/01/2015 03:000.23284637.40668800.01716
st2010-350201/01/2015 04:000.23342537.406788270.01711
st2010-350201/01/2015 05:000.23346837.40675700.01709
st2010-350201/01/2015 06:000.23344137.406736500.01709
st2010-350201/01/2015 07:000.23376237.40674153.41707
st2010-350201/01/2015 08:000.23467737.4087812170.01705
st2010-350201/01/2015 09:000.234937.40915200.01714
.....................
st2010-350205/04/2015 00:000.22874537.431195880.01693
st2010-350205/04/2015 01:000.22403137.4375751180.01693
st2010-350205/04/2015 02:000.23349637.4404731660.01693
st2010-350205/04/2015 03:000.24235837.4663291330.01700
st2010-350205/04/2015 10:000.24140437.472093180.01661
st2010-350205/04/2015 11:000.24137137.4723781390.01679
st2010-350205/04/2015 12:000.24125537.4724311690.01674
st2010-350205/04/2015 13:000.24134537.4723572490.01672
st2010-350205/04/2015 14:000.24137337.472306920.01668
st2010-350205/04/2015 15:000.24133937.472282650.01680

In [56]:
from pywwt.mods import *

In [57]:
#Connect to WWT
wwt = WWTClient(host="127.0.0.1") #Can pass a IP address here if WWT is running on a remote machine


Connecting to WWT on host 127.0.0.1.

In [26]:
wwt.new_layer_group("Earth","Savannah")

In [58]:
#Set up WWT layer
savannah_layer = wwt.new_layer("Earth", "Lion Scar", animal_filtered.colnames)
#Set visualization parameters in WWT
props_dict = {"CoordinatesType":"Spherical",\
              "MarkerScale":"Screen",\
              "PointScaleType":"Constant",\
              "ScaleFactor":"8",\
              "ShowFarSide":"True",\
              "RaUnits":"Degrees",\
              "PlotType":"Circle",\
              "ColorValue":"ARGBColor:255:255:255:255",\
              "TimeSeries":"False"}
savannah_layer.set_properties(props_dict)
#Send data to WWT client
savannah_layer.update(data=animal_filtered, purge_all=True, no_purge=False, show=True)

In [59]:
%config InlineBackend.rc = {}
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn

Lions are Lazy, zebras too, elephants not so much


In [85]:
fig = plt.figure (figsize=(8,8))
p1 = fig.add_subplot(311)
p1.hist(animal_filtered['SPEED'],bins=100,range=[0, 15])
p2 = fig.add_subplot(312)
p2.hist(elephant['SPEED'],bins=100,range=[0, 15])
p3 = fig.add_subplot(313)
p3.hist(zebra['SPEED'],bins=100,range=[0, 15])
p1.set_ylabel("Lion")
p2.set_ylabel("Elephant")
p3.set_ylabel("Zebra")
plt.xlabel("SPEED (km/hr)")


Out[85]:
<matplotlib.text.Text at 0x234ccf60>

In [ ]: