Skip to content

Commit

Permalink
Add GDAL initialization to RasterMap and file generators
Browse files Browse the repository at this point in the history
  • Loading branch information
soaressgabriel committed Mar 18, 2024
1 parent e01a7f2 commit 695b995
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 3 additions & 0 deletions rubem/configuration/raster_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ def __init__(
) -> None:
self.logger = logging.getLogger(__name__)

gdal.UseExceptions()
gdal.AllRegister()

self.logger.debug("Opening raster file: %s", file_path)

self.__validate_file(file_path)
Expand Down
7 changes: 3 additions & 4 deletions rubem/file/_file_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
logger = logging.getLogger(__name__)


gdal.UseExceptions()
gdal.AllRegister()


def report(
variable: Field,
name: str,
Expand Down Expand Up @@ -79,6 +75,9 @@ def __report(
else:
out_tif = os.path.join(str(outpath), f"{name}.{extension}")

gdal.UseExceptions()
gdal.AllRegister()

with gdal.GetDriverByName(driver_short_name).Create(
out_tif,
base_raster_info.cols,
Expand Down

0 comments on commit 695b995

Please sign in to comment.