sarkit-convert 0.1.0__py3-none-any.whl → 0.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sarkit_convert/_utils.py +47 -18
- sarkit_convert/_version.py +1 -1
- sarkit_convert/{csk.py → cosmo.py} +369 -218
- sarkit_convert/create_arp_poly.py +166 -0
- sarkit_convert/iceye.py +217 -301
- sarkit_convert/sentinel.py +457 -453
- sarkit_convert/sidd_metadata.py +201 -0
- sarkit_convert/{tsx.py → terrasar.py} +318 -215
- {sarkit_convert-0.1.0.dist-info → sarkit_convert-0.3.0.dist-info}/METADATA +26 -26
- sarkit_convert-0.3.0.dist-info/RECORD +14 -0
- {sarkit_convert-0.1.0.dist-info → sarkit_convert-0.3.0.dist-info}/WHEEL +1 -1
- sarkit_convert-0.1.0.dist-info/RECORD +0 -12
- {sarkit_convert-0.1.0.dist-info → sarkit_convert-0.3.0.dist-info}/entry_points.txt +0 -0
- {sarkit_convert-0.1.0.dist-info → sarkit_convert-0.3.0.dist-info}/licenses/LICENSE +0 -0
sarkit_convert/_utils.py
CHANGED
|
@@ -124,6 +124,38 @@ def polyfit2d_tol(x, y, z, max_order_x, max_order_y, tol, strict_tol=False):
|
|
|
124
124
|
return best[0]
|
|
125
125
|
|
|
126
126
|
|
|
127
|
+
def polyshift(poly, new_origin):
|
|
128
|
+
"""Returns new polynomial with shifted origin
|
|
129
|
+
|
|
130
|
+
Args
|
|
131
|
+
----
|
|
132
|
+
poly: array-like
|
|
133
|
+
1d polynomial coefficients, with constant term first
|
|
134
|
+
new_origin: float
|
|
135
|
+
location in `poly`'s domain to place new polynomial's origin
|
|
136
|
+
|
|
137
|
+
Returns
|
|
138
|
+
-------
|
|
139
|
+
new_poly
|
|
140
|
+
polynomial of same order as `poly` for which new_poly(0) == poly(new_origin)
|
|
141
|
+
"""
|
|
142
|
+
|
|
143
|
+
working_coeffs = np.array(list(reversed(poly)))
|
|
144
|
+
output_coeffs = []
|
|
145
|
+
|
|
146
|
+
for _ in np.arange(len(poly)):
|
|
147
|
+
quot = np.zeros(shape=working_coeffs.shape)
|
|
148
|
+
rem = 0.0
|
|
149
|
+
for ndx, val in enumerate(working_coeffs):
|
|
150
|
+
carry = rem * new_origin
|
|
151
|
+
rem = val + carry
|
|
152
|
+
quot[ndx] = rem
|
|
153
|
+
output_coeffs.append(rem)
|
|
154
|
+
working_coeffs = quot[:-1]
|
|
155
|
+
|
|
156
|
+
return np.array(output_coeffs)
|
|
157
|
+
|
|
158
|
+
|
|
127
159
|
def broadening_from_amp(amp_vals, threshold_db=None):
|
|
128
160
|
"""Compute the broadening factor from amplitudes
|
|
129
161
|
|
|
@@ -154,38 +186,35 @@ def broadening_from_amp(amp_vals, threshold_db=None):
|
|
|
154
186
|
return width / fft_size * amp_vals.size
|
|
155
187
|
|
|
156
188
|
|
|
157
|
-
def _get_sigma0_noise(
|
|
189
|
+
def _get_sigma0_noise(sicd_ew):
|
|
158
190
|
"""Calculate the absolute noise estimate, in sigma0 power units."""
|
|
159
191
|
|
|
160
|
-
if
|
|
192
|
+
if "SigmaZeroSFPoly" not in sicd_ew["Radiometric"]:
|
|
161
193
|
raise ValueError(
|
|
162
194
|
"Radiometric.SigmaZeroSFPoly is not populated, so no sigma0 noise estimate can be derived."
|
|
163
195
|
)
|
|
164
|
-
if
|
|
165
|
-
xml_helper.load("./{*}Radiometric/{*}NoiseLevel/{*}NoiseLevelType")
|
|
166
|
-
!= "ABSOLUTE"
|
|
167
|
-
):
|
|
196
|
+
if sicd_ew["Radiometric"]["NoiseLevel"]["NoiseLevelType"] != "ABSOLUTE":
|
|
168
197
|
raise ValueError(
|
|
169
198
|
"Radiometric.NoiseLevel.NoiseLevelType is not `ABSOLUTE` so no noise estimate can be derived."
|
|
170
199
|
)
|
|
171
200
|
|
|
172
|
-
noisepoly =
|
|
201
|
+
noisepoly = sicd_ew["Radiometric"]["NoiseLevel"]["NoisePoly"]
|
|
173
202
|
scp_noise_db = noisepoly[0, 0]
|
|
174
203
|
scp_noise = 10 ** (scp_noise_db / 10)
|
|
175
204
|
|
|
176
205
|
# convert to SigmaZero value
|
|
177
|
-
sigma_zero_sf =
|
|
206
|
+
sigma_zero_sf = sicd_ew["Radiometric"]["SigmaZeroSFPoly"]
|
|
178
207
|
scp_noise *= sigma_zero_sf[0, 0]
|
|
179
208
|
|
|
180
209
|
return scp_noise
|
|
181
210
|
|
|
182
211
|
|
|
183
|
-
def _get_default_signal_estimate(
|
|
212
|
+
def _get_default_signal_estimate(sicd_ew):
|
|
184
213
|
"""Gets default signal for use in the RNIIRS calculation.
|
|
185
214
|
|
|
186
215
|
This will be 1.0 for copolar (or unknown) collections, and 0.25 for cross-pole collections."""
|
|
187
216
|
|
|
188
|
-
pol =
|
|
217
|
+
pol = sicd_ew["ImageFormation"].get("TxRcvPolarizationProc", None)
|
|
189
218
|
if pol is None or ":" not in pol:
|
|
190
219
|
return 1.0
|
|
191
220
|
|
|
@@ -227,23 +256,23 @@ def _estimate_rniirs(information_density):
|
|
|
227
256
|
return out
|
|
228
257
|
|
|
229
258
|
|
|
230
|
-
def get_rniirs_estimate(
|
|
259
|
+
def get_rniirs_estimate(sicd_ew):
|
|
231
260
|
"""This calculates the value(s) for RNIIRS and information density for SICD, according to the RGIQE."""
|
|
232
|
-
scp_noise = _get_sigma0_noise(
|
|
233
|
-
signal = _get_default_signal_estimate(
|
|
261
|
+
scp_noise = _get_sigma0_noise(sicd_ew)
|
|
262
|
+
signal = _get_default_signal_estimate(sicd_ew)
|
|
234
263
|
|
|
235
|
-
u_row =
|
|
236
|
-
u_col =
|
|
264
|
+
u_row = sicd_ew["Grid"]["Row"]["UVectECF"]
|
|
265
|
+
u_col = sicd_ew["Grid"]["Col"]["UVectECF"]
|
|
237
266
|
ipn = np.cross(u_row, u_col)
|
|
238
267
|
u_ipn = ipn / np.linalg.norm(ipn)
|
|
239
268
|
|
|
240
|
-
scp_llh =
|
|
269
|
+
scp_llh = sicd_ew["GeoData"]["SCP"]["LLH"]
|
|
241
270
|
u_gpn = sarkit.wgs84.up(scp_llh)
|
|
242
271
|
|
|
243
272
|
bw_sf = np.dot(u_gpn, u_ipn)
|
|
244
273
|
bw_area = abs(
|
|
245
|
-
|
|
246
|
-
*
|
|
274
|
+
sicd_ew["Grid"]["Row"]["ImpRespBW"]
|
|
275
|
+
* sicd_ew["Grid"]["Col"]["ImpRespBW"]
|
|
247
276
|
* bw_sf
|
|
248
277
|
)
|
|
249
278
|
|
sarkit_convert/_version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '0.
|
|
1
|
+
__version__ = '0.3.0'
|