diff --git a/aosstower/level_b1/nc.py b/aosstower/level_b1/nc.py index 894ee37652bb882dd89b4601e9dcc579f3f8c58d..8d7df816ba407958b85e93739337d2ba04ef28d7 100644 --- a/aosstower/level_b1/nc.py +++ b/aosstower/level_b1/nc.py @@ -8,6 +8,7 @@ from netCDF4 import Dataset import numpy as np import platform from aosstower import station +from datetime import timedelta as delta LOG = logging.getLogger(__name__) @@ -118,7 +119,7 @@ def createVariables(ncFile, firstStamp, chunksizes, zlib): return ncFile def minuteAverages(frame): - frame['minute'] = [ts.replace(second=0) for ts in frame.index] + frame['minute'] = [(ts + delta(minutes=1)).replace(second=0) for ts in frame.index] newFrame = frame.groupby('minute').mean() newFrame.index.names = [''] @@ -129,6 +130,8 @@ def minuteAverages(frame): if 'wind_direction' in columns: del newFrame['wind_direction'] + print(frame) + del frame['minute'] return newFrame.fillna(-99999)