def test_check_data_source_probsevere(self): """Ensures correct output from check_data_source. In this case, data source is probSevere. """ tracking_utils.check_data_source(tracking_utils.PROBSEVERE_SOURCE_ID)
def test_check_data_source_segmotion(self): """Ensures correct output from check_data_source. In this case, data source is segmotion. """ tracking_utils.check_data_source(tracking_utils.SEGMOTION_SOURCE_ID)
def _create_best_tracks(start_time_string, end_time_string, top_input_dir_name, data_source, top_output_dir_name, tracking_scale_metres2): """Runs the best-track algorithm with default parameters. :param start_time_string: See documentation at top of file. :param end_time_string: Same. :param top_input_dir_name: Same. :param data_source: Same. :param top_output_dir_name: Same. :param tracking_scale_metres2: Same. """ tracking_utils.check_data_source(data_source) start_time_unix_sec = time_conversion.string_to_unix_sec( start_time_string, INPUT_TIME_FORMAT) end_time_unix_sec = time_conversion.string_to_unix_sec( end_time_string, INPUT_TIME_FORMAT) first_date_string = time_conversion.time_to_spc_date_string( start_time_unix_sec) last_date_string = time_conversion.time_to_spc_date_string( end_time_unix_sec) file_dictionary = best_tracks_smart_io.find_files_for_smart_io( start_time_unix_sec=start_time_unix_sec, start_spc_date_string=first_date_string, end_time_unix_sec=end_time_unix_sec, end_spc_date_string=last_date_string, data_source=data_source, tracking_scale_metres2=tracking_scale_metres2, top_input_dir_name=top_input_dir_name, top_output_dir_name=top_output_dir_name) best_tracks_smart_io.run_best_track(smart_file_dict=file_dictionary)
def test_check_data_source_fake(self): """Ensures correct output from check_data_source. In this case, data source is unrecognized. """ with self.assertRaises(ValueError): tracking_utils.check_data_source(FAKE_DATA_SOURCE)
def _check_file_finding_args(top_tracking_dir_name, tracking_scale_metres2, source_name, raise_error_if_missing): """Error-checks input args for file-finding method. :param top_tracking_dir_name: Name of top-level directory with tracking data. :param tracking_scale_metres2: Tracking scale (minimum storm area). :param source_name: Data source (must be accepted by `storm_tracking_utils.check_data_source`). :param raise_error_if_missing: Boolean flag. If file is missing and `raise_error_if_missing = True`, the file-finding method will throw an error. :return: tracking_scale_metres2: Integer version of input. """ error_checking.assert_is_string(top_tracking_dir_name) error_checking.assert_is_greater(tracking_scale_metres2, 0) tracking_utils.check_data_source(source_name) error_checking.assert_is_boolean(raise_error_if_missing) return int(numpy.round(tracking_scale_metres2))
def _check_input_args_for_file_finding(top_processed_dir_name, tracking_scale_metres2, data_source, raise_error_if_missing): """Error-checks input arguments for file-finding methods. :param top_processed_dir_name: Name of top-level directory with processed tracking files. :param tracking_scale_metres2: Tracking scale (minimum storm area). :param data_source: Data source (must be accepted by `storm_tracking_utils.check_data_source`). :param raise_error_if_missing: Boolean flag. Determines whether or not, if (file is / files are) not found, the method will error out. :return: tracking_scale_metres2: Integer version of input. """ error_checking.assert_is_string(top_processed_dir_name) error_checking.assert_is_greater(tracking_scale_metres2, 0) tracking_utils.check_data_source(data_source) error_checking.assert_is_boolean(raise_error_if_missing) return int(numpy.round(tracking_scale_metres2))