def coarsen_array(a, level=<NUM_LIT:2>, method='<STR_LIT>'):
if a is None: return None    <EOL>a = _n.array(a)<EOL>if level in [<NUM_LIT:0>,<NUM_LIT:1>,False]: return a<EOL>code = '<STR_LIT>'+method+'<STR_LIT>'<EOL>try: return eval(code, dict(a=a[<NUM_LIT:0>:int(len(a)/level)*level], level=level))<EOL>except:<EOL><INDENT>print("<STR_LIT>"+repr(method))<EOL>return a<EOL><DEDENT>
Returns a coarsened (binned) version of the data. Currently supports
any of the numpy array operations, e.g. min, max, mean, std, ...

level=2 means every two data points will be binned.
level=0 or 1 just returns a copy of the array