From a07fdc67d3ba6037ee0f97a69131729003b82e93 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 10 Apr 2023 22:01:45 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/PyCQA/docformatter: v1.5.1 → v1.6.0](https://github.com/PyCQA/docformatter/compare/v1.5.1...v1.6.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a53fcc91..bbf9e421 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -38,7 +38,7 @@ repos: # Make docstrings PEP 257 compliant - repo: https://github.com/PyCQA/docformatter - rev: v1.5.1 + rev: v1.6.0 hooks: - id: docformatter args: ['--in-place', '--make-summary-multi-line', '--pre-summary-newline'] From 56adc2fcd22b3622dc8090b504dae0499abbd2d0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 10 Apr 2023 22:02:04 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- atlite/convert.py | 7 ------- atlite/csp.py | 1 - atlite/pv/orientation.py | 1 - atlite/pv/solar_panel_model.py | 12 +++++------- atlite/pv/solar_position.py | 1 - atlite/resource.py | 5 ----- atlite/wind.py | 1 - test/test_dynamic_line_rating.py | 5 ++--- test/test_gis.py | 1 - test/test_preparation_and_conversion.py | 3 --- 10 files changed, 7 insertions(+), 30 deletions(-) diff --git a/atlite/convert.py b/atlite/convert.py index 29fe7731..9090aa70 100644 --- a/atlite/convert.py +++ b/atlite/convert.py @@ -209,7 +209,6 @@ def convert_temperature(ds): Return outside temperature (useful for e.g. heat pump T-dependent coefficient of performance). """ - # Temperature is in Kelvin return ds["temperature"] - 273.15 @@ -224,7 +223,6 @@ def convert_soil_temperature(ds): Return soil temperature (useful for e.g. heat pump T-dependent coefficient of performance). """ - # Temperature is in Kelvin # There are nans where there is sea; by setting them @@ -363,7 +361,6 @@ def heat_demand(cutout, threshold=15.0, a=1.0, constant=0.0, hour_shift=0.0, **p You can also specify all of the general conversion arguments documented in the `convert_and_aggregate` function. """ - return cutout.convert_and_aggregate( convert_func=convert_heat_demand, threshold=threshold, @@ -463,7 +460,6 @@ def convert_wind(ds, turbine): """ Convert wind speeds for turbine to wind energy generation. """ - V, POW, hub_height, P = itemgetter("V", "POW", "hub_height", "P")(turbine) wnd_hub = windm.extrapolate_wind_speed(ds, to_height=hub_height) @@ -517,7 +513,6 @@ def wind(cutout, turbine, smooth=False, **params): [1] Andresen G B, Søndergaard A A and Greiner M 2015 Energy 93, Part 1 1074 – 1088. doi:10.1016/j.energy.2015.09.071 """ - if isinstance(turbine, (str, Path)): turbine = get_windturbineconfig(turbine) @@ -598,7 +593,6 @@ def pv(cutout, panel, orientation, tracking=None, clearsky_model=None, **params) the Performance Check of Grid Connected Systems, Freiburg, June 2004. Eurosun (ISES Europe Solar Congress). """ - if isinstance(panel, (str, Path)): panel = get_solarpanelconfig(panel) if not callable(orientation): @@ -687,7 +681,6 @@ def csp(cutout, installation, technology=None, **params): [2] Tobias Hirsch (ed.). CSPBankability Project Report, DLR, 2017. URL: https://www.dlr.de/sf/en/desktopdefault.aspx/tabid-11126/19467_read-48251/ """ - if isinstance(installation, (str, Path)): installation = get_cspinstallationconfig(installation) diff --git a/atlite/csp.py b/atlite/csp.py index 2e5a5989..42c09621 100644 --- a/atlite/csp.py +++ b/atlite/csp.py @@ -39,7 +39,6 @@ def calculate_dni(ds, solar_position=None, altitude_threshold=3.75): the solar altitude traversed by the sun within about 15 minutes in a location with maximum solar altitude of 60 deg and 10h day time. """ - if solar_position is None: solar_position = SolarPosition(ds) diff --git a/atlite/pv/orientation.py b/atlite/pv/orientation.py index 0b4a3179..8e81534e 100644 --- a/atlite/pv/orientation.py +++ b/atlite/pv/orientation.py @@ -98,7 +98,6 @@ def SurfaceOrientation(ds, solar_position, orientation, tracking=None): [1] Sproul, A. B., Derivation of the solar geometric relationships using vector analysis, Renewable Energy, 32(7), 1187–1205 (2007). """ - lon = deg2rad(ds["lon"]) lat = deg2rad(ds["lat"]) diff --git a/atlite/pv/solar_panel_model.py b/atlite/pv/solar_panel_model.py index 1a180e9b..3ad587f8 100644 --- a/atlite/pv/solar_panel_model.py +++ b/atlite/pv/solar_panel_model.py @@ -18,10 +18,9 @@ def _power_huld(irradiance, t_amb, pc): Maximum power point tracking is assumed. [1] Huld, T. et al., 2010. Mapping the performance of PV modules, - effects of module type and data averaging. Solar Energy, 84(2), - p.324-338. DOI: 10.1016/j.solener.2009.12.002 + effects of module type and data averaging. Solar Energy, 84(2), + p.324-338. DOI: 10.1016/j.solener.2009.12.002 """ - # normalized module temperature T_ = (pc["c_temp_amb"] * t_amb + pc["c_temp_irrad"] * irradiance) - pc["r_tmod"] @@ -54,11 +53,10 @@ def _power_bofinger(irradiance, t_amb, pc): Maximum power point tracking is assumed. - [2] Hans Beyer, Gerd Heilscher and Stefan Bofinger, 2004. A robust model - for the MPP performance of different types of PV-modules applied for the - performance check of grid connected systems. + [2] Hans Beyer, Gerd Heilscher and Stefan Bofinger, 2004. A robust + model for the MPP performance of different types of PV-modules + applied for the performance check of grid connected systems. """ - fraction = (pc["NOCT"] - pc["Tamb"]) / pc["Intc"] eta_ref = ( diff --git a/atlite/pv/solar_position.py b/atlite/pv/solar_position.py index d2d8f190..d28ba31a 100644 --- a/atlite/pv/solar_position.py +++ b/atlite/pv/solar_position.py @@ -50,7 +50,6 @@ def SolarPosition(ds, time_shift="0H"): been implemented using numba or plain numpy for a single location at https://github.com/pvlib/pvlib-python/blob/master/pvlib/spa.py. """ - # Act like a getter if these return variables are already in ds rvs = { "solar_azimuth", diff --git a/atlite/resource.py b/atlite/resource.py index 5a1897bd..6205b9d2 100644 --- a/atlite/resource.py +++ b/atlite/resource.py @@ -54,7 +54,6 @@ def get_windturbineconfig(turbine): config : dict Config with details on the turbine """ - assert isinstance(turbine, (str, Path)) if isinstance(turbine, str) and turbine.startswith("oedb:"): @@ -94,7 +93,6 @@ def get_solarpanelconfig(panel): config : dict Config with details on the solarpanel """ - assert isinstance(panel, (str, Path)) if isinstance(panel, str): @@ -127,7 +125,6 @@ def get_cspinstallationconfig(installation): config : dict Config with details on the CSP installation. """ - assert isinstance(installation, (str, Path)) if isinstance(installation, str): @@ -216,7 +213,6 @@ def windturbine_smooth(turbine, params=None): Danish wind time series from a new global renewable energy atlas for energy system analysis, Energy 93, Part 1 (2015) 1074–1088. """ - if params is None or params == True: params = {} @@ -297,7 +293,6 @@ def get_oedb_windturbineconfig(search=None, **search_params): >>> get_oedb_windturbineconfig(name="E-53/800", manufacturer="Enercon") {'V': ..., 'POW': ..., ...} """ - # Parse information of different allowed 'turbine' values if isinstance(search, int): search_params.setdefault("id", search) diff --git a/atlite/wind.py b/atlite/wind.py index 0f68f44f..a0fbe662 100644 --- a/atlite/wind.py +++ b/atlite/wind.py @@ -53,7 +53,6 @@ def extrapolate_wind_speed(ds, to_height, from_height=None): [2] https://en.wikipedia.org/w/index.php?title=Roughness_length&oldid=862127433, Retrieved 2019-02-15. """ - # Fast lane to_name = "wnd{h:0d}m".format(h=int(to_height)) if to_name in ds: diff --git a/test/test_dynamic_line_rating.py b/test/test_dynamic_line_rating.py index 3c3d6163..15e99adb 100644 --- a/test/test_dynamic_line_rating.py +++ b/test/test_dynamic_line_rating.py @@ -53,8 +53,8 @@ def test_oeding_and_oswald_sample_case(): This is the same as the DIN 48204-4/84. - We do not exactly know at what ambient temperature the DIN is calculated. - 30 degree is a good guess that fits. + We do not exactly know at what ambient temperature the DIN is + calculated. 30 degree is a good guess that fits. """ ds = { "temperature": 30 + 273, @@ -84,7 +84,6 @@ def test_suedkabel_sample_case(): typ-2xsfl2y-1x2500-rms-250-220-380-kv assume ambient temperature of 20°C, no wind, no sun and max allowed line temperature of 90°C. """ - ds = { "temperature": 293, "wnd100m": 0, diff --git a/test/test_gis.py b/test/test_gis.py index ab61de76..cc89ef86 100755 --- a/test/test_gis.py +++ b/test/test_gis.py @@ -147,7 +147,6 @@ def test_open_closed_checks(ref, geometry, raster): C.f. GH issue #225. """ - res = 0.01 excluder = ExclusionContainer(ref.crs, res=res) diff --git a/test/test_preparation_and_conversion.py b/test/test_preparation_and_conversion.py index 8743581a..dda661d5 100644 --- a/test/test_preparation_and_conversion.py +++ b/test/test_preparation_and_conversion.py @@ -78,7 +78,6 @@ def pv_test(cutout, time=TIME): Compare optimal orientation with flat orientation. """ - orientation = {"slope": 0.0, "azimuth": 0.0} cap_factor = cutout.pv(atlite.resource.solarpanels.CdTe, orientation) @@ -152,7 +151,6 @@ def pv_tracking_test(cutout): Test the atlite.Cutout.pv function with different tracking settings and compare results. """ - orientation = {"slope": 0.0, "azimuth": 180.0} # tracking = None is the default option cap_factor = cutout.pv( @@ -201,7 +199,6 @@ def csp_test(cutout): Test the atlite.Cutout.csp function with different for different settings and technologies. """ - ## Test technology = "solar tower" st = cutout.csp(atlite.cspinstallations.SAM_solar_tower, capacity_factor=True)