コード例 #1
0
def earthquake_event_zip_filter(zip_eq_event):
    """Return true if zip_eq_event in the following format:

    YYYYBBDDhhmmss.out.zip
    for example : 20130226211002.out.zip

    :param zip_eq_event: Filename of zip.
    :type zip_eq_event: str

    :returns: True if it's a valid format.
    :rtype: bool
    """
    expected_length = len('20130226211002.out.zip')
    if len(zip_eq_event) != expected_length:
        return False
    event_id = zip_eq_event[:14]
    if is_event_id(event_id):
        return True
    else:
        return False
コード例 #2
0
def earthquake_map_filter(earthquake_map_path):
    """Return true if earthquake_map_path in correct format.

    Correct format : earthquake_impact_map_YYYYBBDDhhmmss.pdf
    For example : earthquake_impact_map_20120216181705.pdf

    :param earthquake_map_path: A string represent name of the earthquake map.
    :type earthquake_map_path: str

    :returns: True if in correct format, otherwise false.
    :rtype: bool
    """
    expected_length = len('earthquake_impact_map_20120216181705.pdf')
    if len(earthquake_map_path) != expected_length:
        return False

    event_id = get_event_id(earthquake_map_path)
    if is_event_id(event_id):
        return True
    else:
        return False