def test_irrelevant_file_loading(*args, **kwargs): """ check that irrelevant files (irrelevant wavenumber) are not loaded """ # For cdsd-hitemp files : # Ensures file is not empty df = cdsd2df(getTestFile("cdsd_hitemp_09_header.txt"), cache="regen") assert len(df) > 0 # Now test nothing is loaded if asking for outside the wavenumber range with pytest.raises(IrrelevantFileWarning): df = cdsd2df(getTestFile("cdsd_hitemp_09_header.txt"), load_wavenum_min=100000) with pytest.raises(IrrelevantFileWarning): df = cdsd2df(getTestFile("cdsd_hitemp_09_header.txt"), load_wavenum_max=0.5) # For HITRAN files : # Ensures file is not empty df = hit2df(getTestFile("hitran_2016_H2O_2iso_2000_2100cm.par"), cache="regen") assert len(df) > 0 # Now test nothing is loaded if asking for outside the wavenumber range with pytest.raises(IrrelevantFileWarning): df = hit2df(getTestFile("hitran_2016_H2O_2iso_2000_2100cm.par"), load_wavenum_min=100000) with pytest.raises(IrrelevantFileWarning): df = hit2df(getTestFile("hitran_2016_H2O_2iso_2000_2100cm.par"), load_wavenum_max=0.5)
def test_hitemp(verbose=True, warnings=True, **kwargs): ''' Analyse some default files to make sure everything still works''' # 1. Load df = cdsd2df(getTestFile('cdsd_hitemp_09_header.txt'), cache='regen', drop_non_numeric=True) if verbose: print(df.head()) # 2. Tests assert df.wav[3] == 2250.00096 # make sure P Q R is correctly replaced by drop_non_numeric: assert 'branch' in df assert df['branch'].iloc[0] == 0 # Q assert df['branch'].iloc[1] == 1 # R return True
def test_local_hitemp_file(verbose=True, warnings=True, **kwargs): """Analyse some default files to make sure everything still works.""" # 1. Load df = cdsd2df(getTestFile("cdsd_hitemp_09_header.txt"), cache="regen", drop_non_numeric=True) if verbose: print(df.head()) # 2. Tests assert df.wav[3] == 2250.00096 # make sure P Q R is correctly replaced by drop_non_numeric: assert "branch" in df assert df["branch"].iloc[0] == 0 # Q assert df["branch"].iloc[1] == 1 # R return True