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

[registry] AVS .fld data files #333

Merged
merged 3 commits into from
May 15, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/registry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ end

add_format(format"RDataSingle", detect_rdata_single, [".rds"], [idRData, LOAD])

add_format(format"FLD", "# AVS", [".fld"], [idAVSfldIO])
add_format(format"AVSfld", "# AVS", [".fld"], [idAVSfldIO])
add_format(format"CSV", (), [".csv"], [idCSVFiles])
add_format(format"TSV", (), [".tsv"], [idCSVFiles])
add_format(format"Feather", "FEA1", [".feather"], [:FeatherFiles => UUID("b675d258-116a-5741-b937-b79f054b0542")])
Expand Down
2 changes: 2 additions & 0 deletions test/files/avs-ascii.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1 2 3 4 5 6
7 8 9 8 7 6
9 changes: 9 additions & 0 deletions test/files/avs-ascii.fld
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# AVS field file (ascii variant)
Copy link
Member

Choose a reason for hiding this comment

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

Just a question. Does all AVS field file has this # AVS?

Copy link
Member Author

Choose a reason for hiding this comment

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

Every one that I have seen. This format was never blessed by any standards organization and I have been unable to find online documentation of it. (I learned the format from a paper manual before the WWW existed!) So I think we will not find any 100% definitive answer to the question.
I already added a comment about this assumption in the long README here:
https://github.com/JeffFessler/AVSfldIO.jl
That README is probably more complete documentation than you will find anywhere on the web!

It is trivial to add that header if someone (1) has a file without it and (2) wants to read it with Julia.
If at some later point there is someone who has a big pile of the data format without that header then I am happy to write a fancier format detector function if needed.

I have added the query test in the most recent commit.
I also changed the format name from "FLD" to "AVSfld" to be more specific.

ndim=2
dim1=3
dim2=4
nspace=2
veclen=1
data=int
field=uniform
variable 1 file=avs-ascii.dat filetype=ascii
6 changes: 6 additions & 0 deletions test/query.jl
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,12 @@ let file_dir = joinpath(@__DIR__, "files"), file_path = Path(file_dir)
@test position(io) == 4
end
end

@testset "AVSfld detection" begin
q = query(joinpath(file_dir, "avs-ascii.fld"))
@test typeof(q) <: File{format"AVSfld"}
end

end

@testset "Query from IOBuffer" begin
Expand Down