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

Fix decode_cf_variable. #153

Closed
wants to merge 2 commits into from

Conversation

akleeman
Copy link
Contributor

decode_cf_variable was still using da.data instead of da.values.

It now also works with DataArray as input.

It was still using da.data instead of da.values
@shoyer
Copy link
Member

shoyer commented Jun 12, 2014

I'm not opposed to this in principle, but this is an internal API that wasn't really for external consumption.

If you're relying on this in external code, then we should think about what the public API should be and add tests there, not for this internal function.

@@ -413,7 +413,9 @@ def get_to(source, dest, k):

def decode_cf_variable(var, concat_characters=True, mask_and_scale=True,
decode_times=True):
# use _data instead of data so as not to trigger loading data
if isinstance(var, xray.DataArray):
var = var.variable
Copy link
Member

Choose a reason for hiding this comment

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

I would consider using var = xray.variable.as_variable(var) instead.

@akleeman
Copy link
Contributor Author

I'm confused, are you saying we shouldn't add tests for internal functions?

@shoyer
Copy link
Member

shoyer commented Jun 12, 2014

No, just that it's unclear if it's a good idea to add tests (or
functionality) to internal functions in ways for features that aren't used
internally.

On Thu, Jun 12, 2014 at 1:29 PM, akleeman notifications@github.com wrote:

I'm confused, are you saying we shouldn't add tests for internal functions?


Reply to this email directly or view it on GitHub
#153 (comment).

@akleeman
Copy link
Contributor Author

So ... do you want me to remove the tests and only include the .data -> .values fix?

Re: api. I'm working on a better storage scheme for reflectivity data, which involves CF decoding plus remapping some values. I could build my own data store which implements the netcdf store and adds the extra layer there .. but just using decode_cf_variable is far easier. In general, I can imagine a situation where we would want to allow users to provide their own decoding functions, but thats a larger project.

@shoyer
Copy link
Member

shoyer commented Jun 12, 2014

OK, I guess this is fine -- I merged the other PR.

I will open another issue for exposing a public interface to decoding functions.

@shoyer shoyer closed this Jun 12, 2014
keewis pushed a commit to keewis/xarray that referenced this pull request Jan 17, 2024
updates:
- [github.com/keewis/blackdoc: v0.3.6 → v0.3.7](keewis/blackdoc@v0.3.6...v0.3.7)
- [github.com/pre-commit/mirrors-mypy: v0.971 → v0.981](pre-commit/mirrors-mypy@v0.971...v0.981)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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.

None yet

2 participants