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

Finalised write aseg gdf function #67

Merged
merged 7 commits into from Feb 26, 2024
Merged

Finalised write aseg gdf function #67

merged 7 commits into from Feb 26, 2024

Conversation

rade7
Copy link
Collaborator

@rade7 rade7 commented Feb 12, 2024

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.

@rade7 rade7 requested a review from a2ray February 12, 2024 00:39
Copy link
Collaborator

@a2ray a2ray left a 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.

Comment on lines +2012 to +2023
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
Copy link
Collaborator

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

Comment on lines 2025 to 2040
##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
Copy link
Collaborator

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done please see screenshot of geosoft import
MWE

Ravin Deo added 4 commits February 26, 2024 15:03
-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.
@a2ray a2ray merged commit edde0ac into master Feb 26, 2024
1 check passed
@a2ray a2ray deleted the aseggdf branch February 26, 2024 04:48
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

Successfully merging this pull request may close these issues.

None yet

2 participants