Skip to content
Snippets Groups Projects
Commit 047f30b4 authored by Coda Phillips's avatar Coda Phillips
Browse files

update netcdf variable attributes

parent d938d696
No related branches found
No related tags found
No related merge requests found
...@@ -22,11 +22,9 @@ def save_quality(frame, qc_path): ...@@ -22,11 +22,9 @@ def save_quality(frame, qc_path):
# Define the netcdf # Define the netcdf
*_, temp = mkstemp() *_, temp = mkstemp()
ncdf = netCDF4.Dataset(temp, 'w') ncdf = netCDF4.Dataset(temp, 'w')
time = ncdf.createDimension('time', len(frame)) ncdf.createDimension('time', len(frame))
base_time = ncdf.createVariable('base_time', 'i8', ()) time = ncdf.createVariable('time', 'f8', ('time',))
time_offset = ncdf.createVariable('time_offset', 'i8', ('time',)) time.units = 'nanoseconds since 1970-01-01 00:00:00'
qc_percent = ncdf.createVariable('qc_percent', 'f4', ('time',))
qc_notes = ncdf.createVariable('qc_notes', str, ('time',))
# Write the columns ending in _check (aggregate tests) # Write the columns ending in _check (aggregate tests)
for check in checklist.checks: for check in checklist.checks:
...@@ -36,12 +34,8 @@ def save_quality(frame, qc_path): ...@@ -36,12 +34,8 @@ def save_quality(frame, qc_path):
variable[:] = frame[check.name].values variable[:] = frame[check.name].values
# Write time information # Write time information
base_time[:] = frame.datetime.dropna().iloc[0].to_datetime64() time[:] = frame.datetime.values
time_offset[:] = (frame.datetime - frame.datetime.dropna().iloc[0]).values
# Write the summary
qc_percent[:] = frame['qc_percent'].values
qc_notes[:] = frame['qc_notes'].fillna('').values
ncdf.close() ncdf.close()
move(temp,qc_path) move(temp,qc_path)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment