From feae339db2fbb7a006d855e2f2d2e85e3610769f Mon Sep 17 00:00:00 2001 From: Zhang Yunjun Date: Thu, 9 May 2024 19:45:16 +0800 Subject: [PATCH] add version tag for 1.6.0 (#1190) + version: add version tag for 1.6.0 + utils.transect_yx/lalo(): update comment for example usage --- src/mintpy/utils/utils.py | 41 ++++++++++++++++++++++++++++++--------- src/mintpy/version.py | 1 + 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/src/mintpy/utils/utils.py b/src/mintpy/utils/utils.py index fb55dec58..524d2f4a5 100644 --- a/src/mintpy/utils/utils.py +++ b/src/mintpy/utils/utils.py @@ -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 @@ -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]]) diff --git a/src/mintpy/version.py b/src/mintpy/version.py index 45b59935c..317c661ad 100644 --- a/src/mintpy/version.py +++ b/src/mintpy/version.py @@ -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'),