This repository was archived by the owner on Jun 2, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 7
7
8
8
@functional_datapipe ("location_picker" )
9
9
class LocationPickerIterDataPipe (IterDataPipe ):
10
- def __init__ (self , source_dp : IterDataPipe , return_all_locations : bool = False ):
10
+ """Picks locations from a dataset and returns them"""
11
+ def __init__ (self , source_datapipe : IterDataPipe , return_all_locations : bool = False ):
12
+ """
13
+ Picks locations from a dataset and returns them
14
+
15
+ Args:
16
+ source_datapipe: Datapipe emitting Xarray Dataset
17
+ return_all_locations: Whether to return all locations, if True, also returns them in order
18
+ """
11
19
super ().__init__ ()
12
- self .source_dp = source_dp
20
+ self .source_datapipe = source_datapipe
13
21
self .return_all_locations = return_all_locations
14
22
15
23
def __iter__ (self ) -> Location :
16
- for xr_dataset in self .source_dp :
24
+ """Returns locations from the inputs datapipe"""
25
+ for xr_dataset in self .source_datapipe :
17
26
if self .return_all_locations :
18
27
# Iterate through all locations in dataset
19
28
for location_idx in range (len (xr_dataset ["x_osgb" ])):
You can’t perform that action at this time.
0 commit comments