Skip to content

Can we clarify decode_cf option of open_dataset? #3020

Open

Description

@MeraX

Dea all,

I encountered a small unforeseen bug using the decode_cf of open_dataset. By only reading the doc string, I was not aware of the complete meaning of this parameter. Especially, that it overwrites other options.

Example:
ds = xarray.open_dataset(file_name, mask_and_scale=True, decode_cf=False)

The result is an unmasked and not sclaed dataset. decode_cf simply overwrites other options. See the code: https://github.com/pydata/xarray/blob/stable/xarray/backends/api.py#L308-L312

A simple solution would be to explain, that decode_cf sets mask_and_scale, decode_times, concat_characters, and decode_coords to False. But probably it would be more convenient to detect option conflicts like in my example and raise a ValueError.

What do you think? Do you prefer any of these options? I could write the little PR.

Activity

  1. dcherian commented on Jun 13, 2019

    @dcherian
    Contributor

    Thanks @MeraX.

    +1 on raising an error. and +5 for sending in a PR :)

  2. MeraX commented on Nov 16, 2019

    @MeraX
    ContributorAuthor

    Good things take a while, but today I finally managed to create a PR. What do you think?

    If there is more to to, let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions