def main(): setup_logging() turbines = load_turbines() with ProgressBar(): for year in YEARS: for month in MONTHS: fname = ( INTERIM_DIR / 'wind_speed_usa_era5' / 'wind_speed_usa_era5-{}-{:02d}.nc'.format(year, month)) # here is a poor man Makefile, because it takes some while to convert all files if fname.exists(): logging.debug("Skipping %s", fname) continue logging.info("Processing %s...", fname) wind_velocity = load_wind_velocity(year=year, month=month) wind_speed = calc_wind_speed_at_turbines( wind_velocity, turbines) wind_speed.to_netcdf(fname)
if turbine_model_new != 'mixed' else 'mixed') repower_potential.attrs['turbine_model_new'] = turbine_model_new_fname repower_potential.attrs['turbine_model_old'] = turbine_model_old.file_name repower_potential.attrs['distance_factor'] = ( distance_factor if distance_factor is not None else 0) df_filename = '' if distance_factor is None else f'_{distance_factor}' fname = (INTERIM_DIR / 'repower_potential' / f'repower_potential_{turbine_model_old.file_name}_' f'{turbine_model_new_fname}{df_filename}.nc') repower_potential.to_netcdf(fname) def main(): distance_factors = (None, ) if COMPUTE_CONSTANT_DISTANCE_FACTORS: distance_factors += DISTANCE_FACTORS params = product(new_turbine_models() + ('mixed', ), distance_factors) with Pool(processes=NUM_PROCESSES) as pool: pool.map(calc_optimal_locations_worker, params) if __name__ == '__main__': setup_logging() main()