From 063259d65e41f22dd332a5928344d373612cffb9 Mon Sep 17 00:00:00 2001 From: Francesco Nattino Date: Mon, 20 Nov 2023 22:48:51 +0100 Subject: [PATCH] final run of yapf --- dhdt/auxiliary/handler_mgrs.py | 8 ++-- dhdt/generic/handler_landsat.py | 4 +- dhdt/generic/mapping_tools.py | 13 ++----- dhdt/generic/orbit_tools.py | 37 +++++++++++-------- dhdt/processing/coupling_tools.py | 34 ++++++++++++----- .../processing/matching_tools_organization.py | 14 +++---- 6 files changed, 61 insertions(+), 49 deletions(-) diff --git a/dhdt/auxiliary/handler_mgrs.py b/dhdt/auxiliary/handler_mgrs.py index 694f4a4..bd27262 100644 --- a/dhdt/auxiliary/handler_mgrs.py +++ b/dhdt/auxiliary/handler_mgrs.py @@ -23,11 +23,9 @@ supported_drivers['KML'] = 'rw' -MGRS_TILING_URL = ( - "https://sentinels.copernicus.eu/documents/247904/1955685/" - "S2A_OPER_GIP_TILPAR_MPC__20151209T095117_V20150622T000000" - "_21000101T000000_B00.kml" -) +MGRS_TILING_URL = ("https://sentinels.copernicus.eu/documents/247904/1955685/" + "S2A_OPER_GIP_TILPAR_MPC__20151209T095117_V20150622T000000" + "_21000101T000000_B00.kml") MGRS_TILING_FILENAME = 'sentinel2_tiles_world.geojson' MGRS_TILING_DIR_DEFAULT = os.path.join('.', 'data', 'MGRS') diff --git a/dhdt/generic/handler_landsat.py b/dhdt/generic/handler_landsat.py index bab34a2..feee8ee 100755 --- a/dhdt/generic/handler_landsat.py +++ b/dhdt/generic/handler_landsat.py @@ -17,7 +17,9 @@ def get_wrs_url(version=2): """ # noqa: E501 assert isinstance(version, int), 'please provide an integer' assert 0 < version < 3, 'please provide a correct version, i.e.: {1,2}' - wrs_url = 'https://d9-wret.s3.us-west-2.amazonaws.com/assets/palladium/production/s3fs-public/atoms/files/WRS' + str(version) + '_descending_0.zip' # noqa: E501 + wrs_url = ( + 'https://d9-wret.s3.us-west-2.amazonaws.com/assets/palladium/production/s3fs-public/atoms/files/WRS' # noqa: E501 + + str(version) + '_descending_0.zip') return wrs_url diff --git a/dhdt/generic/mapping_tools.py b/dhdt/generic/mapping_tools.py index 63e99ce..d5949f9 100644 --- a/dhdt/generic/mapping_tools.py +++ b/dhdt/generic/mapping_tools.py @@ -989,16 +989,9 @@ def get_bbox(geoTransform, rows=None, cols=None): def get_geoTransform(bbox, dx, dy): dx = float(dx) dy = float(dy) - geoTransform = ( - bbox[0], - +dx, - 0., - bbox[3], - 0., - -dy, - int(np.floor((bbox[3] - bbox[2]) / dy)), - int(np.floor((bbox[1] - bbox[0]) / dx)) - ) + geoTransform = (bbox[0], +dx, 0., bbox[3], 0., -dy, + int(np.floor((bbox[3] - bbox[2]) / dy)), + int(np.floor((bbox[1] - bbox[0]) / dx))) return geoTransform diff --git a/dhdt/generic/orbit_tools.py b/dhdt/generic/orbit_tools.py index b93adcf..5ae1a7b 100644 --- a/dhdt/generic/orbit_tools.py +++ b/dhdt/generic/orbit_tools.py @@ -607,8 +607,8 @@ def orbital_calculation(ltime, radius, inclination, period, ω_0, λ_0): return Px -def observation_calculation(ltime, Sat, Gx, radius, inclination, - period, ω_0, λ_0): +def observation_calculation(ltime, Sat, Gx, radius, inclination, period, ω_0, + λ_0): """ Parameters @@ -679,37 +679,44 @@ def partial_obs(ltime, Sat, Gx, ϕ, λ, radius, inclination, period): are_two_arrays_equal(Sat, Gx) P_0 = np.zeros((3, 4, ltime.size)) ω_0, λ_0 = _omega_lon_calculation(ϕ, λ, inclination) - Dx = observation_calculation(ltime, Sat, Gx, radius, inclination, - period, ω_0, λ_0) + Dx = observation_calculation(ltime, Sat, Gx, radius, inclination, period, + ω_0, λ_0) pert_var = ['lat', 'lon', 'radius', 'inclination'] Pert = np.array([1E-5, 1E-5, 1E+1, 1E-4]) for idx, pert in enumerate(Pert): - (ϕ, λ, radius, inclination) = _pert_param(idx, +pert, ϕ, λ, - radius, inclination) + (ϕ, λ, radius, inclination) = _pert_param(idx, +pert, ϕ, λ, radius, + inclination) ω_0, λ_0 = _omega_lon_calculation(ϕ, λ, inclination) - Dp = observation_calculation(ltime, Sat, Gx, radius, - inclination, period, ω_0, λ_0) + Dp = observation_calculation(ltime, Sat, Gx, radius, inclination, + period, ω_0, λ_0) P_0[0, idx, :] = np.divide(Dp[:, 0] - Dx[:, 0], pert) P_0[1, idx, :] = np.divide(Dp[:, 1] - Dx[:, 1], pert) P_0[2, idx, :] = np.divide(Dp[:, 2] - Dx[:, 2], pert) - (ϕ, λ, radius, inclination) = _pert_param(idx, -pert, ϕ, λ, - radius, inclination) + (ϕ, λ, radius, inclination) = _pert_param(idx, -pert, ϕ, λ, radius, + inclination) return P_0 -def partial_tim(ltime, Sat, Gx, ϕ, λ, radius, inclination, period, +def partial_tim(ltime, + Sat, + Gx, + ϕ, + λ, + radius, + inclination, + period, pertubation=.1): are_two_arrays_equal(Sat, Gx) P_1 = np.zeros((3, 1, ltime.size)) ω_0, λ_0 = _omega_lon_calculation(ϕ, λ, inclination) - Dx = observation_calculation(ltime, Sat, Gx, radius, inclination, - period, ω_0, λ_0) + Dx = observation_calculation(ltime, Sat, Gx, radius, inclination, period, + ω_0, λ_0) # pertubation in the time domain ltime += pertubation - Dp = observation_calculation(ltime, Sat, Gx, radius, inclination, - period, ω_0, λ_0) + Dp = observation_calculation(ltime, Sat, Gx, radius, inclination, period, + ω_0, λ_0) ltime -= pertubation P_1[0, 0, ...] = np.divide(Dp[..., 0] - Dx[..., 0], pertubation) diff --git a/dhdt/processing/coupling_tools.py b/dhdt/processing/coupling_tools.py index e48cc6b..3ef7c9c 100755 --- a/dhdt/processing/coupling_tools.py +++ b/dhdt/processing/coupling_tools.py @@ -312,10 +312,20 @@ def match_pair(I1, return X2_grd, Y2_grd, match_metric -def match_image(Z, M, D, geoTransform, id_1, id_2, X_grd, Y_grd, - temp_radius=2**3, search_radius=2**4, - correlator='robu_corr', subpix='moment', - metric='peak_abs', **kwargs): +def match_image(Z, + M, + D, + geoTransform, + id_1, + id_2, + X_grd, + Y_grd, + temp_radius=2**3, + search_radius=2**4, + correlator='robu_corr', + subpix='moment', + metric='peak_abs', + **kwargs): # combating import loops from .matching_tools_organization import (list_differential_correlators, list_frequency_correlators, @@ -334,17 +344,23 @@ def match_image(Z, M, D, geoTransform, id_1, id_2, X_grd, Y_grd, I_grd, J_grd = map2pix(geoTransform, X_grd, Y_grd) # inside selection and padding - IN = np.logical_and.reduce((I_grd >= 0, I_grd < (Z.shape[0] - 1), - J_grd >= 0, J_grd < (Z.shape[1] - 1))) + IN = np.logical_and.reduce((I_grd >= 0, I_grd < (Z.shape[0] - 1), J_grd + >= 0, J_grd < (Z.shape[1] - 1))) M2_new = pad_radius(M2, ds2) i2 += ds2 j2 += ds2 I1, I2, i1, j1, i2, j2, IN = pad_images_and_filter_coord_list( - I1, I2, geoTransform1, geoTransform2, X_grd, Y_grd, - temp_radius, search_radius, same=True - ) + I1, + I2, + geoTransform1, + geoTransform2, + X_grd, + Y_grd, + temp_radius, + search_radius, + same=True) return diff --git a/dhdt/processing/matching_tools_organization.py b/dhdt/processing/matching_tools_organization.py index 418034c..28e6ebe 100644 --- a/dhdt/processing/matching_tools_organization.py +++ b/dhdt/processing/matching_tools_organization.py @@ -26,15 +26,11 @@ get_correlation_metric, hessian_spread, list_matching_metrics) -from .matching_tools_spatial_subpixel import (get_top_2d_gaussian, - get_top_birchfield, - get_top_blais, get_top_centroid, - get_top_equiangular, - get_top_esinc, get_top_gaussian, - get_top_mass, get_top_moment, - get_top_parabolic, - get_top_paraboloid, get_top_ren, - get_top_triangular) +from .matching_tools_spatial_subpixel import ( + get_top_2d_gaussian, get_top_birchfield, get_top_blais, get_top_centroid, + get_top_equiangular, get_top_esinc, get_top_gaussian, get_top_mass, + get_top_moment, get_top_parabolic, get_top_paraboloid, get_top_ren, + get_top_triangular) # admin