<commit_before>


import pandas as pd
import os
from cea.utilities import dbfreader
import cea.globalvar
import cea.inputlocator

__author__ = "<NAME>"
__copyright__ = "Copyright 2017, Architecture and Building Systems - ETH Zurich"
__credits__ = ["<NAME>", "<NAME>"]
__license__ = "MIT"
__version__ = "0.1"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Production"

def calc_spatio_temporal_visuals(locator, period, variables_to_plot, list_of_buildings, initial_date):

    # now the dates in which the building demand is calculated is stored in 'date'
    date = pd.date_range(initial_date, periods=8760, freq='H')[period[0]: period[1]]
    time = date.strftime("%Y%m%d%H%M%S")

    # this loop checks if all the buildings are selected and gets the building names from Total demand.csv file
    if 'all' in list_of_buildings:
        building_names = pd.read_csv(locator.get_total_demand())['Name'].values
    else:
        building_names = list_of_buildings

    for i, building in enumerate(building_names):
        # importing corresponding variables of each building and then slicing it to take just a single period value i.e a time step
        data = pd.read_csv(locator.PV_results(building))[variables_to_plot][period[0]: period[1]]
        data['date'] = time
        data['Name'] = building

        if i == 0:
            final = data
        else:
            final = final.append(data, ignore_index=True)

    dbfreader.dataframe_to_dbf(final, locator.get_4D_pv_plot(period))

def run_as_script():
    import cea.inputlocator
    import cea.config
    config = cea.config.Configuration()

    locator = cea.inputlocator.InputLocator(scenario_path=config.scenario)

    variables_to_plot = ['E_PV_gen_kWh', 'radiation_kWh']
    initial_date = '1/1/2015'
    list_of_buildings = ['all']  # 'all' for all buildings or else provide a list of building names
    period = [1, 168] # period in hours of the year to viualize
    calc_spatio_temporal_visuals(locator, period, variables_to_plot, list_of_buildings, initial_date)

if __name__ == '__main__':
    run_as_script()


<commit_msg>minor updates<commit_after>


import pandas as pd
import os
from cea.utilities import dbfreader
import cea.globalvar
import cea.inputlocator

__author__ = "<NAME>"
__copyright__ = "Copyright 2017, Architecture and Building Systems - ETH Zurich"
__credits__ = ["<NAME>", "<NAME>"]
__license__ = "MIT"
__version__ = "0.1"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Production"

def calc_spatio_temporal_visuals(locator, period, variables_to_plot, list_of_buildings, initial_date):

    # now the dates in which the building demand is calculated is stored in 'date'
    date = pd.date_range(initial_date, periods=8760, freq='H')[period[0]: period[1]]
    time = date.strftime("%Y%m%d%H%M%S")

    # this loop checks if all the buildings are selected and gets the building names from Total demand.csv file
    if 'all' in list_of_buildings:
        building_names = pd.read_csv(locator.get_total_demand())['Name'].values
    else:
        building_names = list_of_buildings

    for i, building in enumerate(building_names):
        # importing corresponding variables of each building and then slicing it to take just a single period value i.e a time step
        data = pd.read_csv(locator.PV_results(building))[variables_to_plot][period[0]: period[1]]
        data['date'] = time
        data['Name'] = building
        data['kWhperm2'] = data['radiation_kWh'] / data['Area_PV_m2']

        if i == 0:
            final = data
        else:
            final = final.append(data, ignore_index=True)

    dbfreader.dataframe_to_dbf(final, locator.get_4D_pv_plot(period))

def run_as_script():
    import cea.inputlocator
    import cea.config
    config = cea.config.Configuration()

    locator = cea.inputlocator.InputLocator(scenario_path=config.scenario)

    variables_to_plot = ['E_PV_gen_kWh', 'radiation_kWh', 'Area_PV_m2']
    initial_date = '1/1/2015'
    list_of_buildings = ['all']  # 'all' for all buildings or else provide a list of building names
    period = [1680, 1848] # period in hours of the year to viualize
    calc_spatio_temporal_visuals(locator, period, variables_to_plot, list_of_buildings, initial_date)

if __name__ == '__main__':
    run_as_script()



{'fraction_non_alphanumeric': 0.1023201856148492, 'fraction_numerical': 0.013689095127610209, 'mean_word_length': 4.042105263157895, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7574931', 'n_tokens_mistral': 1459, 'n_tokens_neox': 1377, 'n_words': 377}