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

Can't read gEQDSK files with multiple new lines at end #10

Open
bclyons12 opened this issue Jul 26, 2024 · 2 comments
Open

Can't read gEQDSK files with multiple new lines at end #10

bclyons12 opened this issue Jul 26, 2024 · 2 comments

Comments

@bclyons12
Copy link
Collaborator

The latest version of EFIT.jl can't read some gEQDSK files that the old version did. For example: g163303.03170_fix.zip

I get the following output:

julia> gfixed = readg(fixed_geqdsk; set_time=0.0)

ERROR: InvalidStateException: Channel is closed.
Stacktrace:
 [1] try_yieldto(undo::typeof(Base.ensure_rescheduled))
   @ Base ./task.jl:931
 [2] wait()
   @ Base ./task.jl:995
 [3] wait(c::Base.GenericCondition{ReentrantLock}; first::Bool)
   @ Base ./condition.jl:130
 [4] wait
   @ ./condition.jl:125 [inlined]
 [5] take_unbuffered(c::Channel{Float64})
   @ Base ./channels.jl:494
 [6] take!
   @ ./channels.jl:471 [inlined]
 [7] readg(gfile::String; set_time::Float64)
   @ EFIT ~/.julia/dev/EFIT/src/io.jl:198
 [8] top-level scope
   @ REPL[38]:1

This appears to be caused by the fact that this file is missing some of the extra data that is read, and it has multiple new lines at the end. It appears common to files produced by CHEASE. The extra new line causes it not to report eof(f)=true so it tries to read a token in the following lines and fails:

EFIT.jl/src/io.jl

Lines 195 to 199 in d63c58c

for i 1:3
if !eof(f)
xdum = take!(token)
end
end

I'm not sure the best fix for this. Maybe a try-catch?

@bclyons12
Copy link
Collaborator Author

@orso82 @eldond @lstagner I have a fix but don't have permission to push a new branch here for some reason:

git push --set-upstream origin closed-channel-fix
ERROR: Permission to JuliaFusion/EFIT.jl.git denied to bclyons12.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

@orso82
Copy link
Contributor

orso82 commented Jul 26, 2024

@bclyons12 unless @lstagner gives you write permission you'd have to fork the repo, commit there and open a PR from your repo to the JuliaFusion one

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

2 participants