Exemplo n.º 1
0
def main():
    df = load_shapefile(
        '../data/BCN_Private_communities_barrios/BCN_Private_communities_4326_SJ_barrios.shp'
    )
    df = clean_data(df)
    barrio_ids = df[['BARRI']].squeeze().unique()
    barrio_ids.sort()
    for barrio_id in barrio_ids:
        print("\nBARRI id: ", barrio_id)
        df_barrio = df[df['BARRI'] == barrio_id]

        nb_buildings = len(df_barrio.index)
        print("Number of buildings: ", nb_buildings)

        sum_build_consumption = df_barrio['Build_cons'].sum()
        print("Total Energy Consumption: ", round(sum_build_consumption))

        sum_build_co2 = df_barrio['Build_CO2'].sum()
        print("Total CO2 emission: ", round(sum_build_co2))

        avg_build_date = df_barrio['build_date'].apply(
            lambda bdate: float(bdate)).mean()
        print("Average building age: ", round(avg_build_date))

        sum_build_surface = df_barrio['build_surf'].sum()
        sum_build_surface = sum_build_surface * ureg['meter**2']
        # print("Total building surface: ", round(sum_build_surface))
        print(f'Total building surface:  {sum_build_surface:~H}')
def main():
    df = clean_data(
        load_shapefile('../data/Buildings_SJ/BCN_Avg_Energy_4326.shp'))
    drawer_map = DrawerMap(full_df=df,
                           color_col="en_cert",
                           xlim=(2.05, 2.23),
                           ylim=(41.313, 41.47),
                           bg_img='../out/background_greyscale.tif')
    drawer_chart = DrawerChart(full_df=df,
                               xcol="build_date",
                               ycol="en_cert",
                               xlabel="Build year",
                               ylabel="Energy Certificate",
                               dot_size=0.5,
                               line_size=1)

    drawer = Drawer(
        full_df=df,
        drawers=[drawer_map, drawer_chart],
        time_col='en_cert',
        # dpi = 600,
        dpi=72,
        save_dir_path='../out/building_cert/')

    drawer.draw_anime(save_anim_imgs=True, show=False)
def main():
    df = clean_data(
        load_shapefile(
            '../data/EIX_superblock_buildings_energy/EIX_superblock_buildings_energy_consumption_4326.shp'
        ))
    drawer_map = DrawerMap(full_df=df,
                           color_col="build_date",
                           xlim=(2.13, 2.20),
                           ylim=(41.313, 41.47))
    drawer_chart = DrawerChart(full_df=df,
                               xcol="build_date",
                               ycol="E_final",
                               xlabel="Build year",
                               ylabel="Energy (kWh/year)",
                               dot_size=0.5,
                               line_size=1)

    drawer = Drawer(
        full_df=df,
        drawers=[drawer_map, drawer_chart],
        time_col='superblock',
        # dpi = 600,
        dpi=72,
        save_dir_path='../out/buildyear_energy/')

    drawer.draw_anime(save_anim_imgs=True, show=False)
def main():
    df = load_shapefile(
        '../data/BCN_Private_communities/BCN_Private_communities_4326.shp')
    df = clean_data(df)
    cmap = plt.cm.RdYlGn.reversed()
    drawer_map = DrawerMap(
        full_df=df,
        color_col="E_certific",
        xlim=(2.05, 2.23),
        # ylim=(41.313, 41.47),
        bg_img='../out/background_greyscale.tif',
        cmap=cmap)
    drawer_stacked = DrawerStackedBar(full_df=df,
                                      xcol='build_date_10',
                                      group_col='E_certific',
                                      xlabel="Build year",
                                      ylabel="Energy Certificate",
                                      cmap=cmap)

    drawer_map.download_bg('../out/bg.tif')
    exit()

    drawer = Drawer(
        full_df=df,
        drawers=[drawer_map],
        # drawers=[drawer_map, drawer_stacked],
        time_col='build_date_10',
        dpi=600,
        # dpi=72,
        save_dir_path='../out/building_cert2/map/')

    # drawer.draw_anime(save_anim_imgs=True, show=False)
    drawer.draw_static()
def main():
    df = load_shapefile(
        '../data/BCN_Private_communities_barrios/BCN_Private_communities_4326_SJ_barrios.shp'
    )
    df = clean_data(df)
    drawer_hist = DrawerHist(full_df=df,
                             xcol='House_cons',
                             xlabel="Dwelling energy (kWh/year)",
                             ylabel="Density")

    drawer = Drawer(
        full_df=df,
        drawers=[drawer_hist],
        time_col='BARRI',
        is_time_cumulative=False,
        #time_col='build_date_10',
        dpi=600,
        #dpi=72,
        save_dir_path='../out/building_district_consumption/')

    drawer.draw_anime(save_anim_imgs=True, show=False)
Exemplo n.º 6
0
def main():
    df = clean_data(load_shapefile('../data/Buildings_SJ/BCN_Avg_Energy_4326.shp'))
    drawer_map = DrawerMap(full_df=df,
                           color_col="RES_energy",
                           xlim=(2.05, 2.23),
                           ylim=(41.313, 41.47))
    drawer_chart = DrawerChart(full_df=df,
                               xcol="build_date",
                               ycol="RES_energy",
                               xlabel="Build year",
                               ylabel="Energy (kWh/year)",
                               dot_size=0.5, line_size=1)

    drawer = Drawer(full_df=df,
                    drawers=[drawer_map, drawer_chart],
                    time_col='gr_by_age',
                    # dpi = 600,
                    dpi=72,
                    save_dir_path='../out/building_age/')
    
    drawer.draw_anime(save_anim_imgs=True, show=False)
Exemplo n.º 7
0
def main():
    df = clean_data(load_shapefile('../data/Income/BCN_City_Income.shp'))
    drawer_map = DrawerMap(full_df=df,
                           color_col="Avg_in_hou",
                           xlim=(2.02, 2.26),
                           ylim=(41.313, 41.47))
    drawer_chart = DrawerChart(
        full_df=df,
        xcol="Avg_in_hou",
        ycol="Avg_age",
        xlabel="Avg_in_hou",  # "Energy (kWh/year)"
        ylabel="Building age",
        dot_size=1,
        line_size=0)

    drawer = Drawer(
        full_df=df,
        drawers=[drawer_map, drawer_chart],
        time_col='quantile_time',
        # dpi = 600,
        dpi=72,
        save_dir_path='../out/income/')
    # drawer.draw_anime(save_anim_imgs=True)
    drawer.draw_static()