arviz-devs / InferenceObjects.jl

Storage for results of Bayesian inference
https://julia.arviz.org/InferenceObjects
MIT License
14 stars 1 forks source link

Add NetCDF I/O #4

Closed sethaxen closed 2 years ago

sethaxen commented 2 years ago

This PR fixes #3 by implementing NetCDF I/O using NCDatasets.

Interestingly, if a NetCDF file written using Python features dimensions in the order (chain, draw, dims...), in Julia, they will be read as (dims..., draw, chain). This happens because NumPy uses row-major storage, while Julia uses column-major.

codecov-commenter commented 2 years ago

Codecov Report

Merging #4 (46dc23c) into main (e5a96f1) will increase coverage by 0.27%. The diff coverage is 98.03%.

@@            Coverage Diff             @@
##             main       #4      +/-   ##
==========================================
+ Coverage   96.50%   96.78%   +0.27%     
==========================================
  Files           7        8       +1     
  Lines         229      280      +51     
==========================================
+ Hits          221      271      +50     
- Misses          8        9       +1     
Impacted Files Coverage Δ
...ferenceObjectsNetCDF/src/InferenceObjectsNetCDF.jl 98.03% <98.03%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

sethaxen commented 2 years ago

Instead of using Requires to conditionally load NCDatasets into InferenceObjects, I created an InferenceObjectsNetCDF subpackage in the same repo. Loading this package re-exports all InferenceObjects exports, along with from_netcdf and to_netcdf.

This both enables better control over compat entries as well as improves downstream load times. Requires can significantly slow package loading.

sethaxen commented 2 years ago

Docs build won't work until the new package is registered, so this should not block this PR.