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 ambient or soil temperature to coefficient of performance (COP) of
air- or ground-sourced heat pumps. The COP is a function of temperature
difference from source to sink. The defaults for either source (c0, c1, c2)
are based on a quadratic regression in [1].
Convert and aggregate a weather-based renewable generation time-series.
NOTE: Not meant to be used by the user him or herself. Rather it is a
gateway function that is called by all the individual time-series
generation functions like pv and wind. Thus, all its parameters are also
available from these.
Parameters:
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).
capacity_factor (boolean) – If True, the static capacity factor of the chosen resource for each
grid cell is computed.
capacity_factor_timeseries (boolean) – If True, the capacity factor time series of the chosen resource for
each grid cell is computed.
show_progress (boolean, default False) – Whether to show a progress bar.
dask_kwargs (dict, default {}) – Dict with keyword arguments passed to dask.compute.
convert_func (Function) – Callback like convert_wind, convert_pv
Returns:
resource (xr.DataArray) – Time-series of renewable generation aggregated to buses, if
matrix or equivalents are provided else the total sum of
generated energy.
units (xr.DataArray (optional)) – The installed units per bus in MW corresponding to layout
(only if return_capacity is True).
Convert outside temperature into daily cooling demand using the degree-day
approximation.
Since “daily average temperature” means different things in
different time zones and since xarray coordinates do not handle
time zones gracefully like pd.DateTimeIndex, you can provide an
hour_shift to redefine when the day starts.
E.g. for Moscow in summer, hour_shift = 3, for New York in summer,
hour_shift = -4
This time shift applies across the entire spatial scope of ds for
all times. More fine-grained control will be built in a some
point, i.e. space- and time-dependent time zones.
WARNING: Because the original data is provided every month, at the
month boundaries there is untidiness if you use a time shift. The
resulting xarray will have duplicates in the index for the parts
of the day in each month at the boundary. You will have to
re-average these based on the number of hours in each month for
the duplicated day.
Parameters:
threshold (float) – Outside temperature in degrees Celsius below which there is no
cooling demand. The default 23C is taken as a more liberal
estimation following European computational practices
(e.g. UK Met Office and European commission take as thresholds
22C and 24C, respectively)
a (float) – Linear factor relating cooling demand to outside temperature.
constant (float) – Constant part of cooling demand that does not depend on outside
temperature (e.g. due to ventilation).
hour_shift (float) – Time shift relative to UTC for taking daily average
Note
You can also specify all of the general conversion arguments
documented in the convert_and_aggregate function.
Convert downward shortwave direct radiation into a csp generation time-
series.
Parameters:
installation (str or xr.DataArray) – CSP installation details determining the solar field efficiency dependent on
the local solar position. Can be either the name of one of the standard
installations provided through atlite.cspinstallationsPanel or an
xarray.DataArray with ‘azimuth’ (in rad) and ‘altitude’ (in rad) coordinates
and an ‘efficiency’ (in p.u.) entry.
technology (str) – Overwrite CSP technology from the installation configuration. The technology
affects which direct radiation is considered. Either ‘parabolic trough’ (DHI)
or ‘solar tower’ (DNI).
Returns:
csp – Time-series or capacity factors based on additional general
conversion arguments.
Return type:
xr.DataArray
Note
You can also specify all of the general conversion arguments
documented in the convert_and_aggregate function.
Convert outside temperature into daily heat demand using the degree-day
approximation.
Since “daily average temperature” means different things in
different time zones and since xarray coordinates do not handle
time zones gracefully like pd.DateTimeIndex, you can provide an
hour_shift to redefine when the day starts.
E.g. for Moscow in winter, hour_shift = 4, for New York in winter,
hour_shift = -5
This time shift applies across the entire spatial scope of ds for
all times. More fine-grained control will be built in a some
point, i.e. space- and time-dependent time zones.
WARNING: Because the original data is provided every month, at the
month boundaries there is untidiness if you use a time shift. The
resulting xarray will have duplicates in the index for the parts
of the day in each month at the boundary. You will have to
re-average these based on the number of hours in each month for
the duplicated day.
Parameters:
threshold (float) – Outside temperature in degrees Celsius above which there is no
heat demand.
a (float) – Linear factor relating heat demand to outside temperature.
constant (float) – Constant part of heat demand that does not depend on outside
temperature (e.g. due to water heating).
hour_shift (float) – Time shift relative to UTC for taking daily average
Note
You can also specify all of the general conversion arguments
documented in the convert_and_aggregate function.
Compute inflow time-series for plants by aggregating over catchment
basins from hydrobasins
Parameters:
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.
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].
Calculate the total, direct, diffuse, or ground irradiation on a tilted
surface.
Parameters:
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.
Returns:
irradiation – The desired irradiation quantity on the tilted surface. Defaults to
“total”.
Return type:
xr.DataArray
Note
You can also specify all of the general conversion arguments
documented in the convert_and_aggregate function.
References
[1] D.T. Reindl, W.A. Beckman, and J.A. Duffie. Diffuse fraction correla-
tions. Solar Energy, 45(1):1 – 7, 1990.
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.
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 downward-shortwave, upward-shortwave radiation flux and ambient
temperature into a pv generation time-series.
Parameters:
panel (str or dict) – Panel config dictionary with the parameters for the electrical
model in [3]. Alternatively, name of yaml file stored in
atlite.config.solarpanel_dir.
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.
Returns:
pv – Time-series or capacity factors based on additional general
conversion arguments.
Return type:
xr.DataArray
Note
You can also specify all of the general conversion arguments
documented in the convert_and_aggregate function.
References
[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).
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().
Note
You can also specify all of the general conversion arguments
documented in the convert_and_aggregate function.
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.
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 ambient or soil temperature to coefficient of performance (COP) of
air- or ground-sourced heat pumps. The COP is a function of temperature
difference from source to sink. The defaults for either source (c0, c1, c2)
are based on a quadratic regression in [1].
Convert and aggregate a weather-based renewable generation time-series.
NOTE: Not meant to be used by the user him or herself. Rather it is a
gateway function that is called by all the individual time-series
generation functions like pv and wind. Thus, all its parameters are also
available from these.
Parameters:
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).
capacity_factor (boolean) – If True, the static capacity factor of the chosen resource for each
grid cell is computed.
capacity_factor_timeseries (boolean) – If True, the capacity factor time series of the chosen resource for
each grid cell is computed.
show_progress (boolean, default False) – Whether to show a progress bar.
dask_kwargs (dict, default {}) – Dict with keyword arguments passed to dask.compute.
convert_func (Function) – Callback like convert_wind, convert_pv
Returns:
resource (xr.DataArray) – Time-series of renewable generation aggregated to buses, if
matrix or equivalents are provided else the total sum of
generated energy.
units (xr.DataArray (optional)) – The installed units per bus in MW corresponding to layout
(only if return_capacity is True).
Convert the cutout data to dynamic line rating time series.
The formulation is based on:
[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.
The following simplifications/assumptions were made:
Wind speed are taken at height 100 meters above ground. However, ironmen
and transmission lines are typically at 50-60 meters.
Solar heat influx is set proportionally to solar short wave influx.
The incidence angle of the solar heat influx is assumed to be 90 degree.
Parameters:
ds (xr.Dataset) – Subset of the cutout data including all weather cells overlapping with
the line.
psi (int/float) – Azimuth angle of the line in degree, that is the incidence angle of the line
with a pointer directing north (90 is east, 180 is south, 270 is west).
R (float) – Resistance of the conductor in [Ω/m] at maximally allowed temperature Ts.
Convert outside temperature into daily cooling demand using the degree-day
approximation.
Since “daily average temperature” means different things in
different time zones and since xarray coordinates do not handle
time zones gracefully like pd.DateTimeIndex, you can provide an
hour_shift to redefine when the day starts.
E.g. for Moscow in summer, hour_shift = 3, for New York in summer,
hour_shift = -4
This time shift applies across the entire spatial scope of ds for
all times. More fine-grained control will be built in a some
point, i.e. space- and time-dependent time zones.
WARNING: Because the original data is provided every month, at the
month boundaries there is untidiness if you use a time shift. The
resulting xarray will have duplicates in the index for the parts
of the day in each month at the boundary. You will have to
re-average these based on the number of hours in each month for
the duplicated day.
Parameters:
threshold (float) – Outside temperature in degrees Celsius below which there is no
cooling demand. The default 23C is taken as a more liberal
estimation following European computational practices
(e.g. UK Met Office and European commission take as thresholds
22C and 24C, respectively)
a (float) – Linear factor relating cooling demand to outside temperature.
constant (float) – Constant part of cooling demand that does not depend on outside
temperature (e.g. due to ventilation).
hour_shift (float) – Time shift relative to UTC for taking daily average
Note
You can also specify all of the general conversion arguments
documented in the convert_and_aggregate function.
Convert downward shortwave direct radiation into a csp generation time-
series.
Parameters:
installation (str or xr.DataArray) – CSP installation details determining the solar field efficiency dependent on
the local solar position. Can be either the name of one of the standard
installations provided through atlite.cspinstallationsPanel or an
xarray.DataArray with ‘azimuth’ (in rad) and ‘altitude’ (in rad) coordinates
and an ‘efficiency’ (in p.u.) entry.
technology (str) – Overwrite CSP technology from the installation configuration. The technology
affects which direct radiation is considered. Either ‘parabolic trough’ (DHI)
or ‘solar tower’ (DNI).
Returns:
csp – Time-series or capacity factors based on additional general
conversion arguments.
Return type:
xr.DataArray
Note
You can also specify all of the general conversion arguments
documented in the convert_and_aggregate function.
Convert outside temperature into daily heat demand using the degree-day
approximation.
Since “daily average temperature” means different things in
different time zones and since xarray coordinates do not handle
time zones gracefully like pd.DateTimeIndex, you can provide an
hour_shift to redefine when the day starts.
E.g. for Moscow in winter, hour_shift = 4, for New York in winter,
hour_shift = -5
This time shift applies across the entire spatial scope of ds for
all times. More fine-grained control will be built in a some
point, i.e. space- and time-dependent time zones.
WARNING: Because the original data is provided every month, at the
month boundaries there is untidiness if you use a time shift. The
resulting xarray will have duplicates in the index for the parts
of the day in each month at the boundary. You will have to
re-average these based on the number of hours in each month for
the duplicated day.
Parameters:
threshold (float) – Outside temperature in degrees Celsius above which there is no
heat demand.
a (float) – Linear factor relating heat demand to outside temperature.
constant (float) – Constant part of heat demand that does not depend on outside
temperature (e.g. due to water heating).
hour_shift (float) – Time shift relative to UTC for taking daily average
Note
You can also specify all of the general conversion arguments
documented in the convert_and_aggregate function.
Compute inflow time-series for plants by aggregating over catchment
basins from hydrobasins
Parameters:
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.
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.
Calculate the total, direct, diffuse, or ground irradiation on a tilted
surface.
Parameters:
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.
Returns:
irradiation – The desired irradiation quantity on the tilted surface. Defaults to
“total”.
Return type:
xr.DataArray
Note
You can also specify all of the general conversion arguments
documented in the convert_and_aggregate function.
References
[1] D.T. Reindl, W.A. Beckman, and J.A. Duffie. Diffuse fraction correla-
tions. Solar Energy, 45(1):1 – 7, 1990.
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.
Convert downward-shortwave, upward-shortwave radiation flux and ambient
temperature into a pv generation time-series.
Parameters:
panel (str or dict) – Panel config dictionary with the parameters for the electrical
model in [3]. Alternatively, name of yaml file stored in
atlite.config.solarpanel_dir.
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.
Returns:
pv – Time-series or capacity factors based on additional general
conversion arguments.
Return type:
xr.DataArray
Note
You can also specify all of the general conversion arguments
documented in the convert_and_aggregate function.
References
[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).
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().
Note
You can also specify all of the general conversion arguments
documented in the convert_and_aggregate function.
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) – 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:
RuntimeError – If the cutout is missing the data for the chosen method
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.
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 and optionally
reproject.
Parameters:
geometry (geopandas.Series) – Geometry of which the eligible area is computed. If the series contains
more than one geometry, the eligble 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 (rasterion.Affine) – Affine transform of the mask.
Plot the eligible area for one or more geometries and optionally
reproject.
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 funtion 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 eligble area of the combined geometries is
computed.
ax (matplotlib Axis, optional)
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].
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. Additional
keyword arguments are used in np.pad().
ds (xr.Dataset|xr.DataArray) – N-dim data on a spatial grid
dimx (pd.Index) – New x-coordinates in destination crs.
dimx.name MUST refer to x-coord of ds.
dimy (pd.Index) – New y-coordinates in destination crs.
dimy.name MUST refer to y-coord of ds.
**kwargs – Arguments passed to rio.wrap.reproject; of note:
- resampling is one of gis.Resampling.{average,cubic,bilinear,nearest}
- src_crs, dst_crs define the different crs (default: EPSG 4326, ie 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 eligble 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 (rasterion.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 all non-nodata data
points are projected in full cells of the target raster. The ensures that
all data within the mask are projected correclty (GDAL inherent ‘problem’).
more than one geometry, the eligble area of the combined geometries is
computed.
excluderatlite.gis.ExclusionContainer
Container of all meta data or objects which to exclude, i.e.
rasters and geometries.
dst_transformrasterio.Affine
Transform of the target raster.
dst_crsrasterio.CRS/proj.CRS
CRS of the target raster.
dst_shapetuple
Shape of the target raster.
maskednp.array
Average share of available area per grid cell. 0 indicates excluded,
1 is fully included.
Computes attribute value and caches it in the instance.
From the Python Cookbook (Denis Otkidach) This decorator allows you
to create a property which can be computed once and accessed many
times. Sort of like memoization.