<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
## 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.
``` bash
git clone https://gitlab.dlr.de/psl/mertisreader.git
cd mertisreader
python -m pip install -e .
```
## mertisreader - Quick cheatsheet
Import Required Libraries
``` python
import pathlib
import rich
import mertisreader as mr
print("Libraries imported successfully.")
```
Libraries imported successfully.
Initialize MERTISDataPackReader
``` python
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
``` python
ms_reader.show_files()
```
All files in input_dir :
All files in input_dir matching \d{8}:
<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">'.tdat'</span>: <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">1</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">'.fits'</span>: <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">1</span>, <span style="color: #008000; text-decoration-color: #008000">'.xml'</span>: <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">3</span><span style="font-weight: bold">})</span>
</pre>
<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">3</span>, <span style="color: #008000; text-decoration-color: #008000">'mer_cal_hk_extended'</span>: <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2</span>, <span style="color: #008000; text-decoration-color: #008000">'mer_cal_hk_default'</span>: <span style="color: #008080; text-decoration-color: #008080; font-weight: bold">2</span><span style="font-weight: bold">})</span>
</pre>
List File Types
``` python
ms_reader.listfiletypes()
```
<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="font-weight: bold">[</span><span style="color: #008000; text-decoration-color: #008000">'mer_cal_hk_default_20200409_20200409.dat'</span><span style="font-weight: bold">]</span>,
<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_20200409.dat'</span><span style="font-weight: bold">]</span>,
<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_20200409_1.fits'</span><span style="font-weight: bold">]</span>,
<span style="color: #008000; text-decoration-color: #008000">'sc_tir'</span>: <span style="font-weight: bold">[]</span>,
<span style="color: #008000; text-decoration-color: #008000">'sc_tis_ql'</span>: <span style="font-weight: bold">[]</span>,
<span style="color: #008000; text-decoration-color: #008000">'sc_tir_ql'</span>: <span style="font-weight: bold">[]</span>
<span style="font-weight: bold">}</span>
</pre>
<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>
</pre>
Collect Data
``` python
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
``` python
ms_reader.data_assembler(verbose=True)
```
Output()
<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
../data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/cal/me
r_cal_sc_tis_20200409_20200409_1.fits
</pre>
<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace"></pre>
<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">
</pre>
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
``` python
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,)
Raw data
{
"_id": null,
"home_page": "https://gitlab.com/damo_ma/mertisreader/tree/master/",
"name": "mertisreader",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "planetary, instrument, data",
"author": "Mario D Amore",
"author_email": "mario.damore@dlr.de",
"download_url": "https://files.pythonhosted.org/packages/56/74/7c148f3006164424ae2548471287a0cb65b3272738efdc401662294dcd67/mertisreader-0.0.1.tar.gz",
"platform": null,
"description": "\n\n<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->\n\n## Quick Install\n\nTo install the `mertisreader` package, you can clone the repository from\nGitLab and install it using pip:\n\nThe code is under active development, this enable to pull the last code\nwith `git pull` and have this directly enabled in your environment.\n\nI advise to use a pytohn virtual environment /conda environment.\n\n``` bash\ngit clone https://gitlab.dlr.de/psl/mertisreader.git\ncd mertisreader\npython -m pip install -e .\n```\n\n## mertisreader - Quick cheatsheet\n\nImport Required Libraries\n\n``` python\nimport pathlib\nimport rich\nimport mertisreader as mr\n\nprint(\"Libraries imported successfully.\")\n```\n\n Libraries imported successfully.\n\nInitialize MERTISDataPackReader\n\n``` python\ninput_path = pathlib.Path('../data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/cal')\noutput_path = pathlib.Path('/tmp/')\nlog_level = 'INFO'\n\nif not input_path.exists():\n print(f\"Input path {input_path} does not exist.\")\nelse:\n print(f\"Reading path {input_path}\")\n\nms_reader = mr.MERTISDataPackReader(input_dir=input_path, output_dir=output_path, log_level=log_level)\n\nprint(f'MERTISDataPackReader initialized with input directory: {ms_reader.input_dir}')\nprint(f'Output directory: {ms_reader.output_dir}')\nprint(f'Log level: {ms_reader.log_level}')\n```\n\n 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')\n\n Reading path ../data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/cal\n MERTISDataPackReader initialized with input directory: ../data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/cal\n Output directory: /tmp\n Log level: INFO\n\nShow Files in Input Directory\n\n``` python\nms_reader.show_files()\n```\n\n All files in input_dir :\n All files in input_dir matching \\d{8}:\n\n<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\">'.tdat'</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</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\">'.fits'</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'.xml'</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3</span><span style=\"font-weight: bold\">})</span>\n</pre>\n<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\">3</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'mer_cal_hk_extended'</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'mer_cal_hk_default'</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2</span><span style=\"font-weight: bold\">})</span>\n</pre>\n\nList File Types\n\n``` python\nms_reader.listfiletypes()\n```\n\n<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>\n <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_20200409.dat'</span><span style=\"font-weight: bold\">]</span>,\n <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_20200409.dat'</span><span style=\"font-weight: bold\">]</span>,\n <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_20200409_1.fits'</span><span style=\"font-weight: bold\">]</span>,\n <span style=\"color: #008000; text-decoration-color: #008000\">'sc_tir'</span>: <span style=\"font-weight: bold\">[]</span>,\n <span style=\"color: #008000; text-decoration-color: #008000\">'sc_tis_ql'</span>: <span style=\"font-weight: bold\">[]</span>,\n <span style=\"color: #008000; text-decoration-color: #008000\">'sc_tir_ql'</span>: <span style=\"font-weight: bold\">[]</span>\n<span style=\"font-weight: bold\">}</span>\n</pre>\n<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>\n</pre>\n\nCollect Data\n\n``` python\nms_reader.data_collector()\n\nprint(f'Collected data keys: {ms_reader.collect_data.keys()}')\nfor key, value in ms_reader.collect_data.items():\n print(f'{key}: {len(value)} files collected')\n```\n\n Reading filetype: hk_default from mer_cal_hk_default_20200409_20200409\n Reading filetype: hk_extended from mer_cal_hk_extended_20200409_20200409\n Reading filetype: tis from mer_cal_sc_tis_20200409_20200409_1\n Collected data keys: dict_keys(['hk_default', 'hk_extended', 'tis'])\n hk_default: 1 files collected\n hk_extended: 1 files collected\n tis: 1 files collected\n\nAssemble Data\n\n``` python\nms_reader.data_assembler(verbose=True)\n```\n\n Output()\n\n<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 \n../data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/cal/me\nr_cal_sc_tis_20200409_20200409_1.fits\n</pre>\n<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">\n</pre>\n\n n_wav=40 # generic wavelengths : not precise enough for scientific analysis!\n | | tis_stem | finite(geo) | geo.size |\n |---:|:-----------------------------------|--------------:|-----------:|\n | 0 | mer_cal_sc_tis_20200409_20200409_1 | 672 | 11000 |\n Indices of measurements targets (HK_STAT_TIS_DATA_ACQ_TARGET):\n space_index.shape=(21,)\n bb7_index.shape=(0,)\n bb3_index.shape=(1,)\n planet_index.shape=(0,)\n Collected data statistics:\n Number of TIS files: 1\n Number of HK files: 2\n Number of TIR files: 0\n Number of TIS QL files: 0\n Number of TIR QL files: 0\n\nVerify the Assembled Data\n\n``` python\nprint(f'Geometry data keys: {ms_reader.geom_ls.keys()}')\nprint(f'Frames data keys: {ms_reader.frames.keys()}')\nprint(f'Wavelengths data keys: {ms_reader.wavelengths.keys()}')\nprint(f'MERTIS TIS metadata keys: {ms_reader.mertis_tis_metadata.keys()}')\nprint(f'Space index shape: {ms_reader.space_index.shape}')\nprint(f'BB7 index shape: {ms_reader.bb7_index.shape}')\nprint(f'BB3 index shape: {ms_reader.bb3_index.shape}')\nprint(f'Planet index shape: {ms_reader.planet_index.shape}')\n```\n\n Geometry data keys: dict_keys(['mer_cal_sc_tis_20200409_20200409_1'])\n Frames data keys: dict_keys(['mer_cal_sc_tis_20200409_20200409_1'])\n Wavelengths data keys: dict_keys(['mer_cal_sc_tis_20200409_20200409_1'])\n MERTIS TIS metadata keys: dict_keys(['mer_cal_sc_tis_20200409_20200409_1'])\n Space index shape: (21,)\n BB7 index shape: (0,)\n BB3 index shape: (1,)\n Planet index shape: (0,)\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "helper routines to read ESA/Bepicolombo space mission - DLR MERTIS instrument data",
"version": "0.0.1",
"project_urls": {
"Homepage": "https://gitlab.com/damo_ma/mertisreader/tree/master/"
},
"split_keywords": [
"planetary",
" instrument",
" data"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f293d5c802eaf9778de6ecab48bc4fae2098bd2d69edfb950d7a351c90ea2c75",
"md5": "161da020b4c3d488184088b31a7c418a",
"sha256": "f3672cf0786253781d1bd6f8c6be53d0e00e13f327aa5c60ac470c5986c243a6"
},
"downloads": -1,
"filename": "mertisreader-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "161da020b4c3d488184088b31a7c418a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 10654,
"upload_time": "2024-11-28T11:20:36",
"upload_time_iso_8601": "2024-11-28T11:20:36.262610Z",
"url": "https://files.pythonhosted.org/packages/f2/93/d5c802eaf9778de6ecab48bc4fae2098bd2d69edfb950d7a351c90ea2c75/mertisreader-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "56747c148f3006164424ae2548471287a0cb65b3272738efdc401662294dcd67",
"md5": "0cf2e148f43eb67f11ed690b59fe4537",
"sha256": "3df298fcb484f08e0d6da56bab233b4ae34ebeace66890626017d3f24a3139ed"
},
"downloads": -1,
"filename": "mertisreader-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "0cf2e148f43eb67f11ed690b59fe4537",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 13981,
"upload_time": "2024-11-28T11:20:37",
"upload_time_iso_8601": "2024-11-28T11:20:37.616345Z",
"url": "https://files.pythonhosted.org/packages/56/74/7c148f3006164424ae2548471287a0cb65b3272738efdc401662294dcd67/mertisreader-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-28 11:20:37",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "damo_ma",
"gitlab_project": "mertisreader",
"lcname": "mertisreader"
}