def create_arb_matrix():
    arb_data = ImportData()
    crudes, destinations = crude_destination_check(arb_data)
    global_arbs = make_arbs(crudes, destinations, arb_data)
    """Assign the levels names"""
    global_arbs.columns.names, global_arbs.index.names = [
        'RefineryConfig', 'Grade', 'Region', 'Series'
    ], ['Date']
    global_arbs = global_arbs.round(2)
    return global_arbs
Exemplo n.º 2
0
    def test_get_data_load_everything_correct(self):
        # Arrange
        import_data = ImportData.ImportData()

        # Act
        data = import_data.get_data("../../Data/test.csv")

        expected = [[1, 2], [3, 4], [5, 6], [7, 8]]
        result = data
        # Assert
        self.assertListEqual(expected, result)
Exemplo n.º 3
0
    def transform_data(self,input_df,mapping_file,precession,column,new_datatype):
        
        
        map_df = read.csv_to_df(mapping_file)
        
        join_df = transform.inner_join_df(input_df,map_df)
        
        transformed_df = transform.transform_datatype(join_df,column,new_datatype)

        
        return transformed_df
Exemplo n.º 4
0
from ImportData import ImportData
from Point import Point
from Paint import Painter
from Autoclust import Autoclust
import configparser

if __name__ == '__main__':
    config = configparser.ConfigParser()
    config_file = "config.ini"
    config.read(config_file)
    import_data = ImportData.ImportData()
    path_to_data = config['DEFAULT']['path_to_data']
    data_raw = import_data.get_data(path_to_data)
    points = []
    for row in data_raw:
        point = Point.Point()
        point.init_data(row)
        points.append(point)
    points.sort(key=lambda e: (e.y, e.x))

    painter = Painter.Painter()
    painter.set_to_paint = points
    painter.paint_points_by_label()

    # phase 1
    algorithm = Autoclust.Autoclust()
    algorithm.load_data(points)
    algorithm.make_triangulation()
    algorithm.print_ambiguities_from_triangulation()
    painter.paint_delaunay(algorithm.point_array, algorithm.tri)
Exemplo n.º 5
0
    """This returns a dataframe with crack values and the sum of the GPW dependent on the ref config we have. 
    This is essentially saying to run the algo for the choice of crude through the refining configuration given. So for simple and complex,
    we need to pass alternative configurations"""

    base_yields = standard_ref(price_codes[pricing_centre]['base_blend'],
                               refinery_volume, reformer_capacity,
                               fcc_capacity, coker_capacity, lvn_gasolinepool,
                               kero_gasolinepool)
    base_crude = calculate_margin(base_yields)
    crude_yields = standard_ref(crude, refinery_volume, reformer_capacity,
                                fcc_capacity, coker_capacity, lvn_gasolinepool,
                                kero_gasolinepool)
    crude_gpw = calculate_margin(crude_yields)

    crude_gpw['Base_GPW'] = base_crude['GPW']
    return crude_gpw


if __name__ == "__main__":
    crude = 'AZERI'
    destination = 'Rotterdam'
    t5 = time.process_time()
    arb_data = ImportData()
    refinery_config = arb_data.refinery_configs['simple']
    test = gpw_calculation(crude, destination, arb_data,
                           arb_data.refinery_configs['simple'])
    print("ArbData created successfully: Time was {}".format(
        time.process_time() - t5))

#refinery_config = arb_data.refinery_configs['simple']
Exemplo n.º 6
0
 def import_data(self,input_file):
     
    
     input_df = read.csv_to_df(input_file)
     
     return input_df