Skip to content

Extensions to the to_netcdf docstring #681

Open
@rpgoldman

Description

@rpgoldman

Tell us about it

Saving an arviz inferenceData object to a file, I was looking at the docstring (on the website) for guidance. Here are some questions I think would be good to answer in that docstring:

  1. The docstring says

    Save dataset as a netcdf file.
    WARNING: Only idempotent in case data is InferenceData
    I don't understand what "idempotent" means in this context. This function should not change the InferenceData argument, so what does it mean for it to be idempotent (or not, for that matter)? If this means that writing the same data object that is not an InferenceData twice gives different results, the docstring should just say so.
    For that matter, it seems pretty complicated to understand what will happen if the data argument is not an InferenceData object, but is "any object accepted by convert_to_inference_data". Wouldn't it be simpler to have the user translate the object to save themselves, instead of trying to guess what they want?

  2. Supporting coords and dims arguments just made me worried. Does this mean that the function won't save the coords and dims that are already in the InferenceData? Or is this just for the case when the argument is not an InferenceData (or is, for some reason, an InferenceData object that doesn't have coords and dims)? Maybe clarify by saying "defaults to the coords (respectively, dims) already in the InferenceData, if any."

  3. The description of the group argument is hard to understand:

    groupstr (optional)
    In case data is not InferenceData, this is the group it will be saved to

    Does this mean that this function will try to splice additional information into a previously-existing netcdf file? Or is this just if, for example, we pass a PyMC3 prior predictive trace as the data argument? Again, maybe it would make things simpler for both users and maintainers/developers if things were simplified by requiring an InferenceData object as data (and requiring the callers to do the translation themselves).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions