arviz-devs / arviz

Exploratory analysis of Bayesian models with Python
https://python.arviz.org
Apache License 2.0
1.56k stars 388 forks source link

Allow additional arguments to to_netcdf() methods #2298

Open cluhmann opened 6 months ago

cluhmann commented 6 months ago

I noticed that the signatures of the az.InferenceData.to_netcdf() method and the az.to_netcdf() methods are not entirely aligned. For example, az.InferenceData.to_netcdf() takes a boolean compress argument which is absent in the az.to_netcdf() method. So the first request is to align these two methods so that they match.

More generally, however, there are a variety of kwargs that xarray.Dataset.to_netcdf() method accepts that are not accepted by the arviz methods. For example, there is the encoding argument that allows for much finer-grained control over the compression encoding parameters. Things might get a bit tricky when allowing a detailed specification that could, in principle, conflict with some of the arviz-provided arguments. But it might be nice to expose whatever is feasible.