wolfhece 2.1.50__py3-none-any.whl → 2.1.56__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -261,13 +261,23 @@ class xyz_laz():
261
261
  y=np.frombuffer(f.read(blocsize),dtype_file)
262
262
  z=np.frombuffer(f.read(nbloc*4),np.float32)
263
263
  classi=np.frombuffer(f.read(nbloc),np.int8)
264
+
264
265
  count+=4+(2*blocsize+nbloc*(4+1))
265
266
 
266
- if len(myret)==0:
267
- # dt=[('x',np.float32),('y',np.float32),('z',np.float32),('classification',np.int8)]
268
- myret=np.array([x,y,z,classi]).transpose()
267
+ if classi.shape[0] != nbloc:
268
+ logging.warning(_('Bad classification size - file {}'.format(fn)))
269
269
  else:
270
- myret=np.concatenate((myret,np.array([x,y,z,classi]).transpose()))
270
+ if len(myret)==0:
271
+ # dt=[('x',np.float32),('y',np.float32),('z',np.float32),('classification',np.int8)]
272
+ myret=np.array([x,y,z,classi]).transpose()
273
+ else:
274
+ if len(x)>1:
275
+ added = np.array([x,y,z,classi]).transpose()
276
+
277
+ if myret.shape[1] == added.shape[1]:
278
+ myret=np.concatenate((myret,added))
279
+ else:
280
+ logging.warning(_('Incompatible shapes'))
271
281
 
272
282
  # Format Numpy
273
283
  self.data = myret
@@ -485,16 +495,17 @@ class xyz_laz_grids():
485
495
  """
486
496
  Scan all LAZ to find used data
487
497
 
488
- Args:
489
- bounds (Union[tuple[tuple[float,float],tuple[float,float]], list[list[float, float],list[float, float]]]): [[xmin,xmax], [ymin,ymax]]
490
-
491
- Returns:
492
- _type_: np.ndarray
498
+ :param bounds: [[xmin,xmax], [ymin,ymax]]
499
+ :type bounds: Union[tuple[tuple[float,float],tuple[float,float]], list[list[float, float],list[float, float]]]
500
+ :return: np.ndarray
493
501
  """
494
502
  ret = [cur.scan(bounds) for cur in self.grids]
495
503
  ret = [cur for cur in ret if len(cur)>0]
496
504
 
497
- return np.concatenate(ret)
505
+ if len(ret)==0:
506
+ return np.asarray([])
507
+ else:
508
+ return np.concatenate(ret)
498
509
 
499
510
  def read_dir(self, dir_grids):
500
511
  dirs = listdir(dir_grids)
@@ -637,8 +648,8 @@ def find_pointsXYZ(xyz:np.ndarray, bounds:Union[tuple[tuple[float,float],tuple[f
637
648
  xb=bounds[0]
638
649
  yb=bounds[1]
639
650
  # Get arrays which indicate invalid X, Y, or Z values.
640
- X_valid = (xb[0] <= xyz[:,0]) & (xb[1] >= xyz[:,0])
641
- Y_valid = (yb[0] <= xyz[:,1]) & (yb[1] >= xyz[:,1])
651
+ X_valid = np.logical_and((xb[0] <= xyz[:,0]), (xb[1] >= xyz[:,0]))
652
+ Y_valid = np.logical_and((yb[0] <= xyz[:,1]), (yb[1] >= xyz[:,1]))
642
653
  good_indices = np.where(X_valid & Y_valid)[0]
643
654
 
644
655
  return xyz[good_indices]
Binary file
@@ -0,0 +1,65 @@
1
+ 16
2
+ 0.0
3
+ 247
4
+ 251
5
+ 255
6
+ 0.06666666666666667
7
+ 233
8
+ 242
9
+ 250
10
+ 0.13333333333333333
11
+ 220
12
+ 233
13
+ 246
14
+ 0.2
15
+ 207
16
+ 225
17
+ 242
18
+ 0.26666666666666666
19
+ 192
20
+ 216
21
+ 237
22
+ 0.3333333333333333
23
+ 171
24
+ 207
25
+ 229
26
+ 0.39999999999999997
27
+ 147
28
+ 196
29
+ 222
30
+ 0.4666666666666666
31
+ 120
32
+ 181
33
+ 216
34
+ 0.5333333333333333
35
+ 96
36
+ 166
37
+ 209
38
+ 0.6
39
+ 74
40
+ 151
41
+ 201
42
+ 0.6666666666666666
43
+ 55
44
+ 135
45
+ 192
46
+ 0.7333333333333333
47
+ 37
48
+ 117
49
+ 183
50
+ 0.7999999999999999
51
+ 23
52
+ 100
53
+ 171
54
+ 0.8666666666666666
55
+ 9
56
+ 83
57
+ 157
58
+ 0.9333333333333332
59
+ 8
60
+ 65
61
+ 133
62
+ 0.9999999999999999
63
+ 8
64
+ 48
65
+ 107