Skip to content
Snippets Groups Projects
Commit 0e1747de authored by kgao's avatar kgao
Browse files

Added pandas to requirements and fixed few errors

setup.py now requires the pandas module
Fixed bug where some files were missing a data entry
Fixed bug where autoRun.bash pointed to wrong python file and python directory
parent cf6ecdeb
No related branches found
No related tags found
No related merge requests found
!/usr/bin/env bash #!/usr/bin/env bash
PYENV=/home/kgao/env/ PYENV=~/anaconda3/envs/env
SCRIPT=/home/kgao/Code/finished/Aoss_Tower_a1_Conversion/convertFromASCIIToNETCDF/autoRun.py SCRIPT=/home/kgao/Code/curr_projects/ncGenerate/AossTower/aosstower/level_a0/autoRun.py
( (
flock -x -n 200 || exit $? flock -x -n 200 || exit $?
$PYENV/bin/python $SCRIPT $PYENV/bin/python $SCRIPT
......
...@@ -6,6 +6,26 @@ import time ...@@ -6,6 +6,26 @@ import time
from netCDF4 import Dataset from netCDF4 import Dataset
import os import os
def writeBack(frame, filename, cur_dt):
#get start
startString = str(frame.index[0])
startObj = dt.strptime(startString.split(" ")[0], '%Y-%m-%d')
createDirectory(startObj)
#get end
endObj = startObj.replace(hour=23, minute=59, second=59, microsecond=59)
#input file
inputFiles = []
inputFiles.append(filename)
inputFiles.append(createFilename(cur_dt - delta(days=1)))
#output filename
outputFilename = 'aoss_tower.' + startString.split(" ")[0] + '.nc'
#create file
createGiantNetCDF(startObj, endObj, inputFiles, outputFilename, True, None, False)
def createDirectory(stamp): def createDirectory(stamp):
if os.path.exists("/mnt/inst-data/regen_netcdf/aoss/tower/" + stamp.strftime('%Y/%m')): if os.path.exists("/mnt/inst-data/regen_netcdf/aoss/tower/" + stamp.strftime('%Y/%m')):
os.chdir("/mnt/inst-data/regen_netcdf/aoss/tower/" + stamp.strftime('%Y/%m')) os.chdir("/mnt/inst-data/regen_netcdf/aoss/tower/" + stamp.strftime('%Y/%m'))
...@@ -79,26 +99,18 @@ def create_files(start_date, end_date): ...@@ -79,26 +99,18 @@ def create_files(start_date, end_date):
#get second frame #get second frame
frame = DFList[1] frame = DFList[1]
#get start
startString = str(frame.index[0])
startObj = dt.strptime(startString.split(" ")[0], '%Y-%m-%d')
createDirectory(startObj)
#get end
endObj = startObj.replace(hour=23, minute=59, second=59, microsecond=59)
#input file
inputFiles = []
inputFiles.append(filename)
inputFiles.append(createFilename(cur_dt - delta(days=1)))
#output filename
outputFilename = 'aoss_tower.' + startString.split(" ")[0] + '.nc'
#create file
createGiantNetCDF(startObj, endObj, inputFiles, outputFilename, True, None, False)
writeBack(frame, filename, cur_dt)
else:
frame = DFList[1]
createNCFile(frame, filename)
#get second frame
frame = DFList[0]
writeBack(frame, filename, cur_dt)
else: else:
print(len(DFList)) print(len(DFList))
......
File added
File added
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