Removing parsers: PowerSystemTableData, PowerModelsData, PowerFlowDataNetwork#1648
Open
hannahchubin wants to merge 7 commits intopsy6from
Open
Removing parsers: PowerSystemTableData, PowerModelsData, PowerFlowDataNetwork#1648hannahchubin wants to merge 7 commits intopsy6from
hannahchubin wants to merge 7 commits intopsy6from
Conversation
…er commit 419bdb6
…twork and tests passing, just pushing changes to I can rebase with main and make sure tests still pass
…PowerSystemTableData object
| pm_kwargs = Dict(k => v for (k, v) in kwargs if !in(k, SYSTEM_KWARGS)) | ||
| sys_kwargs = Dict(k => v for (k, v) in kwargs if in(k, SYSTEM_KWARGS)) | ||
| return System(PowerModelsData(file_path; pm_kwargs...); sys_kwargs...) | ||
| return System(PowerFlowFileParser.PowerModelsData(file_path; pm_kwargs...); sys_kwargs...) |
Contributor
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
Suggested change
| return System(PowerFlowFileParser.PowerModelsData(file_path; pm_kwargs...); sys_kwargs...) | |
| return System( | |
| PowerFlowFileParser.PowerModelsData(file_path; pm_kwargs...); | |
| sys_kwargs..., | |
| ) |
|
|
||
| """Return the PowerSystems generator type for this fuel and unit_type.""" | ||
| function get_generator_type(fuel, unit_type, mappings::Dict{NamedTuple, DataType}) | ||
| function get_generator_type(fuel, unit_type, mappings::Union{Dict{NamedTuple, String}, Dict{NamedTuple, DataType}}) |
Contributor
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
Suggested change
| function get_generator_type(fuel, unit_type, mappings::Union{Dict{NamedTuple, String}, Dict{NamedTuple, DataType}}) | |
| function get_generator_type( | |
| fuel, | |
| unit_type, | |
| mappings::Union{Dict{NamedTuple, String}, Dict{NamedTuple, DataType}}, | |
| ) |
| """Return a vector of user-defined fields for the category.""" | ||
| function get_user_fields(data::PowerSystemTableData, category::InputCategory) | ||
| if !haskey(data.user_descriptors, category) | ||
| function get_user_fields(data::PowerTableDataParser.PowerSystemTableData, category::InputCategory) |
Contributor
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
Suggested change
| function get_user_fields(data::PowerTableDataParser.PowerSystemTableData, category::InputCategory) | |
| function get_user_fields( | |
| data::PowerTableDataParser.PowerSystemTableData, | |
| category::InputCategory, | |
| ) |
| """Return the dataframe for the category.""" | ||
| function get_dataframe(data::PowerSystemTableData, category::InputCategory) | ||
| df = get(data.category_to_df, category, DataFrames.DataFrame()) | ||
| function get_dataframe(data::PowerTableDataParser.PowerSystemTableData, category::InputCategory) |
Contributor
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
Suggested change
| function get_dataframe(data::PowerTableDataParser.PowerSystemTableData, category::InputCategory) | |
| function get_dataframe( | |
| data::PowerTableDataParser.PowerSystemTableData, | |
| category::InputCategory, | |
| ) |
| Refer to the PowerSystems descriptor file for field names that will be created. | ||
| """ | ||
| function iterate_rows(data::PowerSystemTableData, category; na_to_nothing = true) | ||
| function iterate_rows(data::PowerTableDataParser.PowerSystemTableData, category; na_to_nothing = true) |
Contributor
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
Suggested change
| function iterate_rows(data::PowerTableDataParser.PowerSystemTableData, category; na_to_nothing = true) | |
| function iterate_rows( | |
| data::PowerTableDataParser.PowerSystemTableData, | |
| category; | |
| na_to_nothing = true, | |
| ) |
|
|
||
| function _get_field_infos(data::PowerSystemTableData, category::InputCategory, df_names) | ||
| if !haskey(data.user_descriptors, category) | ||
| function _get_field_infos(data::PowerTableDataParser.PowerSystemTableData, category::InputCategory, df_names) |
Contributor
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
Suggested change
| function _get_field_infos(data::PowerTableDataParser.PowerSystemTableData, category::InputCategory, df_names) | |
| function _get_field_infos( | |
| data::PowerTableDataParser.PowerSystemTableData, | |
| category::InputCategory, | |
| df_names, | |
| ) |
|
|
||
| """Reads values from dataframe row and performs necessary conversions.""" | ||
| function _read_data_row(data::PowerSystemTableData, row, field_infos; na_to_nothing = true) | ||
| function _read_data_row(data::PowerTableDataParser.PowerSystemTableData, row, field_infos; na_to_nothing = true) |
Contributor
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
Suggested change
| function _read_data_row(data::PowerTableDataParser.PowerSystemTableData, row, field_infos; na_to_nothing = true) | |
| function _read_data_row( | |
| data::PowerTableDataParser.PowerSystemTableData, | |
| row, | |
| field_infos; | |
| na_to_nothing = true, | |
| ) |
| end | ||
|
|
||
| function Base.show(io::IO, ::MIME"text/plain", data::PowerSystemTableData) | ||
| function Base.show(io::IO, ::MIME"text/plain", data::PowerTableDataParser.PowerSystemTableData) |
Contributor
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
Suggested change
| function Base.show(io::IO, ::MIME"text/plain", data::PowerTableDataParser.PowerSystemTableData) | |
| function Base.show( | |
| io::IO, | |
| ::MIME"text/plain", | |
| data::PowerTableDataParser.PowerSystemTableData, | |
| ) |
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.
I've removed the parsing functions
PowerSystemTableData(),PowerModelsData(), andPowerFlowDataNetwork()from all of PSY, meaning I've commented out (can fully delete once my changes are approved) and edited the following:PowerFlowFileParser.jlandPowerTableDataParser.jlrepos as dependencies ofPowerSystems.jlinstead of exporting the parsing functions from PSY directlySystemmethods, that use the parsed data created by said functions, in this reposrc/parsers/that are only used to create/support the parsing functions to their new respective reposget_generator_typedefined insrc/parsers/common.jlis called on the output ofget_generator_mapping(defined in the same file), but the latter function is copied toPowerTableDataParser.jlwith a different method. Therefore, the former function needed to be modified here to accommodate for both possible output types from the latter.src/parsers/power_system_table_data.jlwere also modified to accommodate this change_category_keydefined insrc/parsers/power_system_table_data.jlto handle the fact thatPowerTableDataParser.jlhas data that does not useInputCategoryin an effort to remove any PSY deps from the parsing repos. Previously,PowerSystemTableDatain PSY could useInputCategory, so this new function is to handle this discrepancysrc/parsers/with comments describing where certain functions are used in the parsing workflow