def test_rotate_grid_one_storm_object_arbitrary(self): """Ensures correct output from _rotate_grid_one_storm_object. In this case, storm motion is in an arbitrary direction (not 0, 90, 180, 270, or NaN degrees). """ this_latitude_matrix_deg, this_longitude_matrix_deg = ( storm_images._rotate_grid_one_storm_object( centroid_latitude_deg=ONE_CENTROID_LATITUDE_DEG, centroid_longitude_deg=ONE_CENTROID_LONGITUDE_DEG, eastward_motion_m_s01=EASTWARD_MOTION_M_S01, northward_motion_m_s01=NORTHWARD_MOTION_M_S01, num_storm_image_rows=NUM_FULL_GRID_ROWS_ROTATED, num_storm_image_columns=NUM_FULL_GRID_COLUMNS_ROTATED, storm_grid_spacing_metres=ROTATED_GRID_SPACING_METRES)) self.assertTrue( numpy.allclose(this_latitude_matrix_deg, ROTATED_LAT_MATRIX_ARBITRARY_MOTION_DEG, atol=TOLERANCE)) self.assertTrue( numpy.allclose(this_longitude_matrix_deg, ROTATED_LNG_MATRIX_ARBITRARY_MOTION_DEG, atol=TOLERANCE))
def test_rotate_grid_one_storm_object_zero_motion(self): """Ensures correct output from _rotate_grid_one_storm_object. In this case, storm motion is zero (stationary). """ (this_latitude_matrix_deg, this_longitude_matrix_deg ) = storm_images._rotate_grid_one_storm_object( centroid_latitude_deg=ONE_CENTROID_LATITUDE_DEG, centroid_longitude_deg=ONE_CENTROID_LONGITUDE_DEG, eastward_motion_m_s01=0., northward_motion_m_s01=0., num_storm_image_rows=NUM_FULL_GRID_ROWS_ROTATED, num_storm_image_columns=NUM_FULL_GRID_COLUMNS_ROTATED, storm_grid_spacing_metres=ROTATED_GRID_SPACING_METRES) self.assertTrue(numpy.allclose( this_latitude_matrix_deg, ROTATED_LAT_MATRIX_ZERO_MOTION_DEG, atol=TOLERANCE)) self.assertTrue(numpy.allclose( this_longitude_matrix_deg, ROTATED_LNG_MATRIX_ZERO_MOTION_DEG, atol=TOLERANCE))