def _write_timeseries_to_fd(self, fd): ''' Takes a general file descriptor as input and writes data to it. Writes the "OSSM format" with the full header ''' if self.units in ossm_wind_units.values(): data_units = self.units else: # we know C++ understands this unit data_units = 'meters per second' header = ('Station Name\n' 'Position\n' '{0}\n' 'LTime\n' '0,0,0,0,0,0,0,0\n').format(data_units) data = self.get_wind_data(units=data_units) val = data['value'] dt = data['time'].astype(datetime.datetime) fd.write(header) for i, idt in enumerate(dt): fd.write('{0.day:02}, ' '{0.month:02}, ' '{0.year:04}, ' '{0.hour:02}, ' '{0.minute:02}, ' '{1:02.2f}, {2:02.2f}\n'.format(idt, round(val[i, 0], 4), round(val[i, 1], 4)))