mertisreader 0.0.2__tar.gz → 0.0.3__tar.gz
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.
- mertisreader-0.0.3/PKG-INFO +490 -0
- mertisreader-0.0.3/README.md +450 -0
- mertisreader-0.0.3/mertisreader/__init__.py +2 -0
- {mertisreader-0.0.2 → mertisreader-0.0.3}/mertisreader/_modidx.py +6 -0
- {mertisreader-0.0.2 → mertisreader-0.0.3}/mertisreader/core.py +92 -32
- mertisreader-0.0.3/mertisreader.egg-info/PKG-INFO +490 -0
- {mertisreader-0.0.2 → mertisreader-0.0.3}/mertisreader.egg-info/SOURCES.txt +1 -0
- mertisreader-0.0.3/pyproject.toml +11 -0
- {mertisreader-0.0.2 → mertisreader-0.0.3}/settings.ini +1 -1
- {mertisreader-0.0.2 → mertisreader-0.0.3}/setup.py +0 -2
- mertisreader-0.0.2/PKG-INFO +0 -191
- mertisreader-0.0.2/README.md +0 -163
- mertisreader-0.0.2/mertisreader/__init__.py +0 -2
- mertisreader-0.0.2/mertisreader.egg-info/PKG-INFO +0 -191
- {mertisreader-0.0.2 → mertisreader-0.0.3}/CONTRIBUTING.md +0 -0
- {mertisreader-0.0.2 → mertisreader-0.0.3}/LICENSE +0 -0
- {mertisreader-0.0.2 → mertisreader-0.0.3}/MANIFEST.in +0 -0
- {mertisreader-0.0.2 → mertisreader-0.0.3}/mertisreader/_nbdev.py +0 -0
- {mertisreader-0.0.2 → mertisreader-0.0.3}/mertisreader.egg-info/dependency_links.txt +0 -0
- {mertisreader-0.0.2 → mertisreader-0.0.3}/mertisreader.egg-info/not-zip-safe +0 -0
- {mertisreader-0.0.2 → mertisreader-0.0.3}/mertisreader.egg-info/requires.txt +0 -0
- {mertisreader-0.0.2 → mertisreader-0.0.3}/mertisreader.egg-info/top_level.txt +0 -0
- {mertisreader-0.0.2 → mertisreader-0.0.3}/nbdev_template/__init__.py +0 -0
- {mertisreader-0.0.2 → mertisreader-0.0.3}/nbdev_template/_nbdev.py +0 -0
- {mertisreader-0.0.2 → mertisreader-0.0.3}/nbdev_template/core.py +0 -0
- {mertisreader-0.0.2 → mertisreader-0.0.3}/setup.cfg +0 -0
|
@@ -0,0 +1,490 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mertisreader
|
|
3
|
+
Version: 0.0.3
|
|
4
|
+
Summary: helper routines to read ESA/Bepicolombo space mission - DLR MERTIS instrument data
|
|
5
|
+
Home-page: https://github.com/mariodamore/mertisreader/tree/master/
|
|
6
|
+
Author: Mario D Amore
|
|
7
|
+
Author-email: mario.damore@dlr.de
|
|
8
|
+
License: MIT License
|
|
9
|
+
Keywords: planetary,instrument,data
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Natural Language :: English
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Requires-Python: >=3.7
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: rich
|
|
22
|
+
Requires-Dist: numpy
|
|
23
|
+
Requires-Dist: pandas
|
|
24
|
+
Requires-Dist: astropy
|
|
25
|
+
Requires-Dist: matplotlib
|
|
26
|
+
Requires-Dist: xmltodict
|
|
27
|
+
Requires-Dist: rich
|
|
28
|
+
Dynamic: author
|
|
29
|
+
Dynamic: author-email
|
|
30
|
+
Dynamic: classifier
|
|
31
|
+
Dynamic: description
|
|
32
|
+
Dynamic: description-content-type
|
|
33
|
+
Dynamic: home-page
|
|
34
|
+
Dynamic: keywords
|
|
35
|
+
Dynamic: license
|
|
36
|
+
Dynamic: license-file
|
|
37
|
+
Dynamic: requires-dist
|
|
38
|
+
Dynamic: requires-python
|
|
39
|
+
Dynamic: summary
|
|
40
|
+
|
|
41
|
+
# install
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
|
|
45
|
+
|
|
46
|
+
## mertisreader - Quick cheatsheet
|
|
47
|
+
|
|
48
|
+
Import Required Libraries
|
|
49
|
+
|
|
50
|
+
``` python
|
|
51
|
+
import pathlib
|
|
52
|
+
import rich
|
|
53
|
+
import mertisreader as mr
|
|
54
|
+
|
|
55
|
+
print("Libraries imported successfully.")
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Libraries imported successfully.
|
|
59
|
+
|
|
60
|
+
### Initialize MERTISDataPackReader
|
|
61
|
+
|
|
62
|
+
Initialize the MERTISSessionReader with the input directory and optional
|
|
63
|
+
parameters for output directory and log level.
|
|
64
|
+
|
|
65
|
+
The `../data/` contains a subset of the Moon flyby , technically called
|
|
66
|
+
Earth Gravity Assist (EGA).
|
|
67
|
+
|
|
68
|
+
The directory name reflects ESA-PSA/PDS4 naminhc scheme and the start /
|
|
69
|
+
stop data acquistion , plus the data pack creation.
|
|
70
|
+
|
|
71
|
+
Under this, there the different data levels :
|
|
72
|
+
|
|
73
|
+
| Level | Units | Geometry | Calibration Targets | TIS Aligned |
|
|
74
|
+
|-------|-----------------|----------|---------------------|-------------|
|
|
75
|
+
| raw | Digital Numbers | No | No | No |
|
|
76
|
+
| par | Physical Units | Yes | Yes | No |
|
|
77
|
+
| cal | Physical Units | Yes | No | Yes |
|
|
78
|
+
|
|
79
|
+
- **Calibration Target** : if the currnet level contains calibration
|
|
80
|
+
target measurements or only scientifically relevant one.
|
|
81
|
+
- **TIS Aligned:** : the TIS (Thermal Infrared Spectrometer) wavelength
|
|
82
|
+
grid is aligned with the detector’s X and Y axes, so all pixels share
|
|
83
|
+
the same wavelength grid. If not aligned, each pixel has its own
|
|
84
|
+
wavelength grid, making data comparison and analysis more complex.
|
|
85
|
+
|
|
86
|
+
Just change the level directory, the package can handle all the levels
|
|
87
|
+
and read the data, take care of not calling geometry related paramter on
|
|
88
|
+
RAW.
|
|
89
|
+
|
|
90
|
+
``` python
|
|
91
|
+
input_path = pathlib.Path('../data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/cal')
|
|
92
|
+
output_path = pathlib.Path('/tmp/')
|
|
93
|
+
log_level = 'INFO'
|
|
94
|
+
|
|
95
|
+
if not input_path.exists():
|
|
96
|
+
print(f"Input path {input_path} does not exist.")
|
|
97
|
+
else:
|
|
98
|
+
print(f"Reading path {input_path}")
|
|
99
|
+
|
|
100
|
+
ms_reader = mr.MERTISDataPackReader(input_dir=input_path, output_dir=output_path, log_level=log_level)
|
|
101
|
+
|
|
102
|
+
print(f'MERTISDataPackReader initialized with input directory: {ms_reader.input_dir}')
|
|
103
|
+
print(f'Output directory: {ms_reader.output_dir}')
|
|
104
|
+
print(f'Log level: {ms_reader.log_level}')
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
2025-10-01 17:28:17,029|3540409|INFO|input_dir=PosixPath('../data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/cal')
|
|
108
|
+
|
|
109
|
+
Reading path ../data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/cal
|
|
110
|
+
MERTISDataPackReader initialized with input directory: ../data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/cal
|
|
111
|
+
Output directory: /tmp
|
|
112
|
+
Log level: INFO
|
|
113
|
+
|
|
114
|
+
Show Files in Input Directory
|
|
115
|
+
|
|
116
|
+
``` python
|
|
117
|
+
ms_reader.show_files()
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
All files in input_dir :
|
|
121
|
+
|
|
122
|
+
<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace"><span style="color: #800080; text-decoration-color: #800080; font-weight: bold">Counter</span><span style="font-weight: bold">({</span><span style="color: #008000; text-decoration-color: #008000">'.dat'</span>: <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2</span>, <span style="color: #008000; text-decoration-color: #008000">'.lblx'</span>: <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3</span>, <span style="color: #008000; text-decoration-color: #008000">'.fits'</span>: <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">1</span><span style="font-weight: bold">})</span>
|
|
123
|
+
</pre>
|
|
124
|
+
|
|
125
|
+
All files in input_dir matching old pattern <v0.2.6 (\d{8}_\d{8}):
|
|
126
|
+
|
|
127
|
+
<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace"><span style="color: #800080; text-decoration-color: #800080; font-weight: bold">Counter</span><span style="font-weight: bold">()</span>
|
|
128
|
+
</pre>
|
|
129
|
+
|
|
130
|
+
All files in input_dir matching new pattern >=v0.2.6 (mer_cal_sc_tis_YYYYMMDD_1-...):
|
|
131
|
+
|
|
132
|
+
<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace"><span style="color: #800080; text-decoration-color: #800080; font-weight: bold">Counter</span><span style="font-weight: bold">({</span><span style="color: #008000; text-decoration-color: #008000">'mer_cal_sc_tis'</span>: <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">1</span><span style="font-weight: bold">})</span>
|
|
133
|
+
</pre>
|
|
134
|
+
|
|
135
|
+
List File Types
|
|
136
|
+
|
|
137
|
+
``` python
|
|
138
|
+
ms_reader.listfiletypes()
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace"><span style="font-weight: bold">{</span>
|
|
142
|
+
<span style="color: #008000; text-decoration-color: #008000">'hk_default'</span>: <span style="font-weight: bold">[</span><span style="color: #008000; text-decoration-color: #008000">'mer_cal_hk_default_20200409_1-0651130766-12538__0_1.dat'</span><span style="font-weight: bold">]</span>,
|
|
143
|
+
<span style="color: #008000; text-decoration-color: #008000">'hk_extended'</span>: <span style="font-weight: bold">[</span><span style="color: #008000; text-decoration-color: #008000">'mer_cal_hk_extended_20200409_1-0651130766-12595__0_1.dat'</span><span style="font-weight: bold">]</span>,
|
|
144
|
+
<span style="color: #008000; text-decoration-color: #008000">'sc_tis'</span>: <span style="font-weight: bold">[</span><span style="color: #008000; text-decoration-color: #008000">'mer_cal_sc_tis_20200409_1-0651130819-21186__0_1.fits'</span><span style="font-weight: bold">]</span>,
|
|
145
|
+
<span style="color: #008000; text-decoration-color: #008000">'sc_tir'</span>: <span style="font-weight: bold">[]</span>,
|
|
146
|
+
<span style="color: #008000; text-decoration-color: #008000">'sc_tis_ql'</span>: <span style="font-weight: bold">[]</span>,
|
|
147
|
+
<span style="color: #008000; text-decoration-color: #008000">'sc_tir_ql'</span>: <span style="font-weight: bold">[]</span>
|
|
148
|
+
<span style="font-weight: bold">}</span>
|
|
149
|
+
</pre>
|
|
150
|
+
|
|
151
|
+
<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace"><span style="font-weight: bold">{</span><span style="color: #008000; text-decoration-color: #008000">'hk_default'</span>: <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">1</span>, <span style="color: #008000; text-decoration-color: #008000">'hk_extended'</span>: <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">1</span>, <span style="color: #008000; text-decoration-color: #008000">'sc_tis'</span>: <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">1</span>, <span style="color: #008000; text-decoration-color: #008000">'sc_tir'</span>: <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">0</span>, <span style="color: #008000; text-decoration-color: #008000">'sc_tis_ql'</span>: <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">0</span>, <span style="color: #008000; text-decoration-color: #008000">'sc_tir_ql'</span>: <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">0</span><span style="font-weight: bold">}</span>
|
|
152
|
+
</pre>
|
|
153
|
+
|
|
154
|
+
Collect Data
|
|
155
|
+
|
|
156
|
+
``` python
|
|
157
|
+
ms_reader.data_collector()
|
|
158
|
+
|
|
159
|
+
print(f'Collected data keys: {ms_reader.collect_data.keys()}')
|
|
160
|
+
for key, value in ms_reader.collect_data.items():
|
|
161
|
+
print(f'{key}: {len(value)} files collected')
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Reading filetype: hk_default from mer_cal_hk_default_20200409_1-0651130766-12538__0_1
|
|
165
|
+
Reading filetype: hk_extended from mer_cal_hk_extended_20200409_1-0651130766-12595__0_1
|
|
166
|
+
Reading filetype: tis from mer_cal_sc_tis_20200409_1-0651130819-21186__0_1
|
|
167
|
+
Collected data keys: dict_keys(['hk_default', 'hk_extended', 'tis'])
|
|
168
|
+
hk_default: 1 files collected
|
|
169
|
+
hk_extended: 1 files collected
|
|
170
|
+
tis: 1 files collected
|
|
171
|
+
|
|
172
|
+
Assemble Data
|
|
173
|
+
|
|
174
|
+
``` python
|
|
175
|
+
ms_reader.data_assembler(verbose=True)
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Output()
|
|
179
|
+
|
|
180
|
+
<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">Reading filetype: tis from
|
|
181
|
+
../data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/cal/me
|
|
182
|
+
r_cal_sc_tis_20200409_1-0651130819-21186__0_1.fits
|
|
183
|
+
</pre>
|
|
184
|
+
|
|
185
|
+
<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace"></pre>
|
|
186
|
+
|
|
187
|
+
n_wav=40 # generic wavelengths : not precise enough for scientific analysis!
|
|
188
|
+
| | tis_stem | finite(geo) | geo.size |
|
|
189
|
+
|---:|:------------------------------------------------|--------------:|-----------:|
|
|
190
|
+
| 0 | mer_cal_sc_tis_20200409_1-0651130819-21186__0_1 | 672 | 10500 |
|
|
191
|
+
Indices of measurements targets (HK_STAT_TIS_DATA_ACQ_TARGET):
|
|
192
|
+
space_index.shape=(21,)
|
|
193
|
+
bb7_index.shape=(0,)
|
|
194
|
+
bb3_index.shape=(0,)
|
|
195
|
+
planet_index.shape=(0,)
|
|
196
|
+
Collected data statistics:
|
|
197
|
+
Number of TIS files: 1
|
|
198
|
+
Number of HK files: 2
|
|
199
|
+
Number of TIR files: 0
|
|
200
|
+
Number of TIS QL files: 0
|
|
201
|
+
Number of TIR QL files: 0
|
|
202
|
+
|
|
203
|
+
Verify the Assembled Data
|
|
204
|
+
|
|
205
|
+
``` python
|
|
206
|
+
# RAW does not have geometry data
|
|
207
|
+
if ms_reader.processing_level != 'RAW':
|
|
208
|
+
print(f'Geometry data keys: {ms_reader.geom_ls.keys()}')
|
|
209
|
+
print(f'Frames data keys: {ms_reader.frames.keys()}')
|
|
210
|
+
print(f'Wavelengths data keys: {ms_reader.wavelengths.keys()}')
|
|
211
|
+
print(f'MERTIS TIS metadata keys: {ms_reader.mertis_tis_metadata.keys()}')
|
|
212
|
+
print(f'Space index shape: {ms_reader.space_index.shape}')
|
|
213
|
+
print(f'BB7 index shape: {ms_reader.bb7_index.shape}')
|
|
214
|
+
print(f'BB3 index shape: {ms_reader.bb3_index.shape}')
|
|
215
|
+
print(f'Planet index shape: {ms_reader.planet_index.shape}')
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Geometry data keys: dict_keys(['mer_cal_sc_tis_20200409_1-0651130819-21186__0_1'])
|
|
219
|
+
Frames data keys: dict_keys(['mer_cal_sc_tis_20200409_1-0651130819-21186__0_1'])
|
|
220
|
+
Wavelengths data keys: dict_keys(['mer_cal_sc_tis_20200409_1-0651130819-21186__0_1'])
|
|
221
|
+
MERTIS TIS metadata keys: dict_keys(['mer_cal_sc_tis_20200409_1-0651130819-21186__0_1'])
|
|
222
|
+
Space index shape: (21,)
|
|
223
|
+
BB7 index shape: (0,)
|
|
224
|
+
BB3 index shape: (0,)
|
|
225
|
+
Planet index shape: (0,)
|
|
226
|
+
|
|
227
|
+
A data directory can contains more file for each type, those are
|
|
228
|
+
collected in a dict for each `ms_reader` variable , so it is handy to
|
|
229
|
+
define which file we want to work with after inspection, like the
|
|
230
|
+
following :
|
|
231
|
+
|
|
232
|
+
``` python
|
|
233
|
+
file_key = list(ms_reader.frames.keys())[0]
|
|
234
|
+
print(f'Example DataCube shape for file {file_key}: {ms_reader.frames[file_key].shape}')
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Example DataCube shape for file mer_cal_sc_tis_20200409_1-0651130819-21186__0_1: (40, 100, 21)
|
|
238
|
+
|
|
239
|
+
### Show some data & plots
|
|
240
|
+
|
|
241
|
+
now, let’s see some (meta)data:
|
|
242
|
+
|
|
243
|
+
``` python
|
|
244
|
+
ms_reader.mertis_tis_metadata[file_key].iloc[0:4].T
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
<div>
|
|
248
|
+
<style scoped>
|
|
249
|
+
.dataframe tbody tr th:only-of-type {
|
|
250
|
+
vertical-align: middle;
|
|
251
|
+
}
|
|
252
|
+
.dataframe tbody tr th {
|
|
253
|
+
vertical-align: top;
|
|
254
|
+
}
|
|
255
|
+
.dataframe thead th {
|
|
256
|
+
text-align: right;
|
|
257
|
+
}
|
|
258
|
+
</style>
|
|
259
|
+
|
|
260
|
+
| | 0 | 1 | 2 | 3 |
|
|
261
|
+
|----|----|----|----|----|
|
|
262
|
+
| TIME_UTC | 2020-04-09T05:40:20.710Z | 2020-04-09T05:40:31.748Z | 2020-04-09T05:40:32.548Z | 2020-04-09T05:40:33.348Z |
|
|
263
|
+
| TIME_OBT | 1/0651130819:21186 | 1/0651130830:23689 | 1/0651130831:10567 | 1/0651130831:62998 |
|
|
264
|
+
| TimeStamp | 651130823\.044403 | 651130830\.950928 | 651130831\.746674 | 651130832\.544235 |
|
|
265
|
+
| HK_STAT_TIS_DATA_ACQ_ID | 3740 | 3743 | 3744 | 3745 |
|
|
266
|
+
| HK_STAT_TIS_DATA_ACQ_TYPE | Sci_Raw | Sci_Subtracted_BB3 | Sci_Subtracted_BB3 | Sci_Subtracted_BB3 |
|
|
267
|
+
| HK_STAT_TIS_DATA_ACQ_TARGET | Space | Space | Space | Space |
|
|
268
|
+
| HK_STAT_BOL_BIAS_VOLT_ACTIVE_PARAM_SET | 2 | 2 | 2 | 2 |
|
|
269
|
+
| HK_STAT_TIS_DATA_ACQ_TIME | 651130819\.323273 | 651130830\.361465 | 651130831\.16124 | 651130831\.961273 |
|
|
270
|
+
| PAR_TIS_BIN_MODE | 1x2 | 1x2 | 1x2 | 1x2 |
|
|
271
|
+
| PAR_TIS_WIN_SIZE | 100x80pixel | 100x80pixel | 100x80pixel | 100x80pixel |
|
|
272
|
+
| PAR_TIS_COMP_MODE | lossless | lossless | lossless | lossless |
|
|
273
|
+
| HK_STAT_TIS_COMP_VERSION | 1 | 1 | 1 | 1 |
|
|
274
|
+
| HK_STAT_TIS_COMP_RICE_K_VALUE | 8 | 8 | 8 | 8 |
|
|
275
|
+
| HK_STAT_TIS_COMP_INPUT_LENGTH | 100 | 100 | 100 | 100 |
|
|
276
|
+
| HK_STAT_TIS_COMP_NUM_BANDS | 5 | 5 | 5 | 5 |
|
|
277
|
+
| HK_STAT_TIS_NUM_OVERSAMP | 0 | 32 | 32 | 32 |
|
|
278
|
+
| HK_TEMP_BOL_CHIP | 15.0 | 15.0 | 15.003 | 15.002 |
|
|
279
|
+
| DAT_TIS_OFFSET_MACRO_PIXEL | 1 | 2052 | 2052 | 2053 |
|
|
280
|
+
| HK_TEMP_BOL_HOUSING | 9.527 | 9.519 | 9.519 | 9.52 |
|
|
281
|
+
| HK_TEMP_OST_BASE_PLATE | 9.894 | 9.891 | 9.889 | 9.889 |
|
|
282
|
+
| PAR_TIS_DATA_NOISE_REDUCTION | 0 | 0 | 0 | 0 |
|
|
283
|
+
| HK_STAT_TIS_TOTAL_PACKET_NUM | 1 | 1 | 1 | 1 |
|
|
284
|
+
| HK_STAT_TIS_CURRENT_PACKET_NUM | 1 | 1 | 1 | 1 |
|
|
285
|
+
| HK_STAT_TIS_NUM_DATA_WORDS | 384 | 1206 | 1200 | 1208 |
|
|
286
|
+
|
|
287
|
+
</div>
|
|
288
|
+
|
|
289
|
+
``` python
|
|
290
|
+
from matplotlib import pyplot as plt
|
|
291
|
+
import matplotlib.dates as mdates
|
|
292
|
+
|
|
293
|
+
ax = ms_reader.mertis_tis_metadata[file_key]\
|
|
294
|
+
.set_index('TIME_UTC').loc[:,'HK_STAT_TIS_COMP_VERSION':]\
|
|
295
|
+
.plot(figsize=[10,15], legend=True, title='MERTIS TIS Metadata', grid=True, subplots=True);
|
|
296
|
+
|
|
297
|
+
ax[-1].xaxis.set_major_formatter(mdates.DateFormatter('%H:%M:%S'))
|
|
298
|
+
ax[-1].set_xlabel('TIME_UTC', fontsize=10)
|
|
299
|
+
plt.tight_layout()
|
|
300
|
+
|
|
301
|
+
plt.tight_layout()
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+

|
|
305
|
+
|
|
306
|
+
Now some data from TIS detector, each one a 2D array.
|
|
307
|
+
|
|
308
|
+
For those data, dufing cruise, the scientific data are collected ueing
|
|
309
|
+
the Space port and not Planet port.
|
|
310
|
+
|
|
311
|
+
TIS Datacube size is the union of several TIS 2D array measurement, each
|
|
312
|
+
one typically `(40, 100)` = (`n_spectral`,`n_spatial`), depending on
|
|
313
|
+
binning and windowing.
|
|
314
|
+
|
|
315
|
+
``` python
|
|
316
|
+
ms_reader.frames[file_key].shape
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
(40, 100, 21)
|
|
320
|
+
|
|
321
|
+
`(40, 100, 21)` = (`n_spectral`,`n_spatial`,`n_frames`)
|
|
322
|
+
|
|
323
|
+
- `n_spectral` : number of spectral channels, depends on pixel spectral
|
|
324
|
+
binning (1,2,4) result in `n_spatial` == (80,40,20)
|
|
325
|
+
- `n_spatial` : number of measurements spatial pixels, depends on pixel
|
|
326
|
+
spatial binning (1,2,4) result in `n_spatial` == (100,50,25)
|
|
327
|
+
- `n_frames` : number of TIS frames, or measurements, this correspond to
|
|
328
|
+
the time axis.
|
|
329
|
+
|
|
330
|
+
``` python
|
|
331
|
+
full_frames_3D = ms_reader.frames[file_key]
|
|
332
|
+
wav = ms_reader.wavelengths[file_key]
|
|
333
|
+
plot_index = ms_reader.space_index
|
|
334
|
+
print(f'plot_index: {plot_index}')
|
|
335
|
+
|
|
336
|
+
fig, ax = plt.subplots(ncols=2,nrows=2, figsize = [22,12])
|
|
337
|
+
|
|
338
|
+
fig.suptitle(f'MERTIS TIS DataCube - {file_key} \n'
|
|
339
|
+
f'average over the measurements {full_frames_3D.shape} -> {full_frames_3D[:,:,0].shape}',
|
|
340
|
+
fontsize=16)
|
|
341
|
+
title = 'Space'
|
|
342
|
+
ax[0][0].plot(wav,full_frames_3D[:,:,plot_index].mean(axis=2));
|
|
343
|
+
ax[0][0].set_title(f'{title} - frames average ')
|
|
344
|
+
ax[0][1].imshow(full_frames_3D[:,:,plot_index].mean(axis=2),aspect='auto',cmap=plt.cm.Spectral_r)
|
|
345
|
+
ax[0][1].set_title(f'{title} - frames average')
|
|
346
|
+
|
|
347
|
+
ax[1][0].set_title(f'{title} - frames std')
|
|
348
|
+
ax[1][0].plot(wav,full_frames_3D[:,:,plot_index].std(axis=2));
|
|
349
|
+
ax[1][1].set_title(f'{title} - frames std')
|
|
350
|
+
ax[1][1].imshow(full_frames_3D[:,:,plot_index].std(axis=2),aspect='auto',cmap=plt.cm.Spectral_r)
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
plot_index: RangeIndex(start=0, stop=21, step=1)
|
|
354
|
+
|
|
355
|
+

|
|
356
|
+
|
|
357
|
+
The higher level pixel near 40 are the “first light” MERTIS ever saw in
|
|
358
|
+
space, from the Moon.
|
|
359
|
+
|
|
360
|
+
Now some geometry data , not available in RAW data.
|
|
361
|
+
|
|
362
|
+
``` python
|
|
363
|
+
rich.print(ms_reader.geom_ls[file_key].keys())
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace"><span style="color: #800080; text-decoration-color: #800080; font-weight: bold">dict_keys</span><span style="font-weight: bold">([</span><span style="color: #008000; text-decoration-color: #008000">'MERTIS_TIS_GEOMETRY_TARGET_LONGITUDE'</span>, <span style="color: #008000; text-decoration-color: #008000">'MERTIS_TIS_GEOMETRY_TARGET_LATITUDE'</span>,
|
|
367
|
+
<span style="color: #008000; text-decoration-color: #008000">'MERTIS_TIS_GEOMETRY_SUBSPACECRAFT_LONGITUDE'</span>, <span style="color: #008000; text-decoration-color: #008000">'MERTIS_TIS_GEOMETRY_SUBSPACECRAFT_LATITUDE'</span>,
|
|
368
|
+
<span style="color: #008000; text-decoration-color: #008000">'MERTIS_TIS_GEOMETRY_SUB_SUN_LONGITUDE'</span>, <span style="color: #008000; text-decoration-color: #008000">'MERTIS_TIS_GEOMETRY_SUB_SUN_LATITUDE'</span>,
|
|
369
|
+
<span style="color: #008000; text-decoration-color: #008000">'MERTIS_TIS_GEOMETRY_TARGET_ALTITUDE'</span>, <span style="color: #008000; text-decoration-color: #008000">'MERTIS_TIS_GEOMETRY_SUBSPACECRAFT_ALTITUDE'</span>,
|
|
370
|
+
<span style="color: #008000; text-decoration-color: #008000">'MERTIS_TIS_GEOMETRY_SUB_SUN_ALTITUDE'</span>, <span style="color: #008000; text-decoration-color: #008000">'MERTIS_TIS_GEOMETRY_TARGET_DISTANCE'</span>,
|
|
371
|
+
<span style="color: #008000; text-decoration-color: #008000">'MERTIS_TIS_GEOMETRY_TARGET_ANGULAR_DIAMETER'</span>, <span style="color: #008000; text-decoration-color: #008000">'MERTIS_TIS_GEOMETRY_LOCAL_TIME'</span>,
|
|
372
|
+
<span style="color: #008000; text-decoration-color: #008000">'MERTIS_TIS_GEOMETRY_TARGET_PHASE_ANGLE'</span>, <span style="color: #008000; text-decoration-color: #008000">'MERTIS_TIS_GEOMETRY_TARGET_EMISSION_ANGLE'</span>,
|
|
373
|
+
<span style="color: #008000; text-decoration-color: #008000">'MERTIS_TIS_GEOMETRY_TARGET_INCIDENCE_ANGLE'</span><span style="font-weight: bold">])</span>
|
|
374
|
+
</pre>
|
|
375
|
+
|
|
376
|
+
``` python
|
|
377
|
+
ms_reader.geom_ls[file_key]['MERTIS_TIS_GEOMETRY_TARGET_LONGITUDE'].shape
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
(5, 100, 21)
|
|
381
|
+
|
|
382
|
+
The dimension for the geoemtry variables are `(5, 100, 21)` == (corners,
|
|
383
|
+
n_spatial, n_frames) :
|
|
384
|
+
|
|
385
|
+
- **Corners** of each pixel used for SPICE calculation, in order,
|
|
386
|
+
looking from instrument , X axis up = (center, upper left, upper
|
|
387
|
+
right, lower right, lower left)
|
|
388
|
+
|
|
389
|
+
<!-- -->
|
|
390
|
+
|
|
391
|
+
C2 C1
|
|
392
|
+
+-------+
|
|
393
|
+
| |
|
|
394
|
+
| C0 |
|
|
395
|
+
| |
|
|
396
|
+
+-------+
|
|
397
|
+
C3 C4
|
|
398
|
+
|
|
399
|
+
- `n_spatial` : number of measurements spatial pixels, depends on pixel
|
|
400
|
+
spatial binning (1,2,4) result in `n_spatial` == (100,50,25)
|
|
401
|
+
- `n_frames` : number of TIS frames, or measurements, this correspond to
|
|
402
|
+
the time axis in the TIS datacube.
|
|
403
|
+
|
|
404
|
+
``` python
|
|
405
|
+
plt.figure(figsize=(16, 6))
|
|
406
|
+
longitudes = ms_reader.geom_ls[file_key]['MERTIS_TIS_GEOMETRY_TARGET_LONGITUDE']
|
|
407
|
+
longitudes_center = longitudes[0,:,:]
|
|
408
|
+
latitudes = ms_reader.geom_ls[file_key]['MERTIS_TIS_GEOMETRY_TARGET_LATITUDE']
|
|
409
|
+
latitudes_center = latitudes[0,:,:]
|
|
410
|
+
|
|
411
|
+
local_times = ms_reader.geom_ls[file_key]['MERTIS_TIS_GEOMETRY_LOCAL_TIME']
|
|
412
|
+
local_times_center = local_times[0,:,:]
|
|
413
|
+
|
|
414
|
+
sc = plt.scatter(longitudes_center.flatten(), latitudes_center.flatten(), c=local_times_center.flatten(), s=10, cmap='Spectral_r')
|
|
415
|
+
plt.xlabel('Longitude')
|
|
416
|
+
cbar = plt.colorbar(sc)
|
|
417
|
+
cbar.set_label('Local Time')
|
|
418
|
+
plt.ylabel('Latitudes')
|
|
419
|
+
plt.title('Scatter plot of Target Longitude vs Latitude centers')
|
|
420
|
+
plt.grid(True)
|
|
421
|
+
plt.show()
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+

|
|
425
|
+
|
|
426
|
+
Let’s find some TIS sptail pixels with defined geometries on all corners
|
|
427
|
+
|
|
428
|
+
``` python
|
|
429
|
+
import numpy as np
|
|
430
|
+
|
|
431
|
+
arr = latitudes # shape (5, 100, 21)
|
|
432
|
+
not_nan_mask = ~np.isnan(arr)
|
|
433
|
+
all_not_nan = np.all(not_nan_mask, axis=0) # shape (100, 21)
|
|
434
|
+
indices = np.argwhere(all_not_nan) # returns (i, j) pairs where all axis=0 are not nan
|
|
435
|
+
|
|
436
|
+
print(len(indices))
|
|
437
|
+
print(indices[:5])
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
105
|
|
441
|
+
[[38 0]
|
|
442
|
+
[38 1]
|
|
443
|
+
[38 2]
|
|
444
|
+
[38 3]
|
|
445
|
+
[38 4]]
|
|
446
|
+
|
|
447
|
+
``` python
|
|
448
|
+
plt.figure(figsize=(8, 6))
|
|
449
|
+
|
|
450
|
+
pixel_index = indices[0] # Take the first valid pixel for demonstration
|
|
451
|
+
|
|
452
|
+
# Plot the corners of the polygon
|
|
453
|
+
plt.scatter(longitudes[1:,pixel_index[0],pixel_index[1] ], latitudes[1:,pixel_index[0],pixel_index[1] ], s=100, c='black')
|
|
454
|
+
|
|
455
|
+
# Extract the longitude and latitude for the corners (1:5), close the polygon by repeating the first corner
|
|
456
|
+
poly_lons = longitudes[1:, pixel_index[0], pixel_index[1]]
|
|
457
|
+
poly_lats = latitudes[1:, pixel_index[0], pixel_index[1]]
|
|
458
|
+
# Close the polygon
|
|
459
|
+
poly_lons = np.append(poly_lons, poly_lons[0])
|
|
460
|
+
poly_lats = np.append(poly_lats, poly_lats[0])
|
|
461
|
+
|
|
462
|
+
for i in range(1, 5):
|
|
463
|
+
plt.text(
|
|
464
|
+
poly_lons[i-1],
|
|
465
|
+
poly_lats[i-1]+0.5, # Offset the text slightly above the point
|
|
466
|
+
f'Corner_{i}',
|
|
467
|
+
fontsize=10,
|
|
468
|
+
color='black',
|
|
469
|
+
ha='left',
|
|
470
|
+
va='bottom'
|
|
471
|
+
)
|
|
472
|
+
|
|
473
|
+
# Plot the connecting lines
|
|
474
|
+
plt.plot(poly_lons, poly_lats, linestyle='-', color='black')
|
|
475
|
+
|
|
476
|
+
plt.scatter(longitudes[0,pixel_index[0],pixel_index[1] ], latitudes[0,pixel_index[0],pixel_index[1] ], s=100)
|
|
477
|
+
plt.text(
|
|
478
|
+
longitudes[0, pixel_index[0], pixel_index[1]],
|
|
479
|
+
latitudes[0, pixel_index[0], pixel_index[1]]+0.5, # Offset the text slightly above the point
|
|
480
|
+
'Center',
|
|
481
|
+
fontsize=12,
|
|
482
|
+
color='blue',
|
|
483
|
+
ha='left',
|
|
484
|
+
va='bottom'
|
|
485
|
+
)
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
Text(31.43904149826383, -33.20697106068339, 'Center')
|
|
489
|
+
|
|
490
|
+

|