def from_pickle(): msg = "Creation of a Waterframe object:" try: wf = WaterFrame() print(msg, "Done.") except ImportError: print(msg, "Import Error.") msg = "Loading pickle file:" wf.from_pickle("tests/data/pickle_file.pkl") if wf.data.empty: print( msg, "No such file or directory. Please check if exist" "tests/data/pickle_file.pkl") else: print(msg, "Done.")
def scatter_matrix(): msg = "Creation of a Waterframe object:" try: wf = WaterFrame() print(msg, "Done.") except ImportError: print(msg, "Import Error.") msg = "Loading pickle file:" wf.from_pickle("tests/data/test_file.pkl") if wf.data.empty: print( msg, "No such file or directory. Please check if exist" "tests/data/pickle_file.pkl") else: print(msg, "Done.") msg = "Creation of figure:" ax = wf.scatter_matrix(keys=['VAVH', 'VCMX']) if ax is not None: print(msg, "Done.") else: print(msg, "Error, not enough keys.")
def concat(): msg = "Creation of a Waterframe object:" try: wf = WaterFrame() print(msg, "Done.") except ImportError: print(msg, "Import Error.") msg = "Loading pickle file:" wf.from_pickle("tests/data/test_file.pkl") if wf.data.empty: print( msg, "No such file or directory. Please check if exist" "tests/data/pickle_file.pkl") else: print(msg, "Done.") msg = "Concat other waterframe:" wf.concat(wf) if 'VCMX(NEW1)' in wf.data.keys(): print(msg, "Done.") else: print(msg, "Error.")
def rename(): msg = "Creation of a Waterframe object:" try: wf = WaterFrame() print(msg, "Done.") except ImportError: print(msg, "Import Error.") msg = "Loading pickle file:" wf.from_pickle("tests/data/test_file.pkl") if wf.data.empty: print( msg, "No such file or directory. Please check if exist" "tests/data/pickle_file.pkl") else: print(msg, "Done.") msg = "Renaming name:" wf.rename('VAVH', 'HELLO') if 'HELLO' in wf.data.keys(): print(msg, "Done.") else: print(msg, "Error.")
def slice(): msg = "Creation of a Waterframe object:" try: wf = WaterFrame() print(msg, "Done.") except ImportError: print(msg, "Import Error.") msg = "Loading pickle file:" wf.from_pickle("tests/data/test_file.pkl") if wf.data.empty: print( msg, "No such file or directory. Please check if exist" "tests/data/pickle_file.pkl") else: print(msg, "Done.") msg = "Slicing:" wf.slice(start='20050101000000', end='20120101000000') if str(wf.data.index[0]) == "2005-01-01 00:20:00.000000256" and \ str(wf.data.index[-1]) == "2012-01-01 00:00:00": print(msg, "Done.") else: print(msg, "Error.")
def resample(): msg = "Creation of a Waterframe object:" try: wf = WaterFrame() print(msg, "Done.") except ImportError: print(msg, "Import Error.") msg = "Loading pickle file:" wf.from_pickle("tests/data/test_file.pkl") if wf.data.empty: print( msg, "No such file or directory. Please check if exist" "tests/data/pickle_file.pkl") else: print(msg, "Done.") msg = "Resampling:" wf.resample('W') if str(wf.data.index[0]) == "1956-12-02 00:00:00" and \ str(wf.data.index[1]) == "1956-12-09 00:00:00": print(msg, "Done.") else: print(msg, "Error.")
def drop(): msg = "Creation of a Waterframe object:" try: wf = WaterFrame() print(msg, "Done.") except ImportError: print(msg, "Import Error.") msg = "Loading pickle file:" wf.from_pickle("tests/data/pickle_file.pkl") if wf.data.empty: print( msg, "No such file or directory. Please check if exist" "tests/data/pickle_file.pkl") else: print(msg, "Done.") msg = "Droping parameters:" wf.drop( ['DEPTH', 'VEPK', 'VHM0', 'VSMC', 'VTPK', 'VAVT', 'SWHT', 'SWPR']) if len(wf.data.keys()) == 5: print(msg, "Done.") else: print(msg, "Error.")