-
Notifications
You must be signed in to change notification settings - Fork 172
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
Add merge/reduce FLORIS objects #866
Conversation
I think this way (as a static function in floris_model.py) is reasonable. Will we want to do the same for uncertain models and parallel models? perhaps we can figure out a convenient function that could handle any of them? In that case, we may want this function on a separate file. I'm more into the merge function than the reduce function. For reducing, we already have the following options:
|
Ok sounds good, I'll set it as a static member of the FlorisModel and remove the reduce function. I think for uncertain/parallel these should be defined specifically for those, rather than trying to make a catch-all for now, which we could do later, but that moment catching all the special cases could be something. At any rate I think I will just make the change in FlorisModel and then pause and wait for refactor merge just to simplify a little |
nevermind... hit the wrong button |
Ok @misi9170 , I think this one is ready, I think for now just adding the function is good. I tested it out a bit with some test code, but I think for now we won't call it in the examples and can add that later (or just make greater use in flasc). This is ready from my perspective |
floris/floris_model.py
Outdated
if len(fi_turbine_type) == 1: | ||
fi_turbine_type = fi_turbine_type * len(fmodel.layout_x) | ||
elif not len(fi_turbine_type) == len(fmodel.layout_x): | ||
raise UserWarning("Incompatible format of turbine_type in fmodel.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these UserWarnings be errors?
floris/floris_model.py
Outdated
if reference_wind_height is None: | ||
reference_wind_height = np.mean(reference_wind_heights) | ||
if np.any(np.abs(np.array(reference_wind_heights) - reference_wind_height) > 1.0e-3): | ||
raise UserWarning( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above
floris/floris_model.py
Outdated
y_list = [] | ||
turbine_type_list = [] | ||
reference_wind_heights = [] | ||
for fmodel in fi_list: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmodel.reset_operation()
@paulf81 I made a few changes in d127c70
If you're happy with those changes, feel free to merge this in. |
or general solver settings. | ||
""" | ||
|
||
if not isinstance(fmodel_list[0], FlorisModel): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@misi9170 @paulf81 I just came across this and I think it's not validating fmodel_list
correctly. If I understand correctly that it's a 1-D list, then it's only validating the first element. You can check all elements with something like:
# does `isinstance` on each element of the list through `map`
# then checks whether all the elements are True.
# If any elements are not True, then it goes into the if-statement
if not all( list( map(isinstance, fmodel_list, len(fmodel_list)*[FlorisModel]) ) ):
# or the same thing but more simply
if not all( type(fm) == FlorisModel for fm in fmodel_list ):
It may or may not be worth fixing right now, but I wanted to give you a heads up in case you see anything funny in the future with this function.
Just a rough draft for now @misi9170 and @Bartdoekemeijer of sketching in merging/reducing FLORIS objects (taking these functions out of FLASC and into FLORIS), we'll look a mess until we merge refactor...
Then also, first decision, is this the right place? Do we prefer a static member function?