diff --git a/main.py b/main.py index 01c137cd4212013c5a5b764e29a1b0e6fca85243..6c719b6dd3f1d26fef2eb20b304446e121865269 100644 --- a/main.py +++ b/main.py @@ -22,11 +22,9 @@ def save_quality(frame, qc_path): # Define the netcdf *_, temp = mkstemp() ncdf = netCDF4.Dataset(temp, 'w') - time = ncdf.createDimension('time', len(frame)) - base_time = ncdf.createVariable('base_time', 'i8', ()) - time_offset = ncdf.createVariable('time_offset', 'i8', ('time',)) - qc_percent = ncdf.createVariable('qc_percent', 'f4', ('time',)) - qc_notes = ncdf.createVariable('qc_notes', str, ('time',)) + ncdf.createDimension('time', len(frame)) + time = ncdf.createVariable('time', 'f8', ('time',)) + time.units = 'nanoseconds since 1970-01-01 00:00:00' # Write the columns ending in _check (aggregate tests) for check in checklist.checks: @@ -36,12 +34,8 @@ def save_quality(frame, qc_path): variable[:] = frame[check.name].values # Write time information - base_time[:] = frame.datetime.dropna().iloc[0].to_datetime64() - time_offset[:] = (frame.datetime - frame.datetime.dropna().iloc[0]).values + time[:] = frame.datetime.values - # Write the summary - qc_percent[:] = frame['qc_percent'].values - qc_notes[:] = frame['qc_notes'].fillna('').values ncdf.close() move(temp,qc_path)