dshean / demcoreg

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

AttributeError: module 'numpy' has no attribute 'float'. #57

Closed LKPatel1 closed 1 year ago

LKPatel1 commented 1 year ago

I am following the beginners guide to run the codes but getting the following error, even after updating numpy version.

Traceback (most recent call last): File "/home/lpatel/src/demcoreg/demcoreg/dem_align.py", line 21, in from imview.lib import pltlib File "/home/lpatel/src/imview/imview/init.py", line 3, in from .lib import * File "/home/lpatel/src/imview/imview/lib/pltlib.py", line 19, in cpt_rainbow = gmtColormap.get_rainbow() ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/lpatel/src/imview/imview/lib/gmtColormap.py", line 19, in get_rainbow d = gmtColormap(fn, reverse=rev) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/lpatel/src/imview/imview/lib/gmtColormap.py", line 74, in gmtColormap x = np.array( x , np.float) ^^^^^^^^ File "/home/lpatel/anaconda3/envs/ev1/lib/python3.11/site-packages/numpy/init.py", line 319, in getattr raise AttributeError(__former_attrs__[attr]) AttributeError: module 'numpy' has no attribute 'float'. np.float was a deprecated alias for the builtin float. To avoid this error in existing code, use float by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.float64 here. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'cfloat'?

Please see

Regards Lavkush

dshean commented 1 year ago

Thanks @LKPatel1 Fixed here: https://github.com/dshean/imview/commit/1425f0a7eb611ce41d44e9f9d63554eb711ad482 In the future, please feel free to submit a PR with fixes like this.

LKPatel1 commented 1 year ago

Thanks David for fixing this. :-)

LKPatel1 commented 1 year ago

Hello David I need a bit of help from you to coregister my DEMs (Svalbard region). I have entered as per the instructions provided but getting the error "Input images do not intersect". The all the image files are having similar projection (WGS84), even then its showing the same error.

ev1) @.***:~/src1/demcoreg/demcoreg$ python dem_align.py -mode nuth /home/lpatel/Documents/DEM_Hornsund/ref_dem.tiff /home/lpatel/Documents/DEM_Hornsund/dem_1.tiff

Reference: /home/lpatel/Documents/DEM_Hornsund/ref_dem.tiff Source: /home/lpatel/Documents/DEM_Hornsund/dem_1.tiff Mode: nuth Output: /home/lpatel/Documents/DEM_Hornsund/dem_1_dem_align/dem_1_ref_dem

Warping all inputs to the following: Resolution: 0.0006257065476075122 Extent: [15.753292604, 76.842848691, 16.330004492, 76.949548673] Projection: '+proj=longlat +datum=WGS84 +no_defs' Resampling alg: cubic

1 of 2: /home/lpatel/Documents/DEM_Hornsund/ref_dem.tiff nl: 171 ns: 922 res: 0.001 0...10...20...30...40...50...60...70...80...90...100 - done. 2 of 2: [memory] nl: 171 ns: 922 res: 0.001 0...10...20...30...40...50...60...70...80...90...100 - done.

Reference DEM res: 0.00 Source DEM res: 0.00 Resolution for coreg: mean (0.00 m)

Iteration 1

Warping all inputs to the following: Resolution: 0.0006257065476075122 Extent: [15.753292604, 76.84255285335911, 16.330194040894128, 76.949548673] Projection: '+proj=longlat +datum=WGS84 +no_defs' Resampling alg: cubic

1 of 2: /home/lpatel/Documents/DEM_Hornsund/ref_dem.tiff 2 of 2: [memory] Elevation difference stats for uncorrected input DEMs (src - ref) Removing outliers Initial pixel count: 147961 Absolute dz filter: 100.00 147230 Excluding values outside of range: -18.176 +/- 3*14.504 Excluding values outside of range: -61.687701 to 25.335010 136603 Computing slope Slope filter: 0.10 - 40.00 Initial count: 155480 Excluding values outside of range: 0.100000 to 40.000000 143954 Computing aspect Filtered difference map count: 132786 min: -61.68 max: 25.33 mean: -18.39 std: 14.98 med: -17.95 mad: 13.06 q1: -27.24 q2: -9.56 iqr: 17.67 mode: -16.00 p16: -32.29 p84: -4.91 spread: 13.69 Computing sub-pixel offset between DEMs using mode: nuth Computing common mask Initial sample count: 132786 Removing outliers 3-sigma filter: -1947.18 - 1366.95 130617 Computing 1-degree bin statistics: count Computing 1-degree bin statistics: median Computing fit [ 171.57619843 806.26546969 -217.28055887] Generating Nuth and Kaab plot Median dz: -17.95 Nuth dz: -27.61 Incremental offset: dx=-171.21m, dy=-11.18m, dz=+17.95m Cumulative offset: dx=-171.21m, dy=-11.18m, dz=+17.95m Writing offset plot: /home/lpatel/Documents/DEM_Hornsund/dem_1_dem_align/dem_1_ref_dem_nuth_iter01_plot.png X shift: -171.21186417848057 Y shift: -11.175393994661125 Original geotransform: (15.753292604, 0.0006257065476075122, 0.0, 76.949548673, 0.0, -0.0006257065476075122) Updated geotransform: [-1.55458572e+02 6.25706548e-04 0.00000000e+00 6.57741547e+01 0.00000000e+00 -6.25706548e-04] Z shift offset: 17.952560424804688

Iteration 2 Input images do not intersect

Please check and let me know

I have attached the cropped DEMs also for your reference.

Thanks in advance for your help.

Regards Lavkush

On Mon, Aug 21, 2023 at 10:03 PM David Shean @.***> wrote:

Closed #57 https://github.com/dshean/demcoreg/issues/57 as completed.

— Reply to this email directly, view it on GitHub https://github.com/dshean/demcoreg/issues/57#event-10150006077, or unsubscribe https://github.com/notifications/unsubscribe-auth/BB726WCSINMUWFEXQB2YTTTXWO5HZANCNFSM6AAAAAA3VJ2G3M . You are receiving this because you were mentioned.Message ID: @.***>

--

Dr. Lavkush Kumar Patel Assistant Professor (Post-Doc) Department of Polar and Marine Research

Institute of Geophysics, Polish Academy of Sciences, Warsaw, Poland ‪Lavkush Kumar Patel‬ - ‪Google Scholar‬ https://scholar.google.co.in/citations?user=yCsxOfEAAAAJ&hl=en

(20) Lavkush Patel @.***) / Twitter https://twitter.com/LavkushPatel1

dshean commented 1 year ago

Thanks for the detailed report. Both DEMs must have a projection with units of meters for dem_align.py. You can use gdalwarp -r cubic -t_srs EPSG:XXXXX input_dem.tif output_dem_proj.tif where XXXXX is the UTM zone for Svalbard. Or some other local projection. Still need to add some checks for this: https://github.com/dshean/demcoreg/issues/28

dshean commented 1 year ago

See 8a490679571a4753a709d073b5b233016bd508ac

LKPatel1 commented 1 year ago

Thanks David It is working well, It was the projection error. I reprojected the layers in a local projection with the units as meter, and I got the results. Thanks alot for your immediate response and help provided.

Regards Lavkush

On Wed, Aug 23, 2023 at 2:34 AM David Shean @.***> wrote:

See 8a49067 https://github.com/dshean/demcoreg/commit/8a490679571a4753a709d073b5b233016bd508ac

— Reply to this email directly, view it on GitHub https://github.com/dshean/demcoreg/issues/57#issuecomment-1689094424, or unsubscribe https://github.com/notifications/unsubscribe-auth/BB726WH3RUSGVEDD6FY4Z7DXWVFX7ANCNFSM6AAAAAA3VJ2G3M . You are receiving this because you were mentioned.Message ID: @.***>

--

Dr. Lavkush Kumar Patel Assistant Professor (Post-Doc) Department of Polar and Marine Research

Institute of Geophysics, Polish Academy of Sciences, Warsaw, Poland ‪Lavkush Kumar Patel‬ - ‪Google Scholar‬ https://scholar.google.co.in/citations?user=yCsxOfEAAAAJ&hl=en

(20) Lavkush Patel @.***) / Twitter https://twitter.com/LavkushPatel1