add __and__, __or__, __xor__ operations in Series class

This commit is contained in:
wyq 2022-03-15 16:37:36 +08:00
parent 6ea625403e
commit d5933827c4
3 changed files with 25 additions and 7 deletions

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<MeteoInfo File="milconfig.xml" Type="configurefile">
<Path OpenPath="D:\Working\MIScript\Jython\mis\satellite\FY">
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\geotiff"/>
<Path OpenPath="D:\Working\MIScript\Jython\mis\map\webmap">
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\map"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\map\projection"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\city"/>
@ -11,22 +10,23 @@
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\bar"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\map\webmap"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\awx"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\satellite"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\satellite\FY"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\dataframe"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\map\webmap"/>
</Path>
<File>
<OpenedFiles>
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\plot\traj_3d.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\3d_earth\CALIPSO_L1_3d_axis.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\map\webmap\plotweb_1.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\map\webmap\plotweb_2.py"/>
</OpenedFiles>
<RecentFiles>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\plot\traj_3d.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\3d_earth\CALIPSO_L1_3d_axis.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\map\webmap\plotweb_1.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\map\webmap\plotweb_2.py"/>
</RecentFiles>
</File>
<Font>
@ -34,5 +34,5 @@
</Font>
<LookFeel DockWindowDecorated="true" LafDecorated="true" Name="FlatDarkLaf"/>
<Figure DoubleBuffering="true"/>
<Startup MainFormLocation="-7,0" MainFormSize="1395,835"/>
<Startup MainFormLocation="-7,0" MainFormSize="1368,830"/>
</MeteoInfo>

View File

@ -50,6 +50,24 @@ class Series(object):
self._data = np.array(self._series.getData())
self._index = Index.factory(index=self._series.getIndex())
def __and__(self, other):
if isinstance(other, Series):
other = other.values
return Series(self.values.__and__(other), index=self._index)
def __or__(self, other):
if isinstance(other, Series):
other = other.values
return Series(self.values.__or__(other), index=self._index)
def __xor__(self, other):
if isinstance(other, Series):
other = other.values
return Series(self.values.__xor__(other), index=self._index)
#---- index property
def get_index(self):
return self._index