Exemplo n.º 1
0
    def test_missing_data_files(self):
        """Test with missing files."""

        diagnostic_name = 'temperature_on_height_levels'
        msg = 'The relevant data files for'
        with self.assertRaisesRegexp(IOError, msg):
            get_additional_diagnostics(diagnostic_name, 'not_a_valid_path')
    def test_available_data_files_with_invalid_time_extraction(self):
        """Test with files available and an attempted extraction of data at a
        time that is not valid."""

        diagnostic_name = 'temperature_on_height_levels'
        msg = 'No diagnostics match .*'
        time_extract = Constraint(time=PartialDateTime(2018, 1, 1, 0))
        with self.assertRaisesRegexp(ValueError, msg):
            get_additional_diagnostics(diagnostic_name, self.data_directory,
                                       time_extract=time_extract)
Exemplo n.º 3
0
    def test_available_data_files(self):
        """Test with files available."""

        diagnostic_name = 'temperature_on_height_levels'
        result = get_additional_diagnostics(diagnostic_name,
                                            self.data_directory)
        self.assertIsInstance(result, CubeList)
        self.assertArrayEqual(result[0].data,
                              self.temperature_on_height_levels.data)
Exemplo n.º 4
0
    def test_available_data_files_with_time_extraction(self):
        """Test with files available and an extraction of data at a given
        time."""

        diagnostic_name = 'temperature_on_height_levels'
        result = get_additional_diagnostics(diagnostic_name,
                                            self.data_directory,
                                            time_extract=self.time_extract)

        self.assertIsInstance(result, CubeList)
        self.assertArrayEqual(result[0].data,
                              self.temperature_on_height_levels[0].data)