Skip to content

Commit

Permalink
improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
pdebuyl committed Sep 19, 2024
1 parent 3ab2fdc commit 097a655
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
9 changes: 8 additions & 1 deletion satpy/tests/reader_tests/modis_tests/_modis_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,14 @@ def _get_l3_land_cover_info() -> dict:
"attrs": {
"dim_labels": ["YDim:MCD12Q1", "XDim:MCD12Q1"],
},
}
},
"LC_Type2": {"data": lc_data,
"type": SDC.UINT8,
"fill_value": 255,
"attrs": {
"dim_labels": ["YDim:MCD12Q1", "XDim:MCD12Q1"],
},
},
}

return variables_info
Expand Down
20 changes: 8 additions & 12 deletions satpy/tests/reader_tests/modis_tests/test_modis_l3_mcd12q1.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,21 @@
# - modis_l3_nasa_mcd12q1_file


def _check_shared_metadata(data_arr, expect_area=False):
assert data_arr.attrs["sensor"] == "modis"
assert data_arr.attrs["platform_name"] == "EOS-Terra"
assert "rows_per_scan" in data_arr.attrs
assert isinstance(data_arr.attrs["rows_per_scan"], int)
assert data_arr.attrs["reader"] == "mcd12q1"
if expect_area:
assert data_arr.attrs.get("area") is not None
else:
assert "area" not in data_arr.attrs


class TestModisL3MCD12Q1:
"""Test MODIS L3 MCD12Q1 reader."""

def test_available_reader(self):
"""Test that MODIS L3 reader is available."""
assert "mcd12q1" in available_readers()

def test_metadata(self, modis_l3_nasa_mcd12q1_file):
"""Test some basic metadata that should exist in the file."""
scene = Scene(reader="mcd12q1", filenames=modis_l3_nasa_mcd12q1_file)
ds_name = "LC_Type2"
scene.load([ds_name])
assert scene[ds_name].attrs['area'].description == 'Tiled sinusoidal L3 MODIS area'
assert scene[ds_name].attrs['sensor'] == 'modis'

def test_scene_available_datasets(self, modis_l3_nasa_mcd12q1_file):
"""Test that datasets are available."""
scene = Scene(reader="mcd12q1", filenames=modis_l3_nasa_mcd12q1_file)
Expand Down

0 comments on commit 097a655

Please sign in to comment.