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

portrait plot does not work with python 3 env #368

Closed
lee1043 opened this issue Oct 5, 2018 · 3 comments
Closed

portrait plot does not work with python 3 env #368

lee1043 opened this issue Oct 5, 2018 · 3 comments
Labels
bug help wanted high Highest priority issue
Milestone

Comments

@lee1043
Copy link
Contributor

lee1043 commented Oct 5, 2018

Python code: pp.py.txt

Input JSON: monsoon-wang_CMIP5_historical-regrid2_regrid2_2018-07-19-10-58-22.json.txt

Error message:

/Users/lee1043/anaconda2/envs/pmp_nightly_20180830/lib/python3.6/site-packages/numpy/ma/core.py:3169: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  dout = self.data[indx]
(44, 7) (44, 7)
/Users/lee1043/anaconda2/envs/pmp_nightly_20180830/lib/python3.6/site-packages/genutil/statistics.py:1712: VisibleDeprecationWarning: `rank` is deprecated; use the `ndim` attribute or function instead. To find the rank of a matrix see `numpy.linalg.matrix_rank`.
  if numpy.rank(ii) > 0:
/Users/lee1043/anaconda2/envs/pmp_nightly_20180830/lib/python3.6/site-packages/numpy/ma/core.py:3201: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  mout = _mask[indx]
Traceback (most recent call last):
  File "pp.py", line 95, in <module>
    P.plot(rms_norm,x=x,bg=0)
  File "/Users/lee1043/anaconda2/envs/pmp_nightly_20180830/lib/python3.6/site-packages/pcmdi_metrics/graphics/portraits.py", line 849, in plot
    self.set_colormap()
  File "/Users/lee1043/anaconda2/envs/pmp_nightly_20180830/lib/python3.6/site-packages/pcmdi_metrics/graphics/portraits.py", line 1942, in set_colormap
    cols = MV2.reshape(cols, (len(cols) / 3, 3))
  File "/Users/lee1043/anaconda2/envs/pmp_nightly_20180830/lib/python3.6/site-packages/cdms2/MV2.py", line 992, in reshape
    maresult = numpy.ma.reshape(ta, newshape)
  File "/Users/lee1043/anaconda2/envs/pmp_nightly_20180830/lib/python3.6/site-packages/numpy/ma/core.py", line 7002, in reshape
    return a.reshape(new_shape, order=order)
  File "/Users/lee1043/anaconda2/envs/pmp_nightly_20180830/lib/python3.6/site-packages/numpy/ma/core.py", line 4577, in reshape
    result = self._data.reshape(*s, **kwargs).view(type(self))
TypeError: 'float' object cannot be interpreted as an integer

The final Type Error is coming from cols = MV2.reshape(cols, (len(cols) / 3, 3)) part in the above message, where Python 2 returns integer while Python 3 returns float.

For example in Python 2:

>>> 3/2
1

But in Python 3:

>>> 3/2
1.5

And given float number cannot be used for the reshape of MV2.

@doutriaux1 any chance to fix this? @gleckler1 you may experience same error when you update your pmp to most recent.

@lee1043
Copy link
Contributor Author

lee1043 commented Oct 9, 2018

Issue moved to PMP.
PCMDI/pcmdi_metrics#581

@lee1043 lee1043 closed this as completed Oct 9, 2018
@doutriaux1
Copy link
Contributor

doutriaux1 commented Oct 9, 2018

@lee1043 you got one of the few that escaped us! Fixing right away in pmp

@lee1043
Copy link
Contributor Author

lee1043 commented Oct 9, 2018

@doutriaux1 good to know. Yay, gotcha! :)

@doutriaux1 doutriaux1 added this to the 8.1 milestone Feb 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug help wanted high Highest priority issue
Projects
None yet
Development

No branches or pull requests

2 participants