@@ -372,7 +372,6 @@ def set_limits_from_bbox(self, bbox: Tuple[float, float, float, float]) -> None:
372372
373373
374374class Pyramid :
375-
376375 """A data pyramid, raster or vector
377376
378377 Attributes:
@@ -384,7 +383,7 @@ class Pyramid:
384383 __format (str): Data format
385384 __storage (Dict[str, Union[rok4.enums.StorageType,str,int]]): Pyramid's storage informations (type, root and depth if FILE storage)
386385 __raster_specifications (Dict): If raster pyramid, raster specifications
387- __content (Dict): Loading status (loaded) and list content (cache).
386+ __content (Dict): Loading status (loaded), slab count (count) and list content (cache).
388387
389388 Example (S3 storage):
390389
@@ -397,6 +396,7 @@ class Pyramid:
397396 'slab': 'DATA_18_5424_7526'
398397 }
399398 },
399+ 'count': 1,
400400 'loaded': True
401401 }
402402 """
@@ -409,7 +409,7 @@ def from_descriptor(cls, descriptor: str) -> "Pyramid":
409409 descriptor (str): pyramid's descriptor path
410410
411411 Raises:
412- FormatError: Provided path or the TMS is not a well formed JSON
412+ FormatError: Provided path or the descriptor is not a well formed JSON
413413 Exception: Level issue : no one in the pyramid or the used TMS, or level ID not defined in the TMS
414414 MissingAttributeError: Attribute is missing in the content
415415 StorageError: Storage read issue (pyramid descriptor or TMS)
@@ -548,7 +548,7 @@ def __init__(self) -> None:
548548 self .__levels = {}
549549 self .__masks = None
550550
551- self .__content = {"loaded" : False , "cache" : {}}
551+ self .__content = {"loaded" : False , "count" : 0 , " cache" : {}}
552552
553553 def __str__ (self ) -> str :
554554 return f"{ self .type .name } pyramid '{ self .__name } ' ({ self .__storage ['type' ].name } storage)"
@@ -737,19 +737,22 @@ def type(self) -> PyramidType:
737737 else :
738738 return PyramidType .RASTER
739739
740- def load_list (self ) -> None :
740+ def load_list (self ) -> int :
741741 """Load list content and cache it
742742
743743 If list is already loaded, nothing done
744744 """
745745 if self .__content ["loaded" ]:
746- return
746+ return self . __content [ "count" ]
747747
748748 for slab , infos in self .list_generator ():
749749 self .__content ["cache" ][slab ] = infos
750+ self .__content ["count" ] += 1
750751
751752 self .__content ["loaded" ] = True
752753
754+ return self .__content ["count" ]
755+
753756 def list_generator (
754757 self , level_id : str = None
755758 ) -> Iterator [Tuple [Tuple [SlabType , str , int , int ], Dict ]]:
0 commit comments