fractal_single_track.py 764 Bytes
Newer Older
ecofractal's avatar
ecofractal committed
1 2 3 4 5 6 7 8 9 10 11
'''
This is a fractaL code developed to sonify data.
Partially based on Sonify library.

@author: smjacques
'''
import json
import matplotlib.pyplot as plt
import pandas as pd

import fractaL.core as fractal
12

ecofractal's avatar
ecofractal committed
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35


with open('sample_data/1880-2019.json') as data_file:    
    climate_json = json.load(data_file)


json_pd = climate_json

normalized_climate_data = fractal.normalize_climate_data(climate_json)
plt.scatter(*zip(*normalized_climate_data))

#print(normalized_climate_data)


'''
Convert Array to pandas
'''
#define labels date and temperature
labels = ['date', 'temperature']
climatefile = pd.DataFrame.from_records(normalized_climate_data, columns=labels)



36 37
fractal.export_midi(normalized_climate_data, bpm=12,
                    track_type='single')