-
Notifications
You must be signed in to change notification settings - Fork 33
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
cmor.axis is not handling unicode string values correctly in Python #612
Comments
yes I agree, assuming @mauzey1 also agrees. |
@mauzey1 I also think we should (so CMOR should) be able to handle unicode strings. Often I will rewrite strings to unicode, to ensure that they view correctly on html pages for e.g., so we should really support such a web standard format |
I am trying to apply the solution that I suggested to @markcollier in #611 (comment) inside of the axis function in pywrapper.py. Lines 432 to 440 in 16c7c35
If an array with unicode strings is passed to cmor.axis , then those strings will be converted to zero-terminated byte arrays.
|
@mauzey1 you know this code far better than me, would it benefit code maintenance to fix the fact that unicode strings aren't being dealt with correctly? This seems like a kludge fix that might squash this particular bug, but it may appear elsewhere |
This is a followup of #611.
Passing axis values of unicode string type to
cmor.axis
will cause CMOR to store only the first characters of the axis values.Example:
This can be fixed by converting the unicode strings to zero-terminated byte strings, which is type
'S'
in numpy.Shouldn't this conversion happen in CMOR? Or should we change the code and documentation to say that only strings of type
'S'
are accepted bycmor.axis
?The text was updated successfully, but these errors were encountered: