Skip to content

Commit d63c58c

Browse files
authored
Fix parsing of CHEASE gEQDSK files (#9)
* fix parsing of CHEASE gEQDSK files * bump version number to 1.0.0
1 parent 20efb29 commit d63c58c

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "EFIT"
22
uuid = "cda752c5-6b03-55a3-9e33-132a441b0c17"
33
author = ["Luke Stagner <[email protected]>"]
4-
version = "0.2.0"
4+
version = "1.0.0"
55

66
[deps]
77
IMASDD = "06b86afa-9f21-11ec-2ef8-e51b8960cfc5"

src/io.jl

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,31 @@ end
5353
function read_array(t,n)
5454
data = zeros(n)
5555
for i=1:n
56-
data[i] = take!(t)
56+
try
57+
data[i] = take!(t)
58+
catch e
59+
if isa(e, InvalidStateException)
60+
# InvalidStateException when Channel is closed
61+
else
62+
rethrow(e)
63+
end
64+
end
5765
end
5866
return data
5967
end
6068

6169
function read_array2d(t,n,m)
6270
data = zeros(n,m)
6371
for i=1:n, j=1:m
64-
data[i,j] = take!(t)
72+
try
73+
data[i,j] = take!(t)
74+
catch e
75+
if isa(e, InvalidStateException)
76+
# InvalidStateException when Channel is closed
77+
else
78+
rethrow(e)
79+
end
80+
end
6581
end
6682
return data'
6783
end
@@ -114,7 +130,7 @@ function readg(gfile; set_time=nothing)
114130
f = open(gfile)
115131

116132
desc = readline(f)
117-
idum, time, nw, nh = parse_gfile_header(desc, set_time=set_time)
133+
idum, time, nw, nh = parse_gfile_header(desc; set_time)
118134

119135
token = file_numbers(f)
120136

0 commit comments

Comments
 (0)