I am trying to write out a time series of dates to a netCDF variable. My dates are stored as a Pandas DatetimeIndex called date_array. The code I'm trying use is as follows:
Times = w_nc_fid.createVariable('Times','S1',('time',))
Times[:] = str(date_array)
The result is a [72,1] array all with just the string D. What I'm actually trying to write out are the strings of dates (72 consecutive dates):
'2015-07-19 10:00:00'
'2015-07-19 11:00:00'
'2015-07-19 12:00:00'
Can anyone help me with this?