def find_samp_rec(s, data, az_type):
    """
    find the orientation info for samp s
    """
    datablock, or_error, bed_error = [], 0, 0
    orient = {}
    orient["sample_dip"] = ""
    orient["sample_azimuth"] = ""
    orient['sample_description'] = ""
    for rec in data:
        if rec["er_sample_name"].lower() == s.lower():
            if 'sample_orientation_flag' in list(rec.keys()) and rec['sample_orientation_flag'] == 'b':
                orient['sample_orientation_flag'] = 'b'
                return orient
            if "magic_method_codes" in list(rec.keys()) and az_type != "0":
                methods = rec["magic_method_codes"].replace(" ", "").split(":")
                if az_type in methods and "sample_azimuth" in list(rec.keys()) and rec["sample_azimuth"] != "":
                    orient["sample_azimuth"] = float(rec["sample_azimuth"])
                if "sample_dip" in list(rec.keys()) and rec["sample_dip"] != "":
                    orient["sample_dip"] = float(rec["sample_dip"])
                if "sample_bed_dip_direction" in list(rec.keys()) and rec["sample_bed_dip_direction"] != "":
                    orient["sample_bed_dip_direction"] = float(
                        rec["sample_bed_dip_direction"])
                if "sample_bed_dip" in list(rec.keys()) and rec["sample_bed_dip"] != "":
                    orient["sample_bed_dip"] = float(rec["sample_bed_dip"])
            else:
                if "sample_azimuth" in list(rec.keys()):
                    orient["sample_azimuth"] = float(rec["sample_azimuth"])
                if "sample_dip" in list(rec.keys()):
                    orient["sample_dip"] = float(rec["sample_dip"])
                if "sample_bed_dip_direction" in list(rec.keys()):
                    orient["sample_bed_dip_direction"] = float(
                        rec["sample_bed_dip_direction"])
                if "sample_bed_dip" in list(rec.keys()):
                    orient["sample_bed_dip"] = float(rec["sample_bed_dip"])
                if 'sample_description' in list(rec.keys()):
                    orient['sample_description'] = rec['sample_description']
        if orient["sample_azimuth"] != "":
            break
    return orient
def find_samp_rec ( s , data , az_type ) : datablock , or_error , bed_error = [ ] , 0 , 0 orient = { } orient [ "sample_dip" ] = "" orient [ "sample_azimuth" ] = "" orient [ 'sample_description' ] = "" for rec in data : if rec [ "er_sample_name" ] . lower ( ) == s . lower ( ) : if 'sample_orientation_flag' in list ( rec . keys ( ) ) and rec [ 'sample_orientation_flag' ] == 'b' : orient [ 'sample_orientation_flag' ] = 'b' return orient if "magic_method_codes" in list ( rec . keys ( ) ) and az_type != "0" : methods = rec [ "magic_method_codes" ] . replace ( " " , "" ) . split ( ":" ) if az_type in methods and "sample_azimuth" in list ( rec . keys ( ) ) and rec [ "sample_azimuth" ] != "" : orient [ "sample_azimuth" ] = float ( rec [ "sample_azimuth" ] ) if "sample_dip" in list ( rec . keys ( ) ) and rec [ "sample_dip" ] != "" : orient [ "sample_dip" ] = float ( rec [ "sample_dip" ] ) if "sample_bed_dip_direction" in list ( rec . keys ( ) ) and rec [ "sample_bed_dip_direction" ] != "" : orient [ "sample_bed_dip_direction" ] = float ( rec [ "sample_bed_dip_direction" ] ) if "sample_bed_dip" in list ( rec . keys ( ) ) and rec [ "sample_bed_dip" ] != "" : orient [ "sample_bed_dip" ] = float ( rec [ "sample_bed_dip" ] ) else : if "sample_azimuth" in list ( rec . keys ( ) ) : orient [ "sample_azimuth" ] = float ( rec [ "sample_azimuth" ] ) if "sample_dip" in list ( rec . keys ( ) ) : orient [ "sample_dip" ] = float ( rec [ "sample_dip" ] ) if "sample_bed_dip_direction" in list ( rec . keys ( ) ) : orient [ "sample_bed_dip_direction" ] = float ( rec [ "sample_bed_dip_direction" ] ) if "sample_bed_dip" in list ( rec . keys ( ) ) : orient [ "sample_bed_dip" ] = float ( rec [ "sample_bed_dip" ] ) if 'sample_description' in list ( rec . keys ( ) ) : orient [ 'sample_description' ] = rec [ 'sample_description' ] if orient [ "sample_azimuth" ] != "" : break return orient
find the orientation info for samp s