@@ -121,11 +121,13 @@ def update_representations_command(args):
121121 print (f"Error: Directory { base_dir } does not exist" )
122122 return
123123
124- # Determine registry output directory
124+ # Determine registry output directory - go up to parent of base_dir
125125 if hasattr (args , 'registry_dir' ) and args .registry_dir :
126- registry_dir = os .path .join (os .path .abspath (args .registry_dir ), "embeddings " )
126+ registry_dir = os .path .join (os .path .abspath (args .registry_dir ), "registry " )
127127 else :
128- registry_dir = base_dir
128+ # Place registry at same level as global_0.1_degree_representation
129+ parent_dir = os .path .dirname (base_dir )
130+ registry_dir = os .path .join (parent_dir , "registry" )
129131
130132 # Ensure registry directory exists
131133 os .makedirs (registry_dir , exist_ok = True )
@@ -240,6 +242,27 @@ def update_representations_command(args):
240242
241243 print (f"Master index written with { len (all_registry_files )} registry files" )
242244 print (f"Total blocks processed: { total_blocks } " )
245+
246+ # Generate master registry.txt that includes all individual registries
247+ master_registry_path = os .path .join (registry_dir , "registry.txt" )
248+ print (f"Generating master registry.txt: { master_registry_path } " )
249+
250+ with open (master_registry_path , 'w' ) as f :
251+ f .write ("# GeoTessera Master Registry\n " )
252+ f .write ("# This file combines all block registries for embeddings\n " )
253+ f .write (f"# Contains entries from { len (all_registry_files )} block registry files\n \n " )
254+
255+ total_entries = 0
256+ for registry_file in sorted (all_registry_files ):
257+ if os .path .exists (registry_file ):
258+ with open (registry_file , 'r' ) as reg_f :
259+ for line in reg_f :
260+ line = line .strip ()
261+ if line and not line .startswith ('#' ):
262+ f .write (f"{ line } \n " )
263+ total_entries += 1
264+
265+ print (f"Master registry.txt written with { total_entries } total entries" )
243266
244267
245268
@@ -250,11 +273,13 @@ def update_tiles_command(args):
250273 print (f"Error: Directory { base_dir } does not exist" )
251274 return
252275
253- # Determine registry output directory
276+ # Determine registry output directory - go up to parent of base_dir
254277 if hasattr (args , 'registry_dir' ) and args .registry_dir :
255- registry_dir = os .path .join (os .path .abspath (args .registry_dir ), "tiles " )
278+ registry_dir = os .path .join (os .path .abspath (args .registry_dir ), "registry " )
256279 else :
257- registry_dir = base_dir
280+ # Place registry at same level as global_0.1_degree_tiff_all
281+ parent_dir = os .path .dirname (base_dir )
282+ registry_dir = os .path .join (parent_dir , "registry" )
258283
259284 # Ensure registry directory exists
260285 os .makedirs (registry_dir , exist_ok = True )
@@ -348,7 +373,7 @@ def update_tiles_command(args):
348373
349374 # Generate master index of all tile registry files
350375 if all_registry_files :
351- master_index_path = os .path .join (registry_dir , "registry_index .txt" )
376+ master_index_path = os .path .join (registry_dir , "tiles_registry_index .txt" )
352377 print (f"\n Generating master tiles registry index: { master_index_path } " )
353378
354379 with open (master_index_path , 'w' ) as f :
0 commit comments