当前位置:网站首页>‘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
边栏推荐
- QT compressed folder
- 巴普洛夫与兴趣爱好
- If I am PM's performance, movie VR ticket purchase display
- Pavlov and hobbies
- The QT debug version runs normally and the release version runs crash
- Relative reference and absolute reference of Excel
- Utf8 to STD: string and STD: string to utf8
- refused connection
- Radar equipment (greedy)
- 提升Facebook触及率和互动率攻略 | 智能客服帮您抓住用户的心
猜你喜欢
随机推荐
Flutter 新一代圖形渲染器 Impeller
X86 assembly syntax: at & T and Intel
Hongji | how does HR carry out self change and organizational change in the digital era?
Create process memory management copy_ Mm - processes and threads (IX)
Tslint annotations ignore errors and restful understanding
Flutter nouvelle génération de rendu graphique Impeller
Rog attack
Fast application fuzzy search
Note: unordered_ Understanding and use of map
Usage and difference of shellexecute, shellexecuteex and winexec in QT
qt. qpa. plugin: Could not find the Qt platform plugin “xcb“ in ““
Phlli in a VM node
Jiugong magic square - the 8th Lanqiao provincial competition - group C (DFS and comparison of all magic square types)
Qwebsocket communication
橙单微服务之批量导入
Xiuxian real world and game world
Flutter 新一代图形渲染器 Impeller
Wbpack configuring production development environment
巴普洛夫与兴趣爱好
Call the interface to get the time




![[the background color changes after clicking a line]](/img/3a/709d47fd3a370d86569fb9b560b403.png)



