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

Add indents for JSON files for readbility #167

Merged
merged 8 commits into from
Dec 6, 2024
Merged

Conversation

calvinchai
Copy link
Contributor

@calvinchai calvinchai commented Sep 30, 2024

The library writes json files minimized which is difficult to read.
e.g.

{"dtype":"<u1","filters":null,"shape":[348],"order":"C","zarr_format":2,"chunks":[348],"fill_value":null,"compressor":null}

Added indents for readability.

{
    "dtype": "<u1",
    "filters": null,
    "shape": [
        348
    ],
    "order": "C",
    "zarr_format": 2,
    "chunks": [
        348
    ],
    "fill_value": null,
    "compressor": null
}

@asinghvi17
Copy link
Member

Should this be a choice / keyword argument instead? Maybe it could propagate down from write or zcreate.

@nhz2
Copy link
Member

nhz2 commented Oct 9, 2024

Yes, minimizing the JSON files saves disk space so adding indents should be optional.

@calvinchai
Copy link
Contributor Author

Agree. I just revised it and made it a keyword arguments

src/Storage/Storage.jl Outdated Show resolved Hide resolved
src/Storage/Storage.jl Outdated Show resolved Hide resolved
src/ZArray.jl Outdated Show resolved Hide resolved
src/ZGroup.jl Outdated Show resolved Hide resolved
calvinchai and others added 5 commits October 10, 2024 11:21
Co-authored-by: Anshul Singhvi <[email protected]>
Co-authored-by: Anshul Singhvi <[email protected]>
Co-authored-by: Anshul Singhvi <[email protected]>
Co-authored-by: Anshul Singhvi <[email protected]>
Copy link
Member

@asinghvi17 asinghvi17 left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks for the PR! @meggart should probably review as well.

Test failures are from the pangeo AWS bucket that went down.

Copy link
Collaborator

@meggart meggart left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, looks good to me. I know its a matter of taste but in my opinion we could make indent_json=true the default and only disable for very large arrays. But I am fine with both ways and would merge in 1-2 days if there is no more feedback.

@meggart meggart merged commit 2ae3c2a into JuliaIO:master Dec 6, 2024
1 of 8 checks passed
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.

4 participants