@@ -432,8 +432,9 @@ def subset_by_basin(self):
432432 Returns
433433 -------
434434 dict_tc_basins : dict
435- A dictionary where the keys are basin names (e.g., "NA", "EP", "WP", etc.) and the values are instances
436- of the `TCTracks` class containing the tropical cyclones that belong to each basin.
435+ A dictionary where the keys are basin names (e.g., "NA", "EP", "WP", etc.) and the
436+ values are instances of the `TCTracks` class containing the tropical cyclones that
437+ belong to each basin.
437438
438439 Example:
439440 --------
@@ -447,24 +448,24 @@ def subset_by_basin(self):
447448 basins_dict = defaultdict (list )
448449 tracks_outside_basin : list = []
449450 # Iterate over each tropical cyclone
450- for tc in self .data :
451- lat , lon = tc .lat .values [0 ], tc .lon .values [0 ]
451+ for track in self .data :
452+ lat , lon = track .lat .values [0 ], track .lon .values [0 ]
452453 origin_point = Point (lon , lat )
453454 point_in_basin = False
454455
455456 # Find the basin that contains the point
456457 for basin in Basin :
457458 if basin .value .contains (origin_point ):
458- basins_dict [basin .name ].append (tc )
459+ basins_dict [basin .name ].append (track )
459460 point_in_basin = True
460461 break
461462
462463 if not point_in_basin :
463- tracks_outside_basin .append (tc .id_no )
464+ tracks_outside_basin .append (track .id_no )
464465
465466 if tracks_outside_basin :
466467 warnings .warn (
467- f"A total of { len (tracks_outside_basin )} tracks did not originate in any of the "
468+ f"A total of { len (tracks_outside_basin )} tracks did not originate in any of the \n "
468469 f"defined basins. IDs of the tracks outside the basins: { tracks_outside_basin } " ,
469470 UserWarning ,
470471 )
0 commit comments