def _run(): """Plots dilation of WPC fronts. This is effectively the main method. """ print 'Reading data from: "{0:s}"...'.format(FRONT_LINE_FILE_NAME) front_line_table = fronts_io.read_polylines_from_file(FRONT_LINE_FILE_NAME) print 'Reading data from: "{0:s}"...'.format(FRONTAL_GRID_FILE_NAME) frontal_grid_table = fronts_io.read_narr_grids_from_file( FRONTAL_GRID_FILE_NAME) num_grid_rows, num_grid_columns = nwp_model_utils.get_grid_dimensions( model_name=nwp_model_utils.NARR_MODEL_NAME) ternary_front_matrix = ml_utils.front_table_to_images( frontal_grid_table=frontal_grid_table, num_rows_per_image=num_grid_rows, num_columns_per_image=num_grid_columns) _plot_fronts(front_line_table=front_line_table, ternary_front_matrix=ternary_front_matrix, title_string='Observed fronts before dilation', annotation_string='(a)', output_file_name=BEFORE_FILE_NAME) ternary_front_matrix = ml_utils.dilate_ternary_target_images( target_matrix=ternary_front_matrix, dilation_distance_metres=DILATION_DISTANCE_METRES, verbose=False) _plot_fronts(front_line_table=front_line_table, ternary_front_matrix=ternary_front_matrix, title_string='Observed fronts after dilation', annotation_string='(b)', output_file_name=AFTER_FILE_NAME) print 'Concatenating figures to: "{0:s}"...'.format(CONCAT_FILE_NAME) imagemagick_utils.concatenate_images( input_file_names=[BEFORE_FILE_NAME, AFTER_FILE_NAME], output_file_name=CONCAT_FILE_NAME, num_panel_rows=1, num_panel_columns=2) imagemagick_utils.resize_image(input_file_name=CONCAT_FILE_NAME, output_file_name=CONCAT_FILE_NAME, output_size_pixels=CONCAT_SIZE_PIXELS)
def _run(): """Plots example of double penalty. This is effectively the main method. """ print 'Reading data from: "{0:s}"...'.format(INPUT_FILE_NAME) actual_grid_point_table = fronts_io.read_narr_grids_from_file( INPUT_FILE_NAME) predicted_grid_point_table = copy.deepcopy(actual_grid_point_table) predicted_grid_point_table[ front_utils.WARM_FRONT_COLUMN_INDICES_COLUMN] += 1 predicted_grid_point_table[ front_utils.COLD_FRONT_COLUMN_INDICES_COLUMN] += 1 predicted_grid_point_table[front_utils.WARM_FRONT_ROW_INDICES_COLUMN] += 1 predicted_grid_point_table[front_utils.COLD_FRONT_ROW_INDICES_COLUMN] += 1 num_grid_rows, num_grid_columns = nwp_model_utils.get_grid_dimensions( model_name=nwp_model_utils.NARR_MODEL_NAME) actual_binary_matrix = ml_utils.front_table_to_images( frontal_grid_table=actual_grid_point_table, num_rows_per_image=num_grid_rows, num_columns_per_image=num_grid_columns) actual_binary_matrix = ml_utils.binarize_front_images(actual_binary_matrix) predicted_binary_matrix = ml_utils.front_table_to_images( frontal_grid_table=predicted_grid_point_table, num_rows_per_image=num_grid_rows, num_columns_per_image=num_grid_columns) predicted_binary_matrix = ml_utils.binarize_front_images( predicted_binary_matrix) _plot_fronts(actual_binary_matrix=actual_binary_matrix, predicted_binary_matrix=predicted_binary_matrix, title_string='Observed and predicted front\nwithout dilation', annotation_string='(c)', output_file_name=NO_DILATION_FILE_NAME) actual_binary_matrix = ml_utils.dilate_binary_target_images( target_matrix=actual_binary_matrix, dilation_distance_metres=DILATION_DISTANCE_METRES, verbose=False) predicted_binary_matrix = ml_utils.dilate_binary_target_images( target_matrix=predicted_binary_matrix, dilation_distance_metres=DILATION_DISTANCE_METRES, verbose=False) _plot_fronts(actual_binary_matrix=actual_binary_matrix, predicted_binary_matrix=predicted_binary_matrix, title_string='Observed and predicted front\nwith dilation', annotation_string='(d)', output_file_name=WITH_DILATION_FILE_NAME) print 'Concatenating figures to: "{0:s}"...'.format(CONCAT_FILE_NAME) imagemagick_utils.concatenate_images( input_file_names=[NO_DILATION_FILE_NAME, WITH_DILATION_FILE_NAME], output_file_name=CONCAT_FILE_NAME, num_panel_rows=1, num_panel_columns=2) imagemagick_utils.resize_image(input_file_name=CONCAT_FILE_NAME, output_file_name=CONCAT_FILE_NAME, output_size_pixels=CONCAT_SIZE_PIXELS)
def create_full_size_4d_example(target_time_unix_sec, num_lead_time_steps, predictor_time_step_offsets, top_narr_directory_name, top_frontal_grid_dir_name, narr_predictor_names, pressure_level_mb, dilation_distance_metres, num_classes): """Creates full-size 4-D examples from raw files. :param target_time_unix_sec: See doc for `create_downsized_3d_examples`. :param num_lead_time_steps: See doc for `create_downsized_4d_examples`. :param predictor_time_step_offsets: Same. :param top_narr_directory_name: See doc for `create_downsized_3d_examples`. :param top_frontal_grid_dir_name: Same. :param narr_predictor_names: Same. :param pressure_level_mb: Same. :param dilation_distance_metres: Same. :param num_classes: Same. :return: predictor_matrix: 1-by-M-by-N-by-T-by-C numpy array of predictor values. :return: target_matrix: 1-by-M-by-N numpy array of target values. Each value is an integer from the list `front_utils.VALID_INTEGER_IDS`. """ error_checking.assert_is_integer(num_classes) error_checking.assert_is_geq(num_classes, 2) error_checking.assert_is_leq(num_classes, 3) (narr_file_name_matrix, frontal_grid_file_names) = trainval_io.find_input_files_for_4d_examples( first_target_time_unix_sec=target_time_unix_sec, last_target_time_unix_sec=target_time_unix_sec, predictor_time_step_offsets=predictor_time_step_offsets, num_lead_time_steps=num_lead_time_steps, top_narr_directory_name=top_narr_directory_name, top_frontal_grid_dir_name=top_frontal_grid_dir_name, narr_predictor_names=narr_predictor_names, pressure_level_mb=pressure_level_mb) narr_file_name_matrix = narr_file_name_matrix[0, ...] frontal_grid_file_name = frontal_grid_file_names[0] num_predictor_times_per_example = len(predictor_time_step_offsets) num_predictors = len(narr_predictor_names) tuple_of_4d_predictor_matrices = () for i in range(num_predictor_times_per_example): tuple_of_3d_predictor_matrices = () for j in range(num_predictors): print 'Reading data from: "{0:s}"...'.format( narr_file_name_matrix[i, j]) this_field_predictor_matrix = ( processed_narr_io.read_fields_from_file( narr_file_name_matrix[i, j]))[0] this_field_predictor_matrix = ( ml_utils.fill_nans_in_predictor_images( this_field_predictor_matrix)) tuple_of_3d_predictor_matrices += (this_field_predictor_matrix, ) tuple_of_4d_predictor_matrices += (ml_utils.stack_predictor_variables( tuple_of_3d_predictor_matrices), ) predictor_matrix = ml_utils.stack_time_steps( tuple_of_4d_predictor_matrices) print 'Reading data from: "{0:s}"...'.format(frontal_grid_file_name) frontal_grid_table = fronts_io.read_narr_grids_from_file( frontal_grid_file_name) print 'Processing full-size 4-D machine-learning example...' predictor_matrix, _ = ml_utils.normalize_predictors( predictor_matrix=predictor_matrix) target_matrix = ml_utils.front_table_to_images( frontal_grid_table=frontal_grid_table, num_rows_per_image=predictor_matrix.shape[1], num_columns_per_image=predictor_matrix.shape[2]) if num_classes == 2: target_matrix = ml_utils.binarize_front_images(target_matrix) predictor_matrix = ml_utils.subset_narr_grid_for_fcn_input( predictor_matrix) target_matrix = ml_utils.subset_narr_grid_for_fcn_input(target_matrix) if num_classes == 2: target_matrix = ml_utils.dilate_binary_target_images( target_matrix=target_matrix, dilation_distance_metres=dilation_distance_metres, verbose=False) else: target_matrix = ml_utils.dilate_ternary_target_images( target_matrix=target_matrix, dilation_distance_metres=dilation_distance_metres, verbose=False) predictor_matrix = predictor_matrix.astype('float32') print 'Fraction of pixels with a front = {0:.4f}'.format( numpy.mean(target_matrix > 0)) target_matrix = numpy.expand_dims(target_matrix, axis=-1) return predictor_matrix, target_matrix
def create_downsized_3d_examples(center_row_indices, center_column_indices, num_rows_in_half_grid, num_columns_in_half_grid, full_predictor_matrix=None, full_target_matrix=None, target_time_unix_sec=None, top_narr_directory_name=None, top_frontal_grid_dir_name=None, narr_predictor_names=None, pressure_level_mb=None, dilation_distance_metres=None, num_classes=None): """Creates downsized 3-D examples from raw files. This method creates one example for each center pixel, where center pixels are specified by `center_row_indices` and `center_column_indices`. If `full_predictor_matrix` and `full_target_matrix` are specified, all input args thereafter will be ignored. E = number of examples (center pixels) P = number of rows in full NARR grid Q = number of columns in full NARR grid :param center_row_indices: length-E numpy array with row for each center pixel. :param center_column_indices: length-E numpy array with column for each center pixel. :param num_rows_in_half_grid: Number of rows in half-grid for each example. Actual number of rows will be 2 * `num_rows_in_half_grid` + 1. :param num_columns_in_half_grid: Same but for columns. :param full_predictor_matrix: 1-by-P-by-Q-by-C numpy array of predictor values. :param full_target_matrix: 1-by-P-by-Q-by-C numpy array of target values. Each value is an integer from the list `front_utils.VALID_INTEGER_IDS`. :param target_time_unix_sec: Target time. :param top_narr_directory_name: Name of top-level directory with NARR data. Files therein will be found by `processed_narr_io.find_file_for_one_time` and read by `processed_narr_io.read_fields_from_file`. :param top_frontal_grid_dir_name: Name of top-level directory with target values (grids of front labels). Files therein will be found by `fronts_io.find_file_for_one_time` and read by `fronts_io.read_narr_grids_from_file`. :param narr_predictor_names: length-C list with names of predictor variables. Each must be accepted by `processed_narr_io.check_field_name`. :param pressure_level_mb: Pressure level (millibars) for predictors. :param dilation_distance_metres: Dilation distance. Will be used to dilate WF and CF labels, which effectively creates a distance buffer around each front, thus accounting for spatial uncertainty in front placement. :param num_classes: Number of target classes (either 2 or 3). :return: downsized_predictor_matrix: E-by-M-by-N-by-C numpy array of predictor values. :return: target_values: length-E numpy array of target values (integers from the list `front_utils.VALID_INTEGER_IDS`). :return: full_predictor_matrix: 1-by-P-by-Q-by-C numpy array of predictor values. :return: full_target_matrix: 1-by-P-by-Q-by-C numpy array of target values. Each value is an integer from the list `front_utils.VALID_INTEGER_IDS`. """ if full_predictor_matrix is None or full_target_matrix is None: error_checking.assert_is_integer(num_classes) error_checking.assert_is_geq(num_classes, 2) error_checking.assert_is_leq(num_classes, 3) (narr_file_name_matrix, frontal_grid_file_names ) = trainval_io.find_input_files_for_3d_examples( first_target_time_unix_sec=target_time_unix_sec, last_target_time_unix_sec=target_time_unix_sec, top_narr_directory_name=top_narr_directory_name, top_frontal_grid_dir_name=top_frontal_grid_dir_name, narr_predictor_names=narr_predictor_names, pressure_level_mb=pressure_level_mb) narr_file_names = narr_file_name_matrix[0, :] frontal_grid_file_name = frontal_grid_file_names[0] num_predictors = len(narr_predictor_names) tuple_of_full_predictor_matrices = () for j in range(num_predictors): print 'Reading data from: "{0:s}"...'.format(narr_file_names[j]) this_field_predictor_matrix = ( processed_narr_io.read_fields_from_file(narr_file_names[j]))[0] this_field_predictor_matrix = ( ml_utils.fill_nans_in_predictor_images( this_field_predictor_matrix)) tuple_of_full_predictor_matrices += (this_field_predictor_matrix, ) print 'Reading data from: "{0:s}"...'.format(frontal_grid_file_name) frontal_grid_table = fronts_io.read_narr_grids_from_file( frontal_grid_file_name) full_predictor_matrix = ml_utils.stack_predictor_variables( tuple_of_full_predictor_matrices) full_predictor_matrix, _ = ml_utils.normalize_predictors( predictor_matrix=full_predictor_matrix) full_target_matrix = ml_utils.front_table_to_images( frontal_grid_table=frontal_grid_table, num_rows_per_image=full_predictor_matrix.shape[1], num_columns_per_image=full_predictor_matrix.shape[2]) if num_classes == 2: full_target_matrix = ml_utils.binarize_front_images( full_target_matrix) if num_classes == 2: full_target_matrix = ml_utils.dilate_binary_target_images( target_matrix=full_target_matrix, dilation_distance_metres=dilation_distance_metres, verbose=False) else: full_target_matrix = ml_utils.dilate_ternary_target_images( target_matrix=full_target_matrix, dilation_distance_metres=dilation_distance_metres, verbose=False) print 'Creating {0:d} downsized 3-D examples...'.format( len(center_row_indices)) this_target_point_dict = { ml_utils.ROW_INDICES_BY_TIME_KEY: [center_row_indices], ml_utils.COLUMN_INDICES_BY_TIME_KEY: [center_column_indices] } (downsized_predictor_matrix, target_values) = ml_utils.downsize_grids_around_selected_points( predictor_matrix=full_predictor_matrix, target_matrix=full_target_matrix, num_rows_in_half_window=num_rows_in_half_grid, num_columns_in_half_window=num_columns_in_half_grid, target_point_dict=this_target_point_dict, verbose=False)[:2] downsized_predictor_matrix = downsized_predictor_matrix.astype('float32') return (downsized_predictor_matrix, target_values, full_predictor_matrix, full_target_matrix)
def create_downsized_4d_examples(center_row_indices, center_column_indices, num_rows_in_half_grid, num_columns_in_half_grid, full_predictor_matrix=None, full_target_matrix=None, target_time_unix_sec=None, num_lead_time_steps=None, predictor_time_step_offsets=None, top_narr_directory_name=None, top_frontal_grid_dir_name=None, narr_predictor_names=None, pressure_level_mb=None, dilation_distance_metres=None, num_classes=None): """Creates downsized 4-D examples from raw files. This method creates one example for each center pixel, where center pixels are specified by `center_row_indices` and `center_column_indices`. If `full_predictor_matrix` and `full_target_matrix` are specified, all input args thereafter will be ignored. E = number of examples (center pixels) P = number of rows in full NARR grid Q = number of columns in full NARR grid :param center_row_indices: See doc for `create_downsized_3d_examples`. :param center_column_indices: Same. :param num_rows_in_half_grid: Same. :param num_columns_in_half_grid: Same. :param full_predictor_matrix: 1-by-P-by-Q-by-T-by-C numpy array of predictor values. :param full_target_matrix: 1-by-P-by-Q-by-C numpy array of target values. Each value is an integer from the list `front_utils.VALID_INTEGER_IDS`. :param target_time_unix_sec: See doc for `create_downsized_3d_examples`. :param num_lead_time_steps: Number of time steps between target time and latest possible predictor time. :param predictor_time_step_offsets: length-T numpy array of offsets between predictor time and latest possible predictor time (target time minus lead time). :param top_narr_directory_name: See doc for `create_downsized_3d_examples`. :param top_frontal_grid_dir_name: Same. :param narr_predictor_names: Same. :param pressure_level_mb: Same. :param dilation_distance_metres: Same. :param num_classes: Same. :return: downsized_predictor_matrix: E-by-M-by-N-by-T-by-C numpy array of predictor values. :return: target_values: length-E numpy array of target values (integers from the list `front_utils.VALID_INTEGER_IDS`). :return: full_predictor_matrix: 1-by-P-by-Q-by-T-by-C numpy array of predictor values. :return: full_target_matrix: 1-by-P-by-Q-by-C numpy array of target values. Each value is an integer from the list `front_utils.VALID_INTEGER_IDS`. """ if full_predictor_matrix is None or full_target_matrix is None: error_checking.assert_is_integer(num_classes) error_checking.assert_is_geq(num_classes, 2) error_checking.assert_is_leq(num_classes, 3) (narr_file_name_matrix, frontal_grid_file_names ) = trainval_io.find_input_files_for_4d_examples( first_target_time_unix_sec=target_time_unix_sec, last_target_time_unix_sec=target_time_unix_sec, predictor_time_step_offsets=predictor_time_step_offsets, num_lead_time_steps=num_lead_time_steps, top_narr_directory_name=top_narr_directory_name, top_frontal_grid_dir_name=top_frontal_grid_dir_name, narr_predictor_names=narr_predictor_names, pressure_level_mb=pressure_level_mb) narr_file_name_matrix = narr_file_name_matrix[0, ...] frontal_grid_file_name = frontal_grid_file_names[0] num_predictor_times_per_example = len(predictor_time_step_offsets) num_predictors = len(narr_predictor_names) tuple_of_4d_predictor_matrices = () for i in range(num_predictor_times_per_example): tuple_of_3d_predictor_matrices = () for j in range(num_predictors): print 'Reading data from: "{0:s}"...'.format( narr_file_name_matrix[i, j]) this_field_predictor_matrix = ( processed_narr_io.read_fields_from_file( narr_file_name_matrix[i, j]))[0] this_field_predictor_matrix = ( ml_utils.fill_nans_in_predictor_images( this_field_predictor_matrix)) tuple_of_3d_predictor_matrices += ( this_field_predictor_matrix, ) tuple_of_4d_predictor_matrices += ( ml_utils.stack_predictor_variables( tuple_of_3d_predictor_matrices), ) full_predictor_matrix = ml_utils.stack_time_steps( tuple_of_4d_predictor_matrices) print 'Reading data from: "{0:s}"...'.format(frontal_grid_file_name) frontal_grid_table = fronts_io.read_narr_grids_from_file( frontal_grid_file_name) full_predictor_matrix, _ = ml_utils.normalize_predictors( predictor_matrix=full_predictor_matrix) full_target_matrix = ml_utils.front_table_to_images( frontal_grid_table=frontal_grid_table, num_rows_per_image=full_predictor_matrix.shape[1], num_columns_per_image=full_predictor_matrix.shape[2]) if num_classes == 2: full_target_matrix = ml_utils.binarize_front_images( full_target_matrix) if num_classes == 2: full_target_matrix = ml_utils.dilate_binary_target_images( target_matrix=full_target_matrix, dilation_distance_metres=dilation_distance_metres, verbose=False) else: full_target_matrix = ml_utils.dilate_ternary_target_images( target_matrix=full_target_matrix, dilation_distance_metres=dilation_distance_metres, verbose=False) print 'Creating {0:d} downsized 4-D examples...'.format( len(center_row_indices)) this_target_point_dict = { ml_utils.ROW_INDICES_BY_TIME_KEY: [center_row_indices], ml_utils.COLUMN_INDICES_BY_TIME_KEY: [center_column_indices] } (downsized_predictor_matrix, target_values) = ml_utils.downsize_grids_around_selected_points( predictor_matrix=full_predictor_matrix, target_matrix=full_target_matrix, num_rows_in_half_window=num_rows_in_half_grid, num_columns_in_half_window=num_columns_in_half_grid, target_point_dict=this_target_point_dict, verbose=False)[:2] downsized_predictor_matrix = downsized_predictor_matrix.astype('float32') return (downsized_predictor_matrix, target_values, full_predictor_matrix, full_target_matrix)
def _run(top_frontal_grid_dir_name, first_time_string, last_time_string, dilation_distance_metres, min_num_fronts, output_dir_name): """Creates mask, indicating where human forecasters usually draw fronts. This is effectively the main method. :param top_frontal_grid_dir_name: See documentation at top of file. :param first_time_string: Same. :param last_time_string: Same. :param dilation_distance_metres: Same. :param min_num_fronts: Same. :param output_dir_name: Same. """ file_system_utils.mkdir_recursive_if_necessary( directory_name=output_dir_name) error_checking.assert_is_greater(min_num_fronts, 0) first_time_unix_sec = time_conversion.string_to_unix_sec( first_time_string, INPUT_TIME_FORMAT) last_time_unix_sec = time_conversion.string_to_unix_sec( last_time_string, INPUT_TIME_FORMAT) valid_times_unix_sec = time_periods.range_and_interval_to_list( start_time_unix_sec=first_time_unix_sec, end_time_unix_sec=last_time_unix_sec, time_interval_sec=TIME_INTERVAL_SECONDS) num_times = len(valid_times_unix_sec) num_grid_rows, num_grid_columns = nwp_model_utils.get_grid_dimensions( model_name=nwp_model_utils.NARR_MODEL_NAME) num_cold_fronts_matrix = None num_warm_fronts_matrix = None for i in range(num_times): this_file_name = fronts_io.find_file_for_one_time( top_directory_name=top_frontal_grid_dir_name, file_type=fronts_io.GRIDDED_FILE_TYPE, valid_time_unix_sec=valid_times_unix_sec[i], raise_error_if_missing=False) if not os.path.isfile(this_file_name): warning_string = ('POTENTIAL PROBLEM. Cannot find file: "{0:s}"' ).format(this_file_name) warnings.warn(warning_string) continue print 'Reading data from: "{0:s}"...'.format(this_file_name) this_frontal_grid_table = fronts_io.read_narr_grids_from_file( this_file_name) this_frontal_grid_matrix = ml_utils.front_table_to_images( frontal_grid_table=this_frontal_grid_table, num_rows_per_image=num_grid_rows, num_columns_per_image=num_grid_columns) this_frontal_grid_matrix = ml_utils.dilate_ternary_target_images( target_matrix=this_frontal_grid_matrix, dilation_distance_metres=dilation_distance_metres, verbose=False) this_frontal_grid_matrix = this_frontal_grid_matrix[0, ...] this_num_cold_fronts_matrix = (this_frontal_grid_matrix == front_utils. COLD_FRONT_INTEGER_ID).astype(int) this_num_warm_fronts_matrix = (this_frontal_grid_matrix == front_utils. WARM_FRONT_INTEGER_ID).astype(int) if num_cold_fronts_matrix is None: num_cold_fronts_matrix = this_num_cold_fronts_matrix + 0 num_warm_fronts_matrix = this_num_warm_fronts_matrix + 0 else: num_cold_fronts_matrix = (num_cold_fronts_matrix + this_num_cold_fronts_matrix) num_warm_fronts_matrix = (num_warm_fronts_matrix + this_num_warm_fronts_matrix) print SEPARATOR_STRING print 'Masking out grid cells with < {0:d} fronts...'.format( min_num_fronts) num_both_fronts_matrix = num_warm_fronts_matrix + num_cold_fronts_matrix mask_matrix = (num_both_fronts_matrix >= min_num_fronts).astype(int) pickle_file_name = '{0:s}/narr_mask.p'.format(output_dir_name) print 'Writing mask to: "{0:s}"...'.format(pickle_file_name) ml_utils.write_narr_mask(mask_matrix=mask_matrix, pickle_file_name=pickle_file_name) warm_front_map_file_name = '{0:s}/num_warm_fronts.jpg'.format( output_dir_name) _plot_front_densities(num_fronts_matrix=num_warm_fronts_matrix, colour_map_object=WARM_FRONT_COLOUR_MAP_OBJECT, title_string='Number of warm fronts', annotation_string='(a)', output_file_name=warm_front_map_file_name, mask_matrix=None, add_colour_bar=True) cold_front_map_file_name = '{0:s}/num_cold_fronts.jpg'.format( output_dir_name) _plot_front_densities(num_fronts_matrix=num_cold_fronts_matrix, colour_map_object=COLD_FRONT_COLOUR_MAP_OBJECT, title_string='Number of cold fronts', annotation_string='(b)', output_file_name=cold_front_map_file_name, mask_matrix=None, add_colour_bar=True) both_fronts_title_string = 'Grid cells with at least {0:d} fronts'.format( min_num_fronts) both_fronts_map_file_name = '{0:s}/num_both_fronts.jpg'.format( output_dir_name) num_both_fronts_matrix[num_both_fronts_matrix > 1] = 1 _plot_front_densities(num_fronts_matrix=num_both_fronts_matrix, colour_map_object=BOTH_FRONTS_COLOUR_MAP_OBJECT, title_string=both_fronts_title_string, annotation_string='(c)', output_file_name=both_fronts_map_file_name, mask_matrix=mask_matrix, add_colour_bar=False)