Fix turbine_type search parameter in get_oedb_windturbineconfig - #519
Open
dylanpulver wants to merge 1 commit into
Open
Fix turbine_type search parameter in get_oedb_windturbineconfig#519dylanpulver wants to merge 1 commit into
dylanpulver wants to merge 1 commit into
Conversation
The `turbine_type` branch filtered the `turbine_type` column with the value of `search_params["name"]`. Searching by `turbine_type` alone raised `KeyError: 'name'`, and passing both silently ignored the requested turbine type. In the OEDB wind turbine library the two columns differ for 58 of the 68 entries that carry a power curve, so the two are not interchangeable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes proposed in this Pull Request
get_oedb_windturbineconfigdocumentsturbine_typeas a recognized searchargument, but the branch that applies it reads the wrong key:
Two consequences on current
master, both reproduced against the live OEDBwind_turbine_libraryendpoint the function queries:get_oedb_windturbineconfig(turbine_type="E-101/3050")raisesKeyError: 'name'.get_oedb_windturbineconfig(name="E-101/3050", turbine_type="__nope__")returns
E-101/3050. The turbine type is silently ignored rather thannarrowing the search.
The two columns are not interchangeable. Of the 68 library entries that carry
a power curve, 58 have
name != turbine_type, 51 have aturbine_typethatis not a substring of its own
name, and 7 have nonameat all (severalNordex rows), so for those the turbine type is the only string that
identifies them.
manufacturerandnameare unaffected and are used ascontrols in the new tests.
The fix passes
search_params["turbine_type"]. Introduced in12846ce(v0.2 preparation, Jan 2021).
The three new tests patch the module-level
_oedb_turbinescache with atwo-row frame, so they are deterministic and make no network call. Reverting
the fix fails the first two; filtering the right value against the
namecolumn fails the first; deleting the branch fails both.
test_resource.pypreviously asserted only that a result was truthy and never passed
turbine_type=, which is why the defect survived.Test suite: 83 passed / 38 skipped on
master→ 86 / 38 with this branch,the +3 being exactly the new tests. The 38 skips are the CDS-credentialed
cutout tests and are skipped identically either way, so that path is unverified
here.
ruff checkandruff format --checkareclean across the repo.
Written with AI assistance; the behaviour above was measured, not inferred.
Checklist
doc.environment.yaml,environment_docs.yamlandsetup.py(if applicable).doc/release_notes.rstof the upcoming release is included.