From 678e6bba4e04eded0a1e7d3615df4a5694405573 Mon Sep 17 00:00:00 2001 From: fukun364202818 <138986373+fukun364202818@users.noreply.github.com> Date: Fri, 14 Feb 2025 09:30:22 +0800 Subject: [PATCH 1/2] Update tropo_pyaps3.py In the get_snwe function within tropo_pyaps3.py, the original return (S, N, W, E) was returning S, N, W, and E as NumPy's np.int64 type, while the expected type was standard Python's int. Therefore, I modified the return statement to return (int(S), int(N), int(W), int(E)), which successfully fixed the problem. --- src/mintpy/tropo_pyaps3.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mintpy/tropo_pyaps3.py b/src/mintpy/tropo_pyaps3.py index 43256b851..dca67c42f 100644 --- a/src/mintpy/tropo_pyaps3.py +++ b/src/mintpy/tropo_pyaps3.py @@ -318,8 +318,8 @@ def floor2multiple(x, step=10): W = floor2multiple(W, step=step) N = ceil2multiple(N, step=step) E = ceil2multiple(E, step=step) - - return (S, N, W, E) + # modified by fukun 2025.2.14, return (S, N, W, E)->return (int(S), int(N), int(W), int(E)) + return (int(S), int(N), int(W), int(E)) def get_bounding_box(meta, geom_file=None): From 52336a60b15db7caff92f347f5dd9c7118b98eea Mon Sep 17 00:00:00 2001 From: Zhang Yunjun Date: Sun, 16 Feb 2025 17:08:29 +0800 Subject: [PATCH 2/2] remove unnecessary formating --- src/mintpy/tropo_pyaps3.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/mintpy/tropo_pyaps3.py b/src/mintpy/tropo_pyaps3.py index dca67c42f..863dfb6ac 100644 --- a/src/mintpy/tropo_pyaps3.py +++ b/src/mintpy/tropo_pyaps3.py @@ -24,7 +24,7 @@ 'MERRA' : [0, 6, 12, 18], } -INT_DATA_TYPES = (int, np.int16, np.int32, np.int64) +# INT_DATA_TYPES = (int, np.int16, np.int32, np.int64) ############################################################### @@ -292,7 +292,7 @@ def get_snwe(meta, geom_file=None, min_buffer=2, step=10): # utils sub-functions def ceil2multiple(x, step=10): """Given a number x, find the smallest number in multiple of step >= x.""" - assert isinstance(x, INT_DATA_TYPES), f'input number is not int: {type(x)}' + # assert isinstance(x, INT_DATA_TYPES), f'input number is not int: {type(x)}' if x % step == 0: return x else: @@ -300,17 +300,17 @@ def ceil2multiple(x, step=10): def floor2multiple(x, step=10): """Given a number x, find the largest number in multiple of step <= x.""" - assert isinstance(x, INT_DATA_TYPES), f'input number is not int: {type(x)}' + # assert isinstance(x, INT_DATA_TYPES), f'input number is not int: {type(x)}' return x - x % step # get bounding box lat0, lat1, lon0, lon1 = get_bounding_box(meta, geom_file=geom_file) # lat/lon0/1 --> SNWE - S = np.floor(min(lat0, lat1) - min_buffer).astype(int) - N = np.ceil( max(lat0, lat1) + min_buffer).astype(int) - W = np.floor(min(lon0, lon1) - min_buffer).astype(int) - E = np.ceil( max(lon0, lon1) + min_buffer).astype(int) + S = np.floor(min(lat0, lat1) - min_buffer) + N = np.ceil( max(lat0, lat1) + min_buffer) + W = np.floor(min(lon0, lon1) - min_buffer) + E = np.ceil( max(lon0, lon1) + min_buffer) # SNWE in multiple of 10 if step > 1: @@ -318,7 +318,8 @@ def floor2multiple(x, step=10): W = floor2multiple(W, step=step) N = ceil2multiple(N, step=step) E = ceil2multiple(E, step=step) - # modified by fukun 2025.2.14, return (S, N, W, E)->return (int(S), int(N), int(W), int(E)) + + # return native int format, as cdsapi-0.7.3 does not support numpy.int64 return (int(S), int(N), int(W), int(E))