32 lines
668 B
Python
32 lines
668 B
Python
import numpy as np
|
|
import glob
|
|
from datetime import date
|
|
|
|
|
|
def get_mask(dataArray):
|
|
return np.ones(dataArray.shape, dtype=bool)
|
|
|
|
|
|
def remove_bad_shots(dataArray, **kwargs):
|
|
dataArray.loc[dict(kwargs)] = np.nan
|
|
|
|
|
|
def auto_rechunk(dataSet):
|
|
kwargs = {
|
|
key: "auto"
|
|
for key in dataSet.dims.keys()
|
|
}
|
|
return dataSet.chunk(**kwargs)
|
|
|
|
|
|
def get_h5_file_path(folderpath, maxFileNum=None, filename='*.h5',):
|
|
filepath = np.sort(glob.glob(folderpath + filename))
|
|
if maxFileNum is None:
|
|
return filepath
|
|
else:
|
|
return filepath[:maxFileNum]
|
|
|
|
|
|
def get_date():
|
|
today = date.today()
|
|
return today.strftime("%y/%m/%d") |