-
Notifications
You must be signed in to change notification settings - Fork 4
Minor bug fix in writeg and parse_gfile_header #20
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
Conversation
|
@eldond Do you know why the "####ms" time style isn't being parsed properly? That's what all the sample gEQDSK files in OMFIT have, so I assume it's the default EFIT output format. |
Additional Fixes in
|
Minor fix in
|
|
@mgyoo86 @bclyons12 @lstagner should this be merged and a new version released? There's also the question of where to add documentation like @mgyoo86 example on Discord: import EFIT
import EFIT.IMASdd
filename = joinpath(dirname(dirname(pathof(EFIT))), "test", "test_dd_eq.json")
dd = IMASdd.json2imas(filename);
# Convert dd to GEQDSK struct (Note: GEQDSK is not a file)
ggs = EFIT.imas2geqdsk(dd)
# Write into file
for gg in ggs
file_name = gg.file # default file name has "g00000.xxxxx" format
EFIT.writeg(gg, file_name)
end
# You can specify a file name
EFIT.writeg(ggs[1], "my_equilibrium.geqdsk")
# specify description, shot, and time as keyword arguments
# NOTE: time must be in `ms` unit (You can just put a number in `ms` without postfix `ms`)
EFIT.writeg(ggs[1], "my_equilibrium.geqdsk"; desc="my description", shot="my shot 12345", time="1000ms")
# If the description is too long, it will cause an error.
EFIT.writeg(ggs[1], "my_equilibrium.geqdsk"; desc="This too long description will cause error.") |
bclyons12
left a comment
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.
Overall looks good, but I'd make the simplifying change I suggest and maybe add a test.
|
I have confirmed that the format produced by this PR can be opened in OMFIT, which for me, is the minimal requirement :-) |
|
@bclyons12
@orso82 |
|
@mgyoo86 I'd be in favor of that, just the basic functionality. We can then add a link to the regression tests for people to see any extra/optional features. |
|
@mgyoo86 Great work. And I agree. In the Readme, just add a section on reading and writing gEQDSK files, including from IMAS. |
|
@orso82 @bclyons12 |
|
Fantastic! Thank you @mgyoo86 |
Minor bug fixes in
runtest.jlparse_gfile_headerwritegwith postfix, (e.g., "1ms") is parsed asExpr, which causes an error.timeisExpr, convert it toStringfirst, then the error is gone.@bclyons12 could you please review the changes?
I cannot find the
reviewersbutton for this PR..Suggestion
If the GitHub CI action is added, it would be useful to automatically test
runtest.jl.The current Travis CI seems not to be triggered automatically.