lat = coords[0] lon = coords[1] bl,x,y = bil.bilinear(lat, lon, df) wind = bl['t_interp'] wind_hourly = wind.rename('wind_speed') wind_locations[key] = wind_hourly else: # ERA5 weather print('Using weather data from ERA5') parameters = { 'wind_u': 'u10', 'wind_v': 'v10' } download.weather_era5(input_path, year, 1, 'I', 'wind', ['10m_u_component_of_wind', '10m_v_component_of_wind'], [ 60, -8, 50, 2, ]) df_u = read.weather_era5(input_path, year, 1, 'I', 'wind','u10') df_v = read.weather_era5(input_path, year, 1, 'I', 'wind','v10') print(df_v) # for each location ... for key, generator in generators.items(): # blinearly interpolate wind from weather grid coords = generator['coords'] lat = coords[0] lon = coords[1] bl_u,x,y = bil.bilinear(lat, lon, df_u) bl_v,x,y = bil.bilinear(lat, lon, df_v) wind_u = bl_u['t_interp'] wind_v = bl_v['t_interp'] wind_squared = wind_u.pow(2) + wind_u.pow(2) wind_hourly = wind_squared.pow(1/2).rename('wind_speed')
population_path = "/home/malcolm/uclan/tools/python/scripts/heat/input/populaiton" output_path = "/home/malcolm/uclan/output/correlation" year = 2018 hour = 1 grid = 'I' # get weather, if not already present download.weather_era5(output_path, year, hour, grid, 'weather', [ '2m_temperature', 'soil_temperature_level_4', '10m_u_component_of_wind', '10m_v_component_of_wind', 'surface_pressure', 'total_cloud_cover', 'instantaneous_large_scale_surface_precipitation_fraction', 'large_scale_rain_rate', 'precipitation_type', 'surface_solar_radiation_downwards', 'surface_solar_radiation_downward_clear_sky' ], [ 60, -8, 48, 2, ]) # read weather parameters = { 'air_temp': 't2m', 'soil_temp': 'stl4', 'wind_u': 'u10', 'wind_v': 'v10', 'pressure': 'sp', 'cloud': 'tcc',
lat = 53.7746 lon = -3.03647 site_location = pvlib.location.Location(lat, lon, tz=pytz.timezone('Europe/London')) # read ERA5 input_path = "/home/malcolm/uclan/input/" interim_path = "/home/malcolm/uclan/interim/" year = '2018' download.weather_era5(input_path, year, 1, 'I', 'pv', [ 'surface_solar_radiation_downwards', 'surface_solar_radiation_downward_clear_sky' ], [ 60, -8, 50, 2, ]) df_ir = read.weather_era5(input_path, year, 1, 'I', 'pv', 'ssrd') df_ir, x, y = bil.bilinear(lat, lon, df_ir) era5_ir = df_ir['t_interp'] df_cs = read.weather_era5(input_path, year, 1, 'I', 'pv', 'ssrdc') df_cs, x, y = bil.bilinear(lat, lon, df_cs) era5_cs = df_cs['t_interp'] # convert from J/m2 to wh/m2 era5_ir = era5_ir * 0.000277778 era5_cs = era5_cs * 0.000277778 # print(era5_ir) # print(era5_cs)