Skip to content
Snippets Groups Projects
Commit 7b5cb32e authored by kgao's avatar kgao
Browse files

variables except wind related one updated

averages now start at future minute - 1 to future minute
parent 3ddaab34
No related branches found
No related tags found
No related merge requests found
...@@ -8,6 +8,7 @@ from netCDF4 import Dataset ...@@ -8,6 +8,7 @@ from netCDF4 import Dataset
import numpy as np import numpy as np
import platform import platform
from aosstower import station from aosstower import station
from datetime import timedelta as delta
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
...@@ -118,7 +119,7 @@ def createVariables(ncFile, firstStamp, chunksizes, zlib): ...@@ -118,7 +119,7 @@ def createVariables(ncFile, firstStamp, chunksizes, zlib):
return ncFile return ncFile
def minuteAverages(frame): 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 = frame.groupby('minute').mean()
newFrame.index.names = [''] newFrame.index.names = ['']
...@@ -129,6 +130,8 @@ def minuteAverages(frame): ...@@ -129,6 +130,8 @@ def minuteAverages(frame):
if 'wind_direction' in columns: if 'wind_direction' in columns:
del newFrame['wind_direction'] del newFrame['wind_direction']
print(frame)
del frame['minute'] del frame['minute']
return newFrame.fillna(-99999) return newFrame.fillna(-99999)
......
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