-
Notifications
You must be signed in to change notification settings - Fork 5
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
Finalised write aseg gdf function #67
Conversation
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.
Nicely done.
Next time, please provide an MWE (minimum working example) to aid reviewing as follows:
using HiQGA
vall=[[1, [2., 3.]], [2, [3., 4.]]]
sfmt = ["%3d", "%4.1f"]
outfile = "myfile"
channel_names = [["FID", "dBz/dt"], ["","pV/Am4"],["FID", "dBz/dt"]]
transD_GP.CommonToAll.writeaseggdf(vall, sfmt, outfile, channel_names)
- please check if output f above MWE works in Geosoft, especially checking if providing no unit name is problematic. Add a screenshot here to confirm ok.
- lastly, please check review comments on making standalone functions for the DFN file writer.
sfmt_fortran = Vector{String}(undef, length(sfmt)) | ||
|
||
for i =1:length(sfmt) | ||
temp1 = last(sfmt[i], 1) | ||
temp1 = uppercase(temp1) | ||
temp2 = strip(sfmt[i], '%') | ||
|
||
fortran_format = string(temp1, temp2) | ||
fortran_format = chop(fortran_format) | ||
|
||
sfmt_fortran[i] = fortran_format | ||
end |
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.
Please make the fortran format creator a standalone function which can be re-used
src/CommonToAll.jl
Outdated
##Write the definition file | ||
open(outfile*".dfn", "w") do io | ||
#println(io, "DEFN ST=RECD,RT=COMM;RT:A4;COMMENTS:A76") #Geosoft | ||
|
||
for i=1:length(channel_names[1]) | ||
if (length(vall[1][i]) == 1) | ||
println(io, "DEFN $(i) ST=RECD,RT=; $(channel_names[1][i]): $(sfmt_fortran[i]) : NULL=-99999.99, UNITS=$(channel_names[2][i]), LONGNAME=$(channel_names[3][i])") | ||
else | ||
println(io, "DEFN $(i) ST=RECD,RT=; $(channel_names[1][i]): $(record[i])$(sfmt_fortran[i]) : NULL=-99999.99, UNITS=$(channel_names[2][i]), LONGNAME=$(channel_names[3][i])") | ||
end | ||
end | ||
|
||
println(io, "DEFN $(length(channel_names[1])+1) ST=RECD,RT=; END DEFN") | ||
flush(io) | ||
close(io) | ||
end |
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.
Please make the DFN writer into a standalone function for re-usability. Also, please check whitespace formatting. close
should be tabbed from end
and open
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.
-split functions for .dat and .dfn file -created fortran formatter for field codes -created a test file
-split functions for .dat and .dfn file -created fortran formatter for field codes -created a test file
ensure that line field is present.
Two functions added. Generic field names removed. Function can write the ASEG GDF format .dat and .dfn files based on fname supplied as a user string.