-
Notifications
You must be signed in to change notification settings - Fork 7
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
Support both 3-winding and 2-winding transformers #19
Conversation
src/parsing.jl
Outdated
for col in 1:ncols | ||
col = 1 | ||
is_2w = false | ||
while col < ncols | ||
eltyp = eltype(fieldtype(typeof(rec), col)) |
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.
if using Vector{Union{T, Missing}}
(rather than SentinelArray
), this may need to be nonmissingtype(eltype(...))
|
||
# Store data in column table so conversion to DataFrame efficient. | ||
Tables.istable(::Type{<:Records}) = true | ||
Tables.columnaccess(::Type{<:Records}) = true | ||
Tables.columns(x::Records) = x | ||
Tables.getcolumn(x::Records, i::Int) = getfield(x, i) | ||
Tables.columnnames(R::Type{<:Records}) = fieldnames(R) | ||
Tables.schema(R::Type{<:Records}) = Tables.Schema(fieldnames(R), fieldtypes(R)) | ||
Tables.schema(x::R) where {R <: Records} = Tables.Schema(fieldnames(R), fieldtypes(R)) |
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.
since we have to define schema
on Transformers
objects (not the type itself) we define this on objects too, so we can generically call schema(x)
(e.g. in show
)
src/parsing.jl
Outdated
# each "three-winding transformer" is 5 lines with (14, 11, 16, 16, 16) columns each. | ||
const T2_COLS = (14, 3, 16, 2) | ||
const T3_COLS = (14, 11, 16, 16, 16) | ||
const EOL_COLS = cumsum(T3_COLS) |
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.
i'm not sure these consts are better than magic numbers (tbh i find them harder to think about), but i suspect they might survive the test of time better...
a0f2e58
to
81aa67d
Compare
1d7f26b
to
5e979a2
Compare
closes #17 (follow-up to #11)
Supports 3-winding and 2-winding transformers in the same type.
Columns not present in 2-winding data...
Union{T, Missing}
missing
at parse timeTables.schema
/Tables.columns
/Tables.columnnames
) of the data in the givenTransformer
instanceLimitations:
:suffering:
0
indicates the end of the transformers datathis data is a madness