pvcompare.era5.weather_df_from_era5¶
- pvcompare.era5.weather_df_from_era5(era5_netcdf_filename, lib, start=None, end=None)[source]¶
Gets ERA5 weather data from netcdf file and converts it to a pandas dataframe as required by the spcified lib.
- Parameters
era5_netcdf_filename (str) – Filename including path of netcdf file containing ERA5 weather data for specified time span and area.
start (None or anything pandas.to_datetime can convert to a timestamp) – Get weather data starting from this date. Defaults to None in which case start is set to first time step in the dataset.
end (None or anything pandas.to_datetime can convert to a timestamp) – Get weather data upto this date. Defaults to None in which case the end date is set to the last time step in the dataset.
area (shapely compatible geometry object (i.e. Polygon, Multipolygon, etc...) or list(float) or list(tuple)) – Area specifies for which geographic area to return weather data. Area can either be a single location or an area. In case you want data for a single location provide a list in the form [lon, lat]. If you want data for an area you can provide a shape of this area or specify a rectangular area giving a list of the form [(lon west, lon east), (lat south, lat north)].
- Returns
Dataframe with ERA5 weather data in format required by the lib. In case a single location is provided in parameter area index of the dataframe is a datetime index. Otherwise the index is a multiindex with time, latitude and longitude levels.
- Return type