def _add_channel_occ(ports, i):
    'Creates the channel occupancy column.'
    channel_width = [[800, 400, 1000, 500], [600, 300, 600, 300]]
    for row in range(len(ports[i])):
        vessel_class = ports[i].loc[(row, 'Class')]
        transit_type = ports[i].loc[(row, 'Transit')]
        eff_beam = ports[i].loc[(row, 'Effective Beam ft')]
        if ((vessel_class == 'Post-Panamax') & (transit_type == 'One-way Transit')):
            occ = ((eff_beam / channel_width[i][0]) * 100)
            ports[i].loc[(row, '% Channel Occupied')] = round(occ, 2)
        elif ((vessel_class == 'Post-Panamax') & (transit_type == 'Two-way Transit')):
            occ = ((eff_beam / channel_width[i][1]) * 100)
            ports[i].loc[(row, '% Channel Occupied')] = round(occ, 2)
        elif ((vessel_class == 'Panamax') & (transit_type == 'One-way Transit')):
            occ = ((eff_beam / channel_width[i][2]) * 100)
            ports[i].loc[(row, '% Channel Occupied')] = round(occ, 2)
        elif ((vessel_class == 'Panamax') & (transit_type == 'Two-way Transit')):
            occ = ((eff_beam / channel_width[i][3]) * 100)
            ports[i].loc[(row, '% Channel Occupied')] = round(occ, 2)
        else:
            sys.stderr.write(('Error: Undefined Class and ' + 'transit combination...\n'))
            ports[i].loc[(row, '% Channel Occupied')] = float('NaN')
    return ports[i]
Creates the channel occupancy column.
def _add_channel_occ(ports, i):
    
    channel_width = [[800, 400, 1000, 500], [600, 300, 600, 300]]
    for row in range(len(ports[i])):
        vessel_class = ports[i].loc[(row, 'Class')]
        transit_type = ports[i].loc[(row, 'Transit')]
        eff_beam = ports[i].loc[(row, 'Effective Beam ft')]
        if ((vessel_class == 'Post-Panamax') & (transit_type == 'One-way Transit')):
            occ = ((eff_beam / channel_width[i][0]) * 100)
            ports[i].loc[(row, '% Channel Occupied')] = round(occ, 2)
        elif ((vessel_class == 'Post-Panamax') & (transit_type == 'Two-way Transit')):
            occ = ((eff_beam / channel_width[i][1]) * 100)
            ports[i].loc[(row, '% Channel Occupied')] = round(occ, 2)
        elif ((vessel_class == 'Panamax') & (transit_type == 'One-way Transit')):
            occ = ((eff_beam / channel_width[i][2]) * 100)
            ports[i].loc[(row, '% Channel Occupied')] = round(occ, 2)
        elif ((vessel_class == 'Panamax') & (transit_type == 'Two-way Transit')):
            occ = ((eff_beam / channel_width[i][3]) * 100)
            ports[i].loc[(row, '% Channel Occupied')] = round(occ, 2)
        else:
            sys.stderr.write(('Error: Undefined Class and ' + 'transit combination...\n'))
            ports[i].loc[(row, '% Channel Occupied')] = float('NaN')
    return ports[i]