def get_origin_metadata(row):
    """
    Returns the dictionary of metadata from the origins
    """
    metadata = {
        'Nphases': _to_int(row[83:87]),
        'Nstations': _to_int(row[88:92]),
        'AzimuthGap': _to_float(row[93:96]),
        'minDist': _to_float(row[97:103]),
        'maxDist': _to_float(row[104:110]),
        'FixedTime': _to_str(row[22]),
        'DepthSolution': _to_str(row[54]),
        'AnalysisType': _to_str(row[111]),
        'LocationMethod': _to_str(row[113]),
        'EventType': _to_str(row[115:117])}
    return metadata
def get_origin_metadata(row):
    """
    Returns the dictionary of metadata from the origins
    """
    metadata = {
        'Nphases': _to_int(row[83:87]),
        'Nstations': _to_int(row[88:92]),
        'AzimuthGap': _to_float(row[93:96]),
        'minDist': _to_float(row[97:103]),
        'maxDist': _to_float(row[104:110]),
        'FixedTime': _to_str(row[22]),
        'DepthSolution': _to_str(row[54]),
        'AnalysisType': _to_str(row[111]),
        'LocationMethod': _to_str(row[113]),
        'EventType': _to_str(row[115:117])}
    return metadata
def get_origin_metadata(row):
    """
    Returns the dictionary of metadata from the origins
    """
    metadata = {
        "Nphases": _to_int(row[83:87]),
        "Nstations": _to_int(row[88:92]),
        "AzimuthGap": _to_float(row[93:96]),
        "minDist": _to_float(row[97:103]),
        "maxDist": _to_float(row[104:110]),
        "FixedTime": _to_str(row[22]),
        "DepthSolution": _to_str(row[54]),
        "AnalysisType": _to_str(row[111]),
        "LocationMethod": _to_str(row[113]),
        "EventType": _to_str(row[115:117]),
    }
    return metadata
def get_event_magnitude(row, event_id, selected_agencies=[]):
    """
    Creates an instance of an isf_catalogue.Magnitude object from the row
    string, or returns None if the author is not one of the selected agencies
    """
    origin_id = _to_str(row[30:])
    author = row[20:29].strip(" ")
    if len(selected_agencies) and not author in selected_agencies:
        # Magnitude does not corresond to a selected agency - ignore
        return None
    sigma = _to_float(row[11:14])
    nstations = _to_int(row[15:19])
    return Magnitude(
        event_id, origin_id, _to_float(row[6:10]), author, scale=row[:5].strip(" "), sigma=sigma, stations=nstations
    )
def get_event_magnitude(row, event_id, 
                        selected_agencies=[]):
                        #,selected_types=[]):
    """
    Creates an instance of an isf_catalogue.Magnitude object from the row
    string, or returns None if the author is not one of the selected agencies
    or magnitude types
    """
    origin_id = _to_str(row[30:])
    author = row[20:29].strip(' ')
    scale=row[:5].strip(' ')
    if (len(selected_agencies) and not author in selected_agencies):
        # Magnitude does not correspond to a selected agency - ignore
        return None
    sigma = _to_float(row[11:14])
    nstations = _to_int(row[15:19])
    return Magnitude(event_id, origin_id, _to_float(row[6:10]), author, 
                     scale=scale, sigma=sigma, stations=nstations)