Esempio n. 1
0
    def test_column_name_to_distance_buffer_small_buffer_grid_rows(self):
        """Ensures correct output from _column_name_to_distance_buffer.

        In this case, the buffer is "inside storm" and the column name is for
        grid rows inside the polygon.
        """

        this_min_distance_metres, this_max_distance_metres = (
            gridded_forecasts._column_name_to_distance_buffer(
                SMALL_BUFFER_GRID_ROWS_COLUMN))

        self.assertTrue(numpy.isclose(
            this_min_distance_metres, SMALL_BUFFER_MIN_DISTANCE_METRES,
            equal_nan=True, atol=TOLERANCE))
        self.assertTrue(numpy.isclose(
            this_max_distance_metres, SMALL_BUFFER_MAX_DISTANCE_METRES,
            atol=TOLERANCE))
Esempio n. 2
0
    def test_column_name_to_distance_buffer_large_buffer_grid_columns(self):
        """Ensures correct output from _column_name_to_distance_buffer.

        In this case, the buffer is "5-10 km outside storm" and the column name
        is for grid columns inside the polygon.
        """

        this_min_distance_metres, this_max_distance_metres = (
            gridded_forecasts._column_name_to_distance_buffer(
                LARGE_BUFFER_GRID_COLUMNS_COLUMN))

        self.assertTrue(numpy.isclose(
            this_min_distance_metres, LARGE_BUFFER_MIN_DISTANCE_METRES,
            atol=TOLERANCE))
        self.assertTrue(numpy.isclose(
            this_max_distance_metres, LARGE_BUFFER_MAX_DISTANCE_METRES,
            atol=TOLERANCE))
Esempio n. 3
0
    def test_column_name_to_distance_buffer_small_buffer_forecast(self):
        """Ensures correct output from _column_name_to_distance_buffer.

        In this case, the buffer is "inside storm" and the column name is for
        forecast probabilities.
        """

        this_min_distance_metres, this_max_distance_metres = (
            gridded_forecasts._column_name_to_distance_buffer(
                SMALL_BUFFER_FORECAST_COLUMN))

        self.assertTrue(numpy.isclose(
            this_min_distance_metres, SMALL_BUFFER_MIN_DISTANCE_METRES,
            equal_nan=True, atol=TOLERANCE))
        self.assertTrue(numpy.isclose(
            this_max_distance_metres, SMALL_BUFFER_MAX_DISTANCE_METRES,
            atol=TOLERANCE))