我究竟做错了什么?TypeError: 不支持的操作数类型 -: 'str' 和 'Cube'

我的 MSc 论文代码有一些问题。我正在关注https://github.com/ErikaWarnatzsch/Malawi-Future-Climate-Modelling-Assessment/edit/master/Histogram_TasMAX.py模型,以便能够在使用历史记录的同时为未来的 RCP 场景(4.5 和 8.5)构建直方图和观测数据。

我正在查看的区域位于哥伦比亚中部地带。

(env) C:\Users\issaa\Desktop\190720>python  testewhistogram_tasmax.py

C:\Users\issaa\Anaconda3\envs\env\lib\site-packages\iris\fileformats\cf.py:1038: UserWarning: Ignoring variable 'rotated

_pole' referenced by variable 'tasmax': Dimensions ('time', 'string1') do not span ('time', 'rlat', 'rlon')

  warnings.warn(msg)

C:\Users\issaa\Anaconda3\envs\env\lib\site-packages\iris\fileformats\cf.py:1038: UserWarning: Ignoring variable 'rotated

_pole' referenced by variable 'tasmax': Dimensions ('time', 'string1') do not span ('time', 'rlat', 'rlon')

  warnings.warn(msg)

C:\Users\issaa\Anaconda3\envs\env\lib\site-packages\iris\fileformats\cf.py:1038: UserWarning: Ignoring variable 'rotated

_pole' referenced by variable 'tasmax': Dimensions ('time', 'string1') do not span ('time', 'rlat', 'rlon')

  warnings.warn(msg)

Traceback (most recent call last):

  File "testewhistogram_tasmax.py", line 161, in <module>

    main()

  File "testewhistogram_tasmax.py", line 77, in main

    CRU - iris.load_cube(CRU, 'near-surface temperature maximum')

TypeError: unsupported operand type(s) for -: 'str' and 'Cube'

我在 Internet 上看到一些关于它是 Python 2/Python 3 键入错误的信息——但是我仍然有点困惑从这里去哪里。


非常感谢您的帮助:)


蓝山帝景
浏览 114回答 1
1回答

RISEBY

我认为这只是一个错字!&nbsp;&nbsp;&nbsp;&nbsp;CRU&nbsp;-&nbsp;iris.load_cube(CRU,&nbsp;'near-surface&nbsp;temperature&nbsp;maximum')该行在应该有“=”的地方有一个“-”。类型错误中的“-”我看的时候并没有真正为我注册,但那一行显然不是你想做的!
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python