Example #1
0
        config.bigmacc.key = key
        print(config.bigmacc.key)
        try:
            t1 = time.perf_counter()
            cea.bigmacc.bigmacc_operations.run_bigmacc(config)
            time_end = time.perf_counter() - t1
            print('Completed iteration in: %d.2 seconds' % time_end)
        except:
            print(f'THERE WAS AN ERROR IN {key}.')
            error_path = os.path.join(bigmacc_outputs_path, 'error_logger.csv')

            if os.path.exists(error_path):
                pass
            else:
                initialdf = pd.DataFrame(columns=['Experiment'])
                initialdf.to_csv(error_path)
            error_df = pd.read_csv(error_path, index_col='Unnamed: 0')
            error_df = error_df.append(
                pd.DataFrame({'Experiments': 'exp_{}'.format(key)}))
            error_df.to_csv(error_path)
            error_df.to_csv(r"C:\Users\justi\Desktop\error_log_backup.csv")
    duration = 1000  # milliseconds
    freq = 440  # Hz
    winsound.Beep(freq, duration)

    print('Simulations completed. Move to next scenario.')


if __name__ == '__main__':
    main(cea.config.Configuration())
Example #2
0
    zarr_path = os.path.join(
        config.bigmacc.data, config.general.parent, 'bigmacc_out',
        config.bigmacc.round,
        f"hourly_{config.general.parent}_{config.bigmacc.key}")
    hourly.to_zarr(zarr_path, mode='w', consolidated=True)
    return print(f' - Saved hourly dataset zarr to {zarr_path}')


def main(config, time_scale='none'):
    if time_scale == 'hourly':
        print(f' - Creating hourly dataset for {config.bigmacc.key}.')
        t1 = time.perf_counter()
        netcdf_hourly(config)
        time_end = time.perf_counter() - t1
        print(time_end)
        print(f' - Hourly dataset for {config.bigmacc.key} saved to netcdf.')
    elif time_scale == 'whole':
        print(f' - Creating whole dataset for {config.general.parent}.')
        t1 = time.perf_counter()
        save_whole_dataset(config)
        time_end = time.perf_counter() - t1
        print(time_end)
        print(f' - Whole dataset for {config.general.parent} saved to netcdf.')
    else:
        print(' - No netcdf files saved')
    return print(' ')


if __name__ == '__main__':
    main(cea.config.Configuration(), time_scale='hourly')