dshean / demcoreg

Utilities for DEM and point cloud co-registration
MIT License
110 stars 42 forks source link

Unable to create glacier mask (TypeError: data type 'Bool' not understood) #29

Open bro076 opened 3 years ago

bro076 commented 3 years ago

Hi, I have been trying to create a mask based on the RGI outlines. I ran "get_rgi.sh" which seems to work even if I got the message

ERROR`` 1: TopologyException: Input geom 0 is invalid: Ring Self-intersection at or near point 75.186070378000068 36.165444900000068 at 75.18607037800006836.165444900000068`

When I run dem_mask.py --glaciers --outdir "mask" 2012_geoeye.tif I get the error message

Traceback (most recent call last): File "/mnt/c/Ben/Ben/Other/demcoreg/demcoreg/demcoreg/dem_mask.py", line 647, in <module> main() File "/mnt/c/Ben/Ben/Other/demcoreg/demcoreg/demcoreg/dem_mask.py", line 625, in main newmask = get_mask(dem_ds, mask_list, dem_fn=dem_fn, writeout=args.writeout, outdir=args.outdir, args=args) File "/mnt/c/Ben/Ben/Other/demcoreg/demcoreg/demcoreg/dem_mask.py", line 439, in get_mask icemask = get_icemask(dem_ds) File "/mnt/c/Ben/Ben/Other/demcoreg/demcoreg/demcoreg/dem_mask.py", line 107, in get_icemask icemask = geolib.shp2array(glac_shp_fn, ds) File "/mnt/c/Ben/Ben/Other/demcoreg/pygeotools/pygeotools/lib/geolib.py", line 799, in shp2array a = ~(a.astype('Bool')) TypeError: data type 'Bool' not understood

Thanks,

Ben

bro076 commented 3 years ago

Seemed to fix it, line 799 needs to be changed in geolib.py so it is "bool" and not "Bool"

ShashankBice commented 3 years ago

@dshean another user reported this issue. I got the error as well with numpy version: 1.20.1. Changing to lower case as reported above fixes it. I can add a pull request upstream, but I would need to check if it breaks something backwards.

VuOn7 commented 3 years ago

The 'Bool" Error got fixed. Thank you so much!! but there is this deprecation warning. What is it trying to say? Help me.

Generating Nuth and Kaab plot /Users/sun/src/demcoreg/demcoreg/coreglib.py:337: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray. bp = ax.boxplot(np.array(output)[idx][::s], positions=bin_centers[::s], widths=widths[::s], showfliers=False, \