dshean / demcoreg

Utilities for DEM and point cloud co-registration
MIT License
114 stars 45 forks source link

swig/python detected a memory leak of type 'OSRSpatialReferenceShadow *', no destructor found. #60

Open Leoned opened 9 months ago

Leoned commented 9 months ago

Help please, i have this mensaje, I don´t know how to fix.

(demcoreg) enver@lynx-pc:~$ dem_align.py -h usage: dem_align.py [-h] [-mode {ncc,sad,nuth,none}] [-mask_list {toa,snodas,modscag,bareground,glaciers,nlcd,none} [{toa,snodas,modscag,bareground,glaciers,nlcd,none} ...]] [-tiltcorr] [-polyorder POLYORDER] [-tol TOL] [-max_offset MAX_OFFSET] [-max_dz MAX_DZ] [-res {min,max,mean,common_scale_factor}] [-slope_lim SLOPE_LIM SLOPE_LIM] [-max_iter MAX_ITER] [-outdir OUTDIR] ref_fn src_fn

Perform DEM co-registration using multiple algorithms

positional arguments: ref_fn Reference DEM filename src_fn Source DEM filename to be shifted

options: -h, --help show this help message and exit -mode {ncc,sad,nuth,none} Type of co-registration to use (default: nuth) -mask_list {toa,snodas,modscag,bareground,glaciers,nlcd,none} [{toa,snodas,modscag,bareground,glaciers,nlcd,none} ...] Define masks to use to limit reference surfaces for co-registration (default: []) -tiltcorr After preliminary translation, fit polynomial to residual elevation offsets and remove (default: False) -polyorder POLYORDER Specify order of polynomial fit (default: 1) -tol TOL When iterative translation magnitude is below this tolerance (meters), break and write out corrected DEM (default: 0.02) -max_offset MAX_OFFSET Maximum expected horizontal offset in meters, used to set search range for ncc and sad modes (default: 100) -max_dz MAX_DZ Maximum expected vertical offset in meters, used to filter outliers (default: 100) -res {min,max,mean,common_scale_factor} Warp intputs to this resolution (default: mean) -slope_lim SLOPE_LIM SLOPE_LIM Minimum and maximum surface slope limits to consider (default: (0.1, 40)) -max_iter MAX_ITER Maximum number of iterations, if tol is not reached (default: 30) -outdir OUTDIR Output directory (default: None) swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found. swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found. swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found. swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found. swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found. swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found. swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found. swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found. swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found. swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found. swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found. swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found. swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found. swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found. swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found. swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found.

dshean commented 9 months ago

As I recall, this was a bug that was introduced last year in a previous version of GDAL/OGR, and it was fixed. If you upgrade GDAL (and pull latest version of pygeotools and demcoreg), it should go away.

HaoChenA commented 3 months ago

Maybe I encountered the same problem. According to the author's method, it has not been resolved. I want to know if your problem has been solved and how it was resolved?

(demcoreg_env) chen@chen-virtual-machine:~/src/demcoreg/demcoreg$ ~/src/demcoreg/demcoreg/dem_align.py -h Traceback (most recent call last): File "/home/chen/src/demcoreg/demcoreg/dem_align.py", line 21, in from imview.lib import pltlib File "/home/chen/src/imview/imview/init.py", line 3, in from .lib import File "/home/chen/src/imview/imview/lib/pltlib.py", line 20, in plt.register_cmap(cmap=cpt_rainbow) ^^^^^^^^^^^^^^^^^ AttributeError: module 'matplotlib.pyplot' has no attribute 'register_cmap' swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found. swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found. swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found. swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found. swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found. swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found. swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found. swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found. swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found. swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found. swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found. swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found. swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found. swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found. swig/python detected a memory leak of type 'OSRSpatialReferenceShadow ', no destructor found. swig/python detected a memory leak of type 'OSRSpatialReferenceShadow *', no destructor found.

dshean commented 3 months ago

@HaoChenA, the error is actually coming from the register_cmap call. I just pushed a fix for this to the imview repo (https://github.com/dshean/imview/commit/0e2c51266e573f69ac15c9b7ef5cae4a9d69dce7). If you pull and install latest imview from github master, it should be resolved.

dshean commented 3 months ago

The SWIG errors are related to a known issue with SWIG: https://github.com/swig/swig/issues/2638 It may be possible to mitigate with cleanup circular imports within the pygeotools and demcoreg repos (most of these are likely coming from pygeotools/geolib). This is on the to do list, but since these are nonfatal warnings and I'm hoping for an upstream fix to SWIG/GDAL, it's been lower priority.