@@ -255,14 +255,14 @@ def _get_str_rows(self, rows):
255255 row_str : list
256256 List of boolean values indicating which rows contain strings
257257 """
258- str_bool = self .str_bool
258+ _row_idx_str_bool = self ._row_idx_str_bool
259259 if isinstance (rows , slice ):
260260 slice_idx = rows .indices (self .shape [0 ])
261261 row_list = np .arange (slice_idx [0 ], slice_idx [1 ], slice_idx [2 ])
262- row_str = [str_bool [row ] for row in row_list ]
262+ row_str = [_row_idx_str_bool [row ] for row in row_list ]
263263 else :
264264 row_list = list (rows )
265- row_str = [str_bool [row ] for row in rows ]
265+ row_str = [_row_idx_str_bool [row ] for row in rows ]
266266 return row_list , row_str
267267
268268 def __getitem__ (self , key_idx ):
@@ -641,19 +641,42 @@ def rows(self):
641641
642642
643643 @property
644- def str_bool (self ):
644+ def _row_idx_str_bool (self ):
645645 """Dictionary of index : if data entry is string.
646646
647647 Row has string values if the string map is nonempty for a
648648 given row.
649649
650650 Returns
651651 -------
652- str_bool : Dict
652+ _row_idx_str_bool : Dict
653653 Dictionary of whether data at row number key is string or not
654654 """
655- str_bool = {self .map [k ]: bool (len (self .str_map [k ])) for k in self .str_map .keys ()}
656- return str_bool
655+ _row_idx_str_bool = {self .map [k ]: bool (len (self .str_map [k ])) for k in self .str_map .keys ()}
656+ return _row_idx_str_bool
657+
658+ def is_str (self , row_name ):
659+ """Check whether a row contained string values.
660+
661+ Parameters
662+ ----------
663+ row_name : string
664+ Name of the row to check whether it contains string values.
665+
666+ Returns
667+ -------
668+ contains_str : bool
669+ True if the row contains string values, False otherwise.
670+
671+ """
672+
673+ if row_name not in self .map :
674+ raise KeyError ("'" + str (row_name ) \
675+ + "' key doesn't exist in NavData class" )
676+
677+ contains_str = self ._row_idx_str_bool [self .map [row_name ]]
678+
679+ return contains_str
657680
658681 @property
659682 def inv_map (self ):
0 commit comments