grdwindinversion 0.3.5__py3-none-any.whl → 0.3.6__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/inversion.py +19 -46
- grdwindinversion/utils.py +25 -0
- {grdwindinversion-0.3.5.dist-info → grdwindinversion-0.3.6.dist-info}/METADATA +2 -2
- {grdwindinversion-0.3.5.dist-info → grdwindinversion-0.3.6.dist-info}/RECORD +9 -9
- {grdwindinversion-0.3.5.dist-info → grdwindinversion-0.3.6.dist-info}/WHEEL +1 -1
- {grdwindinversion-0.3.5.dist-info → grdwindinversion-0.3.6.dist-info}/AUTHORS.rst +0 -0
- {grdwindinversion-0.3.5.dist-info → grdwindinversion-0.3.6.dist-info}/LICENSE +0 -0
- {grdwindinversion-0.3.5.dist-info → grdwindinversion-0.3.6.dist-info}/entry_points.txt +0 -0
- {grdwindinversion-0.3.5.dist-info → grdwindinversion-0.3.6.dist-info}/top_level.txt +0 -0
grdwindinversion/inversion.py
CHANGED
|
@@ -14,7 +14,7 @@ import yaml
|
|
|
14
14
|
from scipy.ndimage import binary_dilation
|
|
15
15
|
import re
|
|
16
16
|
import string
|
|
17
|
-
from grdwindinversion.utils import check_incidence_range, get_pol_ratio_name, timing
|
|
17
|
+
from grdwindinversion.utils import check_incidence_range, get_pol_ratio_name, timing, convert_polarization_name
|
|
18
18
|
from grdwindinversion.load_config import getConf
|
|
19
19
|
import logging
|
|
20
20
|
import os
|
|
@@ -101,8 +101,9 @@ def getOutputName(
|
|
|
101
101
|
"(...)_(..)_(...)(.)_(.)(.)(..)_(........T......)_(........T......)_(......)_(......)_(....).SAFE"
|
|
102
102
|
)
|
|
103
103
|
template = string.Template(
|
|
104
|
-
"${MISSIONID}_${
|
|
104
|
+
"${MISSIONID}_${SWATH}_${PRODUCT}${RESOLUTION}_${LEVEL}${CLASS}${POLARIZATION}_${STARTDATE}_${STOPDATE}_${ORBIT}_${TAKEID}_${PRODID}.SAFE"
|
|
105
105
|
)
|
|
106
|
+
# S1A_IW_GRDH_1SDV_20210909T130650_20210909T130715_039605_04AE83_C34F
|
|
106
107
|
match = regex.match(basename_match)
|
|
107
108
|
if not match:
|
|
108
109
|
raise AttributeError(
|
|
@@ -111,25 +112,27 @@ def getOutputName(
|
|
|
111
112
|
|
|
112
113
|
(
|
|
113
114
|
MISSIONID,
|
|
114
|
-
|
|
115
|
+
SWATH,
|
|
115
116
|
PRODUCT,
|
|
116
117
|
RESOLUTION,
|
|
117
118
|
LEVEL,
|
|
118
119
|
CLASS,
|
|
119
|
-
|
|
120
|
+
POLARIZATION,
|
|
120
121
|
STARTDATE,
|
|
121
122
|
STOPDATE,
|
|
122
123
|
ORBIT,
|
|
123
124
|
TAKEID,
|
|
124
125
|
PRODID,
|
|
125
126
|
) = match.groups()
|
|
126
|
-
|
|
127
|
+
# last two terms of polarization are removed
|
|
128
|
+
new_format = f"{MISSIONID.lower()}-{SWATH.lower()}-owi-{POLARIZATION.lower()}-{STARTDATE.lower()}-{STOPDATE.lower()}-{ORBIT}-{TAKEID}.nc"
|
|
127
129
|
elif sensor == "RS2":
|
|
128
130
|
regex = re.compile(
|
|
129
131
|
"(RS2)_OK([0-9]+)_PK([0-9]+)_DK([0-9]+)_(....)_(........)_(......)_(.._?.?.?)_(S.F)"
|
|
130
132
|
)
|
|
133
|
+
# RS2_OK141302_PK1242223_DK1208537_SCWA_20220904_093402_VV_VH_SGF
|
|
131
134
|
template = string.Template(
|
|
132
|
-
"${MISSIONID}_OK${DATA1}_PK${DATA2}_DK${DATA3}_${
|
|
135
|
+
"${MISSIONID}_OK${DATA1}_PK${DATA2}_DK${DATA3}_${SWATH}_${DATE}_${TIME}_${POLARIZATION}_${LAST}"
|
|
133
136
|
)
|
|
134
137
|
match = regex.match(basename_match)
|
|
135
138
|
if not match:
|
|
@@ -137,25 +140,27 @@ def getOutputName(
|
|
|
137
140
|
f"RC2 file {basename_match} does not match the expected pattern"
|
|
138
141
|
)
|
|
139
142
|
|
|
140
|
-
MISSIONID, DATA1, DATA2, DATA3,
|
|
143
|
+
MISSIONID, DATA1, DATA2, DATA3, SWATH, DATE, TIME, POLARIZATION, LAST = (
|
|
141
144
|
match.groups()
|
|
142
145
|
)
|
|
143
|
-
new_format = f"{MISSIONID.lower()}
|
|
146
|
+
new_format = f"{MISSIONID.lower()}-{SWATH.lower()}-owi-{convert_polarization_name(POLARIZATION)}-{meta_start_date.lower()}-{meta_stop_date.lower()}-_____-_____.nc"
|
|
144
147
|
elif sensor == "RCM":
|
|
145
148
|
|
|
146
149
|
regex = re.compile(
|
|
147
150
|
r"(RCM[0-9])_OK([0-9]+)_PK([0-9]+)_([0-9]+)_([A-Z0-9]+)_(\d{8})_(\d{6})_([A-Z]{2}(?:_[A-Z]{2})?)_([A-Z]+)$"
|
|
148
151
|
)
|
|
152
|
+
# RCM1_OK2767220_PK2769320_1_SCLND_20230930_214014_VV_VH_GRD
|
|
153
|
+
|
|
149
154
|
match = regex.match(basename_match)
|
|
150
155
|
if not match:
|
|
151
156
|
raise AttributeError(
|
|
152
157
|
f"RCM file {basename_match} does not match the expected pattern"
|
|
153
158
|
)
|
|
154
159
|
|
|
155
|
-
MISSIONID, DATA1, DATA2, DATA3,
|
|
160
|
+
MISSIONID, DATA1, DATA2, DATA3, SWATH, DATE, TIME, POLARIZATION, PRODUCT = (
|
|
156
161
|
match.groups()
|
|
157
162
|
)
|
|
158
|
-
new_format = f"{MISSIONID.lower()}-{
|
|
163
|
+
new_format = f"{MISSIONID.lower()}-{SWATH.lower()}-owi-{convert_polarization_name(POLARIZATION)}-{meta_start_date.lower()}-{meta_stop_date.lower()}-_____-_____.nc"
|
|
159
164
|
|
|
160
165
|
else:
|
|
161
166
|
raise ValueError(
|
|
@@ -1074,35 +1079,8 @@ def preprocess(
|
|
|
1074
1079
|
)
|
|
1075
1080
|
|
|
1076
1081
|
if (recalibration) & ("SENTINEL" in sensor_longname):
|
|
1077
|
-
xr_dataset.attrs["
|
|
1078
|
-
|
|
1079
|
-
os.path.dirname(
|
|
1080
|
-
xsar_dataset.datatree["recalibration"].attrs["path_aux_pp1_new"]
|
|
1081
|
-
)
|
|
1082
|
-
)
|
|
1083
|
-
)
|
|
1084
|
-
xr_dataset.attrs["path_aux_cal_new"] = os.path.basename(
|
|
1085
|
-
os.path.dirname(
|
|
1086
|
-
os.path.dirname(
|
|
1087
|
-
xsar_dataset.datatree["recalibration"].attrs["path_aux_cal_new"]
|
|
1088
|
-
)
|
|
1089
|
-
)
|
|
1090
|
-
)
|
|
1091
|
-
|
|
1092
|
-
xr_dataset.attrs["path_aux_pp1_old"] = os.path.basename(
|
|
1093
|
-
os.path.dirname(
|
|
1094
|
-
os.path.dirname(
|
|
1095
|
-
xsar_dataset.datatree["recalibration"].attrs["path_aux_pp1_old"]
|
|
1096
|
-
)
|
|
1097
|
-
)
|
|
1098
|
-
)
|
|
1099
|
-
xr_dataset.attrs["path_aux_cal_old"] = os.path.basename(
|
|
1100
|
-
os.path.dirname(
|
|
1101
|
-
os.path.dirname(
|
|
1102
|
-
xsar_dataset.datatree["recalibration"].attrs["path_aux_cal_old"]
|
|
1103
|
-
)
|
|
1104
|
-
)
|
|
1105
|
-
)
|
|
1082
|
+
xr_dataset.attrs["aux_cal_recal"] = xsar_dataset.datatree["recalibration"].attrs["aux_cal_new"]
|
|
1083
|
+
xr_dataset.attrs["aux_pp1_recal"] = xsar_dataset.datatree["recalibration"].attrs["aux_pp1_new"]
|
|
1106
1084
|
|
|
1107
1085
|
if add_nrcs_model:
|
|
1108
1086
|
# add timing
|
|
@@ -1477,12 +1455,7 @@ def makeL2(
|
|
|
1477
1455
|
"coverage": xr_dataset.attrs["coverage"],
|
|
1478
1456
|
}
|
|
1479
1457
|
|
|
1480
|
-
for recalib_attrs in [
|
|
1481
|
-
"path_aux_pp1_new",
|
|
1482
|
-
"path_aux_pp1_old",
|
|
1483
|
-
"path_aux_cal_new",
|
|
1484
|
-
"path_aux_cal_old",
|
|
1485
|
-
]:
|
|
1458
|
+
for recalib_attrs in ["aux_pp1_recal", "aux_pp1", "aux_cal_recal", "aux_cal"]:
|
|
1486
1459
|
if recalib_attrs in xr_dataset.attrs:
|
|
1487
1460
|
attrs[recalib_attrs] = xr_dataset.attrs[recalib_attrs]
|
|
1488
1461
|
|
|
@@ -1490,7 +1463,7 @@ def makeL2(
|
|
|
1490
1463
|
if arg in xr_dataset.attrs:
|
|
1491
1464
|
attrs["passDirection"] = xr_dataset.attrs[arg]
|
|
1492
1465
|
|
|
1493
|
-
_S1_added_attrs = ["
|
|
1466
|
+
_S1_added_attrs = ["ipf_version", "platform_heading"]
|
|
1494
1467
|
_RCM_added_attrs = ["productId"]
|
|
1495
1468
|
|
|
1496
1469
|
for sup_attr in _S1_added_attrs + _RCM_added_attrs:
|
grdwindinversion/utils.py
CHANGED
|
@@ -18,6 +18,31 @@ except ImportError:
|
|
|
18
18
|
mem_monitor = False
|
|
19
19
|
|
|
20
20
|
|
|
21
|
+
def convert_polarization_name(pol):
|
|
22
|
+
"""
|
|
23
|
+
Convert polarization name to the format used in the output filename
|
|
24
|
+
|
|
25
|
+
Parameters
|
|
26
|
+
----------
|
|
27
|
+
pol : str
|
|
28
|
+
polarization name
|
|
29
|
+
|
|
30
|
+
Returns
|
|
31
|
+
-------
|
|
32
|
+
str
|
|
33
|
+
polarization name in the format used in the output filename (dv/dh/sv/sh/xx)
|
|
34
|
+
"""
|
|
35
|
+
if pol == "VV_VH":
|
|
36
|
+
return "dv"
|
|
37
|
+
elif pol == "HH_HV":
|
|
38
|
+
return "dh"
|
|
39
|
+
elif pol == "VV":
|
|
40
|
+
return "sv"
|
|
41
|
+
elif pol == "HH":
|
|
42
|
+
return "sh"
|
|
43
|
+
else:
|
|
44
|
+
return "xx"
|
|
45
|
+
|
|
21
46
|
def check_incidence_range(incidence, models, **kwargs):
|
|
22
47
|
"""
|
|
23
48
|
Check if the incidence range of the dataset is within the range of the LUT of the model.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: grdwindinversion
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.6
|
|
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
|
|
@@ -35,7 +35,7 @@ Requires-Dist: aiohttp
|
|
|
35
35
|
Package to perform Wind inversion from GRD Level-1 SAR images
|
|
36
36
|
|
|
37
37
|
- Free software: MIT license
|
|
38
|
-
- Documentation: https://grdwindinversion.
|
|
38
|
+
- Documentation: https://cerweb.ifremer.fr/datarmor/doc_sphinx/grdwindinversion/index.html.
|
|
39
39
|
|
|
40
40
|
## Usage
|
|
41
41
|
|
|
@@ -7,16 +7,16 @@ grdwindinversion/config_prod_streaks.yaml,sha256=lJMl4qH6XYqO8ich7yW0WDQsQDrjmWT
|
|
|
7
7
|
grdwindinversion/config_prod_streaks_nrcsmod.yaml,sha256=4yC4KcsC7rUumYHwhpKxM8_LDMe_Je-RIu4-9e1ayp8,1312
|
|
8
8
|
grdwindinversion/data_config.yaml,sha256=FnglUHbAtGwHWg8w86hwZt3-vo-dY8uIjxqyI1jZpv8,567
|
|
9
9
|
grdwindinversion/gradientFeatures.py,sha256=NIeAJzb1zrlJPBq1th7wjEZoNJMxwqDpNHLMWP6FQN0,18198
|
|
10
|
-
grdwindinversion/inversion.py,sha256=
|
|
10
|
+
grdwindinversion/inversion.py,sha256=gCjuhTbLRvh_vHdx1Ut9XluuqaBPSPOgMYiGTnnrNc4,56099
|
|
11
11
|
grdwindinversion/load_config.py,sha256=ZPozOWt0rf2Pmyc6P2D75cE_9wKUfKfr7RUzlE3WoiY,833
|
|
12
12
|
grdwindinversion/main.py,sha256=Cwmxxz-PEt53JvpTL0Jx1WKLJpWvlIXZ9xtnyGKrGHY,3254
|
|
13
|
-
grdwindinversion/utils.py,sha256=
|
|
13
|
+
grdwindinversion/utils.py,sha256=2BRq_UEbKbP5yCy_0X-nV-SQFmmp4aKrFaRgrs5MqJo,4347
|
|
14
14
|
grdwindinversion/utils_memory.py,sha256=NA0bvkpCTkEiqCcJuldG1XsrP40-3AQUUt3HLeoRpbY,1432
|
|
15
15
|
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.
|
|
16
|
+
grdwindinversion-0.3.6.dist-info/AUTHORS.rst,sha256=KmhW_5LBKGTIGwWEVkoTm1qx_bvdDR3yYL-1cwbDOFQ,218
|
|
17
|
+
grdwindinversion-0.3.6.dist-info/LICENSE,sha256=-B8mBiTeY3J7OLuayiV1myqmc7yeijBc7s34kc8RTmg,1075
|
|
18
|
+
grdwindinversion-0.3.6.dist-info/METADATA,sha256=XifamxABLa3IIQ7oyioa6ozPB3qQFDXFThmKM2TPUY0,2475
|
|
19
|
+
grdwindinversion-0.3.6.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
|
|
20
|
+
grdwindinversion-0.3.6.dist-info/entry_points.txt,sha256=2rjvlVCy0iasRXjOz3kOIGuy2OCGQ-VTNuwuViQ6cMM,95
|
|
21
|
+
grdwindinversion-0.3.6.dist-info/top_level.txt,sha256=z6lPix3QPEYOo37qq8plA2hY7S3C8MQZY81agRlksMI,17
|
|
22
|
+
grdwindinversion-0.3.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|