Example #1
0
def test_ls8_qa_band(mtl_filename):
    metadata = parse_mtl(mtl_filename, convert=True)
    qa_band = LS8_QABand.from_meta(metadata)
    assert isinstance(qa_band, LS8_QABand)
    assert qa_band.index == 0
    assert qa_band.filename == qa_band.path.name
    assert qa_band.height == metadata["reflective_lines"]
    assert qa_band.width == metadata["reflective_samples"]
Example #2
0
def test_ls8_thermal_band(mtl_filename, band_index):
    metadata = parse_mtl(mtl_filename, convert=True)
    thermal_band = LS8_ThermalBand.from_meta(metadata, band_index)
    assert isinstance(thermal_band, LS8_ThermalBand)
    assert thermal_band.index == band_index
    assert thermal_band.filename == thermal_band.path.name
    assert thermal_band.height == metadata["thermal_lines"]
    assert thermal_band.width == metadata["thermal_samples"]
    assert isinstance(thermal_band.radiance, LS8_Radiance)
Example #3
0
def test_ls8_panchromatic_band(mtl_filename):
    metadata = parse_mtl(mtl_filename, convert=True)
    thermal_band = LS8_PanchromaticBand.from_meta(metadata)
    assert isinstance(thermal_band, LS8_Band)
    assert thermal_band.index == 8
    assert thermal_band.filename == thermal_band.path.name
    assert thermal_band.height == metadata["panchromatic_lines"]
    assert thermal_band.width == metadata["panchromatic_samples"]
    assert isinstance(thermal_band.radiance, LS8_Radiance)
    assert isinstance(thermal_band.reflectance, LS8_Reflectance)
Example #4
0
def test_parse_mtl_with_conversion(mtl_filename):
    metadata = parse_mtl(mtl_filename, convert=True)
    assert isinstance(metadata, dict)
    assert len(metadata) >= 100
    assert all("group" not in key for key in metadata.keys())
    assert all(
        isinstance(value, (str, Path, float, int, Date, Time))
        for value in metadata.values())
    assert isinstance(metadata["file_name_band_1"], Path)
    assert isinstance(metadata["file_name_band_2"], Path)
    assert isinstance(metadata["file_name_band_3"], Path)
    assert isinstance(metadata["file_name_band_4"], Path)
    assert isinstance(metadata["file_name_band_5"], Path)
    assert isinstance(metadata["file_date"], Date)
    assert isinstance(metadata["date_acquired"], Date)
    assert isinstance(metadata["scene_center_time"], Time)
Example #5
0
 def test_to_dataset(self, ls8_scene_mtl):
     metadata = parse_mtl(ls8_scene_mtl, convert=True)
     band = LS8_BandBase.from_meta(metadata, 1)
     src = band.to_dataset()
     assert isinstance(src, rasterio.io.DatasetReader)
Example #6
0
def test_parse_mtl_no_conversion(mtl_filename):
    metadata = parse_mtl(mtl_filename, convert=False)
    assert isinstance(metadata, dict)
    assert len(metadata) >= 100
    assert all("group" not in key for key in metadata.keys())
    assert all(isinstance(value, str) for value in metadata.values())