Skip to main content

helper routines to read ESA/Bepicolombo space mission - DLR MERTIS instrument data

Project description

Quick Install

To install the mertisreader package, you can clone the repository from GitLab and install it using pip:

The code is under active development, this enable to pull the last code with git pull and have this directly enabled in your environment.

I advise to use a pytohn virtual environment /conda environment.

git clone https://gitlab.dlr.de/psl/mertisreader.git
cd mertisreader
python -m pip install -e .

mertisreader - Quick cheatsheet

Import Required Libraries

import pathlib
import rich
import mertisreader as mr

print("Libraries imported successfully.")
Libraries imported successfully.

Initialize MERTISDataPackReader

input_path = pathlib.Path('../data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/cal')
output_path = pathlib.Path('/tmp/')
log_level = 'INFO'

if not input_path.exists():
    print(f"Input path {input_path} does not exist.")
else:
    print(f"Reading path {input_path}")

ms_reader = mr.MERTISDataPackReader(input_dir=input_path, output_dir=output_path, log_level=log_level)

print(f'MERTISDataPackReader initialized with input directory: {ms_reader.input_dir}')
print(f'Output directory: {ms_reader.output_dir}')
print(f'Log level: {ms_reader.log_level}')
2024-11-25 16:00:21,499|1472475|INFO|input_dir=PosixPath('../data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/cal')

Reading path ../data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/cal
MERTISDataPackReader initialized with input directory: ../data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/cal
Output directory: /tmp
Log level: INFO

Show Files in Input Directory

ms_reader.show_files()
All files in input_dir :
All files in input_dir matching \d{8}:
Counter({'.tdat': 1, '.dat': 2, '.fits': 1, '.xml': 3})
Counter({'mer_cal_sc_tis': 3, 'mer_cal_hk_extended': 2, 'mer_cal_hk_default': 2})

List File Types

ms_reader.listfiletypes()
{
    'hk_default': ['mer_cal_hk_default_20200409_20200409.dat'],
    'hk_extended': ['mer_cal_hk_extended_20200409_20200409.dat'],
    'sc_tis': ['mer_cal_sc_tis_20200409_20200409_1.fits'],
    'sc_tir': [],
    'sc_tis_ql': [],
    'sc_tir_ql': []
}
{'hk_default': 1, 'hk_extended': 1, 'sc_tis': 1, 'sc_tir': 0, 'sc_tis_ql': 0, 'sc_tir_ql': 0}

Collect Data

ms_reader.data_collector()

print(f'Collected data keys: {ms_reader.collect_data.keys()}')
for key, value in ms_reader.collect_data.items():
    print(f'{key}: {len(value)} files collected')
Reading filetype: hk_default from mer_cal_hk_default_20200409_20200409
Reading filetype: hk_extended from mer_cal_hk_extended_20200409_20200409
Reading filetype: tis from mer_cal_sc_tis_20200409_20200409_1
Collected data keys: dict_keys(['hk_default', 'hk_extended', 'tis'])
hk_default: 1 files collected
hk_extended: 1 files collected
tis: 1 files collected

Assemble Data

ms_reader.data_assembler(verbose=True)
Output()
Reading filetype: tis from 
../data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/cal/me
r_cal_sc_tis_20200409_20200409_1.fits


n_wav=40 # generic wavelengths : not precise enough for scientific analysis!
|    | tis_stem                           |   finite(geo) |   geo.size |
|---:|:-----------------------------------|--------------:|-----------:|
|  0 | mer_cal_sc_tis_20200409_20200409_1 |           672 |      11000 |
Indices of measurements targets (HK_STAT_TIS_DATA_ACQ_TARGET):
space_index.shape=(21,)
bb7_index.shape=(0,)
bb3_index.shape=(1,)
planet_index.shape=(0,)
Collected data statistics:
Number of TIS files: 1
Number of HK files: 2
Number of TIR files: 0
Number of TIS QL files: 0
Number of TIR QL files: 0

Verify the Assembled Data

print(f'Geometry data keys: {ms_reader.geom_ls.keys()}')
print(f'Frames data keys: {ms_reader.frames.keys()}')
print(f'Wavelengths data keys: {ms_reader.wavelengths.keys()}')
print(f'MERTIS TIS metadata keys: {ms_reader.mertis_tis_metadata.keys()}')
print(f'Space index shape: {ms_reader.space_index.shape}')
print(f'BB7 index shape: {ms_reader.bb7_index.shape}')
print(f'BB3 index shape: {ms_reader.bb3_index.shape}')
print(f'Planet index shape: {ms_reader.planet_index.shape}')
Geometry data keys: dict_keys(['mer_cal_sc_tis_20200409_20200409_1'])
Frames data keys: dict_keys(['mer_cal_sc_tis_20200409_20200409_1'])
Wavelengths data keys: dict_keys(['mer_cal_sc_tis_20200409_20200409_1'])
MERTIS TIS metadata keys: dict_keys(['mer_cal_sc_tis_20200409_20200409_1'])
Space index shape: (21,)
BB7 index shape: (0,)
BB3 index shape: (1,)
Planet index shape: (0,)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mertisreader-0.0.2.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mertisreader-0.0.2-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file mertisreader-0.0.2.tar.gz.

File metadata

  • Download URL: mertisreader-0.0.2.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for mertisreader-0.0.2.tar.gz
Algorithm Hash digest
SHA256 66fbdfa5656ef00428c807fed30e1afcc35ec3cc3b32cff937f885adf94777fa
MD5 b0c789b4d5273ecbbf5b106c15dad784
BLAKE2b-256 4c53be22a8d32c02ca4c25a155158c128c8c606a6fe5d86f78a8750e5f232020

See more details on using hashes here.

File details

Details for the file mertisreader-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: mertisreader-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for mertisreader-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 59fbd6551bf1aed1f47719c1e3d5644a59497f178150cfd708e29eb95515e637
MD5 c3ec90cecc3a6fa6afcfcae80f0ad122
BLAKE2b-256 098a4caafb67b88618a411bab535c3652860d25bba66bd523047e36302981b52

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page