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 unicode-named data loading #290

Merged
merged 1 commit into from May 13, 2018
Merged

Conversation

mraspaud
Copy link
Member

Dataset loading was failing in python 2 if the query was done by name with a unicode name.

  • Tests added
  • Tests passed
  • Passes git diff origin/develop **/*py | flake8 --diff

Copy link
Member

@djhoese djhoese left a comment

Choose a reason for hiding this comment

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

In my opinion this is not the right fix for this. This bug that is being encountered is an issue in the readers trying to use unicode objects (in python 2) as normal string values. Your change in this PR is making satpy support unicode objects where it should only support str objects.

I think an "easy" fix would be to modify the yaml reader to convert ancillary metadata to strings before trying to load it. The "best" solution is really to modify the ancillary data stored in the .attrs that the reader is returning to make them not unicode objects. This may be difficult for generic readers that just copy the .attrs from the NetCDF file to the produced dataset.

I am ok with this change if time is an issue, but we could also just suggest moving to python 3 😉.

Copy link
Member

@djhoese djhoese left a comment

Choose a reason for hiding this comment

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

My argument is shutdown by the fact that my_dict[u'my_key'] works for str keys.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 65.52% when pulling 1b8b2ce on fix-ancillary-data-loading into 43475c7 on develop.

@codecov
Copy link

codecov bot commented May 13, 2018

Codecov Report

Merging #290 into develop will not change coverage.
The diff coverage is 66.66%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #290   +/-   ##
========================================
  Coverage    65.52%   65.52%           
========================================
  Files          117      117           
  Lines        14275    14275           
========================================
  Hits          9353     9353           
  Misses        4922     4922
Impacted Files Coverage Δ
satpy/readers/__init__.py 94.75% <66.66%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 43475c7...1b8b2ce. Read the comment docs.

@mraspaud mraspaud merged commit fe37d89 into develop May 13, 2018
@mraspaud mraspaud deleted the fix-ancillary-data-loading branch May 13, 2018 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants