Skip to content

Commit 33cefd5

Browse files
authored
Merge pull request #87 from rok4/develop
Release 2.1.5
2 parents ccbb441 + 823b07d commit 33cefd5

File tree

7 files changed

+23
-12
lines changed

7 files changed

+23
-12
lines changed

.github/workflows/pr-auto-labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: "🏷 PR Labeler"
22
on:
3-
- pull_request_target
3+
- pull_request
44

55
permissions:
66
contents: read

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ repos:
2222
args: [--markdown-linebreak-ext=md]
2323

2424
- repo: https://github.com/astral-sh/ruff-pre-commit
25-
rev: "v0.1.9"
25+
rev: "v0.3.4"
2626
hooks:
2727
- id: ruff
2828
args: ["--fix-only", "--target-version=py38"]
2929

3030
- repo: https://github.com/psf/black
31-
rev: 23.12.1
31+
rev: 24.3.0
3232
hooks:
3333
- id: black
3434
args: ["--target-version=py38"]
@@ -40,7 +40,7 @@ repos:
4040
args: ["--profile", "black", "--filter-files"]
4141

4242
- repo: https://github.com/asottile/pyupgrade
43-
rev: v3.15.0
43+
rev: v3.15.2
4444
hooks:
4545
- id: pyupgrade
4646
args:

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 2.1.5
2+
3+
### [Changed]
4+
5+
* Pyramid : la fonction de chargement de la liste en mémoire retourne le nombre de dalle
6+
17
## 2.1.4
28

39
### [Fixed]

src/rok4/pyramid.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,6 @@ def set_limits_from_bbox(self, bbox: Tuple[float, float, float, float]) -> None:
372372

373373

374374
class 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]]:

src/rok4/storage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Provide functions to use read or write
1+
"""Provide functions to read or write data
22
33
Available storage types are :
44
- S3 (path are preffixed with `s3://`)

src/rok4/tile_matrix_set.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- `TileMatrix` - A tile matrix set level
77
88
Loading a tile matrix set requires environment variables :
9+
910
- ROK4_TMS_DIRECTORY
1011
"""
1112

@@ -208,6 +209,7 @@ def __init__(self, name: str) -> None:
208209
MissingEnvironmentError: Missing object storage informations
209210
Exception: No level in the TMS, CRS not recognized by OSR
210211
StorageError: Storage read issue
212+
FileNotFoundError: TMS file or object does not exist
211213
FormatError: Provided path is not a well formed JSON
212214
MissingAttributeError: Attribute is missing in the content
213215
"""

src/rok4/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def reproject_point(
162162
sr_dst_inv = sr_dst.EPSGTreatsAsLatLong() or sr_dst.EPSGTreatsAsNorthingEasting()
163163

164164
if sr_src.IsSame(sr_dst) and sr_src_inv == sr_dst_inv:
165-
# Les système sont vraiment les même, avec le même ordre des axes
165+
# Les système sont vraiment les mêmes, avec le même ordre des axes
166166
return (point[0], point[1])
167167
elif sr_src.IsSame(sr_dst) and sr_src_inv != sr_dst_inv:
168168
# Les système sont les même pour OSR, mais l'ordre des axes est différent

0 commit comments

Comments
 (0)