diff --git a/satpy/readers/mviri_l1b_fiduceo_nc.py b/satpy/readers/mviri_l1b_fiduceo_nc.py index 9961679728..56f15ca9d8 100644 --- a/satpy/readers/mviri_l1b_fiduceo_nc.py +++ b/satpy/readers/mviri_l1b_fiduceo_nc.py @@ -454,7 +454,17 @@ def is_high_resol(resolution): return resolution == HIGH_RESOL -class DatasetPreprocessor: +def preprocess_dataset(ds): + """Preprocess the given dataset. + + Performs steps that can be done once, such as decoding + according to CF conventions. + """ + preproc = _DatasetPreprocessor() + return preproc.preprocess(ds) + + +class _DatasetPreprocessor: """Helper class for preprocessing the dataset.""" def preprocess(self, ds): @@ -534,7 +544,11 @@ def _cleanup_attrs(self, ds): class DatasetAccessor: - """Helper class for accessing the dataset.""" + """Helper class for accessing the dataset. + + Performs steps that need to be done each time a variable + is accessed, such as renaming "y_*" coordinates to "y". + """ def __init__(self, ds): """Wrap the given dataset.""" @@ -597,7 +611,7 @@ def open_dataset(filename): decode_times=False, mask_and_scale=False, ) - nc_preproc = DatasetPreprocessor().preprocess(nc_raw) + nc_preproc = preprocess_dataset(nc_raw) return DatasetAccessor(nc_preproc) diff --git a/satpy/tests/reader_tests/test_mviri_l1b_fiduceo_nc.py b/satpy/tests/reader_tests/test_mviri_l1b_fiduceo_nc.py index b5b5b5a593..7e925d2b2c 100644 --- a/satpy/tests/reader_tests/test_mviri_l1b_fiduceo_nc.py +++ b/satpy/tests/reader_tests/test_mviri_l1b_fiduceo_nc.py @@ -33,10 +33,10 @@ ALTITUDE, EQUATOR_RADIUS, POLE_RADIUS, - DatasetPreprocessor, FiduceoMviriEasyFcdrFileHandler, FiduceoMviriFullFcdrFileHandler, Interpolator, + preprocess_dataset, ) from satpy.tests.utils import make_dataid @@ -637,7 +637,7 @@ def fixture_dataset_exp(self): def test_preprocess(self, dataset, dataset_exp): """Test dataset preprocessing.""" - preprocessed = DatasetPreprocessor().preprocess(dataset) + preprocessed = preprocess_dataset(dataset) xr.testing.assert_allclose(preprocessed, dataset_exp)