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

JSON parsefile does weird things to types. #26

Open
odunbar opened this issue Dec 13, 2024 · 0 comments
Open

JSON parsefile does weird things to types. #26

odunbar opened this issue Dec 13, 2024 · 0 comments

Comments

@odunbar
Copy link
Member

odunbar commented Dec 13, 2024

Issue

graph_dict = JSON.parsefile(graph_file)

One might expect that we would want graph dict to be
Dict{Int, Vector{Int})
or
Dict{String, Vector{String}
but JSON will go to Dict(String, Vector{Any}) by default, and so user will have to convert this manually after for some consistency.

Possible solution

If we wanted integers we could add the line

graph_dict = Dict(eachrow([[parse(Int,x) for x in keys(graph_dict)] collect(values(graph_dict))])) 

likewise for strings, and adjust any conflicts in the get_upstream_basins function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant