示例#1
0
def write_csv_files(dem_filename, heat_demand):
    filename = dem_filename + '.csv'
    allunits = heat_demand
    if WRITE_CSV_FILES is True:
        for c in allunits:
            make_dir((output_folder))
            make_dir(output_folder + source_folder + 'Database')
            folder = output_folder + source_folder + 'Database/' + scenario + 'Heat_demand/'
            make_dir(folder)
            make_dir(folder + c)
            allunits[c].to_csv(folder + c + '/' + filename)
    else:
        print('[WARNING ]: ' +
              'WRITE_CSV_FILES = False, unable to write .csv files')
def write_csv_files(filename, variable, write_csv=None):
    """
    Function that generates .csv files in the Output/Database/TotalLoadValue folder
    :filename:      has to be a string
    :variable:      p_curve_scaled_ev for example
    """
    filename = filename + '.csv'
    variable = variable
    if write_csv is True:
        for c in p_curve_scaled_ev.columns:
            make_dir((output_folder))
            make_dir(output_folder + source_folder + '/Database')
            folder = output_folder + source_folder + '/Database/' + scenario + '/TotalLoadValue/'
            make_dir(folder)
            folder = folder + c
            make_dir(folder)
            folder = folder + '/1h'
            make_dir(folder)
            variable[c].to_csv(folder + '/' + filename, header=False)
    else:
        print('[WARNING ]: ' +
              'WRITE_CSV_FILES = False, unable to write .csv files')
def write_csv_files(filename, variable, write_csv=None):
    """
    Function that generates .csv files in the Output/Database/AvailabilityFactors folder
    :filename:      has to be a string
    :variable:      af_scaled for example
    """
    filename = filename + '.csv'
    variable = variable
    if write_csv is True:
        for c in countries:
            make_dir((output_folder))
            make_dir(output_folder + 'JRC_EU_TIMES/' + 'Database')
            folder = output_folder + 'JRC_EU_TIMES/' + 'Database/' + scenario + '/AvailabilityFactors/'
            make_dir(folder)
            folder = folder + c
            make_dir(folder)
            folder = folder + '/1h'
            make_dir(folder)
            variable[c].to_csv(folder + '/' + filename)
    else:
        print('[WARNING ]: ' +
              'WRITE_CSV_FILES = False, unable to write .csv files')
def write_csv_files(filename, variable, write_csv=None):
    """
    Function that generates .csv files in the Output/Database/DayAheadNTC/1h/ folder
    :filename:      has to be a string)
    :variable:      ntc_2050_14 for example
    """
    filename = filename + '.csv'
    variable = variable
    if write_csv is True:
        make_dir((output_folder))
        make_dir(output_folder + '/' + source_folder + '/Database')
        folder = output_folder + source_folder + '/Database/' + scenario + '/DayAheadNTC/'
        make_dir(folder)
        folder = folder + '/1h'
        make_dir(folder)
        variable.to_csv(folder + '/' + filename)
    else:
        print('[WARNING ]: ' +
              'WRITE_CSV_FILES = False, unable to write .csv files')
示例#5
0
def write_csv_files(h2_TimeSeries, write_csv=None):
    """
    Function that generates .csv files in the Output/Database/h2_demand/ folder
    :h2_TimeSeries:  DataFrame with H2 demand at each hour for each zone
    """
    if write_csv is True:
        filename = 'H2_Demand' + '_' + '2050' + '.csv'
        make_dir((output_folder))
        make_dir(output_folder + source_folder + 'Database')
        folder = output_folder + source_folder + 'Database/' + scenario + 'H2_demand/'
        make_dir(folder)
        h2_TimeSeries.to_csv(folder + '/' + filename)
    else:
        print('[WARNING ]: ' +
              'WRITE_CSV_FILES = False, unable to write .csv files')
def write_csv_files(file_name, demand, write_csv=None):
    '''
    Function that generates .csv files in the Output/Database/PowerPlants/ folder
    :power_plant_filename:      clustered for example (has to be a string)
    :units:                     allunits for example
    '''
    filename = file_name + '.csv'
    if write_csv == True:
        for c in demand:
            make_dir(output_folder + 'Database')
            folder = output_folder + 'Database/TotalLoadValue/'
            make_dir(folder)
            make_dir(folder + c)
            demand[c].to_csv(folder + c + '/' + filename)
    else:
        print('[WARNING ]: ' +
              'WRITE_CSV_FILES = False, unable to write .csv files')
示例#7
0
def write_csv_files(filename, data, write_csv=None):
    '''
    Function that generates .csv files in the Output/Database/PowerPlants/ folder
    :power_plant_filename:      clustered for example (has to be a string)
    :units:                     allunits for example
    '''
    filename = filename + '.csv'
    if write_csv == True:
        make_dir(output_folder + 'Database')
        folder = output_folder + 'Database/DayAheadNTC/'
        make_dir(folder)
        folder = folder + '/1h/'
        make_dir(folder)
        data.to_csv(folder + '/' + filename)
    else:
        print('[WARNING ]: ' +
              'WRITE_CSV_FILES = False, unable to write .csv files')
def write_csv_files(file_name_AF,
                    file_name_IF,
                    file_name_RL,
                    res_timeseries,
                    inflow_timeseries,
                    reservoirs_timeseries,
                    scenario,
                    write_csv=None):
    '''
    Function that generates .csv files in the Output/Database/PowerPlants/ folder
    :power_plant_filename:      clustered for example (has to be a string)
    :units:                     allunits for example
    '''
    filename_AF = file_name_AF + '.csv'
    filename_IF = file_name_IF + '.csv'
    filename_RL = file_name_RL + '.csv'
    if write_csv == True:
        for c in res_timeseries:
            make_dir(output_folder + source_folder + 'Database' + scenario +
                     '/')
            folder = output_folder + source_folder + 'Database/' + scenario + '/AvailabilityFactors/'
            make_dir(folder)
            make_dir(folder + c)
            res_timeseries[c].to_csv(folder + c + '/' + filename_AF)
        for c in inflow_timeseries:
            make_dir(output_folder + source_folder + 'Database' + scenario +
                     '/')
            make_dir(output_folder + source_folder + 'Database/' + scenario +
                     '/HydroData/')
            folder_1 = output_folder + source_folder + 'Database/' + scenario + '/HydroData/ScaledInflows/'
            make_dir(folder_1)
            make_dir(folder_1 + c)
            inflow_timeseries[c].to_csv(folder_1 + c + '/' + filename_IF)
        for c in reservoirs_timeseries:
            folder_2 = output_folder + source_folder + 'Database/' + scenario + '/HydroData/ScaledLevels/'
            make_dir(folder_2)
            make_dir(folder_2 + c)
            reservoirs_timeseries[c].to_csv(folder_2 + c + '/' + filename_RL)
    else:
        print('[WARNING ]: ' +
              'WRITE_CSV_FILES = False, unable to write .csv files')
示例#9
0

#%%
# Try to load the historical flows if they were already computed.

try:
    flows = pd.read_pickle('historical_flows_' + str(year) + '.p')
except:
    print('Could not laod the historical flows (they will thus not be considered). Try running the get_HistoricalFlows.py script first')

data3 = data2.copy()
maxflows = flows.max()
maxntc = data2.max()

for i in maxflows.index:
    if i in data2:
        print('Connection ' + i + '. Maximum historical flow: ' + str(maxflows[i]) + '. Maximum NTC: ' + str(maxntc[i]))
    else:
        print('Connection ' + i + '. No NTC was found for this connection')
        data3[i] = maxflows[i]

#%%

if write_csv:
    make_dir('Database')
    make_dir('Database/DayAheadNTC')
    make_dir('Database/DayAheadNTC/1h')
    #data2.to_csv('Database/DayAheadNTC/1h/'+str(year)+'.csv')
    data3.to_csv('Database/DayAheadNTC/1h/'+str(year)+'.csv')