Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to fix the deprecation issues... #73

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions src/feedinlib/models/pvlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ def power_plant_requires(self):
"module_name",
["albedo", "surface_type"],
"inverter_name",
"module_type",
"racking_model"
]
# ToDo @Günni: is this necessary?
if super().power_plant_requires is not None:
Expand Down Expand Up @@ -146,9 +148,9 @@ def pv_system_area(self):
"""
if self.power_plant:
return (
self.power_plant.module_parameters.Area
* self.power_plant.strings_per_inverter
* self.power_plant.modules_per_string
self.power_plant.arrays[0].module_parameters.Area
* self.power_plant.arrays[0].strings
* self.power_plant.arrays[0].modules_per_string
)
else:
return None
Expand All @@ -170,18 +172,18 @@ def pv_system_peak_power(self):
if self.power_plant:
if self.mode == "ac":
return min(
self.power_plant.module_parameters.Impo
* self.power_plant.module_parameters.Vmpo
* self.power_plant.strings_per_inverter
* self.power_plant.modules_per_string,
self.power_plant.arrays[0].module_parameters.Impo
* self.power_plant.arrays[0].module_parameters.Vmpo
* self.power_plant.arrays[0].strings
* self.power_plant.arrays[0].modules_per_string,
self.power_plant.inverter_parameters.Paco,
)
elif self.mode == "dc":
return (
self.power_plant.module_parameters.Impo
* self.power_plant.module_parameters.Vmpo
* self.power_plant.strings_per_inverter
* self.power_plant.modules_per_string
self.power_plant.arrays[0].module_parameters.Impo
* self.power_plant.arrays[0].module_parameters.Vmpo
* self.power_plant.arrays[0].strings
* self.power_plant.arrays[0].modules_per_string
)
else:
raise ValueError(
Expand Down Expand Up @@ -315,9 +317,9 @@ def feedin(self, weather, power_plant_parameters, **kwargs):
mc.run_model(weather=weather)

if self.mode == "ac":
return mc.ac
return mc.results.ac
elif self.mode == "dc":
return mc.dc.p_mp
return mc.results.dc.p_mp
else:
raise ValueError(
"{} is not a valid `mode`. `mode` must "
Expand Down
4 changes: 2 additions & 2 deletions src/feedinlib/open_FRED.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def from_df(klass, df):
def location(self, point: Point):
""" Get the measurement location closest to the given `point`.
"""
point = WKTE(point.to_wkt(), srid=4326)
point = WKTE(point.wkt, srid=4326)
return (
self.session.query(self.db["Location"])
.order_by(self.db["Location"].point.distance_centroid(point))
Expand All @@ -311,7 +311,7 @@ def location(self, point: Point):
def within(self, region=None):
""" Get all measurement locations within the given `region`.
"""
region = WKTE(region.to_wkt(), srid=4326)
region = WKTE(region.wkt, srid=4326)
return (
self.session.query(self.db["Location"])
.filter(self.db["Location"].point.ST_Within(region))
Expand Down
3 changes: 3 additions & 0 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def pvlib_weather(self):
"temp_air": [10.0],
"dhi": [150.0],
"ghi": [300],
"dni": [610.11],
},
index=pd.date_range("1/1/1970 12:00", periods=1, tz="UTC"),
)
Expand Down Expand Up @@ -61,6 +62,8 @@ def pvlib_pv_system(self):
"azimuth": 180,
"tilt": 30,
"albedo": 0.2,
"module_type": "glass_glass",
"racking_model": "open_rack"
}

@pytest.fixture
Expand Down