11
11
12
12
@functional_datapipe ("check_greater_than_or_equal_to" )
13
13
class CheckGreaterThanOrEqualToIterDataPipe (IterDataPipe ):
14
+ """Check greater than or equal to"""
14
15
def __init__ (
15
16
self , source_datapipe : IterDataPipe , min_value : int , dataset_name : Optional [str ] = None
16
17
):
18
+ """
19
+ Check greater than or equal to check
20
+
21
+ Args:
22
+ source_datapipe: Datapipe emitting Xarray object
23
+ min_value: Minimum value
24
+ dataset_name: Optional dataset name if checking a subset
25
+ """
17
26
self .source_datapipe = source_datapipe
18
27
self .min_value = min_value
19
28
self .dataset_name = dataset_name
20
29
21
- def __iter__ (self ):
30
+ def __iter__ (self ) -> Union [xr .Dataset , xr .DataArray ]:
31
+ """Check equality"""
22
32
for xr_data in self .source_datapipe :
23
33
if self .dataset_name is not None :
24
34
check_dataset_greater_than_or_equal_to (
@@ -31,14 +41,24 @@ def __iter__(self):
31
41
32
42
@functional_datapipe ("check_less_than_or_equal_to" )
33
43
class CheckLessThanOrEqualToIterDataPipe (IterDataPipe ):
44
+ """Check less than or equal to equality"""
34
45
def __init__ (
35
46
self , source_datapipe : IterDataPipe , max_value : int , dataset_name : Optional [str ] = None
36
47
):
48
+ """
49
+ Check less than or equal to equality
50
+
51
+ Args:
52
+ source_datapipe: Datapipe emitting Xarray object
53
+ max_value: Max value
54
+ dataset_name: Optioanl dataset name if checking a subset
55
+ """
37
56
self .source_datapipe = source_datapipe
38
57
self .max_value = max_value
39
58
self .dataset_name = dataset_name
40
59
41
- def __iter__ (self ):
60
+ def __iter__ (self ) -> Union [xr .Dataset , xr .DataArray ]:
61
+ """Check equality"""
42
62
for xr_data in self .source_datapipe :
43
63
if self .dataset_name is not None :
44
64
check_dataset_less_than_or_equal_to (
@@ -51,19 +71,30 @@ def __iter__(self):
51
71
52
72
@functional_datapipe ("check_not_equal_to" )
53
73
class CheckNotEqualToIterDataPipe (IterDataPipe ):
74
+ """Check not equal to equality"""
54
75
def __init__ (
55
76
self ,
56
77
source_datapipe : IterDataPipe ,
57
78
value : int ,
58
79
dataset_name : Optional [str ] = None ,
59
80
raise_error : bool = True ,
60
81
):
82
+ """
83
+ Checks not equal to equality on the data
84
+
85
+ Args:
86
+ source_datapipe: Datapipe emitting Xarray object
87
+ value: Value to check
88
+ dataset_name: Optional dataset name if checkinga subset
89
+ raise_error: Whether to raise an error or not
90
+ """
61
91
self .source_datapipe = source_datapipe
62
92
self .value = value
63
93
self .dataset_name = dataset_name
64
94
self .raise_error = raise_error
65
95
66
- def __iter__ (self ):
96
+ def __iter__ (self ) -> Union [xr .Dataset , xr .DataArray ]:
97
+ """Check not equal equality"""
67
98
for xr_data in self .source_datapipe :
68
99
if self .dataset_name is not None :
69
100
check_dataset_not_equal (
0 commit comments