Compute the eligible share within cutout cells in the overlap with shapes.
For parallel calculation (nprocesses not None) the excluder must not be
initialized and all raster references must be strings. Otherwise processes
are colliding when reading from one common rasterio.DatasetReader.
Parameters:
cutout (atlite.Cutout) – Cutout which the availability matrix is aligned to.
shapes (geopandas.Series/geopandas.DataFrame) – Geometries for which the availabilities are calculated.
excluder (atlite.gis.ExclusionContainer) – Container of all meta data or objects which to exclude, i.e.
rasters and geometries.
nprocesses (int, optional) – Number of processes to use for calculating the matrix. The paralle-
lization can heavily boost the calculation speed. The default is None.
disable_progressbar (bool, optional) – Disable the progressbar if nprocesses is not None. Then the map
function instead of the imap function is used for the multiprocessing
pool. This speeds up the calculation.
Returns:
availabilities – DataArray of shape (|shapes|, |y|, |x|) containing all the eligible
share of cutout cell (x,y) in the overlap with shape i.
Return type:
xr.DataArray
Notes
The rasterio (or GDAL) average downsampling returns different results
dependent on how the target raster (the cutout raster) is spanned.
Either it is spanned from the top left going downwards,
e.g. Affine(0.25, 0, 0, 0, -0.25, 50), or starting in the
lower left corner and going up, e.g. Affine(0.25, 0, 0, 0, 0.25, 50).
Here we stick to the top down version which is why we use
cutout.transform_r and flipping the y-axis in the end.
Convert and aggregate a weather-based renewable generation time-series.
This is a gateway function called by the individual time-series
generation functions like pv and wind. All parameters documented
here are also available from those functions.
convert_func (callable) – Callback like convert_wind, convert_pv.
matrix (N x S - xr.DataArray or sp.sparse.csr_matrix or None) – If given, it is used to aggregate the grid cells to buses.
N is the number of buses, S the number of spatial coordinates, in the
order of cutout.grid.
index (pd.Index) – Index of Buses.
layout (X x Y - xr.DataArray) – The capacity to be build in each of the grid_cells.
shapes (list or pd.Series of shapely.geometry.Polygon) – If given, matrix is constructed as indicatormatrix of the polygons, its
index determines the bus index on the time-series.
shapes_crs (pyproj.CRS or compatible) – If different to the map crs of the cutout, the shapes are
transformed to match cutout.crs (defaults to EPSG:4326).
per_unit (boolean) – Returns the time-series in per-unit units, instead of in MW (defaults
to False).
return_capacity (boolean) – Additionally returns the installed capacity at each bus corresponding
to layout (defaults to False).
aggregate_time ("sum", "mean", "legacy", or None) – Controls temporal aggregation of results. "sum" sums over time,
"mean" averages over time, None returns full timeseries.
"legacy" (default) preserves historical behavior: time-summed
without spatial aggregation and full timeseries with spatial
aggregation; this option is deprecated and will be removed in a
future release. Replaces the deprecated capacity_factor and
capacity_factor_timeseries parameters.
capacity_factor (boolean) – Deprecated. Use aggregate_time="mean" instead.
capacity_factor_timeseries (boolean) – Deprecated. Use aggregate_time=None instead (which is the default).
show_progress (boolean, default False) – Whether to show a progress bar.
dask_kwargs (dict, default {}) – Dict with keyword arguments passed to dask.compute.
**convert_kwds (Any) – Additional keyword arguments passed to convert_func.
Returns:
resource (xr.DataArray) – The return value depends on which arguments are provided:
With aggregation (matrix, shapes, or layout given):
Time-series of renewable generation aggregated to buses, with
dimensions (bus,time). If aggregate_time is set, the time
dimension is reduced accordingly.
Convert outside temperature into daily cooling demand using degree-day approximation.
The formula is max(0,a*(T_daily_mean-threshold))+constant
where T_daily_mean is the daily-averaged temperature. Output is in
degree-day-like units (scaled by a).
Since “daily average temperature” means different things in different time
zones, you can provide hour_shift to redefine when the day starts.
E.g. for Moscow in summer hour_shift=3, for New York hour_shift=-4.
The shift applies uniformly across all grid cells and times.
threshold (float, default 23.0) – Outside temperature in °C below which there is no cooling demand.
The default follows European computational practices (UK Met Office
uses 22 °C, European Commission uses 24 °C).
a (float, default 1.0) – Linear factor relating cooling demand to outside temperature.
constant (float, default 0.0) – Constant part of cooling demand independent of outside temperature
(e.g. ventilation).
hour_shift (float, default 0.0) – Time shift in hours relative to UTC for daily averaging.
Daily cooling demand time-series in degree-day-like units.
Return type:
xr.DataArray
Warning
Because the original data is provided per month, at month boundaries
there is untidiness when using a time shift. The resulting array will
have duplicate indices for parts of the day at each boundary. You must
re-average these based on the number of hours in each month.
installation (str or xr.DataArray) – CSP installation details determining the solar field efficiency
dependent on the local solar position. Can be a name accepted by
atlite.resource.get_cspinstallationconfig() or an
xr.DataArray with 'azimuth' (rad) and 'altitude' (rad)
coordinates and an 'efficiency' (p.u.) entry.
technology ({"parabolic trough", "solar tower"} or None) – Overwrite CSP technology from the installation configuration.
'parabolictrough' uses direct horizontal irradiance (DHI),
'solartower' uses direct normal irradiance (DNI).
**params – Additional keyword arguments passed to convert_and_aggregate.
Returns:
csp – CSP generation time-series in specific yield (kWh/kW_ref), clipped
to [0, 1]. See convert_and_aggregate() for details on
aggregation behaviour.
Convert outside temperature into daily heat demand using degree-day approximation.
The formula is max(0,a*(threshold-T_daily_mean))+constant
where T_daily_mean is the daily-averaged temperature. Output is in
degree-day-like units (scaled by a).
Since “daily average temperature” means different things in different time
zones, you can provide hour_shift to redefine when the day starts.
E.g. for Moscow in winter hour_shift=4, for New York hour_shift=-5.
The shift applies uniformly across all grid cells and times.
Daily heat demand time-series in degree-day-like units.
Return type:
xr.DataArray
Warning
Because the original data is provided per month, at month boundaries
there is untidiness when using a time shift. The resulting array will
have duplicate indices for parts of the day at each boundary. You must
re-average these based on the number of hours in each month.
plants (pd.DataFrame) – Run-of-river plants or dams with lon, lat columns.
hydrobasins (str|gpd.GeoDataFrame) – Filename or GeoDataFrame of one level of the HydroBASINS dataset.
flowspeed (float) – Average speed of water flows to estimate the water travel time from
basin to plant (default: 1 m/s).
weight_with_height (bool) – Whether surface runoff should be weighted by potential height (probably
better for coarser resolution).
show_progress (bool) – Whether to display progressbars.
**kwargs – Additional keyword arguments passed to convert_and_aggregate.
Returns:
Inflow time-series for each plant.
Return type:
xr.DataArray
References
[1] Liu, Hailiang, et al. “A validated high-resolution hydro power
time-series model for energy systems analysis.” arXiv preprint
arXiv:1901.08476 (2019).
[2] Lehner, B., Grill G. (2013): Global river hydrography and network
routing: baseline data and new approaches to study the world’s large river
systems. Hydrological Processes, 27(15): 2171–2186. Data is available at
www.hydrosheds.org.
The indicatormatrix I[i,j] is a sparse representation of the ratio
of the area in orig[j] lying in dest[i], where orig and dest are
collections of polygons, i.e.
A value of I[i,j] = 1 indicates that the shape orig[j] is fully
contained in shape dest[j].
Note that the polygons must be in the same crs.
Parameters:
shapes (Collection of shapely polygons) – Shapes to compute the indicator matrix for.
shapes_crs (int or CRS, default 4326) – CRS of the shapes.
orientation (str, dict or callback) – Panel orientation can be chosen from either
‘latitude_optimal’, a constant orientation {‘slope’: 0.0,
‘azimuth’: 0.0} or a callback function with the same signature
as the callbacks generated by the
‘atlite.pv.orientation.make_*’ functions.
irradiation (str) – The irradiation quantity to be returned. Defaults to “total” for total
combined irradiation. Other options include “direct” for direct irradiation,
“diffuse” for diffuse irradation, and “ground” for irradiation reflected
by the ground via albedo. NOTE: “ground” irradiation is not calculated
by all trigon_model options in the convert_irradiation method,
so use with caution!
tracking (None or str:) – None for no tracking, default
‘horizontal’ for 1-axis horizontal tracking
‘tilted_horizontal’ for 1-axis horizontal tracking with tilted axis
‘vertical’ for 1-axis vertical tracking
‘dual’ for 2-axis tracking
clearsky_model (str or None) – Either the ‘simple’ or the ‘enhanced’ Reindl clearsky
model. The default choice of None will choose dependending on
data availability, since the ‘enhanced’ model also
incorporates ambient air temperature and relative humidity.
**params (Any) – Additional keyword arguments passed to convert_and_aggregate.
Returns:
irradiation – Irradiation on the tilted surface in W/m².
Get a capacity layout aligned to the cutout based on a capacity list.
Parameters:
data (pandas.DataFrame) – Capacity list with columns ‘x’, ‘y’ and col. Each capacity entry
is added to the grid cell intersecting with the coordinate (x,y).
col (str, optional) – Name of the column with capacity values. The default is ‘Capacity’.
Returns:
Capacity layout with dimensions ‘x’ and ‘y’ indicating the total
capacity placed within one grid cell.
Create a dynamic line rating time series based on the IEEE-738 standard.
[1].
The steady-state capacity is derived from the balance between heat
losses due to radiation and convection, and heat gains due to solar influx
and conductur resistance. For more information on assumptions and modifications
see convert_line_rating.
[1]“IEEE Std 738™-2012 (Revision of IEEE Std 738-2006/Incorporates IEEE Std
738-2012/Cor 1-2013), IEEE Standard for Calculating the Current-Temperature
Relationship of Bare Overhead Conductors,” p. 72.
Prepare all or a selection of features in a cutout.
This function loads the feature data of a cutout, e.g. influx or runoff.
When not specifying the feature argument, all available features will be
loaded. The function compares the variables which are already included in
the cutout with the available variables of the modules specified by the
cutout. It detects missing variables and stores them into the netcdf file
of the cutout.
features (str/list, optional) – Feature(s) to be prepared. The default slice(None) results in all
available features.
tmpdir (str/Path, optional) – Directory in which temporary files (for example retrieved ERA5 netcdf
files) are stored. If set, the directory will not be deleted and the
intermediate files can be examined. The path must be a valid path.
data_format (str, optional) – The data format used to retrieve the data. Only relevant for ERA5 data. The default is ‘grib’.
overwrite (bool, optional) – Whether to overwrite variables which are already included in the
cutout. The default is False.
compression (None/dict, optional) – Compression level to use for all features which are being prepared.
The compression is handled via xarray.Dataset.to_netcdf(…), for details see:
https://docs.xarray.dev/en/stable/generated/xarray.Dataset.to_netcdf.html .
To efficiently reduce cutout sizes, specify the number of ‘least_significant_digits’: n here.
To disable compression, set “complevel” to None.
Default is {‘zlib’: True, ‘complevel’: 9, ‘shuffle’: True}.
show_progress (bool, optional) – If True, a progress bar is shown. The default is False.
dask_kwargs (dict, default {}) – Dict with keyword arguments passed to dask.compute.
monthly_requests (bool, optional) – If True, the data is requested on a monthly basis in ERA5. This is useful for
large cutouts, where the data is requested in smaller chunks. The
default is False
concurrent_requests (bool, optional) – If True, the monthly data requests are posted concurrently.
Only has an effect if monthly_requests is True. The default is False.
Returns:
cutout – Cutout with prepared data. The variables are stored in cutout.data.
orientation (str, dict or callback) – Panel orientation can be chosen from either
‘latitude_optimal’, a constant orientation {‘slope’: 0.0,
‘azimuth’: 0.0} or a callback function with the same signature
as the callbacks generated by the
‘atlite.pv.orientation.make_*’ functions.
tracking (None or str:) – None for no tracking, default
‘horizontal’ for 1-axis horizontal tracking
‘tilted_horizontal’ for 1-axis horizontal tracking with tilted axis
‘vertical’ for 1-axis vertical tracking
‘dual’ for 2-axis tracking
clearsky_model (str or None) – Either the ‘simple’ or the ‘enhanced’ Reindl clearsky
model. The default choice of None will choose dependending on
data availability, since the ‘enhanced’ model also
incorporates ambient air temperature and relative humidity.
**params (Any) – Additional keyword arguments passed to convert_and_aggregate.
Returns:
pv – PV generation time-series. Without aggregation, values are capacity
factors (unitless, 0–1). With aggregation and per_unit=False,
values are in MW. See convert_and_aggregate() for details.
[1] Soteris A. Kalogirou. Solar Energy Engineering: Processes and Systems,
pages 49–117,469–516. Academic Press, 2009. ISBN 0123745012.
[2] D.T. Reindl, W.A. Beckman, and J.A. Duffie. Diffuse fraction correla-
tions. Solar Energy, 45(1):1 – 7, 1990.
[3] Hans Georg Beyer, Gerd Heilscher and Stefan Bofinger. A Robust Model
for the MPP Performance of Different Types of PV-Modules Applied for
the Performance Check of Grid Connected Systems, Freiburg, June 2004.
Eurosun (ISES Europe Solar Congress).
Compute aggregated surface runoff with optional smoothing and normalization.
Parameters:
cutout (atlite.Cutout) – Cutout providing weather data with runoff variables.
smooth (bool or int, optional) – If True, apply a rolling mean with the default window of
24*7 time steps. If an integer, use it as the rolling window
size. Default None (no smoothing).
lower_threshold_quantile (bool or float, optional) – If True, use the default quantile 5e-3. If a float, set
values below that quantile to zero. Default None (no
thresholding).
normalize_using_yearly (pd.Series, optional) – Annual country totals used to scale countries-indexed results over
overlapping full years. One factor per country is derived from the
summed reference values across the overlap.
**params – Additional keyword arguments passed to convert_and_aggregate(),
including weight_with_height for the underlying runoff
conversion.
Returns:
Runoff output from convert_and_aggregate. Smoothing also supports
the tuple return form used with return_capacity=True. Thresholding
and normalization are only supported for xr.DataArray results.
path (str | path-like) – File where to store the sub-cutout. Defaults to a temporary file.
bounds (gpd.GeoSeries.bounds | DataFrame, optional) – The outer bounds of the cutout or as a DataFrame
containing (min.long, min.lat, max.long, max.lat).
buffer (float, optional) – Buffer around the bounds. The default is 0.
**kwargs – Passed to xr.Dataset.sel for data selection.
orientation (dict, str, or callable, optional) – Panel orientation. A dict with 'slope' and 'azimuth' keys
in degrees, the string 'latitude_optimal', or a callable with
the same signature as callbacks from
atlite.pv.orientation.make_*. Default: {'slope':45.0,'azimuth':180.0}.
trigon_model ({"simple", "perez"}, default "simple") – Trigonometric model for tilted irradiation decomposition.
clearsky_model ({"simple", "enhanced"} or None, default "simple") – Clear-sky model for diffuse irradiation. 'enhanced' also uses
ambient temperature and relative humidity.
A turbineconfig dictionary with the keys ‘hub_height’ for the
hub height and ‘V’, ‘POW’ defining the power curve.
Alternatively a str refering to a local or remote turbine configuration
as accepted by atlite.resource.get_windturbineconfig(). Locally stored turbine
configurations can also be modified with this function. E.g. to setup a different hub
height from the one used in the yaml file,one would write
smooth (bool or dict) – If True smooth power curve with a gaussian kernel as
determined for the Danish wind fleet to Delta_v = 1.27 and
sigma = 2.29. A dict allows to tune these values.
add_cutout_windspeed (bool) – If True and in case the power curve does not end with a zero, will add zero power
output at the highest wind speed in the power curve. If False, a warning will be
raised if the power curve does not have a cut-out wind speed. The default is
False.
interpolation_method ({"logarithmic", "power"}) – Law to interpolate wind speed to turbine hub height. Refer to
atlite.wind.extrapolate_wind_speed().
**params (Any) – Additional keyword arguments passed to convert_and_aggregate.
Returns:
resource – Wind generation time-series. Without aggregation, values are capacity
factors (MWh/MWp). With aggregation and per_unit=False, values are
in MW. See convert_and_aggregate() for details.
Prepare all or a selection of features in a cutout.
This function loads the feature data of a cutout, e.g. influx or runoff.
When not specifying the feature argument, all available features will be
loaded. The function compares the variables which are already included in
the cutout with the available variables of the modules specified by the
cutout. It detects missing variables and stores them into the netcdf file
of the cutout.
features (str/list, optional) – Feature(s) to be prepared. The default slice(None) results in all
available features.
tmpdir (str/Path, optional) – Directory in which temporary files (for example retrieved ERA5 netcdf
files) are stored. If set, the directory will not be deleted and the
intermediate files can be examined. The path must be a valid path.
data_format (str, optional) – The data format used to retrieve the data. Only relevant for ERA5 data. The default is ‘grib’.
overwrite (bool, optional) – Whether to overwrite variables which are already included in the
cutout. The default is False.
compression (None/dict, optional) – Compression level to use for all features which are being prepared.
The compression is handled via xarray.Dataset.to_netcdf(…), for details see:
https://docs.xarray.dev/en/stable/generated/xarray.Dataset.to_netcdf.html .
To efficiently reduce cutout sizes, specify the number of ‘least_significant_digits’: n here.
To disable compression, set “complevel” to None.
Default is {‘zlib’: True, ‘complevel’: 9, ‘shuffle’: True}.
show_progress (bool, optional) – If True, a progress bar is shown. The default is False.
dask_kwargs (dict, default {}) – Dict with keyword arguments passed to dask.compute.
monthly_requests (bool, optional) – If True, the data is requested on a monthly basis in ERA5. This is useful for
large cutouts, where the data is requested in smaller chunks. The
default is False
concurrent_requests (bool, optional) – If True, the monthly data requests are posted concurrently.
Only has an effect if monthly_requests is True. The default is False.
Returns:
cutout – Cutout with prepared data. The variables are stored in cutout.data.
Convert and aggregate a weather-based renewable generation time-series.
This is a gateway function called by the individual time-series
generation functions like pv and wind. All parameters documented
here are also available from those functions.
convert_func (callable) – Callback like convert_wind, convert_pv.
matrix (N x S - xr.DataArray or sp.sparse.csr_matrix or None) – If given, it is used to aggregate the grid cells to buses.
N is the number of buses, S the number of spatial coordinates, in the
order of cutout.grid.
index (pd.Index) – Index of Buses.
layout (X x Y - xr.DataArray) – The capacity to be build in each of the grid_cells.
shapes (list or pd.Series of shapely.geometry.Polygon) – If given, matrix is constructed as indicatormatrix of the polygons, its
index determines the bus index on the time-series.
shapes_crs (pyproj.CRS or compatible) – If different to the map crs of the cutout, the shapes are
transformed to match cutout.crs (defaults to EPSG:4326).
per_unit (boolean) – Returns the time-series in per-unit units, instead of in MW (defaults
to False).
return_capacity (boolean) – Additionally returns the installed capacity at each bus corresponding
to layout (defaults to False).
aggregate_time ("sum", "mean", "legacy", or None) – Controls temporal aggregation of results. "sum" sums over time,
"mean" averages over time, None returns full timeseries.
"legacy" (default) preserves historical behavior: time-summed
without spatial aggregation and full timeseries with spatial
aggregation; this option is deprecated and will be removed in a
future release. Replaces the deprecated capacity_factor and
capacity_factor_timeseries parameters.
capacity_factor (boolean) – Deprecated. Use aggregate_time="mean" instead.
capacity_factor_timeseries (boolean) – Deprecated. Use aggregate_time=None instead (which is the default).
show_progress (boolean, default False) – Whether to show a progress bar.
dask_kwargs (dict, default {}) – Dict with keyword arguments passed to dask.compute.
**convert_kwds (Any) – Additional keyword arguments passed to convert_func.
Returns:
resource (xr.DataArray) – The return value depends on which arguments are provided:
With aggregation (matrix, shapes, or layout given):
Time-series of renewable generation aggregated to buses, with
dimensions (bus,time). If aggregate_time is set, the time
dimension is reduced accordingly.
Convert outside temperature into daily cooling demand using degree-day approximation.
The formula is max(0,a*(T_daily_mean-threshold))+constant
where T_daily_mean is the daily-averaged temperature. Output is in
degree-day-like units (scaled by a).
Since “daily average temperature” means different things in different time
zones, you can provide hour_shift to redefine when the day starts.
E.g. for Moscow in summer hour_shift=3, for New York hour_shift=-4.
The shift applies uniformly across all grid cells and times.
threshold (float, default 23.0) – Outside temperature in °C below which there is no cooling demand.
The default follows European computational practices (UK Met Office
uses 22 °C, European Commission uses 24 °C).
a (float, default 1.0) – Linear factor relating cooling demand to outside temperature.
constant (float, default 0.0) – Constant part of cooling demand independent of outside temperature
(e.g. ventilation).
hour_shift (float, default 0.0) – Time shift in hours relative to UTC for daily averaging.
Daily cooling demand time-series in degree-day-like units.
Return type:
xr.DataArray
Warning
Because the original data is provided per month, at month boundaries
there is untidiness when using a time shift. The resulting array will
have duplicate indices for parts of the day at each boundary. You must
re-average these based on the number of hours in each month.
installation (str or xr.DataArray) – CSP installation details determining the solar field efficiency
dependent on the local solar position. Can be a name accepted by
atlite.resource.get_cspinstallationconfig() or an
xr.DataArray with 'azimuth' (rad) and 'altitude' (rad)
coordinates and an 'efficiency' (p.u.) entry.
technology ({"parabolic trough", "solar tower"} or None) – Overwrite CSP technology from the installation configuration.
'parabolictrough' uses direct horizontal irradiance (DHI),
'solartower' uses direct normal irradiance (DNI).
**params – Additional keyword arguments passed to convert_and_aggregate.
Returns:
csp – CSP generation time-series in specific yield (kWh/kW_ref), clipped
to [0, 1]. See convert_and_aggregate() for details on
aggregation behaviour.
Convert outside temperature into daily heat demand using degree-day approximation.
The formula is max(0,a*(threshold-T_daily_mean))+constant
where T_daily_mean is the daily-averaged temperature. Output is in
degree-day-like units (scaled by a).
Since “daily average temperature” means different things in different time
zones, you can provide hour_shift to redefine when the day starts.
E.g. for Moscow in winter hour_shift=4, for New York hour_shift=-5.
The shift applies uniformly across all grid cells and times.
Daily heat demand time-series in degree-day-like units.
Return type:
xr.DataArray
Warning
Because the original data is provided per month, at month boundaries
there is untidiness when using a time shift. The resulting array will
have duplicate indices for parts of the day at each boundary. You must
re-average these based on the number of hours in each month.
plants (pd.DataFrame) – Run-of-river plants or dams with lon, lat columns.
hydrobasins (str|gpd.GeoDataFrame) – Filename or GeoDataFrame of one level of the HydroBASINS dataset.
flowspeed (float) – Average speed of water flows to estimate the water travel time from
basin to plant (default: 1 m/s).
weight_with_height (bool) – Whether surface runoff should be weighted by potential height (probably
better for coarser resolution).
show_progress (bool) – Whether to display progressbars.
**kwargs – Additional keyword arguments passed to convert_and_aggregate.
Returns:
Inflow time-series for each plant.
Return type:
xr.DataArray
References
[1] Liu, Hailiang, et al. “A validated high-resolution hydro power
time-series model for energy systems analysis.” arXiv preprint
arXiv:1901.08476 (2019).
[2] Lehner, B., Grill G. (2013): Global river hydrography and network
routing: baseline data and new approaches to study the world’s large river
systems. Hydrological Processes, 27(15): 2171–2186. Data is available at
www.hydrosheds.org.
orientation (str, dict or callback) – Panel orientation can be chosen from either
‘latitude_optimal’, a constant orientation {‘slope’: 0.0,
‘azimuth’: 0.0} or a callback function with the same signature
as the callbacks generated by the
‘atlite.pv.orientation.make_*’ functions.
irradiation (str) – The irradiation quantity to be returned. Defaults to “total” for total
combined irradiation. Other options include “direct” for direct irradiation,
“diffuse” for diffuse irradation, and “ground” for irradiation reflected
by the ground via albedo. NOTE: “ground” irradiation is not calculated
by all trigon_model options in the convert_irradiation method,
so use with caution!
tracking (None or str:) – None for no tracking, default
‘horizontal’ for 1-axis horizontal tracking
‘tilted_horizontal’ for 1-axis horizontal tracking with tilted axis
‘vertical’ for 1-axis vertical tracking
‘dual’ for 2-axis tracking
clearsky_model (str or None) – Either the ‘simple’ or the ‘enhanced’ Reindl clearsky
model. The default choice of None will choose dependending on
data availability, since the ‘enhanced’ model also
incorporates ambient air temperature and relative humidity.
**params (Any) – Additional keyword arguments passed to convert_and_aggregate.
Returns:
irradiation – Irradiation on the tilted surface in W/m².
Create a dynamic line rating time series based on the IEEE-738 standard.
[1].
The steady-state capacity is derived from the balance between heat
losses due to radiation and convection, and heat gains due to solar influx
and conductur resistance. For more information on assumptions and modifications
see convert_line_rating.
[1]“IEEE Std 738™-2012 (Revision of IEEE Std 738-2006/Incorporates IEEE Std
738-2012/Cor 1-2013), IEEE Standard for Calculating the Current-Temperature
Relationship of Bare Overhead Conductors,” p. 72.
orientation (str, dict or callback) – Panel orientation can be chosen from either
‘latitude_optimal’, a constant orientation {‘slope’: 0.0,
‘azimuth’: 0.0} or a callback function with the same signature
as the callbacks generated by the
‘atlite.pv.orientation.make_*’ functions.
tracking (None or str:) – None for no tracking, default
‘horizontal’ for 1-axis horizontal tracking
‘tilted_horizontal’ for 1-axis horizontal tracking with tilted axis
‘vertical’ for 1-axis vertical tracking
‘dual’ for 2-axis tracking
clearsky_model (str or None) – Either the ‘simple’ or the ‘enhanced’ Reindl clearsky
model. The default choice of None will choose dependending on
data availability, since the ‘enhanced’ model also
incorporates ambient air temperature and relative humidity.
**params (Any) – Additional keyword arguments passed to convert_and_aggregate.
Returns:
pv – PV generation time-series. Without aggregation, values are capacity
factors (unitless, 0–1). With aggregation and per_unit=False,
values are in MW. See convert_and_aggregate() for details.
[1] Soteris A. Kalogirou. Solar Energy Engineering: Processes and Systems,
pages 49–117,469–516. Academic Press, 2009. ISBN 0123745012.
[2] D.T. Reindl, W.A. Beckman, and J.A. Duffie. Diffuse fraction correla-
tions. Solar Energy, 45(1):1 – 7, 1990.
[3] Hans Georg Beyer, Gerd Heilscher and Stefan Bofinger. A Robust Model
for the MPP Performance of Different Types of PV-Modules Applied for
the Performance Check of Grid Connected Systems, Freiburg, June 2004.
Eurosun (ISES Europe Solar Congress).
Compute aggregated surface runoff with optional smoothing and normalization.
Parameters:
cutout (atlite.Cutout) – Cutout providing weather data with runoff variables.
smooth (bool or int, optional) – If True, apply a rolling mean with the default window of
24*7 time steps. If an integer, use it as the rolling window
size. Default None (no smoothing).
lower_threshold_quantile (bool or float, optional) – If True, use the default quantile 5e-3. If a float, set
values below that quantile to zero. Default None (no
thresholding).
normalize_using_yearly (pd.Series, optional) – Annual country totals used to scale countries-indexed results over
overlapping full years. One factor per country is derived from the
summed reference values across the overlap.
**params – Additional keyword arguments passed to convert_and_aggregate(),
including weight_with_height for the underlying runoff
conversion.
Returns:
Runoff output from convert_and_aggregate. Smoothing also supports
the tuple return form used with return_capacity=True. Thresholding
and normalization are only supported for xr.DataArray results.
orientation (dict, str, or callable, optional) – Panel orientation. A dict with 'slope' and 'azimuth' keys
in degrees, the string 'latitude_optimal', or a callable with
the same signature as callbacks from
atlite.pv.orientation.make_*. Default: {'slope':45.0,'azimuth':180.0}.
trigon_model ({"simple", "perez"}, default "simple") – Trigonometric model for tilted irradiation decomposition.
clearsky_model ({"simple", "enhanced"} or None, default "simple") – Clear-sky model for diffuse irradiation. 'enhanced' also uses
ambient temperature and relative humidity.
A turbineconfig dictionary with the keys ‘hub_height’ for the
hub height and ‘V’, ‘POW’ defining the power curve.
Alternatively a str refering to a local or remote turbine configuration
as accepted by atlite.resource.get_windturbineconfig(). Locally stored turbine
configurations can also be modified with this function. E.g. to setup a different hub
height from the one used in the yaml file,one would write
smooth (bool or dict) – If True smooth power curve with a gaussian kernel as
determined for the Danish wind fleet to Delta_v = 1.27 and
sigma = 2.29. A dict allows to tune these values.
add_cutout_windspeed (bool) – If True and in case the power curve does not end with a zero, will add zero power
output at the highest wind speed in the power curve. If False, a warning will be
raised if the power curve does not have a cut-out wind speed. The default is
False.
interpolation_method ({"logarithmic", "power"}) – Law to interpolate wind speed to turbine hub height. Refer to
atlite.wind.extrapolate_wind_speed().
**params (Any) – Additional keyword arguments passed to convert_and_aggregate.
Returns:
resource – Wind generation time-series. Without aggregation, values are capacity
factors (MWh/MWp). With aggregation and per_unit=False, values are
in MW. See convert_and_aggregate() for details.
Download a windturbine configuration from the OEDB database.
Download the configuration of a windturbine model from the OEDB database
into the local ‘windturbine_dir’.
The OEDB database can be viewed here:
https://openenergy-platform.org/dataedit/view/supply/wind_turbine_library
(2019-07-22)
Only one turbine configuration is downloaded at a time, if the
search parameters yield an ambigious result, no data is downloaded.
Parameters:
search (int|str) – Smart search parameter, if int use as model id, if str look in name or turbine_type
**search_params (dict) – Recognized arguments are ‘id’, ‘name’, ‘turbine_type’ and ‘manufacturer’
Returns:
turbineconfig – The turbine configuration in the format from ‘atlite.ressource.get_turbineconf(name)’.
The name of a preshipped turbine from alite.resources.windturbine .
Alternatively, if a str starting with ‘oedb:<name>’ is passed the Open
Energy Database is searched for a turbine with the matching ‘<name>’
and if found that turbine configuration is used. See
atlite.resource.get_oedb_windturbineconfig(…)
if pathlib.Path is provided the configuration is read from this local
path instead
if dict:
a user provided config dict. Needs to have the keys “POW”, “V”, “P”, and
“hub_height”. Values for “POW” and “V” need to be list or np.ndarray with
equal length.
add_cutout_windspeed (bool = True) – If True and in case the power curve does not end with a zero, will add zero power
output at the highest wind speed in the power curve. If False, a warning will be
raised if the power curve does not have a cut-out wind speed.
Smooth the powercurve in turbine with a gaussian kernel.
Parameters:
turbine (dict) – Turbine config with at least V and POW
params (dict) – Allows adjusting fleet availability eta, mean Delta_v and
stdev sigma. Defaults to values from Andresen’s paper: 0.95,
1.27 and 2.29, respectively.
Returns:
turbine – Turbine config with a smoothed power curve
G. B. Andresen, A. A. Søndergaard, M. Greiner, Validation of
Danish wind time series from a new global renewable energy atlas
for energy system analysis, Energy 93, Part 1 (2015) 1074–1088.
Extrapolate the wind speed from a given height above ground to another.
If ds already contains a key refering to wind speeds at the desired to_height,
no conversion is done and the wind speeds are directly returned.
Extrapolation of the wind speed can either use the “logarithmic” law as
described in [1]_ or the “power” law as described in [2]. See also discussion
in GH issue: PyPSA/atlite#231 .
Parameters:
ds (xarray.Dataset) – Dataset containing the wind speed time-series at ‘from_height’ with key
‘wnd{height:d}m’ and the surface orography with key ‘roughness’ at the
geographic locations of the wind speeds.
to_height (int|float) – Height (m) to which the wind speeds are extrapolated to.
from_height (int, optional) – Height (m) from which the wind speeds are interpolated to ‘to_height’.
If not provided, the closest height to ‘to_height’ is selected.
method ({"logarithmic", "power"}) – Method to use for extra/interpolating wind speeds
Returns:
da – DataArray containing the extrapolated wind speeds. Name of the DataArray
is ‘wnd{to_height:d}’.
Return type:
xarray.DataArray
Raises:
AssertionError – If no wind speed variables are found in the dataset.
RuntimeError – If the cutout is missing the data for the chosen method.
ValueError – If method is not 'logarithmic' or 'power'.
raster (str/rasterio.DatasetReader) – Raster or path to raster which to exclude.
codes (int/list/function, optional) – Codes in the raster which to exclude. Can be a callable function
which takes the mask (np.array) as argument and performs a
elementwise condition (must not change the shape). The function may
not be an anonymous (lambda) function.
The default is 1.
buffer (int, optional) – Buffer around the excluded areas in units of ExclusionContainer.crs.
Use this to create a buffer around the excluded/included area.
The default is 0.
nodata (int, optional) – Value to use for nodata pixels. The default is 255.
invert (bool, optional) – Whether to exclude (False) or include (True) the specified areas
of the raster. The default is False.
allow_no_overlap – Allow that a raster and a shape (for which the raster will be used as
a mask) do not overlap. In this case an array with only nodata is
returned.
crs (rasterio.CRS/EPSG) – CRS of the raster. Specify this if the raster has invalid crs.
Compute the eligible area in one or more geometries.
Parameters:
geometry (geopandas.Series) – Geometry of which the eligible area is computed. If the series contains
more than one geometry, the eligible area of the combined geometries is
computed.
dst_transform (rasterio.Affine) – Transform of the target raster. Define if the availability
should be reprojected. Defaults to None.
dst_crs (rasterio.CRS/proj.CRS) – CRS of the target raster. Define if the availability
should be reprojected. Defaults to None.
dst_shape (tuple) – Shape of the target raster. Define if the availability
should be reprojected. Defaults to None.
Returns:
masked (np.array) – Mask whith eligible raster cells indicated by 1 and excluded cells by 0.
transform (rasterio.Affine) – Affine transform of the mask.
Raises:
ValueError – If only some of dst_transform, dst_crs, dst_shape are given.
Plot the eligible area for one or more geometries.
This function uses its own default values for rasterio.plot.show and
geopandas.GeoSeries.plot. Therefore eligible land is drawn in green
Note that this function will likely fail if another CRS than the one of the
ExclusionContainer is used in the axis (e.g. cartopy projections).
Parameters:
geometry (geopandas.Series) – Geometry of which the eligible area is computed. If the series contains
more than one geometry, the eligible area of the combined geometries is
computed.
ax (matplotlib.axes.Axes, optional) – Axes to plot on. If None, a new figure is created.
set_title (boolean, optional) – Whether to set the title with additional information on the share of
eligible land.
dst_transform (rasterio.Affine) – Transform of the target raster. Define if the availability
should be reprojected. Defaults to None.
dst_crs (rasterio.CRS/proj.CRS) – CRS of the target raster. Define if the availability
should be reprojected. Defaults to None.
dst_shape (tuple) – Shape of the target raster. Define if the availability
should be reprojected. Defaults to None.
show_kwargs (dict, optional) – Keyword arguments passed to rasterio.plot.show, by default {}
plot_kwargs (dict, optional) – Keyword arguments passed to geopandas.GeoSeries.plot, by default {}
Compute the eligible share within cutout cells in the overlap with shapes.
For parallel calculation (nprocesses not None) the excluder must not be
initialized and all raster references must be strings. Otherwise processes
are colliding when reading from one common rasterio.DatasetReader.
Parameters:
cutout (atlite.Cutout) – Cutout which the availability matrix is aligned to.
shapes (geopandas.Series/geopandas.DataFrame) – Geometries for which the availabilities are calculated.
excluder (atlite.gis.ExclusionContainer) – Container of all meta data or objects which to exclude, i.e.
rasters and geometries.
nprocesses (int, optional) – Number of processes to use for calculating the matrix. The paralle-
lization can heavily boost the calculation speed. The default is None.
disable_progressbar (bool, optional) – Disable the progressbar if nprocesses is not None. Then the map
function instead of the imap function is used for the multiprocessing
pool. This speeds up the calculation.
Returns:
availabilities – DataArray of shape (|shapes|, |y|, |x|) containing all the eligible
share of cutout cell (x,y) in the overlap with shape i.
Return type:
xr.DataArray
Notes
The rasterio (or GDAL) average downsampling returns different results
dependent on how the target raster (the cutout raster) is spanned.
Either it is spanned from the top left going downwards,
e.g. Affine(0.25, 0, 0, 0, -0.25, 50), or starting in the
lower left corner and going up, e.g. Affine(0.25, 0, 0, 0, 0.25, 50).
Here we stick to the top down version which is why we use
cutout.transform_r and flipping the y-axis in the end.
The indicatormatrix I[i,j] is a sparse representation of the ratio
of the area in orig[j] lying in dest[i], where orig and dest are
collections of polygons, i.e.
A value of I[i,j] = 1 indicates that the shape orig[j] is fully
contained in shape dest[j].
Note that the polygons must be in the same crs.
Parameters:
orig (Collection of shapely polygons) – Origin polygons.
dest (Collection of shapely polygons) – Destination polygons.
orig_crs (int or CRS, default 4326) – CRS of the origin polygons.
dest_crs (int or CRS, default 4326) – CRS of the destination polygons.
Pad the extent of src by an equivalent of one cell of the target raster.
This ensures that the array is large enough to not be treated as nodata in
all cells of the destination raster. If src.ndim>2, the function
expects the last two dimensions to be y,x.
Parameters:
src (numpy.ndarray) – Source array with spatial axes in the last two dimensions.
src_transform (rasterio.Affine) – Transform of the source array.
dst_transform (rasterio.Affine) – Transform of the destination raster.
ds (xarray.Dataset or xarray.DataArray) – Data on a spatial grid.
dimx (pandas.Index) – Target x coordinates. dimx.name must match the source x dimension.
dimy (pandas.Index) – Target y coordinates. dimy.name must match the source y dimension.
**kwargs – Keyword arguments passed to rasterio.warp.reproject; of note:
resampling is one of
gis.Resampling.{average,cubic,bilinear,nearest}; src_crs and
dst_crs define the source/target CRS (default: EPSG 4326, latlong).
Compute the eligible area in one or more geometries.
Parameters:
geometry (geopandas.Series) – Geometry of which the eligible area is computed. If the series contains
more than one geometry, the eligible area of the combined geometries is
computed.
excluder (atlite.gis.ExclusionContainer) – Container of all meta data or objects which to exclude, i.e.
rasters and geometries.
Returns:
masked (np.array) – Mask whith eligible raster cells indicated by 1 and excluded cells by 0.
transform (rasterio.Affine) – Affine transform of the mask.
Compute and reproject the eligible area of one or more geometries.
The function executes shape_availability and reprojects the calculated
mask onto a new raster defined by (dst_transform,dst_crs,dst_shape).
Before reprojecting, the function pads the mask such that all non-nodata
data points are projected in full cells of the target raster. This ensures
that all data within the mask are projected correctly (GDAL inherent
‘problem’).
Parameters:
geometry (geopandas.GeoSeries) – Geometry for which availability is computed.