def setup_cache(self): """Fetch the data files.""" try: from satpy.demo import get_us_midlatitude_cyclone_abi get_us_midlatitude_cyclone_abi() except ImportError: assert len(get_filenames(self.subdir)) == 16 download_rsr() download_luts(aerosol_type='rayleigh_only')
def setup_cache(self): """Fetch the data files.""" try: from satpy.demo import get_us_midlatitude_cyclone_abi get_us_midlatitude_cyclone_abi() except ImportError: if len(get_filenames(self.subdir)) != 16: raise RuntimeError("Existing data files do not match the expected number of files.") download_rsr() download_luts(aerosol_type='rayleigh_only')
def test_get_us_midlatitude_cyclone_abi(self, gcsfs_mod): """Test data download function.""" from satpy.demo import get_us_midlatitude_cyclone_abi gcsfs_mod.GCSFileSystem = mock.MagicMock() gcsfs_inst = mock.MagicMock() gcsfs_mod.GCSFileSystem.return_value = gcsfs_inst gcsfs_inst.glob.return_value = ['a.nc', 'b.nc'] self.assertRaises(AssertionError, get_us_midlatitude_cyclone_abi) self.assertRaises(NotImplementedError, get_us_midlatitude_cyclone_abi, method='unknown') gcsfs_inst.glob.return_value = ['a.nc'] * 16 filenames = get_us_midlatitude_cyclone_abi() expected = os.path.join('.', 'abi_l1b', '20190314_us_midlatitude_cyclone', 'a.nc') for fn in filenames: self.assertEqual(expected, fn)