当前位置:网站首页>‘EddiesObservations‘ object has no attribute ‘filled‘
‘EddiesObservations‘ object has no attribute ‘filled‘
2022-04-23 05:35:00 【3D_ DLW】
problem
Recently used py-eddy-tracker, Refer to official documents Vortex area fill Call found on py_eddy_tracker.observations.observation.EddiesObservations.filled Report errors :
'EddiesObservations' object has no attribute 'filled'
Try
filled Official documentation of functions
Check the information provided on the official website Source code It was found that there was filled Functional , But you don't have it in your local library .
Check the version and find that the local version is 3.2.0, The official document version is 3.5.0
> pip show pyEddyTracker
Name: pyEddyTracker
Version: 3.2.0
...
and pip Unable to install 3.5.0
> pip install pyEddyTracker==3.5.0
ERROR: Could not find a version that satisfies the requirement pyEddyTracker==3.5.0 (from versions: 3.0.0, 3.1.0, 3.2.0)
ERROR: No matching distribution found for pyEddyTracker==3.5.0
Try installing the latest version manually using the method provided in the documentation :
Finally, the version is too low , my python3.6 Unable to install the latest version of py-eddy-tracker
RuntimeError: Cannot install on Python version 3.6.4; only versions >=3.7,<3.10 are supported
resolvent
upgrade python
upgrade python Version is impossible , Never in my life .
Manually modify observation.py Source code
# 32 That's ok +
from matplotlib.cm import get_cmap
from matplotlib.collections import PolyCollection
from matplotlib.colors import Normalize
# 1259 That's ok +
def parse_varname(self, name):
return self[name] if isinstance(name, str) else name
def format_label(self, label):
t0, t1 = self.period
return label.format(
t0=t0,
t1=t1,
nb_obs=len(self),
)
def filled(
self,
ax,
varname=None,
ref=None,
intern=False,
cmap="magma_r",
lut=10,
vmin=None,
vmax=None,
factor=1,
**kwargs,
):
""" :param matplotlib.axes.Axes ax: matplotlib axe used to draw :param str,array,None varname: variable used to fill the contours, or an array of same size than obs :param float,None ref: if defined, all coordinates are wrapped with ref as western boundary :param bool intern: if True draw speed contours instead of effective contours :param str cmap: matplotlib colormap name :param int,None lut: Number of colors in the colormap :param float,None vmin: Min value of the colorbar :param float,None vmax: Max value of the colorbar :param float factor: multiply value by :return: Collection drawed :rtype: matplotlib.collections.PolyCollection .. minigallery:: py_eddy_tracker.EddiesObservations.filled """
x_name, y_name = self.intern(intern)
x, y = self[x_name], self[y_name]
if ref is not None:
# TODO : maybe buggy with global display
shape_out = x.shape
x, y = wrap_longitude(x.reshape(-1), y.reshape(-1), ref)
x, y = x.reshape(shape_out), y.reshape(shape_out)
verts = list()
for x_, y_ in zip(x, y):
verts.append(create_vertice(x_, y_))
if "facecolors" not in kwargs:
kwargs = kwargs.copy()
cmap = get_cmap(cmap, lut)
v = self.parse_varname(varname) * factor
if vmin is None:
vmin = v.min()
if vmax is None:
vmax = v.max()
v = (v - vmin) / (vmax - vmin)
colors = [cmap(v_) for v_ in v]
kwargs["facecolors"] = colors
if "label" in kwargs:
kwargs["label"] = self.format_label(kwargs["label"])
c = PolyCollection(verts, **kwargs)
ax.add_collection(c)
c.cmap = cmap
c.norm = Normalize(vmin=vmin, vmax=vmax)
return c
result
A successful call
fig = plt.figure(figsize=(3, 2))
ax = fig.add_axes([.03, .03, .94, .94])
ax.set_ylim(4, 30)
ax.set_xlim(105.5, 150)
plt.axis('off')
plt.gca().xaxis.set_major_locator(plt.NullLocator())
plt.gca().yaxis.set_major_locator(plt.NullLocator())
plt.subplots_adjust(top=1, bottom=0, right=1, left=0, hspace=0, wspace=0)
plt.margins(0, 0)
ax.set_aspect('equal')
a.filled(ax, 'amplitude', vmin=0, vmax=.5, color='b') # fill
c.filled(ax, 'amplitude', vmin=0, vmax=.5, color='r')
plt.show()

版权声明
本文为[3D_ DLW]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230532508269.html
边栏推荐
- After adding qmenu to qtoolbutton and QPushButton, remove the triangle icon in the lower right corner
- Flutter 新一代图形渲染器 Impeller
- uni使用的一些坑
- Necessity of selenium preloading cookies
- 7-10 longest symmetric substring (25 points) (violence problem solution) C language
- Deep learning object detection
- Flutter 新一代圖形渲染器 Impeller
- Multiple mainstream SQL queries only take the latest one of the data
- Ehcache Memcache redis three caches
- Several examples of pointer transfer, parameter transfer, value transfer, etc
猜你喜欢

相机成像+单应性变换+相机标定+立体校正

双击.jar包无法运行解决方法

Excel 2016 打开文件第一次打不开,有时空白,有时很慢要打开第二次才行

Double click The jar package cannot run the solution

Hongji | how does HR carry out self change and organizational change in the digital era?

Create cells through JS (while loop)

Excel sets row and column colors according to cell contents

The 8th Blue Bridge Cup 2017 - frog jumping cup

Uncle wolf is looking for a translator -- Plato -- ongoing translation

Parameter analysis of open3d material setting
随机推荐
open3d材质设置参数分析
Processus d'exécution du programme exécutable
refused connection
Log introduction and building web application
[untitled] Notepad content writing area
Data bus realizes the communication between brother components
Executable program execution process
World and personal development
巴普洛夫与兴趣爱好
C语言——恶搞关机小程序
Utf8 to STD: string and STD: string to utf8
The main difference between pointer and reference
Traversal array, object parent-child communication props / $emit
Hongji micro classroom | cyclone RPA's "flexible digital employee" actuator
7-10 longest symmetric substring (25 points) (violence problem solution) C language
Edit, cancel, pull up menu
[machine learning] scikit learn introduction
Rog attack
deep learning object detection
On the use of constant pointer and pointer constant -- exercise (record)