mertisreader 0.0.2__tar.gz → 0.0.4__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.
Files changed (182) hide show
  1. mertisreader-0.0.4/.ai/00_CONSTRAINTS.md +39 -0
  2. mertisreader-0.0.4/.ai/00_PHILOSOPHY.md +42 -0
  3. mertisreader-0.0.4/.ai/02_ROADMAP.md +32 -0
  4. mertisreader-0.0.4/.ai/03_CURRENT_STATUS.md +54 -0
  5. mertisreader-0.0.4/.ai/README.md +37 -0
  6. mertisreader-0.0.4/.ai/decisions/ADR-001-nbdev-notebooks-as-source.md +41 -0
  7. mertisreader-0.0.4/.ai/decisions/ADR-002-class-centric-api.md +40 -0
  8. mertisreader-0.0.4/.ai/decisions/ADR-003-processing-level-detection.md +37 -0
  9. mertisreader-0.0.4/.ai/decisions/ADR-004-lazy-evaluation-caching.md +39 -0
  10. mertisreader-0.0.4/.ai/decisions/ADR-005-explicit-interpolation-modes.md +40 -0
  11. mertisreader-0.0.4/.ai/decisions/ADR-007-raw-vs-cal-par-axis-ordering.md +130 -0
  12. mertisreader-0.0.4/.ai/decisions/ADR-008-pds4tools-integration.md +170 -0
  13. mertisreader-0.0.4/.ai/decisions/ADR-009-quarto-and-plain-python-migration.md +97 -0
  14. mertisreader-0.0.4/.ai/decisions/ARD-006-lazy-loading.md +65 -0
  15. mertisreader-0.0.4/.ai/decisions/index.md +12 -0
  16. mertisreader-0.0.4/.github/copilot-instructions.md +1 -0
  17. mertisreader-0.0.4/.github/workflows/jekyll-gh-pages.yml +49 -0
  18. mertisreader-0.0.4/.gitignore +147 -0
  19. mertisreader-0.0.4/.gitlab-ci.yml +10 -0
  20. mertisreader-0.0.4/.pre-commit-config.yaml +8 -0
  21. mertisreader-0.0.4/CHANGELOG.md +27 -0
  22. mertisreader-0.0.4/CITATION.cff +17 -0
  23. mertisreader-0.0.4/CLAUDE.md +408 -0
  24. mertisreader-0.0.4/Makefile +89 -0
  25. mertisreader-0.0.4/PKG-INFO +76 -0
  26. mertisreader-0.0.4/README.md +45 -0
  27. mertisreader-0.0.4/README.qmd +39 -0
  28. mertisreader-0.0.4/_quarto.yml +54 -0
  29. mertisreader-0.0.4/api.qmd +15 -0
  30. mertisreader-0.0.4/conda/mertisreader/meta.yaml +277 -0
  31. mertisreader-0.0.4/data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/cal/mer_cal_hk_default_20200409_1-0651130766-12538__0_1.dat +7 -0
  32. mertisreader-0.0.4/data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/cal/mer_cal_hk_default_20200409_1-0651130766-12538__0_1.lblx +483 -0
  33. mertisreader-0.0.4/data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/cal/mer_cal_hk_extended_20200409_1-0651130766-12595__0_1.dat +7 -0
  34. mertisreader-0.0.4/data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/cal/mer_cal_hk_extended_20200409_1-0651130766-12595__0_1.lblx +547 -0
  35. mertisreader-0.0.4/data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/cal/mer_cal_sc_tis_20200409_1-0651130819-21186__0_1.fits +2187 -4
  36. mertisreader-0.0.4/data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/cal/mer_cal_sc_tis_20200409_1-0651130819-21186__0_1.lblx +1016 -0
  37. mertisreader-0.0.4/data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/par/mer_par_hk_default_20200409_1-0651130766-12538__0_1.dat +7 -0
  38. mertisreader-0.0.4/data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/par/mer_par_hk_default_20200409_1-0651130766-12538__0_1.lblx +483 -0
  39. mertisreader-0.0.4/data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/par/mer_par_hk_extended_20200409_1-0651130766-12595__0_1.dat +7 -0
  40. mertisreader-0.0.4/data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/par/mer_par_hk_extended_20200409_1-0651130766-12595__0_1.lblx +547 -0
  41. mertisreader-0.0.4/data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/par/mer_par_sc_tir_20200409_1-0651130751-42768__0_1.fits +49 -0
  42. mertisreader-0.0.4/data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/par/mer_par_sc_tir_20200409_1-0651130751-42768__0_1.lblx +1515 -0
  43. mertisreader-0.0.4/data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/par/mer_par_sc_tis_20200409_1-0651130819-21186__0_1.fits +2304 -4
  44. mertisreader-0.0.4/data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/par/mer_par_sc_tis_20200409_1-0651130819-21186__0_1.lblx +1016 -0
  45. mertisreader-0.0.4/data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/raw/mer_raw_hk_default_20200409_1-0651130766-12538__0_1.dat +7 -0
  46. mertisreader-0.0.4/data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/raw/mer_raw_hk_default_20200409_1-0651130766-12538__0_1.lblx +485 -0
  47. mertisreader-0.0.4/data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/raw/mer_raw_hk_extended_20200409_1-0651130766-12595__0_1.dat +7 -0
  48. mertisreader-0.0.4/data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/raw/mer_raw_hk_extended_20200409_1-0651130766-12595__0_1.lblx +549 -0
  49. mertisreader-0.0.4/data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/raw/mer_raw_sc_tir_20200409_1-0651130751-42768__0_1.fits +49 -0
  50. mertisreader-0.0.4/data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/raw/mer_raw_sc_tir_20200409_1-0651130751-42768__0_1.lblx +487 -0
  51. mertisreader-0.0.4/data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/raw/mer_raw_sc_tis_20200409_1-0651130819-21186__0_1.fits +332 -0
  52. mertisreader-0.0.4/data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/raw/mer_raw_sc_tis_20200409_1-0651130819-21186__0_1.lblx +476 -0
  53. mertisreader-0.0.4/docs/README.html +829 -0
  54. mertisreader-0.0.4/docs/api.html +798 -0
  55. mertisreader-0.0.4/docs/docs_src/index.qmd +19 -0
  56. mertisreader-0.0.4/docs/docs_src/styles.css +8 -0
  57. mertisreader-0.0.4/docs/docs_src/tutorials/core-reader.html +971 -0
  58. mertisreader-0.0.4/docs/docs_src/tutorials/frame-utils.html +857 -0
  59. mertisreader-0.0.4/docs/docs_src/tutorials/getting-started.html +989 -0
  60. mertisreader-0.0.4/docs/docs_src/tutorials/index.html +769 -0
  61. mertisreader-0.0.4/docs/docs_src/tutorials/lazy-loading.html +860 -0
  62. mertisreader-0.0.4/docs/docs_src/tutorials/pds4-validation.html +878 -0
  63. mertisreader-0.0.4/docs/docs_src/tutorials/read-example.html +1135 -0
  64. mertisreader-0.0.4/docs/docs_src/tutorials/read-example_files/figure-html/cell-6-output-1.png +0 -0
  65. mertisreader-0.0.4/docs/examples/read_merstis_test.ipynb +2055 -0
  66. mertisreader-0.0.4/docs/index.html +759 -0
  67. mertisreader-0.0.4/docs/reference/LazyArray.html +967 -0
  68. mertisreader-0.0.4/docs/reference/LazyCSVLoader.html +881 -0
  69. mertisreader-0.0.4/docs/reference/MERTISDataPackReader.html +936 -0
  70. mertisreader-0.0.4/docs/reference/extract_label_metadata.html +785 -0
  71. mertisreader-0.0.4/docs/reference/extract_mertis_hk_columns.html +784 -0
  72. mertisreader-0.0.4/docs/reference/get_csv_field_metadata.html +785 -0
  73. mertisreader-0.0.4/docs/reference/index.html +774 -0
  74. mertisreader-0.0.4/docs/reference/validate_pds4_label.html +785 -0
  75. mertisreader-0.0.4/docs/search.json +681 -0
  76. mertisreader-0.0.4/docs/site_libs/bootstrap/bootstrap-5959290f89a7450b0d82115c57ffdc70.min.css +12 -0
  77. mertisreader-0.0.4/docs/site_libs/bootstrap/bootstrap-6ad1da411858ed4c4fbfedd8158e9532.min.css +12 -0
  78. mertisreader-0.0.4/docs/site_libs/bootstrap/bootstrap-8e3f72eadb3a95546354bdc35739f9ee.min.css +12 -0
  79. mertisreader-0.0.4/docs/site_libs/bootstrap/bootstrap-dark-0041f584c5b46cc2d4bcb298d094982e.min.css +12 -0
  80. mertisreader-0.0.4/docs/site_libs/bootstrap/bootstrap-dark-3cc637dbb643f23365101b4224d6e832.min.css +12 -0
  81. mertisreader-0.0.4/docs/site_libs/bootstrap/bootstrap-dark-4dfdaaa48c4df8ccba1e72feac0bd608.min.css +12 -0
  82. mertisreader-0.0.4/docs/site_libs/bootstrap/bootstrap-dark-5734112bdb1afff7acb8f74f3ace6965.min.css +12 -0
  83. mertisreader-0.0.4/docs/site_libs/bootstrap/bootstrap-icons.css +2106 -0
  84. mertisreader-0.0.4/docs/site_libs/bootstrap/bootstrap-icons.woff +0 -0
  85. mertisreader-0.0.4/docs/site_libs/bootstrap/bootstrap.min.js +7 -0
  86. mertisreader-0.0.4/docs/site_libs/clipboard/clipboard.min.js +7 -0
  87. mertisreader-0.0.4/docs/site_libs/quarto-html/anchor.min.js +9 -0
  88. mertisreader-0.0.4/docs/site_libs/quarto-html/axe/axe-check.js +145 -0
  89. mertisreader-0.0.4/docs/site_libs/quarto-html/popper.min.js +6 -0
  90. mertisreader-0.0.4/docs/site_libs/quarto-html/quarto-syntax-highlighting-dark-4d9afe2b8d18ee9fa5d0d57b5ed4214d.css +219 -0
  91. mertisreader-0.0.4/docs/site_libs/quarto-html/quarto-syntax-highlighting-ed96de9b727972fe78a7b5d16c58bf87.css +236 -0
  92. mertisreader-0.0.4/docs/site_libs/quarto-html/quarto.js +847 -0
  93. mertisreader-0.0.4/docs/site_libs/quarto-html/tabsets/tabsets.js +95 -0
  94. mertisreader-0.0.4/docs/site_libs/quarto-html/tippy.css +1 -0
  95. mertisreader-0.0.4/docs/site_libs/quarto-html/tippy.umd.min.js +2 -0
  96. mertisreader-0.0.4/docs/site_libs/quarto-nav/headroom.min.js +7 -0
  97. mertisreader-0.0.4/docs/site_libs/quarto-nav/quarto-nav.js +325 -0
  98. mertisreader-0.0.4/docs/site_libs/quarto-search/autocomplete.umd.js +3 -0
  99. mertisreader-0.0.4/docs/site_libs/quarto-search/fuse.min.js +9 -0
  100. mertisreader-0.0.4/docs/site_libs/quarto-search/quarto-search.js +1290 -0
  101. mertisreader-0.0.4/docs/tutorials/core-reader.html +971 -0
  102. mertisreader-0.0.4/docs/tutorials/frame-utils.html +857 -0
  103. mertisreader-0.0.4/docs/tutorials/getting-started.html +983 -0
  104. mertisreader-0.0.4/docs/tutorials/index.html +763 -0
  105. mertisreader-0.0.4/docs/tutorials/lazy-loading.html +860 -0
  106. mertisreader-0.0.4/docs/tutorials/pds4-validation.html +878 -0
  107. mertisreader-0.0.4/docs/tutorials/read-example.html +1129 -0
  108. mertisreader-0.0.4/docs/tutorials/read-example_files/figure-html/cell-6-output-1.png +0 -0
  109. mertisreader-0.0.4/docs_src/api.qmd +15 -0
  110. mertisreader-0.0.4/docs_src/index.qmd +19 -0
  111. mertisreader-0.0.4/docs_src/tutorials/core-reader.qmd +71 -0
  112. mertisreader-0.0.4/docs_src/tutorials/frame-utils.qmd +52 -0
  113. mertisreader-0.0.4/docs_src/tutorials/getting-started.qmd +91 -0
  114. mertisreader-0.0.4/docs_src/tutorials/index.qmd +16 -0
  115. mertisreader-0.0.4/docs_src/tutorials/lazy-loading.qmd +47 -0
  116. mertisreader-0.0.4/docs_src/tutorials/pds4-validation.qmd +58 -0
  117. mertisreader-0.0.4/docs_src/tutorials/read-example.qmd +93 -0
  118. mertisreader-0.0.4/examples/read_mertis_test.ipynb +332 -0
  119. mertisreader-0.0.4/examples/read_mertis_test.py +238 -0
  120. mertisreader-0.0.4/index.qmd +11 -0
  121. mertisreader-0.0.4/index_files/figure-commonmark/cell-12-output-1.png +0 -0
  122. mertisreader-0.0.4/index_files/figure-commonmark/cell-14-output-2.png +0 -0
  123. mertisreader-0.0.4/index_files/figure-commonmark/cell-15-output-1.png +0 -0
  124. mertisreader-0.0.4/index_files/figure-commonmark/cell-15-output-2.png +0 -0
  125. mertisreader-0.0.4/index_files/figure-commonmark/cell-17-output-1.png +0 -0
  126. mertisreader-0.0.4/index_files/figure-commonmark/cell-18-output-1.png +0 -0
  127. mertisreader-0.0.4/index_files/figure-commonmark/cell-19-output-2.png +0 -0
  128. mertisreader-0.0.4/index_files/figure-commonmark/cell-20-output-2.png +0 -0
  129. mertisreader-0.0.4/mertisreader/__init__.py +11 -0
  130. mertisreader-0.0.4/mertisreader/core.py +706 -0
  131. mertisreader-0.0.4/mertisreader/frame_utils.py +571 -0
  132. mertisreader-0.0.4/mertisreader/lazy_loading.py +290 -0
  133. mertisreader-0.0.4/mertisreader/pds4_validation.py +293 -0
  134. mertisreader-0.0.4/nbdev.yml +9 -0
  135. mertisreader-0.0.4/objects.json +1 -0
  136. mertisreader-0.0.4/pyproject.toml +41 -0
  137. mertisreader-0.0.4/reference/LazyArray.qmd +147 -0
  138. mertisreader-0.0.4/reference/LazyCSVLoader.qmd +78 -0
  139. mertisreader-0.0.4/reference/MERTISDataPackReader.qmd +283 -0
  140. mertisreader-0.0.4/reference/_sidebar.yml +15 -0
  141. mertisreader-0.0.4/reference/_styles-quartodoc.css +22 -0
  142. mertisreader-0.0.4/reference/extract_label_metadata.qmd +29 -0
  143. mertisreader-0.0.4/reference/extract_mertis_hk_columns.qmd +21 -0
  144. mertisreader-0.0.4/reference/get_csv_field_metadata.qmd +29 -0
  145. mertisreader-0.0.4/reference/index.qmd +15 -0
  146. mertisreader-0.0.4/reference/validate_pds4_label.qmd +28 -0
  147. mertisreader-0.0.4/test_lazy_helpers.py +46 -0
  148. mertisreader-0.0.4/tests/conftest.py +218 -0
  149. mertisreader-0.0.4/tests/test_core.py +300 -0
  150. mertisreader-0.0.4/tests/test_frame_utils.py +587 -0
  151. mertisreader-0.0.4/tests/test_integration.py +273 -0
  152. mertisreader-0.0.4/tests/test_lazy_csv.py +284 -0
  153. mertisreader-0.0.4/tests/test_lazy_loading.py +377 -0
  154. mertisreader-0.0.4/tests/test_pds4_validation.py +329 -0
  155. mertisreader-0.0.4/tutorials/core-reader.qmd +109 -0
  156. mertisreader-0.0.4/tutorials/frame-utils.qmd +52 -0
  157. mertisreader-0.0.4/tutorials/getting-started.qmd +115 -0
  158. mertisreader-0.0.4/tutorials/index.qmd +16 -0
  159. mertisreader-0.0.4/tutorials/lazy-loading.qmd +76 -0
  160. mertisreader-0.0.4/tutorials/pds4-validation.qmd +58 -0
  161. mertisreader-0.0.4/tutorials/read-example.qmd +93 -0
  162. mertisreader-0.0.2/PKG-INFO +0 -191
  163. mertisreader-0.0.2/README.md +0 -163
  164. mertisreader-0.0.2/mertisreader/__init__.py +0 -2
  165. mertisreader-0.0.2/mertisreader/_modidx.py +0 -32
  166. mertisreader-0.0.2/mertisreader/_nbdev.py +0 -14
  167. mertisreader-0.0.2/mertisreader/core.py +0 -381
  168. mertisreader-0.0.2/mertisreader.egg-info/PKG-INFO +0 -191
  169. mertisreader-0.0.2/mertisreader.egg-info/SOURCES.txt +0 -19
  170. mertisreader-0.0.2/mertisreader.egg-info/dependency_links.txt +0 -1
  171. mertisreader-0.0.2/mertisreader.egg-info/not-zip-safe +0 -1
  172. mertisreader-0.0.2/mertisreader.egg-info/requires.txt +0 -7
  173. mertisreader-0.0.2/mertisreader.egg-info/top_level.txt +0 -2
  174. mertisreader-0.0.2/nbdev_template/__init__.py +0 -1
  175. mertisreader-0.0.2/nbdev_template/_nbdev.py +0 -13
  176. mertisreader-0.0.2/nbdev_template/core.py +0 -6
  177. mertisreader-0.0.2/settings.ini +0 -56
  178. mertisreader-0.0.2/setup.cfg +0 -4
  179. mertisreader-0.0.2/setup.py +0 -46
  180. {mertisreader-0.0.2 → mertisreader-0.0.4}/CONTRIBUTING.md +0 -0
  181. {mertisreader-0.0.2 → mertisreader-0.0.4}/LICENSE +0 -0
  182. {mertisreader-0.0.2 → mertisreader-0.0.4}/MANIFEST.in +0 -0
@@ -0,0 +1,39 @@
1
+ # Constraints
2
+
3
+ Hard rules. These are non-negotiable unless an ADR with a Waiver field explicitly overrides one.
4
+
5
+ ## Core Workflow (NON-NEGOTIABLE)
6
+
7
+ - **Source of Truth**: All logic belongs in the maintained Python modules under `mertisreader/`; Quarto tutorial pages live in `docs_src/tutorials/`.
8
+ - **Cell-Ready Output**: When authoring tutorial content, provide executable code blocks that Quarto can run.
9
+ - **Verification**: Every logic change must include a test case or an `assert` suitable for pytest or a Quarto-executed example.
10
+
11
+ ## Required Technologies
12
+
13
+ - **Quarto** — Reason: Project publishes tutorial documentation and the site is built with `quarto render`
14
+ - **quartodoc** — Reason: API reference is generated from Python docstrings
15
+ - **Python 3.7+** — Reason: Declared minimum version in `settings.ini`
16
+ - **NumPy, pandas, astropy, matplotlib, xmltodict, rich** — Reason: Core dependencies declared in `settings.ini`
17
+
18
+ ## Forbidden Technologies
19
+
20
+ - **Direct edits to generated docs under `docs/`** — Reason: These are built artifacts from Quarto/quartodoc
21
+ - **`setup.py` manual edits** — Reason: Version and metadata come from `settings.ini` and `__init__.py`
22
+
23
+ ## Forbidden Patterns
24
+
25
+ - **Editing `docs/` manually** — Reason: These are built artifacts from Quarto/quartodoc
26
+ - **Non-deterministic ordering in examples** — Reason: Keep outputs reproducible; sort lists by numeric suffix as current code does
27
+ - **Mixing processing levels in input directories** — Reason: `detect_processing_level()` raises if mixed RAW/CAL/PAR levels detected
28
+
29
+ ## External Boundaries
30
+
31
+ - **RAW level lacks geometry** — Geometry-dependent code must guard on `processing_level != 'RAW'`
32
+ - **ESA/PDS4 naming convention** — Input directories should follow `mer_{level}_sc_{type}_{date}_{...}` pattern
33
+
34
+ ## File Path Conventions
35
+
36
+ - **Output directory**: Defaults to `<input_dir>-analysis_products` sibling unless explicitly set
37
+ - **Plot output**: `save_plot()` writes to output_dir with configurable format/dpi
38
+
39
+ _Last updated: 2026-06-05_
@@ -0,0 +1,42 @@
1
+ # Design Philosophy
2
+
3
+ Guidance, not rules. These evolve as the project matures.
4
+
5
+ ## Core Principles
6
+
7
+ - **Plain Python Source** — The maintained code lives in `mertisreader/*.py`; Quarto pages and tutorials live separately in `docs_src/`.
8
+ - **Explicit over Implicit** — Processing levels (RAW/CAL/PAR) are explicitly detected and validated; no magic assumptions about data availability.
9
+ - **Lazy Evaluation with Caching** — Heavy computations (frame assembly, geometry assembly) are cached after first computation to avoid redundant work.
10
+ - **Fail Fast on Invalid State** — Mixed processing levels raise errors; geometry access on RAW data raises errors; dimension mismatches require explicit interpolation mode.
11
+
12
+ ## Architectural Style
13
+
14
+ - **Class-Centric API** — `MERTISDataPackReader` encapsulates all state and operations; the surrounding modules expose focused helpers.
15
+ - **Separation of Concerns** — Collection, assembly, interpolation, validation, and docs are distinct stages with clear boundaries.
16
+ - **Quarto for Narrative Docs** — Tutorials and examples should be written as Quarto pages, while the API is generated from docstrings with quartodoc.
17
+
18
+ ## What We Optimise For
19
+
20
+ - **Scientific Correctness** — Processing level guards prevent invalid operations; geometry data only available when scientifically valid.
21
+ - **Developer Ergonomics** — Rich console output, intuitive method names, sensible defaults for common cases.
22
+ - **Reproducibility** — Deterministic ordering in exports; sorted by TIME_UTC; no random behavior in core workflows.
23
+
24
+ ## What We Accept as Trade-offs
25
+
26
+ - **Some Duplication** — Acceptable to avoid the wrong abstraction; e.g., separate methods for raw vs. assembled frames rather than complex conditional logic.
27
+ - **Tutorial Drift Risk** — Quarto examples are executed during render, so they need to be kept in sync with the current data layout.
28
+ - **Interpolation Loss** — Upsampling/downsampling inherently loses or invents data; users must choose mode consciously based on their analysis needs.
29
+
30
+ ## Interpolation Philosophy
31
+
32
+ - **`match` is Default** — No interpolation unless explicitly requested; users should be aware when resampling occurs.
33
+ - **`up` vs `down` are Explicit Choices** — Upsampling increases memory; downsampling loses resolution; neither is universally better.
34
+ - **Linear (`order=1`) is Default** — Fast and sufficient for most scientific data; cubic (`order=3`) available for smoother results when needed.
35
+
36
+ ## Documentation Style
37
+
38
+ - **Executable Examples** — `README.md`, `docs_src/tutorials/`, and `examples/read_merstis_test.ipynb` should demonstrate real usage.
39
+ - **Quick References** — `ASSEMBLY_QUICK_REFERENCE.md` provides pattern lookup for common operations.
40
+ - **Metadata Transparency** — Assembly operations return metadata dicts explaining what was done (mode, order, target dimensions).
41
+
42
+ _Last updated: 2026-06-05_
@@ -0,0 +1,32 @@
1
+ # Roadmap
2
+
3
+ ## Current Phase: Core Reader Maturity
4
+ **Goal**: Stabilize the MERTISDataPackReader API and ensure robust handling of all processing levels (RAW, CAL, PAR)
5
+ **Target date**: TBD
6
+
7
+ ### In scope
8
+ - Frame assembly with interpolation modes ('match', 'up', 'down', 'none')
9
+ - Geometry assembly for non-RAW levels
10
+ - Housekeeping data integration (hk_default, hk_extended)
11
+ - Metadata indexing (space_index, bb7_index, bb3_index, planet_index)
12
+ - nbdev-based development workflow with pre-commit hooks
13
+
14
+ ### Out of scope
15
+ - New instrument support (TIR quick-look data exists but is not actively developed)
16
+ - Web-based visualization or dashboarding
17
+ - Real-time data streaming or remote access
18
+ - Reprocessing or calibration routines (read-only access to ESA products)
19
+
20
+ ## Upcoming Phases
21
+ - **Use official PDS4 Python Tools** - Currently data read is handled direclty with low level files (astropy FITS, Pandas CSV), we need to read the PDS4 xml label too with https://pdssbn.astro.umd.edu/tools/pds4_tools_docs/current/user_manual.html
22
+ - **Analysis Tools** — Higher-level analysis routines (spectral fitting, time-series analysis)
23
+ - **Performance Optimization** — Memory-efficient streaming for large datasets
24
+ - **Testing Expansion** — Unit tests with realistic fixtures from `data/` directory
25
+
26
+ ## Completed Phases
27
+ - **Initial Reader Implementation** — Completed; basic FITS/HK ingestion working
28
+ - **Processing Level Detection** — Completed; RAW/CAL/PAR auto-detection with validation
29
+ - **Frame Assembly Framework** — Completed; interpolation modes and caching implemented
30
+ - **Documentation Infrastructure** — Completed; nbdev + quarto + quarto-generated docs
31
+
32
+ _Last updated: 2026-06-05_
@@ -0,0 +1,54 @@
1
+ # Current Status
2
+
3
+ ## NOW
4
+ - [ ] ADR-009 migration in progress: switch packaging/docs workflow from nbdev to Quarto + plain Python
5
+ - [x] Compatibility docs reduced to workflow-only pointers in `CLAUDE.md` and `.github/copilot-instructions.md`
6
+ - [x] Removed nbdev hooks from packaging metadata, Makefile, pre-commit, and GitLab CI
7
+ - [x] Removed generated nbdev file banners from the maintained Python modules
8
+ - [x] Removed remaining nbdev cell markers and support modules from `mertisreader/`
9
+ - [x] Root Quarto site now renders tutorial QMD pages plus quartodoc API pages
10
+ - [x] Migrated the converted percent scripts into `docs_src/tutorials/`
11
+ - [x] Removed the legacy notebook source tree and its scaffolding
12
+ - [x] Added a Quarto-backed README generation target (`make readme`)
13
+ - [x] MERTISDataPackReader core functionality implemented and working
14
+ - [x] Frame assembly with interpolation modes (match, up, down, none)
15
+ - [x] Geometry assembly for CAL/PAR levels
16
+ - [x] nbdev pre-commit hooks configured
17
+ - [x] Refactored frame utilities into separate tutorial/docs modules
18
+ - [x] ADR-007: RAW axis normalization implemented (`normalize_raw_axis_order()`)
19
+ - [x] ADR-008: PDS4 Tools Integration completed
20
+ - Added `pds4_tools>=1.10.0` to dependencies
21
+ - Added PDS4 validation utilities and metadata extraction support
22
+ - Implemented `validate_pds4_label()`, `extract_label_metadata()`, `get_csv_field_metadata()`
23
+ - Updated `extract_mertis_hk_columns()` to use pds4tools with fallback
24
+
25
+ ## NEXT
26
+ ### Other
27
+ - [ ] Finish polishing the tutorial pages and add more focused examples where needed
28
+ - [ ] Expand unit test coverage with fixtures from `data/` directory
29
+ - [ ] Performance profiling for large dataset handling
30
+
31
+ ## KNOWN_ISSUES
32
+ - **Debt**: No formal unit tests present beyond pytest hook — Impact: medium (reliance on manual verification)
33
+ - **Note**: Generic wavelength vector computed by averaging; noted as "not precise enough for scientific analysis" — Impact: low (documented limitation)
34
+
35
+ ## Version Status
36
+ - Package version: 0.0.3 (per `settings.ini`)
37
+ - MERTIS pipeline product version: v0.2.6 (supports RAW, CAL, PAR levels)
38
+
39
+ ## Tutorial Structure (Updated 2026-06-11)
40
+ | Page | Purpose |
41
+ |------|---------|
42
+ | `docs_src/tutorials/getting-started.qmd` | Full reader walkthrough and quick start |
43
+ | `docs_src/tutorials/read-example.qmd` | End-to-end example workflow and plotting |
44
+ | `docs_src/tutorials/core-reader.qmd` | Core reader lifecycle and cached frames |
45
+ | `docs_src/tutorials/lazy-loading.qmd` | FITS and CSV lazy-loading helpers |
46
+ | `docs_src/tutorials/frame-utils.qmd` | Frame assembly and interpolation helpers |
47
+ | `docs_src/tutorials/pds4-validation.qmd` | PDS4 metadata extraction and validation |
48
+
49
+ ## Docs Build
50
+ - README source: `docs_src/readme.qmd`
51
+ - Tutorial source: `docs_src/tutorials/`
52
+ - API source: `mertisreader/`
53
+
54
+ _Last updated: 2026-06-11_
@@ -0,0 +1,37 @@
1
+ # .ai/ — Project Memory
2
+
3
+ This folder is the single source of truth for project context for the **mertisreader** library.
4
+ It is read by AI coding agents (Claude Code, GitHub Copilot) and by human contributors.
5
+
6
+ ## About the Project
7
+
8
+ **mertisreader** is a Python library for reading ESA BepiColombo MERTIS instrument data.
9
+ The current workflow uses plain Python source in `mertisreader/`, Quarto tutorial pages in `docs_src/tutorials/`, and quartodoc for API reference generation.
10
+
11
+ ## Files at a glance
12
+
13
+ | File | Read when |
14
+ |---|---|
15
+ | `00_CONSTRAINTS.md` | Every coding session — hard rules |
16
+ | `00_PHILOSOPHY.md` | Architecture work, onboarding, new patterns |
17
+ | `02_ROADMAP.md` | Planning, scope questions |
18
+ | `03_CURRENT_STATUS.md` | Start of every session — current state |
19
+ | `decisions/index.md` | Conflict checks, architecture decisions |
20
+ | `decisions/ADR-NNN-*.md` | When the index flags a relevant decision |
21
+ | `sessions/YYYY-MM-DD.md` | Debugging, "why did we do this" questions |
22
+ | `archive/` | Historical status — rarely needed |
23
+
24
+ ## New contributor?
25
+
26
+ Start here: `00_PHILOSOPHY.md` → `02_ROADMAP.md` → `03_CURRENT_STATUS.md`
27
+
28
+ ## New agent session?
29
+
30
+ Start here: `03_CURRENT_STATUS.md` → `00_CONSTRAINTS.md` → `02_ROADMAP.md` → `decisions/index.md`
31
+
32
+ ## Quick Links
33
+
34
+ - **Core API**: `MERTISDataPackReader` class in `mertisreader/core.py`
35
+ - **Tutorials**: `docs_src/tutorials/`
36
+ - **Sample Data**: `data/bcmer_tm_all_START-20200409T000000_END-20200410T000000_CRE-20240717T132010-ParamEventBootSciHK-short/`
37
+ - **Quick Reference**: `ASSEMBLY_QUICK_REFERENCE.md` for frame assembly patterns
@@ -0,0 +1,41 @@
1
+ # ADR-001: nbdev-based development with notebooks as source
2
+
3
+ - **Status**: Superseded by ADR-009
4
+ - **Date**: 2026-06-05
5
+ - **Author**: Session 2026-06-05
6
+
7
+ ## Context
8
+
9
+ The project needs a development workflow that combines executable code with narrative documentation. Traditional Python development separates code (`*.py`) from documentation (docstrings, separate markdown), leading to drift between examples and implementation.
10
+
11
+ ## Decision
12
+
13
+ Adopt **nbdev** as the primary development methodology:
14
+ - All library code lives in Jupyter notebooks under `nbs/`
15
+ - Code cells marked with `#| export` are included in the generated Python module
16
+ - `nbs/00_core.ipynb` is the single source notebook for all library logic
17
+ - `mertisreader/core.py` is auto-generated via `nbdev_export`
18
+ - Manual edits to `mertisreader/*.py` are forbidden; they are read-only artifacts
19
+
20
+ ## Alternatives Considered
21
+
22
+ - **Traditional Python with Sphinx** — Rejected: Documentation and code are separate; examples can become stale
23
+ - **Jupyter + manual export** — Rejected: Error-prone; no automated testing integration
24
+ - **quarto-only documentation** — Rejected: Would not solve the code-as-documentation problem
25
+
26
+ ## Consequences
27
+
28
+ **Positive:**
29
+ - Examples in documentation are always executable and up-to-date
30
+ - Development workflow encourages literate programming
31
+ - Tests can be embedded as notebook cells
32
+ - Single file contains both implementation and explanation
33
+
34
+ **Negative:**
35
+ - Git diffs are less readable for notebook JSON format
36
+ - Requires nbdev tooling familiarity
37
+ - Monolithic notebook can become large (`00_core.ipynb` is ~580 lines)
38
+
39
+ ## Waiver
40
+
41
+ None.
@@ -0,0 +1,40 @@
1
+ # ADR-002: MERTISDataPackReader class-centric API design
2
+
3
+ - **Status**: Active
4
+ - **Date**: 2026-06-05
5
+ - **Author**: Session 2026-06-05
6
+
7
+ ## Context
8
+
9
+ The API needs to manage complex state: input/output directories, processing level, collected data, assembled frames, geometry, and metadata. A functional API would require passing many arguments between calls and make state management cumbersome.
10
+
11
+ ## Decision
12
+
13
+ Design the API around a single **`MERTISDataPackReader`** class that:
14
+ - Encapsulates all state as instance attributes
15
+ - Provides methods for each stage: `data_collector()`, `data_assembler()`, `get_assembled_frames()`, `get_assembled_geometry()`
16
+ - Uses lazy evaluation with caching for expensive operations
17
+ - Exposes read-only properties for processed data (`frames`, `geom_ls`, `mertis_tis_metadata`)
18
+
19
+ ## Alternatives Considered
20
+
21
+ - **Functional API with explicit state passing** — Rejected: Would require passing data dicts through many functions; harder to track state
22
+ - **Multiple specialized classes** — Rejected: Over-engineering for this codebase size; adds import complexity
23
+ - **Dataclass-based state container** — Rejected: Would not encapsulate behavior; methods would still be scattered
24
+
25
+ ## Consequences
26
+
27
+ **Positive:**
28
+ - Intuitive workflow: instantiate → collect → assemble → access
29
+ - State is implicit in the instance; no global state
30
+ - Easy to work with multiple data packs simultaneously
31
+ - IDE autocomplete works naturally
32
+
33
+ **Negative:**
34
+ - Class can become large (God Object anti-pattern risk)
35
+ - Stateful design makes pure testing harder
36
+ - Users must understand initialization order
37
+
38
+ ## Waiver
39
+
40
+ None.
@@ -0,0 +1,37 @@
1
+ # ADR-003: Processing level detection from filename prefixes
2
+
3
+ - **Status**: Active
4
+ - **Date**: 2026-06-05
5
+ - **Author**: Session 2026-06-05
6
+
7
+ ## Context
8
+
9
+ MERTIS data exists at three processing levels: RAW (digital numbers, no geometry), CAL (calibrated, geometrically aligned), and PAR (physical units, with calibration targets). The API must enforce level-specific constraints (e.g., no geometry on RAW) and validate that input directories contain consistent data.
10
+
11
+ ## Decision
12
+
13
+ - Detect processing level from filename prefixes: `mer_raw_*`, `mer_cal_*`, `mer_par_*`
14
+ - `detect_processing_level()` scans all files and raises if mixed levels are found
15
+ - Processing level is stored as instance attribute and checked before level-sensitive operations
16
+ - RAW level explicitly disables geometry access; CAL/PAR enable it
17
+
18
+ ## Alternatives Considered
19
+
20
+ - **User-specified level parameter** — Rejected: Error-prone; users may specify incorrectly
21
+ - **Infer from file contents** — Rejected: Slower; FITS headers may not be reliable indicators
22
+ - **Directory-based convention** — Rejected: Already using filename convention; adding directory rules would be redundant
23
+
24
+ ## Consequences
25
+
26
+ **Positive:**
27
+ - Automatic detection reduces user error
28
+ - Early validation catches mixed-level directories
29
+ - Clear error messages when operations are invalid for level
30
+
31
+ **Negative:**
32
+ - Relies on ESA naming convention being consistent
33
+ - New processing levels would require code changes
34
+
35
+ ## Waiver
36
+
37
+ None.
@@ -0,0 +1,39 @@
1
+ # ADR-004: Lazy evaluation with caching for heavy computations
2
+
3
+ - **Status**: Active
4
+ - **Date**: 2026-06-05
5
+ - **Author**: Session 2026-06-05
6
+
7
+ ## Context
8
+
9
+ Assembling frames from FITS files, performing interpolation, and building geometry arrays are computationally expensive operations. Users may call `get_assembled_frames()` multiple times with the same parameters during analysis; recomputing each time would waste resources.
10
+
11
+ ## Decision
12
+
13
+ - Use **lazy evaluation**: expensive computations occur only on first access
14
+ - Cache results in private attributes (`_raw_frames`, `_assembled_cube`, `_assembled_geometry`)
15
+ - First call computes and caches; subsequent calls return the cached object (identity check: `cube2 is cube1`)
16
+ - **No parameter tracking**: users must not re-call with different parameters—caching is single-result-per-method
17
+
18
+ ## Alternatives Considered
19
+
20
+ - **Eager evaluation on initialization** — Rejected: Wastes time if user only inspects metadata
21
+ - **No caching** — Rejected: Users would experience unnecessary delays during iterative analysis
22
+ - **Parameter-keyed cache** — Rejected: Complexity not justified for typical usage (call once, reuse result)
23
+
24
+ ## Consequences
25
+
26
+ **Positive:**
27
+ - Fast repeated access to computed data
28
+ - Users control when computation happens
29
+ - Simple implementation (no parameter tracking overhead)
30
+
31
+ **Negative:**
32
+ - First access may be slow; users need to understand this pattern
33
+ - Cache consumes memory for large datasets
34
+ - Calling with different parameters returns stale (first-call) result
35
+ - Users must be aware that modifying returned objects affects the cache
36
+
37
+ ## Waiver
38
+
39
+ None.
@@ -0,0 +1,40 @@
1
+ # ADR-005: Explicit interpolation modes over automatic selection
2
+
3
+ - **Status**: Active
4
+ - **Date**: 2026-06-05
5
+ - **Author**: Session 2026-06-05
6
+
7
+ ## Context
8
+
9
+ TIS frames from different acquisition targets may have different spatial/spectral dimensions due to binning modes (1x2, 2x2, etc.) and window sizes. When assembling frames into a cube, the API must decide how to handle dimension mismatches. Automatic selection could hide important trade-offs from users.
10
+
11
+ ## Decision
12
+
13
+ Provide **explicit interpolation modes** that users must choose:
14
+ - `'match'` (default): No interpolation; fails if dimensions differ (safe default)
15
+ - `'up'`: Upsample all frames to largest dimensions (preserves detail, increases memory)
16
+ - `'down'`: Downsample all frames to smallest dimensions (saves memory, loses resolution)
17
+ - `'none'`: Stack without interpolation (fastest, fails with heterogeneous dims)
18
+
19
+ Users must explicitly specify mode when calling `get_assembled_frames(interp_mode=...)`.
20
+
21
+ ## Alternatives Considered
22
+
23
+ - **Automatic mode selection** — Rejected: Hides trade-offs; users may not realize resampling occurred
24
+ - **Always upsample** — Rejected: Wastes memory when frames already match
25
+ - **Always downsample** — Rejected: Loses data without user consent
26
+
27
+ ## Consequences
28
+
29
+ **Positive:**
30
+ - Users are aware of interpolation effects on their data
31
+ - Explicit choice makes analysis reproducible
32
+ - Metadata includes interpolation mode for documentation
33
+
34
+ **Negative:**
35
+ - Users must understand the options to proceed
36
+ - `'match'` mode frequently fails, requiring user to choose another mode
37
+
38
+ ## Waiver
39
+
40
+ None.
@@ -0,0 +1,130 @@
1
+ # ADR-007: RAW vs CAL/PAR Science Data Axis Ordering
2
+
3
+ - **Status**: Active
4
+ - **Date**: 2026-06-05
5
+ - **Author**: Session 2026-06-05
6
+
7
+ ## Context
8
+
9
+ MERTIS pipeline product v0.2.6 has inconsistent axis ordering between processing levels:
10
+
11
+ ### RAW Level
12
+ ```
13
+ MERTIS_TIS_RAW_SCIENCE_DATA shape = (62415, 100, 40)
14
+ = (n_frames, n_pixels, n_spectrals)
15
+ ```
16
+
17
+ ### CAL/PAR Level
18
+ ```
19
+ MERTIS_TIS_CAL_SCIENCE_DATA shape = (40, 100, 62235)
20
+ = (n_spectrals, n_pixels, n_frames)
21
+
22
+ MERTIS_TIS_PAR_SCIENCE_DATA shape = (40, 100, 62415)
23
+ = (n_spectrals, n_pixels, n_frames)
24
+ ```
25
+
26
+ Both levels share:
27
+ - `MERTIS_TIS_METADATA` with `rows = n_frames` (62415 for RAW, 62235 for CAL)
28
+ - Same spatial/spectral dimensions (100 × 40 for 1×2 binning)
29
+
30
+ ### Binning Modes (from `PAR_TIS_BIN_MODE`)
31
+ | Value | Mode | Resulting Shape |
32
+ |-------|------|-----------------|
33
+ | 0 | 1×1 | (100, 80) |
34
+ | 1 | 1×2 | (100, 40) ← default |
35
+ | 2 | 2×2 | (50, 40) |
36
+ | 3 | 2×4 | (50, 20) |
37
+
38
+ Full frames (rare): 160 × 120 spectral
39
+
40
+ ## Decision
41
+
42
+ ### 1. Normalize Axis Ordering in Code
43
+
44
+ All frame assembly functions must accept explicit axis parameters and handle RAW-level transposition:
45
+
46
+ ```python
47
+ def data_collector(self):
48
+ # For RAW level, transpose from (frames, pixels, spectrals) to (spectrals, pixels, frames)
49
+ if level == "RAW":
50
+ frames[tis_data_path_stem] = tis_data["fits_data"]['MERTIS_TIS_RAW_SCIENCE_DATA'].data.astype(np.float64)
51
+ # Transpose to match CAL/PAR convention
52
+ frames[tis_data_path_stem] = np.transpose(frames[tis_data_path_stem], (2, 1, 0))
53
+ ```
54
+
55
+ ### 2. Source n_total_frames from Metadata
56
+
57
+ Instead of inferring `n_total_frames` from array shape, read it from `MERTIS_TIS_METADATA.rows`:
58
+
59
+ ```python
60
+ # Get actual frame count from metadata
61
+ n_frames = len(tis_data["fits_data"]['MERTIS_TIS_METADATA'].data)
62
+ ```
63
+
64
+ ### 3. Compute n_pixels and n_spectrals from Binning Mode
65
+
66
+ When metadata is available, derive dimensions from binning mode:
67
+
68
+ ```python
69
+ # Full frame dimensions
70
+ FULL_FRAME_PIXELS = 100 # or 160 for rare cases
71
+ FULL_FRAME_SPECTRALS = 80 # or 120 for rare cases
72
+
73
+ # Binning mode divisors
74
+ BIN_DIVISORS = {0: (1, 1), 1: (1, 2), 2: (2, 2), 3: (2, 4)}
75
+
76
+ bin_mode = metadata['PAR_TIS_BIN_MODE']
77
+ spatial_div, spectral_div = BIN_DIVISORS[bin_mode]
78
+ n_pixels = FULL_FRAME_PIXELS // spatial_div
79
+ n_spectrals = FULL_FRAME_SPECTRALS // spectral_div
80
+ ```
81
+
82
+ ### 4. Updated Metadata Structure
83
+
84
+ The `get_frames_by_shape_groups()` function must report dimensions correctly:
85
+
86
+ ```python
87
+ metadata = {
88
+ 'n_files': len(file_list),
89
+ 'n_total_frames': n_frames_from_metadata, # From MERTIS_TIS_METADATA.rows
90
+ 'n_pixels': n_pix, # From shape or bin mode
91
+ 'n_spectrals': n_spec, # From shape or bin mode
92
+ 'shape_key': shape_key,
93
+ }
94
+ ```
95
+
96
+ ## Alternatives Considered
97
+
98
+ ### Alternative A: Keep RAW as-is, Document the Difference
99
+ **Rejected** because:
100
+ - Forces all downstream code to handle two conventions
101
+ - Error-prone: users may assume consistent axis ordering
102
+ - The error "Spectrals mismatch: 40 != 22" indicates confusion already
103
+
104
+ ### Alternative B: Transpose in `get_assembled_frames()` Instead
105
+ **Rejected** because:
106
+ - Transposition should happen at data ingestion (earlier is better)
107
+ - `data_collector()` is the natural place for normalization
108
+ - Keeps RAW data accessible via `get_original_frames()` in normalized form
109
+
110
+ ## Consequences
111
+
112
+ ### Positive
113
+ - Consistent axis ordering across all processing levels
114
+ - `n_total_frames` always accurate (from metadata, not shape inference)
115
+ - Easier to reason about: `(n_spectrals, n_pixels, n_frames)` everywhere
116
+
117
+ ### Negative
118
+ - RAW data is transposed on load (minor memory overhead)
119
+ - Old code accessing RAW frames directly must be updated
120
+ - `get_original_frames()` returns normalized shapes, not raw FITS shapes
121
+
122
+ ## Implementation Notes
123
+
124
+ 1. **Normalization happens in `data_collector()`** when loading RAW data
125
+ 2. **`get_original_frames()` returns normalized shapes** - document this clearly
126
+ 3. **Users needing raw FITS shapes** must access FITS files directly via astropy
127
+
128
+ ## Waiver
129
+
130
+ None - this is a compatibility fix, not a constraint override.