function processBuoy(buoy) {
const temp = Array.from(new Float32Array(buoy.getDataVariable("T_25")));
const ts = Array.from(new Float32Array(buoy.getDataVariable("time")));
const lng = new Float32Array(buoy.getDataVariable("lon"));
const lat = new Float32Array(buoy.getDataVariable("lat"));
const start = new Date("1998-02-15");
function addDays(date, days) {
var result = new Date(date);
result.setDate(result.getDate() + days);
return result;
}
return d3.zip(temp, ts).map((d) => ({
lng: lng[0] > 180 ? -360 + lng[0] : lng[0],
lat: lat[0],
temp: d[0],
ts: addDays(start, Math.trunc(d[1]))
}));
}