@@ -264,23 +264,25 @@ def transect_yx(z, atr, start_yx, end_yx, interpolation='nearest'):
264
264
"""Extract 2D matrix (z) value along the line [x0,y0;x1,y1]
265
265
Link: http://stackoverflow.com/questions/7878398/how-to-extract-an-arbitrary-line-of-values-from-a-numpy-array
266
266
267
- Parameters: z : (np.array ) 2D data matrix
268
- atr : (dict) attribute
267
+ Parameters: z : (np.ndarray ) 2D data matrix
268
+ atr : (dict) attribute
269
269
start_yx : (list) y,x coordinate of start point
270
- end_yx : (list) y,x coordinate of end point
270
+ end_yx : (list) y,x coordinate of end point
271
271
interpolation : str, sampling/interpolation method, including:
272
272
'nearest' - nearest neighbour
273
273
'linear' - linear spline interpolation (order of 1)
274
274
'cubic' - cubic spline interpolation (order of 3)
275
275
'quintic' - quintic spline interpolation (order of 5)
276
276
277
- Returns: transect: (dict) containing 1D matrix:
278
- 'X' - 1D np.array for X/column coordinates in float32
279
- 'Y' - 1D np.array for Y/row. coordinates in float32
280
- 'value' - 1D np.array for z value in float32
277
+ Returns: transect : (dict) containing 1D matrix:
278
+ 'X' - 1D np.array for X/column coordinates in float32
279
+ 'Y' - 1D np.array for Y/row coordinates in float32
280
+ 'value' - 1D np.array for z value in float32
281
281
'distance' - 1D np.array for distance in float32
282
282
283
- Example: transect = transect_yx(dem, demRsc, [10,15], [100,115])
283
+ Example: from mintpy.utils import readfile, utils as ut
284
+ dem, atr = readfile.read('srtm1.dem.wgs84')
285
+ txn = transect_yx(dem, atr, [10,15], [100,115])
284
286
"""
285
287
interpolation = interpolation .lower ()
286
288
[y0 , x0 ] = start_yx
@@ -359,7 +361,28 @@ def transect_yx(z, atr, start_yx, end_yx, interpolation='nearest'):
359
361
360
362
361
363
def transect_lalo (z , atr , start_lalo , end_lalo , interpolation = 'nearest' ):
362
- """Extract 2D matrix (z) value along the line [start_lalo, end_lalo]"""
364
+ """Extract 2D matrix (z) value along the line [start_lalo, end_lalo]
365
+
366
+ Parameters: z : (np.ndarray) 2D data matrix
367
+ atr : (dict) attribute
368
+ start_yx : (list) y,x coordinate of start point
369
+ end_yx : (list) y,x coordinate of end point
370
+ interpolation : str, sampling/interpolation method, including:
371
+ 'nearest' - nearest neighbour
372
+ 'linear' - linear spline interpolation (order of 1)
373
+ 'cubic' - cubic spline interpolation (order of 3)
374
+ 'quintic' - quintic spline interpolation (order of 5)
375
+
376
+ Returns: transect : (dict) containing 1D matrix:
377
+ 'X' - 1D np.array for X/column coordinates in float32
378
+ 'Y' - 1D np.array for Y/row coordinates in float32
379
+ 'value' - 1D np.array for z value in float32
380
+ 'distance' - 1D np.array for distance in float32
381
+
382
+ Example: from mintpy.utils import readfile, utils as ut
383
+ vel, atr = readfile.read('geo_velocity_msk.h5')
384
+ txn = transect_yx(vel, atr, [30.0, 110.0], [30.2, 111.3])
385
+ """
363
386
coord = coordinate (atr )
364
387
[y0 , y1 ], [x0 , x1 ] = coord .lalo2yx ([start_lalo [0 ], end_lalo [0 ]],
365
388
[start_lalo [1 ], end_lalo [1 ]])
0 commit comments