def test_number_of_raw_cubes(self): # Test the constraints generate the correct number of raw cubes. raw_cubes = iris._load_common(self.theta_path, None, strict=False, unique=False, merge=False) self.assertEqual(len(raw_cubes), 38) raw_cubes = iris._load_common(self.theta_path, [self.level_10], strict=False, unique=False, merge=False) self.assertEqual(len(raw_cubes), 1) raw_cubes = iris._load_common(self.theta_path, [self.theta], strict=False, unique=False, merge=False) self.assertEqual(len(raw_cubes), 38) raw_cubes = iris._load_common(self.dec_path, [self.level_30], strict=False, unique=False, merge=False) self.assertEqual(len(raw_cubes), 4) raw_cubes = iris._load_common(self.dec_path, [self.theta], strict=False, unique=False, merge=False) self.assertEqual(len(raw_cubes), 38)
def test_real_data(self): data_path = tests.get_data_path(('PP', 'globClim1', 'theta.pp')) cubes = iris._load_common(data_path, None, strict=False, unique=False, merge=False) # Force the source 2-D cubes to load their data before the merge for cube in cubes: data = cube.data cubes = cubes.merge() self.assertCML(cubes, ['merge', 'theta.cml'])
def _test_file(self, src_path, reference_filename): """ Checks the result of loading the given file spec, or creates the reference file if it doesn't exist. NB. The direct use of :func:`iris._load_common` bypasses the cube merge process. """ cubes = iris._load_common(tests.get_data_path(src_path), constraints=None, strict=False, unique=True, merge=False) self.assertCML(cubes, ['file_load', reference_filename])