Skip to content

Commit

Permalink
add version tag for 1.6.0 (#1190)
Browse files Browse the repository at this point in the history
+ version: add version tag for 1.6.0

+ utils.transect_yx/lalo(): update comment for example usage
  • Loading branch information
yunjunz committed May 9, 2024
1 parent 4d34412 commit feae339
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 9 deletions.
41 changes: 32 additions & 9 deletions src/mintpy/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,23 +264,25 @@ def transect_yx(z, atr, start_yx, end_yx, interpolation='nearest'):
"""Extract 2D matrix (z) value along the line [x0,y0;x1,y1]
Link: http://stackoverflow.com/questions/7878398/how-to-extract-an-arbitrary-line-of-values-from-a-numpy-array
Parameters: z : (np.array) 2D data matrix
atr : (dict) attribute
Parameters: z : (np.ndarray) 2D data matrix
atr : (dict) attribute
start_yx : (list) y,x coordinate of start point
end_yx : (list) y,x coordinate of end point
end_yx : (list) y,x coordinate of end point
interpolation : str, sampling/interpolation method, including:
'nearest' - nearest neighbour
'linear' - linear spline interpolation (order of 1)
'cubic' - cubic spline interpolation (order of 3)
'quintic' - quintic spline interpolation (order of 5)
Returns: transect: (dict) containing 1D matrix:
'X' - 1D np.array for X/column coordinates in float32
'Y' - 1D np.array for Y/row. coordinates in float32
'value' - 1D np.array for z value in float32
Returns: transect : (dict) containing 1D matrix:
'X' - 1D np.array for X/column coordinates in float32
'Y' - 1D np.array for Y/row coordinates in float32
'value' - 1D np.array for z value in float32
'distance' - 1D np.array for distance in float32
Example: transect = transect_yx(dem, demRsc, [10,15], [100,115])
Example: from mintpy.utils import readfile, utils as ut
dem, atr = readfile.read('srtm1.dem.wgs84')
txn = transect_yx(dem, atr, [10,15], [100,115])
"""
interpolation = interpolation.lower()
[y0, x0] = start_yx
Expand Down Expand Up @@ -359,7 +361,28 @@ def transect_yx(z, atr, start_yx, end_yx, interpolation='nearest'):


def transect_lalo(z, atr, start_lalo, end_lalo, interpolation='nearest'):
"""Extract 2D matrix (z) value along the line [start_lalo, end_lalo]"""
"""Extract 2D matrix (z) value along the line [start_lalo, end_lalo]
Parameters: z : (np.ndarray) 2D data matrix
atr : (dict) attribute
start_yx : (list) y,x coordinate of start point
end_yx : (list) y,x coordinate of end point
interpolation : str, sampling/interpolation method, including:
'nearest' - nearest neighbour
'linear' - linear spline interpolation (order of 1)
'cubic' - cubic spline interpolation (order of 3)
'quintic' - quintic spline interpolation (order of 5)
Returns: transect : (dict) containing 1D matrix:
'X' - 1D np.array for X/column coordinates in float32
'Y' - 1D np.array for Y/row coordinates in float32
'value' - 1D np.array for z value in float32
'distance' - 1D np.array for distance in float32
Example: from mintpy.utils import readfile, utils as ut
vel, atr = readfile.read('geo_velocity_msk.h5')
txn = transect_yx(vel, atr, [30.0, 110.0], [30.2, 111.3])
"""
coord = coordinate(atr)
[y0, y1], [x0, x1] = coord.lalo2yx([start_lalo[0], end_lalo[0]],
[start_lalo[1], end_lalo[1]])
Expand Down
1 change: 1 addition & 0 deletions src/mintpy/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
###########################################################################
Tag = collections.namedtuple('Tag', 'version date')
release_history = (
Tag('1.6.0', '2024-05-09'),
Tag('1.5.3', '2023-11-23'),
Tag('1.5.2', '2023-08-09'),
Tag('1.5.1', '2023-01-03'),
Expand Down

0 comments on commit feae339

Please sign in to comment.