File tree Expand file tree Collapse file tree
conda_package/mpas_tools/viz/mpas_to_xdmf Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -300,8 +300,16 @@ def _parse_indices(index_string, dim_size):
300300 if not index_string :
301301 return []
302302 if ':' in index_string :
303- parts = [int (p ) if p else None for p in index_string .split (':' )]
304- return list (range (parts [0 ] or 0 , parts [1 ] or dim_size , parts [2 ] or 1 ))
303+ # Support slice notation like ':', '0:10', '0:10:2', etc.
304+ parts = index_string .split (':' )
305+ # Pad parts to length 3 with empty strings if needed
306+ while len (parts ) < 3 :
307+ parts .append ('' )
308+ # Convert to int or None
309+ start = int (parts [0 ]) if parts [0 ] else 0
310+ stop = int (parts [1 ]) if parts [1 ] else dim_size
311+ step = int (parts [2 ]) if parts [2 ] else 1
312+ return list (range (start , stop , step ))
305313 return [int (i ) for i in index_string .split (',' )]
306314
307315
You can’t perform that action at this time.
0 commit comments