Skip to content

Mask error while dem alignment #69

Description

@Binil92

Hi,

When I try to align two DEMs using dem_align.py, it returns the following error. I tested it with the Planet-generated DEM and both the HMA and COP30 DEMs. I have already resampled the Planet DEM to match the HMA and COP30 DEMs, clipped them to the overlapping area, and ensured that there are no NaN values, and that the size, resolution, and projection are the same.

I would like to align the Planet DEM with one of the reference DEMs in order to perform a DEM of Difference. Could you please help me resolve this issue?
with COP30

1 of 1: DEM_align_23_HMA/KH_planet_2023_DC2_COP_DC2_nuth_x-2.57_y-1.19_z+4.55_align_diff_filt.tif nl: 142 ns: 480 res: 28.737 0...10...20...30...40...50...60...70...80...90...100 - done. Traceback (most recent call last): File "/home/bbk/src/demcoreg/demcoreg/dem_align.py", line 634, in <module> main() File "/home/bbk/src/demcoreg/demcoreg/dem_align.py", line 498, in main iolib.writeGTiff(np.ma.array(src_dem_full_align, mask=np.ma.getmaskarray(align_diff_filt_full)), \ File "/home/bbk/miniconda3/envs/demcoreg_env/lib/python3.10/site-packages/numpy/ma/core.py", line 6915, in array return MaskedArray(data, mask=mask, dtype=dtype, copy=copy, File "/home/bbk/miniconda3/envs/demcoreg_env/lib/python3.10/site-packages/numpy/ma/core.py", line 2983, in __new__ raise MaskError(msg % (nd, nm)) numpy.ma.core.MaskError: Mask and data not compatible: data size is 68340, mask size is 68160.

with HMA
1 of 1: DEM_align_23_HMA1/KH_planet_2023_DC1_HMA_DC1_nuth_x+1.60_y-3.75_z-18.43_align_diff_filt.tif nl: 509 ns: 1735 res: 7.986 0...10...20...30...40...50...60...70...80...90...100 - done. Traceback (most recent call last): File "/home/bbk/src/demcoreg/demcoreg/dem_align.py", line 634, in <module> main() File "/home/bbk/src/demcoreg/demcoreg/dem_align.py", line 498, in main iolib.writeGTiff(np.ma.array(src_dem_full_align, mask=np.ma.getmaskarray(align_diff_filt_full)), \ File "/home/bbk/miniconda3/envs/demcoreg_env/lib/python3.10/site-packages/numpy/ma/core.py", line 6915, in array return MaskedArray(data, mask=mask, dtype=dtype, copy=copy, File "/home/bbk/miniconda3/envs/demcoreg_env/lib/python3.10/site-packages/numpy/ma/core.py", line 2983, in __new__ raise MaskError(msg % (nd, nm)) numpy.ma.core.MaskError: Mask and data not compatible: data size is 884565, mask size is 883115.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions