grdwindinversion 0.3.6__py3-none-any.whl → 0.3.9__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.
- grdwindinversion/config_prod_v3.yaml +113 -0
- grdwindinversion/inversion.py +219 -50
- {grdwindinversion-0.3.6.dist-info → grdwindinversion-0.3.9.dist-info}/METADATA +4 -2
- {grdwindinversion-0.3.6.dist-info → grdwindinversion-0.3.9.dist-info}/RECORD +9 -8
- {grdwindinversion-0.3.6.dist-info → grdwindinversion-0.3.9.dist-info}/WHEEL +1 -1
- {grdwindinversion-0.3.6.dist-info → grdwindinversion-0.3.9.dist-info}/entry_points.txt +0 -0
- {grdwindinversion-0.3.6.dist-info → grdwindinversion-0.3.9.dist-info/licenses}/AUTHORS.rst +0 -0
- {grdwindinversion-0.3.6.dist-info → grdwindinversion-0.3.9.dist-info/licenses}/LICENSE +0 -0
- {grdwindinversion-0.3.6.dist-info → grdwindinversion-0.3.9.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
no_subdir: True
|
|
2
|
+
winddir_convention: "meteorological"
|
|
3
|
+
add_gradientsfeatures: False
|
|
4
|
+
add_nrcs_model: False
|
|
5
|
+
S1A:
|
|
6
|
+
GMF_HH_NAME: "nc_lut_gmf_cmod5n_Rhigh_hh_mouche1"
|
|
7
|
+
GMF_VV_NAME: "gmf_cmod5n"
|
|
8
|
+
GMF_VH_NAME: "gmf_s1_v2"
|
|
9
|
+
dsig_VH_NAME: "gmf_s1_v2"
|
|
10
|
+
dsig_cr_step: "nrcs"
|
|
11
|
+
apply_flattening: True
|
|
12
|
+
S1_EW_calG>20190731:
|
|
13
|
+
GMF_HH_NAME: "nc_lut_gmf_cmod5n_Rhigh_hh_mouche1"
|
|
14
|
+
GMF_VV_NAME: "gmf_cmod5n"
|
|
15
|
+
GMF_VH_NAME: "gmf_s1_v3_ew_rec"
|
|
16
|
+
dsig_VH_NAME: "dsig_wspd_s1_ew_rec_v3"
|
|
17
|
+
dsig_cr_step: "wspd"
|
|
18
|
+
apply_flattening: True
|
|
19
|
+
recalibration: False
|
|
20
|
+
ancillary: "ecmwf"
|
|
21
|
+
inc_step: 0.1
|
|
22
|
+
wspd_step: 0.1
|
|
23
|
+
phi_step: 1.0
|
|
24
|
+
resolution: "high"
|
|
25
|
+
S1B:
|
|
26
|
+
GMF_HH_NAME: "nc_lut_gmf_cmod5n_Rhigh_hh_mouche1"
|
|
27
|
+
GMF_VV_NAME: "gmf_cmod5n"
|
|
28
|
+
GMF_VH_NAME: "gmf_s1_v2"
|
|
29
|
+
dsig_VH_NAME: "gmf_s1_v2"
|
|
30
|
+
dsig_cr_step: "nrcs"
|
|
31
|
+
apply_flattening: True
|
|
32
|
+
S1_EW_calG>20190731:
|
|
33
|
+
GMF_HH_NAME: "nc_lut_gmf_cmod5n_Rhigh_hh_mouche1"
|
|
34
|
+
GMF_VV_NAME: "gmf_cmod5n"
|
|
35
|
+
GMF_VH_NAME: "gmf_s1_v3_ew_rec"
|
|
36
|
+
dsig_VH_NAME: "dsig_wspd_s1_ew_rec_v3"
|
|
37
|
+
dsig_cr_step: "wspd"
|
|
38
|
+
apply_flattening: True
|
|
39
|
+
recalibration: False
|
|
40
|
+
ancillary: "ecmwf"
|
|
41
|
+
inc_step: 0.1
|
|
42
|
+
wspd_step: 0.1
|
|
43
|
+
phi_step: 1.0
|
|
44
|
+
resolution: "high"
|
|
45
|
+
|
|
46
|
+
S1C:
|
|
47
|
+
GMF_HH_NAME: "nc_lut_gmf_cmod5n_Rhigh_hh_mouche1"
|
|
48
|
+
GMF_VV_NAME: "gmf_cmod5n"
|
|
49
|
+
GMF_VH_NAME: "gmf_s1_v2"
|
|
50
|
+
dsig_VH_NAME: "gmf_s1_v2"
|
|
51
|
+
dsig_cr_step: "nrcs"
|
|
52
|
+
apply_flattening: True
|
|
53
|
+
S1_EW_calG>20190731:
|
|
54
|
+
GMF_HH_NAME: "nc_lut_gmf_cmod5n_Rhigh_hh_mouche1"
|
|
55
|
+
GMF_VV_NAME: "gmf_cmod5n"
|
|
56
|
+
GMF_VH_NAME: "gmf_s1_v3_ew_rec"
|
|
57
|
+
dsig_VH_NAME: "dsig_wspd_s1_ew_rec_v3"
|
|
58
|
+
dsig_cr_step: "wspd"
|
|
59
|
+
apply_flattening: True
|
|
60
|
+
recalibration: False
|
|
61
|
+
ancillary: "ecmwf"
|
|
62
|
+
inc_step: 0.1
|
|
63
|
+
wspd_step: 0.1
|
|
64
|
+
phi_step: 1.0
|
|
65
|
+
resolution: "high"
|
|
66
|
+
|
|
67
|
+
S1D:
|
|
68
|
+
GMF_HH_NAME: "nc_lut_gmf_cmod5n_Rhigh_hh_mouche1"
|
|
69
|
+
GMF_VV_NAME: "gmf_cmod5n"
|
|
70
|
+
GMF_VH_NAME: "gmf_s1_v2"
|
|
71
|
+
dsig_VH_NAME: "gmf_s1_v2"
|
|
72
|
+
dsig_cr_step: "nrcs"
|
|
73
|
+
apply_flattening: True
|
|
74
|
+
S1_EW_calG>20190731:
|
|
75
|
+
GMF_HH_NAME: "nc_lut_gmf_cmod5n_Rhigh_hh_mouche1"
|
|
76
|
+
GMF_VV_NAME: "gmf_cmod5n"
|
|
77
|
+
GMF_VH_NAME: "gmf_s1_v3_ew_rec"
|
|
78
|
+
dsig_VH_NAME: "dsig_wspd_s1_ew_rec_v3"
|
|
79
|
+
dsig_cr_step: "wspd"
|
|
80
|
+
apply_flattening: True
|
|
81
|
+
recalibration: False
|
|
82
|
+
ancillary: "ecmwf"
|
|
83
|
+
inc_step: 0.1
|
|
84
|
+
wspd_step: 0.1
|
|
85
|
+
phi_step: 1.0
|
|
86
|
+
resolution: "high"
|
|
87
|
+
|
|
88
|
+
RS2:
|
|
89
|
+
GMF_HH_NAME: "nc_lut_gmf_cmod5n_Rhigh_hh_mouche1"
|
|
90
|
+
GMF_VV_NAME: "gmf_cmod5n"
|
|
91
|
+
GMF_VH_NAME: "gmf_rs2_v3"
|
|
92
|
+
dsig_VH_NAME: "dsig_wspd_rs2_v3"
|
|
93
|
+
dsig_cr_step: "wspd"
|
|
94
|
+
apply_flattening: False
|
|
95
|
+
recalibration: False
|
|
96
|
+
ancillary: "ecmwf"
|
|
97
|
+
inc_step: 0.1
|
|
98
|
+
wspd_step: 0.1
|
|
99
|
+
phi_step: 1.0
|
|
100
|
+
resolution: "high"
|
|
101
|
+
RCM:
|
|
102
|
+
GMF_HH_NAME: "nc_lut_gmf_cmod5n_Rhigh_hh_mouche1"
|
|
103
|
+
GMF_VV_NAME: "gmf_cmod5n"
|
|
104
|
+
GMF_VH_NAME: "gmf_rcm_v3"
|
|
105
|
+
dsig_VH_NAME: "dsig_wspd_rcm_v3"
|
|
106
|
+
dsig_cr_step: "wspd"
|
|
107
|
+
apply_flattening: True
|
|
108
|
+
recalibration: False
|
|
109
|
+
ancillary: "ecmwf"
|
|
110
|
+
inc_step: 0.1
|
|
111
|
+
wspd_step: 0.1
|
|
112
|
+
phi_step: 1.0
|
|
113
|
+
resolution: "high"
|
grdwindinversion/inversion.py
CHANGED
|
@@ -54,6 +54,10 @@ def getSensorMetaDataset(filename):
|
|
|
54
54
|
return "S1A", "SENTINEL-1 A", xsar.Sentinel1Meta, xsar.Sentinel1Dataset
|
|
55
55
|
elif "S1B" in filename:
|
|
56
56
|
return "S1B", "SENTINEL-1 B", xsar.Sentinel1Meta, xsar.Sentinel1Dataset
|
|
57
|
+
elif "S1C" in filename:
|
|
58
|
+
return "S1C", "SENTINEL-1 C", xsar.Sentinel1Meta, xsar.Sentinel1Dataset
|
|
59
|
+
elif "S1D" in filename:
|
|
60
|
+
return "S1D", "SENTINEL-1 D", xsar.Sentinel1Meta, xsar.Sentinel1Dataset
|
|
57
61
|
elif "RS2" in filename:
|
|
58
62
|
return "RS2", "RADARSAT-2", xsar.RadarSat2Meta, xsar.RadarSat2Dataset
|
|
59
63
|
elif "RCM1" in filename:
|
|
@@ -65,7 +69,7 @@ def getSensorMetaDataset(filename):
|
|
|
65
69
|
|
|
66
70
|
else:
|
|
67
71
|
raise ValueError(
|
|
68
|
-
"must be S1A|S1B|RS2|RCM1|RCM2|RCM3, got filename %s" % filename
|
|
72
|
+
"must be S1A|S1B|S1C|S1D|RS2|RCM1|RCM2|RCM3, got filename %s" % filename
|
|
69
73
|
)
|
|
70
74
|
|
|
71
75
|
|
|
@@ -96,7 +100,7 @@ def getOutputName(
|
|
|
96
100
|
basename = os.path.basename(input_file)
|
|
97
101
|
basename_match = basename
|
|
98
102
|
|
|
99
|
-
if sensor == "S1A" or sensor == "S1B":
|
|
103
|
+
if sensor == "S1A" or sensor == "S1B" or sensor == "S1C" or sensor == "S1D":
|
|
100
104
|
regex = re.compile(
|
|
101
105
|
"(...)_(..)_(...)(.)_(.)(.)(..)_(........T......)_(........T......)_(......)_(......)_(....).SAFE"
|
|
102
106
|
)
|
|
@@ -143,7 +147,7 @@ def getOutputName(
|
|
|
143
147
|
MISSIONID, DATA1, DATA2, DATA3, SWATH, DATE, TIME, POLARIZATION, LAST = (
|
|
144
148
|
match.groups()
|
|
145
149
|
)
|
|
146
|
-
new_format = f"{MISSIONID.lower()}-{SWATH.lower()}-owi-{convert_polarization_name(POLARIZATION)}-{meta_start_date.lower()}-{meta_stop_date.lower()}-
|
|
150
|
+
new_format = f"{MISSIONID.lower()}-{SWATH.lower()}-owi-{convert_polarization_name(POLARIZATION)}-{meta_start_date.lower()}-{meta_stop_date.lower()}-xxxxx-xxxxx.nc"
|
|
147
151
|
elif sensor == "RCM":
|
|
148
152
|
|
|
149
153
|
regex = re.compile(
|
|
@@ -160,11 +164,11 @@ def getOutputName(
|
|
|
160
164
|
MISSIONID, DATA1, DATA2, DATA3, SWATH, DATE, TIME, POLARIZATION, PRODUCT = (
|
|
161
165
|
match.groups()
|
|
162
166
|
)
|
|
163
|
-
new_format = f"{MISSIONID.lower()}-{SWATH.lower()}-owi-{convert_polarization_name(POLARIZATION)}-{meta_start_date.lower()}-{meta_stop_date.lower()}-
|
|
167
|
+
new_format = f"{MISSIONID.lower()}-{SWATH.lower()}-owi-{convert_polarization_name(POLARIZATION)}-{meta_start_date.lower()}-{meta_stop_date.lower()}-xxxxx-xxxxx.nc"
|
|
164
168
|
|
|
165
169
|
else:
|
|
166
170
|
raise ValueError(
|
|
167
|
-
"sensor must be S1A|S1B|RS2|RCM, got sensor %s" % sensor)
|
|
171
|
+
"sensor must be S1A|S1B|S1C|RS2|RCM, got sensor %s" % sensor)
|
|
168
172
|
|
|
169
173
|
if subdir:
|
|
170
174
|
out_file = os.path.join(outdir, basename, new_format)
|
|
@@ -189,7 +193,6 @@ def getAncillary(meta, ancillary_name="ecmwf"):
|
|
|
189
193
|
"""
|
|
190
194
|
|
|
191
195
|
if ancillary_name == "ecmwf":
|
|
192
|
-
|
|
193
196
|
logging.debug("conf: %s", getConf())
|
|
194
197
|
ec01 = getConf()["ecmwf_0100_1h"]
|
|
195
198
|
ec0125 = getConf()["ecmwf_0125_1h"]
|
|
@@ -282,6 +285,93 @@ def getAncillary(meta, ancillary_name="ecmwf"):
|
|
|
282
285
|
"ancillary_name must be ecmwf/era5, got %s" % ancillary_name)
|
|
283
286
|
|
|
284
287
|
|
|
288
|
+
@timing(logger=logger.debug)
|
|
289
|
+
def inverse_dsig_wspd(
|
|
290
|
+
dual_pol,
|
|
291
|
+
inc,
|
|
292
|
+
sigma0,
|
|
293
|
+
sigma0_dual,
|
|
294
|
+
ancillary_wind,
|
|
295
|
+
nesz_cr,
|
|
296
|
+
dsig_cr_name,
|
|
297
|
+
model_co,
|
|
298
|
+
model_cross,
|
|
299
|
+
**kwargs,
|
|
300
|
+
):
|
|
301
|
+
"""
|
|
302
|
+
Invert sigma0 to retrieve wind using model (lut or gmf).
|
|
303
|
+
|
|
304
|
+
Parameters
|
|
305
|
+
----------
|
|
306
|
+
dual_pol: bool
|
|
307
|
+
True if dualpol, False if singlepol
|
|
308
|
+
inc: xarray.DataArray
|
|
309
|
+
incidence angle
|
|
310
|
+
sigma0: xarray.DataArray
|
|
311
|
+
sigma0 to be inverted
|
|
312
|
+
sigma0_dual: xarray.DataArray
|
|
313
|
+
sigma0 to be inverted for dualpol
|
|
314
|
+
ancillary_wind=: xarray.DataArray (numpy.complex28)
|
|
315
|
+
ancillary wind
|
|
316
|
+
| (for example ecmwf winds), in **ANTENNA convention**,
|
|
317
|
+
nesz_cr: xarray.DataArray
|
|
318
|
+
noise equivalent sigma0 | flattened or not
|
|
319
|
+
dsig_cr_name: str
|
|
320
|
+
dsig_cr name
|
|
321
|
+
model_co: str
|
|
322
|
+
model to use for VV or HH polarization.
|
|
323
|
+
model_cross: str
|
|
324
|
+
model to use for VH or HV polarization.
|
|
325
|
+
|
|
326
|
+
Returns
|
|
327
|
+
-------
|
|
328
|
+
xarray.DataArray
|
|
329
|
+
inverted wind in copol in ** antenna convention** .
|
|
330
|
+
xarray.DataArray
|
|
331
|
+
inverted wind in dualpol in ** antenna convention** .
|
|
332
|
+
xarray.DataArray
|
|
333
|
+
inverted wind in crosspol in ** antenna convention** .
|
|
334
|
+
xarray.DataArray | array
|
|
335
|
+
alpha (ponderation between co and crosspol)
|
|
336
|
+
|
|
337
|
+
See Also
|
|
338
|
+
--------
|
|
339
|
+
xsarsea documentation
|
|
340
|
+
https://cerweb.ifremer.fr/datarmor/doc_sphinx/xsarsea/
|
|
341
|
+
"""
|
|
342
|
+
|
|
343
|
+
# dsig_cr_step == "wspd":
|
|
344
|
+
|
|
345
|
+
wind_co = xsarsea.windspeed.invert_from_model(
|
|
346
|
+
inc,
|
|
347
|
+
sigma0,
|
|
348
|
+
ancillary_wind=ancillary_wind,
|
|
349
|
+
model=model_co,
|
|
350
|
+
**kwargs
|
|
351
|
+
)
|
|
352
|
+
|
|
353
|
+
if dual_pol:
|
|
354
|
+
|
|
355
|
+
wind_cross = windspeed.invert_from_model(
|
|
356
|
+
inc.values,
|
|
357
|
+
sigma0_dual.values,
|
|
358
|
+
model=model_cross,
|
|
359
|
+
**kwargs,
|
|
360
|
+
)
|
|
361
|
+
|
|
362
|
+
wspd_co = np.abs(wind_co)
|
|
363
|
+
wspd_cross = np.abs(wind_cross)
|
|
364
|
+
SNR_cross = sigma0_dual.values/nesz_cr.values
|
|
365
|
+
alpha = windspeed.get_dsig_wspd(dsig_cr_name, wind_cross, SNR_cross)
|
|
366
|
+
|
|
367
|
+
wpsd_dual = alpha * wspd_co + (1 - alpha) * wspd_cross
|
|
368
|
+
wind_dual = wpsd_dual * np.exp(1j * np.angle(wind_co))
|
|
369
|
+
|
|
370
|
+
return wind_co, wind_dual, wind_cross, alpha
|
|
371
|
+
|
|
372
|
+
return wind_co, None, None, None
|
|
373
|
+
|
|
374
|
+
|
|
285
375
|
@timing(logger=logger.debug)
|
|
286
376
|
def inverse(
|
|
287
377
|
dual_pol,
|
|
@@ -321,8 +411,12 @@ def inverse(
|
|
|
321
411
|
|
|
322
412
|
Returns
|
|
323
413
|
-------
|
|
324
|
-
xarray.DataArray
|
|
325
|
-
inverted wind in ** antenna convention** .
|
|
414
|
+
xarray.DataArray
|
|
415
|
+
inverted wind in copol in ** antenna convention** .
|
|
416
|
+
xarray.DataArray
|
|
417
|
+
inverted wind in dualpol in ** antenna convention** .
|
|
418
|
+
xarray.DataArray
|
|
419
|
+
inverted wind in crosspol in ** antenna convention** .
|
|
326
420
|
|
|
327
421
|
See Also
|
|
328
422
|
--------
|
|
@@ -519,8 +613,15 @@ def makeL2asOwi(xr_dataset, config):
|
|
|
519
613
|
)
|
|
520
614
|
|
|
521
615
|
if config["l2_params"]["dual_pol"]:
|
|
616
|
+
if config["dsig_cr_step"] == "nrcs":
|
|
617
|
+
xr_dataset = xr_dataset.rename({
|
|
618
|
+
'dsig_cross': 'owiDsig_cross',
|
|
619
|
+
})
|
|
620
|
+
else:
|
|
621
|
+
xr_dataset = xr_dataset.rename({
|
|
622
|
+
'alpha': 'owiAlpha',
|
|
623
|
+
})
|
|
522
624
|
xr_dataset = xr_dataset.rename({
|
|
523
|
-
'dsig_cross': 'owiDsig_cross',
|
|
524
625
|
'winddir_cross': 'owiWindDirection_cross',
|
|
525
626
|
'winddir_dual': 'owiWindDirection',
|
|
526
627
|
'windspeed_cross': 'owiWindSpeed_cross',
|
|
@@ -784,6 +885,7 @@ def preprocess(
|
|
|
784
885
|
)
|
|
785
886
|
|
|
786
887
|
try:
|
|
888
|
+
logging.info(f"recalibration = {recalibration}")
|
|
787
889
|
if (recalibration) & ("SENTINEL" in sensor_longname):
|
|
788
890
|
logging.info(
|
|
789
891
|
f"recalibration is {recalibration} : Kersten formula is applied"
|
|
@@ -855,8 +957,31 @@ def preprocess(
|
|
|
855
957
|
copol_gmf = "HH"
|
|
856
958
|
crosspol_gmf = "VH"
|
|
857
959
|
|
|
858
|
-
|
|
859
|
-
|
|
960
|
+
if (sensor == "S1A" or sensor == "S1B" or sensor == "S1C" or sensor == "S1D") and xsar_dataset.dataset.attrs["aux_cal"] is None:
|
|
961
|
+
raise ValueError(
|
|
962
|
+
"aux_cal attribute is None, xsar_dataset.dataset.attrs['aux_cal'] must be set to a valid value"
|
|
963
|
+
)
|
|
964
|
+
cond_aux_cal = (
|
|
965
|
+
(sensor == "S1A" or sensor == "S1B" or sensor == "S1C" or sensor == "S1D")
|
|
966
|
+
and xsar_dataset.dataset.attrs["aux_cal"] is not None
|
|
967
|
+
and xsar_dataset.dataset.attrs["aux_cal"].split("_")[-1][1:9] > "20190731"
|
|
968
|
+
)
|
|
969
|
+
|
|
970
|
+
if cond_aux_cal and xr_dataset.attrs["swath"] == "EW" and "S1_EW_calG>20190731" in config.keys():
|
|
971
|
+
model_co = config["S1_EW_calG>20190731"]["GMF_" + copol_gmf + "_NAME"]
|
|
972
|
+
model_cross = config["S1_EW_calG>20190731"]["GMF_" +
|
|
973
|
+
crosspol_gmf + "_NAME"]
|
|
974
|
+
dsig_cr_name = config["S1_EW_calG>20190731"]["dsig_" +
|
|
975
|
+
crosspol_gmf + "_NAME"]
|
|
976
|
+
apply_flattening = config["S1_EW_calG>20190731"]["apply_flattening"]
|
|
977
|
+
dsig_cr_step = config["S1_EW_calG>20190731"]["dsig_cr_step"]
|
|
978
|
+
|
|
979
|
+
else:
|
|
980
|
+
model_co = config["GMF_" + copol_gmf + "_NAME"]
|
|
981
|
+
model_cross = config["GMF_" + crosspol_gmf + "_NAME"]
|
|
982
|
+
dsig_cr_name = config["dsig_" + crosspol_gmf + "_NAME"]
|
|
983
|
+
apply_flattening = config["apply_flattening"]
|
|
984
|
+
dsig_cr_step = config["dsig_cr_step"]
|
|
860
985
|
|
|
861
986
|
# register paramaters in config
|
|
862
987
|
config["l2_params"]["dual_pol"] = dual_pol
|
|
@@ -868,6 +993,9 @@ def preprocess(
|
|
|
868
993
|
config["l2_params"]["model_cross"] = model_cross
|
|
869
994
|
config["sensor_longname"] = sensor_longname
|
|
870
995
|
config["sensor"] = sensor
|
|
996
|
+
config["dsig_cr_step"] = dsig_cr_step
|
|
997
|
+
config["dsig_cr_name"] = dsig_cr_name
|
|
998
|
+
config["apply_flattening"] = apply_flattening
|
|
871
999
|
|
|
872
1000
|
# need to load LUTs before inversion
|
|
873
1001
|
nc_luts = [x for x in [model_co, model_cross] if x.startswith("nc_lut")]
|
|
@@ -1048,35 +1176,35 @@ def preprocess(
|
|
|
1048
1176
|
xr_dataset['nesz_cross_flattened'].attrs[
|
|
1049
1177
|
"comment"] = 'nesz has been flattened using windspeed.nesz_flattening'
|
|
1050
1178
|
|
|
1051
|
-
if
|
|
1179
|
+
if dsig_cr_step == "nrcs":
|
|
1052
1180
|
# dsig
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1181
|
+
if apply_flattening:
|
|
1182
|
+
xr_dataset["dsig_cross"] = windspeed.get_dsig(
|
|
1183
|
+
dsig_cr_name,
|
|
1184
|
+
xr_dataset.incidence,
|
|
1185
|
+
xr_dataset["sigma0_ocean"].sel(pol=crosspol),
|
|
1186
|
+
xr_dataset.nesz_cross_flattened,
|
|
1187
|
+
)
|
|
1059
1188
|
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1189
|
+
xr_dataset.dsig_cross.attrs["formula_used"] = config[
|
|
1190
|
+
"dsig_" + crosspol_gmf + "_NAME"
|
|
1191
|
+
]
|
|
1063
1192
|
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
)
|
|
1193
|
+
else:
|
|
1194
|
+
xr_dataset["dsig_cross"] = windspeed.get_dsig(
|
|
1195
|
+
dsig_cr_name,
|
|
1196
|
+
xr_dataset.incidence,
|
|
1197
|
+
xr_dataset["sigma0_ocean"].sel(pol=crosspol),
|
|
1198
|
+
xr_dataset.nesz.sel(pol=crosspol),
|
|
1199
|
+
)
|
|
1072
1200
|
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1201
|
+
xr_dataset.dsig_cross.attrs["comment"] = (
|
|
1202
|
+
"variable used to ponderate copol and crosspol. this ponderation is done will combining cost functions during inversion process"
|
|
1203
|
+
)
|
|
1076
1204
|
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1205
|
+
xr_dataset.dsig_cross.attrs["apply_flattening"] = str(
|
|
1206
|
+
apply_flattening
|
|
1207
|
+
)
|
|
1080
1208
|
|
|
1081
1209
|
if (recalibration) & ("SENTINEL" in sensor_longname):
|
|
1082
1210
|
xr_dataset.attrs["aux_cal_recal"] = xsar_dataset.datatree["recalibration"].attrs["aux_cal_new"]
|
|
@@ -1254,6 +1382,7 @@ def makeL2(
|
|
|
1254
1382
|
input filename
|
|
1255
1383
|
outdir : str
|
|
1256
1384
|
output folder
|
|
1385
|
+
|
|
1257
1386
|
config_path : str
|
|
1258
1387
|
configuration file path
|
|
1259
1388
|
overwrite : bool, optional
|
|
@@ -1289,10 +1418,15 @@ def makeL2(
|
|
|
1289
1418
|
dual_pol = config["l2_params"]["dual_pol"]
|
|
1290
1419
|
ancillary_name = config["ancillary"]
|
|
1291
1420
|
sensor_longname = config["sensor_longname"]
|
|
1292
|
-
|
|
1421
|
+
dsig_cr_step = config["dsig_cr_step"]
|
|
1422
|
+
dsig_cr_name = config["dsig_cr_name"]
|
|
1423
|
+
apply_flattening = config["apply_flattening"]
|
|
1293
1424
|
if dual_pol:
|
|
1294
1425
|
sigma0_ocean_cross = xr_dataset["sigma0_ocean"].sel(pol=crosspol)
|
|
1295
|
-
|
|
1426
|
+
if dsig_cr_step == "nrcs":
|
|
1427
|
+
dsig_cross = xr_dataset["dsig_cross"]
|
|
1428
|
+
else:
|
|
1429
|
+
dsig_cross = 0.1
|
|
1296
1430
|
else:
|
|
1297
1431
|
sigma0_ocean_cross = None
|
|
1298
1432
|
dsig_cross = 0.1 # default value set in xsarsea
|
|
@@ -1312,18 +1446,50 @@ def makeL2(
|
|
|
1312
1446
|
inc_check_co, inc_check_cross = check_incidence_range(
|
|
1313
1447
|
xr_dataset["incidence"], [model_co, model_cross], **kwargs
|
|
1314
1448
|
)
|
|
1449
|
+
if dsig_cr_step == "nrcs":
|
|
1450
|
+
logging.info(
|
|
1451
|
+
"dsig_cr_step is nrcs : polarization are mixed at cost function step")
|
|
1452
|
+
wind_co, wind_dual, windspeed_cr = inverse(
|
|
1453
|
+
dual_pol,
|
|
1454
|
+
inc=xr_dataset["incidence"],
|
|
1455
|
+
sigma0=xr_dataset["sigma0_ocean"].sel(pol=copol),
|
|
1456
|
+
sigma0_dual=sigma0_ocean_cross,
|
|
1457
|
+
ancillary_wind=xr_dataset["ancillary_wind"],
|
|
1458
|
+
dsig_cr=dsig_cross,
|
|
1459
|
+
model_co=model_co,
|
|
1460
|
+
model_cross=model_cross,
|
|
1461
|
+
**kwargs,
|
|
1462
|
+
)
|
|
1463
|
+
elif dsig_cr_step == "wspd":
|
|
1464
|
+
logging.info(
|
|
1465
|
+
"dsig_cr_step is wspd : polarization are mixed at winds speed step")
|
|
1466
|
+
|
|
1467
|
+
if apply_flattening:
|
|
1468
|
+
nesz_cross = xr_dataset["nesz_cross_flattened"]
|
|
1469
|
+
else:
|
|
1470
|
+
nesz_cross = xr_dataset.nesz.sel(pol=crosspol)
|
|
1471
|
+
|
|
1472
|
+
wind_co, wind_dual, windspeed_cr, alpha = inverse_dsig_wspd(
|
|
1473
|
+
dual_pol,
|
|
1474
|
+
inc=xr_dataset["incidence"],
|
|
1475
|
+
sigma0=xr_dataset["sigma0_ocean"].sel(pol=copol),
|
|
1476
|
+
sigma0_dual=sigma0_ocean_cross,
|
|
1477
|
+
ancillary_wind=xr_dataset["ancillary_wind"],
|
|
1478
|
+
nesz_cr=nesz_cross,
|
|
1479
|
+
dsig_cr_name=dsig_cr_name,
|
|
1480
|
+
model_co=model_co,
|
|
1481
|
+
model_cross=model_cross,
|
|
1482
|
+
**kwargs
|
|
1483
|
+
)
|
|
1484
|
+
xr_dataset["alpha"] = xr.DataArray(
|
|
1485
|
+
data=alpha, dims=xr_dataset["incidence"].dims, coords=xr_dataset["incidence"].coords)
|
|
1486
|
+
xr_dataset["alpha"].attrs["apply_flattening"] = str(apply_flattening)
|
|
1487
|
+
xr_dataset["alpha"].attrs["comments"] = "alpha used to ponderate copol and crosspol. this ponderation is done will combining wind speeds."
|
|
1488
|
+
|
|
1489
|
+
else:
|
|
1490
|
+
raise ValueError(
|
|
1491
|
+
f"dsig_cr_step must be 'nrcs' or 'wspd', got {dsig_cr_step}")
|
|
1315
1492
|
|
|
1316
|
-
wind_co, wind_dual, windspeed_cr = inverse(
|
|
1317
|
-
dual_pol,
|
|
1318
|
-
inc=xr_dataset["incidence"],
|
|
1319
|
-
sigma0=xr_dataset["sigma0_ocean"].sel(pol=copol),
|
|
1320
|
-
sigma0_dual=sigma0_ocean_cross,
|
|
1321
|
-
ancillary_wind=xr_dataset["ancillary_wind"],
|
|
1322
|
-
dsig_cr=dsig_cross,
|
|
1323
|
-
model_co=model_co,
|
|
1324
|
-
model_cross=model_cross,
|
|
1325
|
-
**kwargs,
|
|
1326
|
-
)
|
|
1327
1493
|
# windspeed_co
|
|
1328
1494
|
xr_dataset["windspeed_co"] = np.abs(wind_co)
|
|
1329
1495
|
xr_dataset["windspeed_co"].attrs["units"] = "m.s⁻1"
|
|
@@ -1351,8 +1517,11 @@ def makeL2(
|
|
|
1351
1517
|
% (model_co, copol, model_cross, crosspol)
|
|
1352
1518
|
)
|
|
1353
1519
|
xr_dataset["windspeed_dual"].attrs["standart_name"] = "wind_speed"
|
|
1354
|
-
xr_dataset["windspeed_dual"].attrs["model"] =
|
|
1355
|
-
|
|
1520
|
+
xr_dataset["windspeed_dual"].attrs["model"] = (model_co, model_cross)
|
|
1521
|
+
xr_dataset["windspeed_dual"].attrs["combining_method"] = dsig_cr_step
|
|
1522
|
+
|
|
1523
|
+
if "comment" in xr_dataset["windspeed_dual"].attrs:
|
|
1524
|
+
del xr_dataset["windspeed_dual"].attrs["comment"]
|
|
1356
1525
|
|
|
1357
1526
|
xr_dataset["winddir_dual"] = transform_winddir(
|
|
1358
1527
|
wind_dual,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: grdwindinversion
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.9
|
|
4
4
|
Summary: Package to perform Wind inversion from GRD Level-1 SAR images
|
|
5
5
|
Author-email: Antoine Grouazel <antoine.grouazel@ifremer.fr>
|
|
6
6
|
License: MIT
|
|
@@ -27,6 +27,8 @@ Requires-Dist: numpy
|
|
|
27
27
|
Requires-Dist: scipy
|
|
28
28
|
Requires-Dist: fsspec
|
|
29
29
|
Requires-Dist: aiohttp
|
|
30
|
+
Requires-Dist: xmlschema==3.4.3
|
|
31
|
+
Dynamic: license-file
|
|
30
32
|
|
|
31
33
|
|
|
32
34
|
[](https://pypi.org/project/grdwindinversion/)
|
|
@@ -5,18 +5,19 @@ grdwindinversion/config_prod_recal.yaml,sha256=74n2J4tzSx1I5vaat3ydwig1jyfDgxGTG
|
|
|
5
5
|
grdwindinversion/config_prod_recal_streaks_nrcsmod.yaml,sha256=ob0YmzHrwkI4GLxaR9HzidYtXBrTOAlEYwPYdCK7AqA,1092
|
|
6
6
|
grdwindinversion/config_prod_streaks.yaml,sha256=lJMl4qH6XYqO8ich7yW0WDQsQDrjmWThlLyx1xZy1DA,1313
|
|
7
7
|
grdwindinversion/config_prod_streaks_nrcsmod.yaml,sha256=4yC4KcsC7rUumYHwhpKxM8_LDMe_Je-RIu4-9e1ayp8,1312
|
|
8
|
+
grdwindinversion/config_prod_v3.yaml,sha256=YdIYJcQhX8bM2vhU4pDmT4BI8O0Mn4DVSS_LvB0CbgI,3136
|
|
8
9
|
grdwindinversion/data_config.yaml,sha256=FnglUHbAtGwHWg8w86hwZt3-vo-dY8uIjxqyI1jZpv8,567
|
|
9
10
|
grdwindinversion/gradientFeatures.py,sha256=NIeAJzb1zrlJPBq1th7wjEZoNJMxwqDpNHLMWP6FQN0,18198
|
|
10
|
-
grdwindinversion/inversion.py,sha256=
|
|
11
|
+
grdwindinversion/inversion.py,sha256=D8HQ4Ch2FvWXs7vkNfcSSl_ox1tf3WoemJZ9vZbR-Ww,62409
|
|
11
12
|
grdwindinversion/load_config.py,sha256=ZPozOWt0rf2Pmyc6P2D75cE_9wKUfKfr7RUzlE3WoiY,833
|
|
12
13
|
grdwindinversion/main.py,sha256=Cwmxxz-PEt53JvpTL0Jx1WKLJpWvlIXZ9xtnyGKrGHY,3254
|
|
13
14
|
grdwindinversion/utils.py,sha256=2BRq_UEbKbP5yCy_0X-nV-SQFmmp4aKrFaRgrs5MqJo,4347
|
|
14
15
|
grdwindinversion/utils_memory.py,sha256=NA0bvkpCTkEiqCcJuldG1XsrP40-3AQUUt3HLeoRpbY,1432
|
|
15
16
|
grdwindinversion/.github/ISSUE_TEMPLATE.md,sha256=qiM_a7CCUz3fSrz3Q20Se1nwPNFS8QCc8tkwK_0DSCo,327
|
|
16
|
-
grdwindinversion-0.3.
|
|
17
|
-
grdwindinversion-0.3.
|
|
18
|
-
grdwindinversion-0.3.
|
|
19
|
-
grdwindinversion-0.3.
|
|
20
|
-
grdwindinversion-0.3.
|
|
21
|
-
grdwindinversion-0.3.
|
|
22
|
-
grdwindinversion-0.3.
|
|
17
|
+
grdwindinversion-0.3.9.dist-info/licenses/AUTHORS.rst,sha256=KmhW_5LBKGTIGwWEVkoTm1qx_bvdDR3yYL-1cwbDOFQ,218
|
|
18
|
+
grdwindinversion-0.3.9.dist-info/licenses/LICENSE,sha256=-B8mBiTeY3J7OLuayiV1myqmc7yeijBc7s34kc8RTmg,1075
|
|
19
|
+
grdwindinversion-0.3.9.dist-info/METADATA,sha256=6Om_Kjm7yZYOylA7puJhcumBy9UwmIIq0xoxf_3W5d0,2529
|
|
20
|
+
grdwindinversion-0.3.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
21
|
+
grdwindinversion-0.3.9.dist-info/entry_points.txt,sha256=2rjvlVCy0iasRXjOz3kOIGuy2OCGQ-VTNuwuViQ6cMM,95
|
|
22
|
+
grdwindinversion-0.3.9.dist-info/top_level.txt,sha256=z6lPix3QPEYOo37qq8plA2hY7S3C8MQZY81agRlksMI,17
|
|
23
|
+
grdwindinversion-0.3.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|