Skip to content

Commit 11c01c4

Browse files
authored
ESA burst map (#47)
* adding a text file with esa burst id and max id number of each id * make the burst IDs consistent with ESA * move sentinel1_track_burst_id.txt * add the data file to setup.cfg and MANIFEST.in * dict to array
1 parent 75b30e9 commit 11c01c4

File tree

4 files changed

+201
-1
lines changed

4 files changed

+201
-1
lines changed

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include src/s1reader/data/sentinel1_track_burst_id.txt

setup.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ package_dir =
1717
= src
1818
packages = find:
1919
python_requires = >=3.9
20+
include_package_data = True
2021

2122
[options.packages.find]
2223
where = src
24+
[options.package_data]
25+
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
001 1 2148
2+
002 2149 4296
3+
003 4297 6443
4+
004 6444 8591
5+
005 8592 10739
6+
006 10740 12887
7+
007 12888 15035
8+
008 15036 17183
9+
009 17184 19331
10+
010 19332 21479
11+
011 21480 23627
12+
012 23628 25775
13+
013 25776 27923
14+
014 27924 30071
15+
015 30072 32219
16+
016 32220 34367
17+
017 34368 36514
18+
018 36515 38662
19+
019 38663 40810
20+
020 40811 42958
21+
021 42959 45106
22+
022 45107 47254
23+
023 47255 49402
24+
024 49403 51550
25+
025 51551 53698
26+
026 53699 55846
27+
027 55847 57994
28+
028 57995 60142
29+
029 60143 62290
30+
030 62291 64438
31+
031 64439 66585
32+
032 66586 68733
33+
033 68734 70881
34+
034 70882 73029
35+
035 73030 75177
36+
036 75178 77325
37+
037 77326 79473
38+
038 79474 81621
39+
039 81622 83769
40+
040 83770 85917
41+
041 85918 88065
42+
042 88066 90213
43+
043 90214 92361
44+
044 92362 94508
45+
045 94509 96656
46+
046 96657 98804
47+
047 98805 100952
48+
048 100953 103100
49+
049 103101 105248
50+
050 105249 107396
51+
051 107397 109544
52+
052 109545 111692
53+
053 111693 113840
54+
054 113841 115988
55+
055 115989 118136
56+
056 118137 120284
57+
057 120285 122432
58+
058 122433 124579
59+
059 124580 126727
60+
060 126728 128875
61+
061 128876 131023
62+
062 131024 133171
63+
063 133172 135319
64+
064 135320 137467
65+
065 137468 139615
66+
066 139616 141763
67+
067 141764 143911
68+
068 143912 146059
69+
069 146060 148207
70+
070 148208 150355
71+
071 150356 152503
72+
072 152504 154650
73+
073 154651 156798
74+
074 156799 158946
75+
075 158947 161094
76+
076 161095 163242
77+
077 163243 165390
78+
078 165391 167538
79+
079 167539 169686
80+
080 169687 171834
81+
081 171835 173982
82+
082 173983 176130
83+
083 176131 178278
84+
084 178279 180426
85+
085 180427 182574
86+
086 182575 184721
87+
087 184722 186869
88+
088 186870 189017
89+
089 189018 191165
90+
090 191166 193313
91+
091 193314 195461
92+
092 195462 197609
93+
093 197610 199757
94+
094 199758 201905
95+
095 201906 204053
96+
096 204054 206201
97+
097 206202 208349
98+
098 208350 210497
99+
099 210498 212645
100+
100 212646 214792
101+
101 214793 216940
102+
102 216941 219088
103+
103 219089 221236
104+
104 221237 223384
105+
105 223385 225532
106+
106 225533 227680
107+
107 227681 229828
108+
108 229829 231976
109+
109 231977 234124
110+
110 234125 236272
111+
111 236273 238420
112+
112 238421 240568
113+
113 240569 242716
114+
114 242717 244863
115+
115 244864 247011
116+
116 247012 249159
117+
117 249160 251307
118+
118 251308 253455
119+
119 253456 255603
120+
120 255604 257751
121+
121 257752 259899
122+
122 259900 262047
123+
123 262048 264195
124+
124 264196 266343
125+
125 266344 268491
126+
126 268492 270639
127+
127 270640 272787
128+
128 272788 274934
129+
129 274935 277082
130+
130 277083 279230
131+
131 279231 281378
132+
132 281379 283526
133+
133 283527 285674
134+
134 285675 287822
135+
135 287823 289970
136+
136 289971 292118
137+
137 292119 294266
138+
138 294267 296414
139+
139 296415 298562
140+
140 298563 300710
141+
141 300711 302857
142+
142 302858 305005
143+
143 305006 307153
144+
144 307154 309301
145+
145 309302 311449
146+
146 311450 313597
147+
147 313598 315745
148+
148 315746 317893
149+
149 317894 320041
150+
150 320042 322189
151+
151 322190 324337
152+
152 324338 326485
153+
153 326486 328633
154+
154 328634 330781
155+
155 330782 332928
156+
156 332929 335076
157+
157 335077 337224
158+
158 337225 339372
159+
159 339373 341520
160+
160 341521 343668
161+
161 343669 345816
162+
162 345817 347964
163+
163 347965 350112
164+
164 350113 352260
165+
165 352261 354408
166+
166 354409 356556
167+
167 356557 358704
168+
168 358705 360852
169+
169 360853 362999
170+
170 363000 365147
171+
171 365148 367295
172+
172 367296 369443
173+
173 369444 371591
174+
174 371592 373739
175+
175 373740 375887

src/s1reader/s1_reader.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
from nisar.workflows.stage_dem import check_dateline
1212
from s1reader.s1_burst_slc import Doppler, Sentinel1BurstSlc
1313

14+
15+
esa_track_burst_id_file = f"{os.path.dirname(os.path.realpath(__file__))}/data/sentinel1_track_burst_id.txt"
16+
1417
# TODO evaluate if it make sense to combine below into a class
1518
def as_datetime(t_str, fmt = "%Y-%m-%dT%H:%M:%S.%f"):
1619
'''Parse given time string to datetime.datetime object.
@@ -271,6 +274,15 @@ def burst_from_xml(annotation_path: str, orbit_path: str, tiff_path: str,
271274
bursts : list
272275
List of Sentinel1BurstSlc objects found in annotation XML.
273276
'''
277+
278+
# a 1D array where the indices are the Sentinel-1 track number
279+
# and the data at each row are the corresponding cumulative ID
280+
# number for the last burst of the given track (i.e., line number)
281+
# get last burst ID number of each track and prepend 0
282+
tracks_burst_id = np.insert(np.loadtxt(esa_track_burst_id_file,
283+
usecols=[2], dtype=int),
284+
0, 0)
285+
274286
_, tail = os.path.split(annotation_path)
275287
platform_id, subswath_id, _, pol = [x.upper() for x in tail.split('-')[:4]]
276288

@@ -354,6 +366,15 @@ def burst_from_xml(annotation_path: str, orbit_path: str, tiff_path: str,
354366
dt = sensing_times[i] - ascending_node_time
355367
id_burst = int((dt.seconds + dt.microseconds / 1e6) // burst_interval)
356368

369+
# To be consistent with ESA let's start the counter of the ID
370+
# from 1 instead of from 0, i,e, the ID of the first burst of the
371+
# first track is 1
372+
id_burst += 1
373+
374+
# the IDs are currently local to one track. Let's adjust based on
375+
# the last ID of the previous track
376+
id_burst += tracks_burst_id[track_number-1]
377+
357378
# choose nearest azimuth FM rate
358379
d_seconds = 0.5 * (n_lines - 1) * azimuth_time_interval
359380
sensing_mid = sensing_start + datetime.timedelta(seconds=d_seconds)
@@ -387,7 +408,7 @@ def burst_from_xml(annotation_path: str, orbit_path: str, tiff_path: str,
387408
last_valid_samples[last_line])
388409

389410

390-
burst_id = f't{track_number}_{subswath_id.lower()}_b{id_burst}'
411+
burst_id = f't{track_number}_{id_burst}_{subswath_id.lower()}'
391412

392413
bursts[i] = Sentinel1BurstSlc(sensing_start, radar_freq, wavelength,
393414
azimuth_steer_rate, azimuth_time_interval,

0 commit comments

Comments
 (0)