#!/usr/bin/python
# -*- coding: utf-8 -*-

import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(__file__)) + '/src')
import DataVisualizing

if len(sys.argv) != 2:
    print 'usage: create_heatmap.py <data file>'
    print '  expected infile is a datafile containing tracking data'
    print '  this is a csv file with the following columns:'
    print '      cartodb_id, date_time, day_of_year, distance_from_nest_in_meters'
    sys.exit(-1)

def main():
    dvis = DataVisualizing.TrackingVisualizer(infile=sys.argv[1])
    print (dvis.as_heatmap_json(domain='month', agg_function='max'))
    print (dvis.as_heatmap_json(domain='month', subdomain='hour', agg_function='max'))

main()

@@ -533,32 +533,71 @@
 v%5B1%5D)%0A    print 
+('var day_month_heatdata = %7B0%7D;'.format
 (dvis.as_heatmap
@@ -638,16 +638,17 @@
 ='max'))
+)
 %0A    pri
@@ -650,16 +650,56 @@
   print 
+('var hour_month_heatdata = %7B0%7D;'.format
 (dvis.as
@@ -766,16 +766,17 @@
 ='max'))
+)
 %0A%0Amain()

Output as javascript