Skip to content
Snippets Groups Projects
Commit 5cbd75f8 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Moved all pyresample imports to methods to avoid Exception: dlopen: cannot...

Moved all pyresample imports to methods to avoid Exception: dlopen: cannot load any more object with static TLS.
parent 7fbf2d02
No related branches found
No related tags found
1 merge request!1Bugfix/fix etrs projection incompatibility
Pipeline #3710 failed
......@@ -5,7 +5,7 @@ import warnings
import multiprocessing
import os
from tempfile import TemporaryDirectory
from typing import Union, Tuple, List, Any # noqa: F401
from typing import Union, Tuple, List, Any, TYPE_CHECKING # noqa: F401
# custom
try:
......@@ -19,8 +19,6 @@ import rasterio
from rasterio.warp import reproject as rio_reproject
from rasterio.warp import calculate_default_transform as rio_calc_transform
from rasterio.warp import Resampling
from pyresample.geometry import AreaDefinition, SwathDefinition
from pyresample.utils import get_area_def
from ...dtypes.conversion import dTypeDic_NumPy2GDAL
from ..projection import EPSG2WKT, WKT2EPSG, isProjectedOrGeographic, prj_equal, proj4_to_WKT
......@@ -32,6 +30,9 @@ from ...processing.progress_mon import ProgressBar
from ...compatibility.gdal import get_gdal_func
from ...processing.shell import subcall_with_output
if TYPE_CHECKING:
from pyresample.geometry import AreaDefinition, SwathDefinition
__author__ = "Daniel Scheffler"
......@@ -550,6 +551,7 @@ class SensorMapGeometryTransformer(object):
os.environ['OMP_NUM_THREADS'] = '%d' % opts['nprocs']
del self.opts['nprocs']
from pyresample.geometry import SwathDefinition
self.lats = lats
self.lons = lons
self.swath_definition = SwathDefinition(lons=lons, lats=lats)
......@@ -667,6 +669,7 @@ class SensorMapGeometryTransformer(object):
out_extent = xmin, ymin, xmax, ymax
# get area_definition
from pyresample.utils import get_area_def
area_definition = get_area_def(area_id='',
area_name='',
proj_id='',
......@@ -778,6 +781,7 @@ class SensorMapGeometryTransformer(object):
proj4_args = proj4_to_dict(get_proj4info(proj=src_prj))
# get area_definition
from pyresample.geometry import AreaDefinition
self.area_definition = AreaDefinition('', '', '', proj4_args, data.shape[1], data.shape[0],
src_extent)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment