flat_data = all_data
.filter(d => d.year >= years[0] && d.year < years[1] || d.year == years[1] && d.month == 1)
.reduce(((a, x) => a.concat(x.values.map((d, i) => ({date: new Date(Date.UTC(x.year, x.month-1)), value: d, station: i, time_scale: x.time_scale}))) ), [])
.sort((a, b) => d3.ascending(a.date, b.date))