@@ -91,7 +91,7 @@ def iterate_tessera_tiles(
9191 processed_dirs = 0
9292 total_dirs = 0
9393
94- # First count total directories for progress
94+ # First count total directories for progress (all grid directories, even empty ones)
9595 for year_item in os .listdir (repr_dir ):
9696 year_path = os .path .join (repr_dir , year_item )
9797 if os .path .isdir (year_path ) and year_item .isdigit () and len (year_item ) == 4 :
@@ -101,7 +101,8 @@ def iterate_tessera_tiles(
101101 total_dirs += 1
102102
103103 if total_dirs == 0 :
104- raise FileNotFoundError ("No grid directories found in embeddings structure" )
104+ # No grid directories at all
105+ return results # Return empty list instead of raising error
105106
106107 # Process each grid directory
107108 for year_item in os .listdir (repr_dir ):
@@ -123,6 +124,20 @@ def iterate_tessera_tiles(
123124 progress_callback (processed_dirs , total_dirs , f"Processing { grid_item } " )
124125
125126 try :
127+ # Check if directory has any files at all
128+ dir_contents = os .listdir (grid_path )
129+ if not dir_contents :
130+ # Empty directory - skip silently
131+ continue
132+
133+ # Check if this looks like a tile directory (has SHA256 or .npy files)
134+ has_sha256 = "SHA256" in dir_contents
135+ has_npy_files = any (f .endswith ('.npy' ) for f in dir_contents )
136+
137+ if not has_sha256 and not has_npy_files :
138+ # Directory has files but doesn't look like a tile directory - skip
139+ continue
140+
126141 # Parse coordinates from grid name
127142 lon , lat = parse_grid_name (grid_item )
128143 if lon is None or lat is None :
@@ -131,7 +146,11 @@ def iterate_tessera_tiles(
131146 # Read SHA256 file
132147 sha256_file = os .path .join (grid_path , "SHA256" )
133148 if not os .path .exists (sha256_file ):
134- raise FileNotFoundError (f"Missing SHA256 file: { sha256_file } " )
149+ # If there are .npy files but no SHA256, that's an error
150+ if has_npy_files :
151+ raise FileNotFoundError (f"Missing SHA256 file in tile directory: { sha256_file } " )
152+ # Otherwise skip this directory
153+ continue
135154
136155 # Parse hashes from SHA256 file
137156 embedding_hash = None
0 commit comments