Skip to content

Commit

Permalink
pre-commit checks
Browse files Browse the repository at this point in the history
  • Loading branch information
pdebuyl committed Sep 18, 2024
1 parent 7375f7f commit 839900a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
6 changes: 3 additions & 3 deletions satpy/readers/mcd12q1.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,16 @@ def _get_res(self):
raise ValueError("Only MCD12Q1 grids are supported")

resolution_string = self.metadata["ARCHIVEDMETADATA"]["NADIRDATARESOLUTION"]["VALUE"]
if resolution_string[-1] == 'm':
return int(resolution_string.removesuffix('m'))
if resolution_string[-1] == "m":
return int(resolution_string.removesuffix("m"))
else:
raise ValueError("Cannot parse resolution of MCD12Q1 grid")


def get_dataset(self, dataset_id, dataset_info):
"""Get DataArray for specified dataset."""
dataset_name = dataset_id["name"]
# xxx
# xxx
dataset = self.load_dataset(dataset_name, dataset_info.pop("category", False))

self._add_satpy_metadata(dataset_id, dataset)
Expand Down
18 changes: 2 additions & 16 deletions satpy/tests/reader_tests/modis_tests/test_modis_l3_mcd12q1.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,13 @@

from __future__ import annotations

import dask
import dask.array as da
import numpy as np
import pytest
from pytest_lazy_fixtures import lf as lazy_fixture

from satpy import Scene, available_readers
from satpy.tests.utils import CustomScheduler, make_dataid

from ._modis_fixtures import _shape_for_resolution, modis_l3_nasa_mcd12q1_file

# NOTE:
# The following fixtures are not defined in this file, but are used and injected by Pytest:
# - modis_l2_imapp_mask_byte1_file
# - modis_l2_imapp_mask_byte1_geo_files
# - modis_l2_imapp_snowmask_file
# - modis_l2_imapp_snowmask_geo_files
# - modis_l2_nasa_mod06_file
# - modis_l2_nasa_mod35_file
# - modis_l2_nasa_mod35_mod03_files
# - modis_l3_nasa_mcd12q1_file


def _check_shared_metadata(data_arr, expect_area=False):
Expand Down Expand Up @@ -70,10 +57,9 @@ def test_scene_available_datasets(self, modis_l3_nasa_mcd12q1_file):
def test_load_l3_dataset(self, modis_l3_nasa_mcd12q1_file):
"""Load and check an L2 variable."""
scene = Scene(reader="mcd12q1", filenames=modis_l3_nasa_mcd12q1_file)
ds_name = 'LC_Type1'
ds_name = "LC_Type1"
scene.load([ds_name])
assert ds_name in scene
data_arr = scene[ds_name]
assert isinstance(data_arr.data, da.Array)
assert data_arr.attrs.get("resolution") == 500

0 comments on commit 839900a

Please sign in to comment.