Skip to content
Snippets Groups Projects
Commit 4ea3b35a authored by David Verelst's avatar David Verelst
Browse files

prepost: add convenience interface for calculating stats+del per file

parent 7873d7be
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 21 15:13:38 2016
@author: dave
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from __future__ import absolute_import
#from builtins import dict
#from io import open
#from builtins import zip
#from builtins import range
#from builtins import str
#from builtins import int
from future import standard_library
standard_library.install_aliases()
import os
from wetb.prepost import windIO
def calc(fpath, no_bins=46, m=[3, 4, 6, 8, 10, 12], neq=None, i0=0, i1=None,
ftype=False, fsave=False):
"""
Should we load m, statchans, delchans from another file? This function
will be called from a PBS script.
"""
if fpath[-4:] == '.sel' or fpath[-4:] == '.dat':
fpath = fpath[-4:]
fdir = os.path.dirname(fpath)
fname = os.path.basename(fpath)
res = windIO.LoadResults(fdir, fname, debug=False, usecols=None,
readdata=True)
statsdel = res.statsdel_df(i0=i0, i1=i1, statchans='all', neq=neq,
no_bins=no_bins, m=m, delchans='all')
if fsave:
if fsave[-4:] == '.csv':
statsdel.to_csv(fsave)
elif fsave[-3:] == '.h5':
statsdel.to_hdf(fsave, 'table', complib='zlib', complevel=9)
elif ftype == '.csv':
statsdel.to_csv(fpath+ftype)
elif ftype == '.h5':
statsdel.to_hdf(fpath+ftype, 'table', complib='zlib', complevel=9)
if __name__ == '__main__':
pass
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