Skip to content

Commit

Permalink
Adding error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean Renaud committed Mar 8, 2024
1 parent 2bf5758 commit 6da57be
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ Temporary Items

# Generated files
.idea/**/contentModel.xml
.idea/**/*.xml
.idea/**/*.iml
.idea/**/profiles_settings.xml
.idea/**/Project_Default.xml
.idea/**/vcs.xml
.idea/**/modules.xml
.idea/**/misc.xml
.idea/**/grdtiler.iml

# Sensitive or high-churn files
.idea/**/dataSources/
Expand Down
6 changes: 2 additions & 4 deletions grdtiler/grdtiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import logging
from xsarslc.tools import xtiling, get_tiles


def tiling_prod(path, nperseg, resolution=None, noverlap=0, centering=False, side='left', tiling_mod='tiling', save_tiles=False, save_dir='.'):
"""
Perform tiling on SAR data based on the specified parameters.
Expand Down Expand Up @@ -74,9 +75,7 @@ def tiling_by_point(path ,posting_loc, posting_box_size=0, resolution=None, save
Parameters:
path (str): Path to the SAR dataset.
posting_loc (tuple): Coordinates (longitude, latitude) of the point.
Default is None, which will use the center of the dataset's spatial extent.
posting_box_size (float): Size of the box centered around the point (in meters). Default is zero.
Default is None, which will use the maximum size that fits within the dataset's spatial extent.
resolution (str, optional): Resolution of the dataset (in meters). Default is None.
save_tiles (bool, optional): Whether to save the extracted tiles. Default is False.
save_dir (str): Saving directory.
Expand Down Expand Up @@ -201,8 +200,7 @@ def save_tile(tiles, resolution, save_dir):
try:
os.makedirs(ds_dir, exist_ok=True)
except OSError as e:
print(f"Error creating directory: {ds_dir}. Error: {e}")
continue
raise ValueError(f"Error creating directory: {ds_dir}. Error: {e}")

for attr in ['footprint', 'multidataset', 'specialHandlingRequired']:
if attr in tile.attrs:
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "grdtiler"
version = "0.0.2"
version = "0.0.1"
dynamic = [
"dependencies",
]
Expand Down Expand Up @@ -52,7 +52,7 @@ universal = true


[tool.bumpversion]
current_version = "0.0.2"
current_version = "0.0.1"
commit = true
tag = true

Expand Down

0 comments on commit 6da57be

Please sign in to comment.