divejson 0.35.1__tar.gz → 0.35.2__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 (295) hide show
  1. {divejson-0.35.1 → divejson-0.35.2}/CHANGELOG.md +11 -0
  2. {divejson-0.35.1 → divejson-0.35.2}/PKG-INFO +1 -1
  3. divejson-0.35.2/SPEC_REF +1 -0
  4. {divejson-0.35.1 → divejson-0.35.2}/divejson/__init__.py +1 -1
  5. {divejson-0.35.1 → divejson-0.35.2}/divejson/fit.py +65 -34
  6. {divejson-0.35.1 → divejson-0.35.2}/divejson/xmlsource.py +5 -1
  7. {divejson-0.35.1 → divejson-0.35.2}/docs/converting.md +8 -5
  8. {divejson-0.35.1 → divejson-0.35.2}/docs/fit-mapping.md +84 -65
  9. {divejson-0.35.1 → divejson-0.35.2}/docs/ssrf-mapping.md +2 -1
  10. {divejson-0.35.1 → divejson-0.35.2}/docs/uddf-mapping.md +1 -1
  11. {divejson-0.35.1 → divejson-0.35.2}/fixtures/README.md +20 -9
  12. divejson-0.35.2/fixtures/fit/garmin-connect-summary-first.divejson +42380 -0
  13. divejson-0.35.2/fixtures/fit/garmin-connect-summary-first.fit +0 -0
  14. {divejson-0.35.1 → divejson-0.35.2}/tests/test_fit_fixtures.py +37 -11
  15. {divejson-0.35.1 → divejson-0.35.2}/tests/test_fit_parsing.py +110 -9
  16. {divejson-0.35.1 → divejson-0.35.2}/tests/test_fit_units.py +58 -0
  17. divejson-0.35.1/SPEC_REF +0 -1
  18. {divejson-0.35.1 → divejson-0.35.2}/.github/scripts/release_bump.py +0 -0
  19. {divejson-0.35.1 → divejson-0.35.2}/.github/scripts/spec_pin.py +0 -0
  20. {divejson-0.35.1 → divejson-0.35.2}/.github/workflows/ci.yml +0 -0
  21. {divejson-0.35.1 → divejson-0.35.2}/.github/workflows/pr-title.yml +0 -0
  22. {divejson-0.35.1 → divejson-0.35.2}/.github/workflows/release-bump.yml +0 -0
  23. {divejson-0.35.1 → divejson-0.35.2}/.github/workflows/release.yml +0 -0
  24. {divejson-0.35.1 → divejson-0.35.2}/.gitignore +0 -0
  25. {divejson-0.35.1 → divejson-0.35.2}/CONTRIBUTING.md +0 -0
  26. {divejson-0.35.1 → divejson-0.35.2}/LICENSE +0 -0
  27. {divejson-0.35.1 → divejson-0.35.2}/README.md +0 -0
  28. {divejson-0.35.1 → divejson-0.35.2}/divejson/cli.py +0 -0
  29. {divejson-0.35.1 → divejson-0.35.2}/divejson/codes.py +0 -0
  30. {divejson-0.35.1 → divejson-0.35.2}/divejson/conform.py +0 -0
  31. {divejson-0.35.1 → divejson-0.35.2}/divejson/converter.py +0 -0
  32. {divejson-0.35.1 → divejson-0.35.2}/divejson/py.typed +0 -0
  33. {divejson-0.35.1 → divejson-0.35.2}/divejson/registry.py +0 -0
  34. {divejson-0.35.1 → divejson-0.35.2}/divejson/series.py +0 -0
  35. {divejson-0.35.1 → divejson-0.35.2}/divejson/shearwater_db.py +0 -0
  36. {divejson-0.35.1 → divejson-0.35.2}/divejson/shearwater_xml.py +0 -0
  37. {divejson-0.35.1 → divejson-0.35.2}/divejson/ssrf.py +0 -0
  38. {divejson-0.35.1 → divejson-0.35.2}/divejson/suunto_json.py +0 -0
  39. {divejson-0.35.1 → divejson-0.35.2}/divejson/suunto_xml.py +0 -0
  40. {divejson-0.35.1 → divejson-0.35.2}/divejson/uddf.py +0 -0
  41. {divejson-0.35.1 → divejson-0.35.2}/divejson/uddf_write.py +0 -0
  42. {divejson-0.35.1 → divejson-0.35.2}/divejson/validate.py +0 -0
  43. {divejson-0.35.1 → divejson-0.35.2}/docs/shearwater-db-mapping.md +0 -0
  44. {divejson-0.35.1 → divejson-0.35.2}/docs/shearwater-xml-mapping.md +0 -0
  45. {divejson-0.35.1 → divejson-0.35.2}/docs/suunto-json-mapping.md +0 -0
  46. {divejson-0.35.1 → divejson-0.35.2}/docs/suunto-xml-mapping.md +0 -0
  47. {divejson-0.35.1 → divejson-0.35.2}/docs/uddf-writing.md +0 -0
  48. {divejson-0.35.1 → divejson-0.35.2}/docs/writing.md +0 -0
  49. {divejson-0.35.1 → divejson-0.35.2}/fixtures/fit/ocean-heart-rate.divejson +0 -0
  50. {divejson-0.35.1 → divejson-0.35.2}/fixtures/fit/ocean-heart-rate.fit +0 -0
  51. {divejson-0.35.1 → divejson-0.35.2}/fixtures/fit/ocean-poor-first-fix.divejson +0 -0
  52. {divejson-0.35.1 → divejson-0.35.2}/fixtures/fit/ocean-poor-first-fix.fit +0 -0
  53. {divejson-0.35.1 → divejson-0.35.2}/fixtures/fit/suunto-d5.divejson +0 -0
  54. {divejson-0.35.1 → divejson-0.35.2}/fixtures/fit/suunto-d5.fit +0 -0
  55. {divejson-0.35.1 → divejson-0.35.2}/fixtures/fit/suunto-ocean-2026.divejson +0 -0
  56. {divejson-0.35.1 → divejson-0.35.2}/fixtures/fit/suunto-ocean-2026.fit +0 -0
  57. {divejson-0.35.1 → divejson-0.35.2}/fixtures/fit/suunto-ocean.divejson +0 -0
  58. {divejson-0.35.1 → divejson-0.35.2}/fixtures/fit/suunto-ocean.fit +0 -0
  59. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/accommodation-dangling-reference.divejson +0 -0
  60. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/address-without-country.divejson +0 -0
  61. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/agency-other-missing.divejson +0 -0
  62. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/avg-depth-exceeds-max.divejson +0 -0
  63. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/bad-version.divejson +0 -0
  64. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/bbox-missing-corner.divejson +0 -0
  65. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/bbox-south-exceeds-north.divejson +0 -0
  66. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/bbox-without-position.divejson +0 -0
  67. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/boat-name-empty.divejson +0 -0
  68. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/boat-name-too-long.divejson +0 -0
  69. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/channel-length-mismatch.divejson +0 -0
  70. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/contact-position-incomplete.divejson +0 -0
  71. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/contact-roles-repeated.divejson +0 -0
  72. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/course-agency-other-without-agency.divejson +0 -0
  73. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/course-dates-reversed.divejson +0 -0
  74. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/current-unknown.divejson +0 -0
  75. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/cylinder-gear-dangling-reference.divejson +0 -0
  76. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/cylinder-gear-repeated.divejson +0 -0
  77. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/dangling-reference.divejson +0 -0
  78. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/deco-model-gf-order.divejson +0 -0
  79. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/device-empty-member.divejson +0 -0
  80. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/dive-duration.divejson +0 -0
  81. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/dive-profile-outside-recording.divejson +0 -0
  82. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/dive-readout-outside-recording.divejson +0 -0
  83. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/diver-email-too-long.divejson +0 -0
  84. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/diver-name-too-long.divejson +0 -0
  85. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/diver-username.divejson +0 -0
  86. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/duplicate-file-uuid-across-recordings.divejson +0 -0
  87. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/duplicate-file-uuid-portrait.divejson +0 -0
  88. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/duplicate-json-member.divejson +0 -0
  89. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/duplicate-uuid.divejson +0 -0
  90. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/emergency-contact-without-name.divejson +0 -0
  91. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/entry-type-unknown.divejson +0 -0
  92. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/event-without-type-or-label.divejson +0 -0
  93. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/external-id-identifier-empty.divejson +0 -0
  94. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/external-id-identifier-too-long.divejson +0 -0
  95. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/external-id-openstreetmap-form.divejson +0 -0
  96. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/external-id-registry-not-a-key.divejson +0 -0
  97. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/external-id-wikidata-form.divejson +0 -0
  98. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/external-id-without-identifier.divejson +0 -0
  99. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/external-id-without-registry.divejson +0 -0
  100. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/external-id-worms-form.divejson +0 -0
  101. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/external-ids-repeated-with-extensions.divejson +0 -0
  102. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/external-ids-repeated.divejson +0 -0
  103. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/gear-dive-time-negative.divejson +0 -0
  104. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/gear-material-unknown.divejson +0 -0
  105. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/gear-type-unknown.divejson +0 -0
  106. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/gear-volume-not-positive.divejson +0 -0
  107. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/gear-working-pressure-too-high.divejson +0 -0
  108. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/heart-rate-zero.divejson +0 -0
  109. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/instructor-dangling-reference.divejson +0 -0
  110. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/insurance-without-provider.divejson +0 -0
  111. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/location-full-name.divejson +0 -0
  112. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/missing-format.divejson +0 -0
  113. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/naive-exported-at.divejson +0 -0
  114. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/non-increasing-samples.divejson +0 -0
  115. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/null-member.divejson +0 -0
  116. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/oxygen-helium-sum.divejson +0 -0
  117. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/person-dangling-reference.divejson +0 -0
  118. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/person-referenced-twice.divejson +0 -0
  119. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/position-incomplete.divejson +0 -0
  120. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/pressure-order.divejson +0 -0
  121. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/profile-duration-short.divejson +0 -0
  122. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/rating-out-of-range.divejson +0 -0
  123. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/recording-without-content.divejson +0 -0
  124. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/schedule-interval-hours-not-positive.divejson +0 -0
  125. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/schedule-without-interval.divejson +0 -0
  126. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/sighting-count-and-abundance.divejson +0 -0
  127. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/sighting-dangling-reference.divejson +0 -0
  128. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/sighting-species-repeated.divejson +0 -0
  129. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/site-altitude-too-high.divejson +0 -0
  130. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/site-altitude-too-low.divejson +0 -0
  131. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/site-bbox-south-exceeds-north.divejson +0 -0
  132. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/site-depth-from-negative.divejson +0 -0
  133. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/site-depth-reversed.divejson +0 -0
  134. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/site-depth-to-negative.divejson +0 -0
  135. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/site-entry-type-unknown.divejson +0 -0
  136. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/site-entry-types-repeated.divejson +0 -0
  137. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/site-other-name-empty.divejson +0 -0
  138. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/site-other-name-repeats-name.divejson +0 -0
  139. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/site-other-name-too-long.divejson +0 -0
  140. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/site-other-names-repeated-by-case.divejson +0 -0
  141. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/site-other-names-repeated.divejson +0 -0
  142. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/site-tag-empty.divejson +0 -0
  143. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/site-tag-too-long.divejson +0 -0
  144. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/site-tags-repeated-by-case.divejson +0 -0
  145. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/site-tags-repeated.divejson +0 -0
  146. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/site-water-type-unknown.divejson +0 -0
  147. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/species-aphia-id.divejson +0 -0
  148. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/species-external-ids-empty.divejson +0 -0
  149. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/species-external-ids-repeated-with-extensions.divejson +0 -0
  150. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/species-no-identity.divejson +0 -0
  151. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/species-two-worms-entries.divejson +0 -0
  152. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/species-wikidata-qid.divejson +0 -0
  153. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/tag-empty.divejson +0 -0
  154. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/tag-too-long.divejson +0 -0
  155. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/tags-repeated-by-case.divejson +0 -0
  156. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/tags-repeated-by-whitespace.divejson +0 -0
  157. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/tags-repeated.divejson +0 -0
  158. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/trailing-newline-datetime.divejson +0 -0
  159. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/trip-dates-reversed.divejson +0 -0
  160. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/type-unknown.divejson +0 -0
  161. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/undefined-member.divejson +0 -0
  162. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/water-type-en13319.divejson +0 -0
  163. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/waves-unknown.divejson +0 -0
  164. {divejson-0.35.1 → divejson-0.35.2}/fixtures/invalid/weather-unknown.divejson +0 -0
  165. {divejson-0.35.1 → divejson-0.35.2}/fixtures/shearwater_db/perdix3-deco-dive-11.db +0 -0
  166. {divejson-0.35.1 → divejson-0.35.2}/fixtures/shearwater_db/perdix3-deco-dive-11.divejson +0 -0
  167. {divejson-0.35.1 → divejson-0.35.2}/fixtures/shearwater_db/perdix3-dives-1-and-8.db +0 -0
  168. {divejson-0.35.1 → divejson-0.35.2}/fixtures/shearwater_db/perdix3-dives-1-and-8.divejson +0 -0
  169. {divejson-0.35.1 → divejson-0.35.2}/fixtures/shearwater_xml/perdix3-deco-dive-11.divejson +0 -0
  170. {divejson-0.35.1 → divejson-0.35.2}/fixtures/shearwater_xml/perdix3-deco-dive-11.xml +0 -0
  171. {divejson-0.35.1 → divejson-0.35.2}/fixtures/shearwater_xml/perdix3-dive-8.divejson +0 -0
  172. {divejson-0.35.1 → divejson-0.35.2}/fixtures/shearwater_xml/perdix3-dive-8.xml +0 -0
  173. {divejson-0.35.1 → divejson-0.35.2}/fixtures/ssrf/people.divejson +0 -0
  174. {divejson-0.35.1 → divejson-0.35.2}/fixtures/ssrf/people.ssrf +0 -0
  175. {divejson-0.35.1 → divejson-0.35.2}/fixtures/ssrf/refusals.divejson +0 -0
  176. {divejson-0.35.1 → divejson-0.35.2}/fixtures/ssrf/refusals.ssrf +0 -0
  177. {divejson-0.35.1 → divejson-0.35.2}/fixtures/ssrf/sites.divejson +0 -0
  178. {divejson-0.35.1 → divejson-0.35.2}/fixtures/ssrf/sites.ssrf +0 -0
  179. {divejson-0.35.1 → divejson-0.35.2}/fixtures/ssrf/subsurface.divejson +0 -0
  180. {divejson-0.35.1 → divejson-0.35.2}/fixtures/ssrf/subsurface.ssrf +0 -0
  181. {divejson-0.35.1 → divejson-0.35.2}/fixtures/ssrf/trip-grouping.divejson +0 -0
  182. {divejson-0.35.1 → divejson-0.35.2}/fixtures/ssrf/trip-grouping.ssrf +0 -0
  183. {divejson-0.35.1 → divejson-0.35.2}/fixtures/ssrf/two-computers.divejson +0 -0
  184. {divejson-0.35.1 → divejson-0.35.2}/fixtures/ssrf/two-computers.ssrf +0 -0
  185. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_json/d5-deco-max-depth.divejson +0 -0
  186. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_json/d5-deco-max-depth.json +0 -0
  187. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_json/d5-deep-stop-broken.divejson +0 -0
  188. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_json/d5-deep-stop-broken.json +0 -0
  189. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_json/d5-stop-alarms.divejson +0 -0
  190. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_json/d5-stop-alarms.json +0 -0
  191. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_json/header-only.divejson +0 -0
  192. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_json/header-only.json +0 -0
  193. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_json/not-a-dive.divejson +0 -0
  194. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_json/not-a-dive.json +0 -0
  195. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_json/ocean-deco-ppo2.divejson +0 -0
  196. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_json/ocean-deco-ppo2.json +0 -0
  197. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_json/ocean-heart-rate.divejson +0 -0
  198. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_json/ocean-heart-rate.json +0 -0
  199. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_json/ocean-poor-first-fix.divejson +0 -0
  200. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_json/ocean-poor-first-fix.json +0 -0
  201. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_json/ocean-tank-pressure.divejson +0 -0
  202. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_json/ocean-tank-pressure.json +0 -0
  203. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_json/purged-regulator.divejson +0 -0
  204. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_json/purged-regulator.json +0 -0
  205. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_json/suunto-d5.divejson +0 -0
  206. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_json/suunto-d5.json +0 -0
  207. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_json/suunto-ocean-2026.divejson +0 -0
  208. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_json/suunto-ocean-2026.json +0 -0
  209. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_json/suunto-ocean.divejson +0 -0
  210. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_json/suunto-ocean.json +0 -0
  211. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_xml/freedive.divejson +0 -0
  212. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_xml/freedive.xml +0 -0
  213. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_xml/nitrox-deco.divejson +0 -0
  214. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_xml/nitrox-deco.xml +0 -0
  215. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_xml/refusals.divejson +0 -0
  216. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_xml/refusals.xml +0 -0
  217. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_xml/suunto-d5.divejson +0 -0
  218. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_xml/suunto-d5.xml +0 -0
  219. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_xml/unlabelled-pressure.divejson +0 -0
  220. {divejson-0.35.1 → divejson-0.35.2}/fixtures/suunto_xml/unlabelled-pressure.xml +0 -0
  221. {divejson-0.35.1 → divejson-0.35.2}/fixtures/uddf/conditions.divejson +0 -0
  222. {divejson-0.35.1 → divejson-0.35.2}/fixtures/uddf/conditions.uddf +0 -0
  223. {divejson-0.35.1 → divejson-0.35.2}/fixtures/uddf/contacts.divejson +0 -0
  224. {divejson-0.35.1 → divejson-0.35.2}/fixtures/uddf/contacts.uddf +0 -0
  225. {divejson-0.35.1 → divejson-0.35.2}/fixtures/uddf/divelogs.divejson +0 -0
  226. {divejson-0.35.1 → divejson-0.35.2}/fixtures/uddf/divelogs.uddf +0 -0
  227. {divejson-0.35.1 → divejson-0.35.2}/fixtures/uddf/gear.divejson +0 -0
  228. {divejson-0.35.1 → divejson-0.35.2}/fixtures/uddf/gear.uddf +0 -0
  229. {divejson-0.35.1 → divejson-0.35.2}/fixtures/uddf/legacy-writer.divejson +0 -0
  230. {divejson-0.35.1 → divejson-0.35.2}/fixtures/uddf/legacy-writer.uddf +0 -0
  231. {divejson-0.35.1 → divejson-0.35.2}/fixtures/uddf/mix-only-cylinder.divejson +0 -0
  232. {divejson-0.35.1 → divejson-0.35.2}/fixtures/uddf/mix-only-cylinder.uddf +0 -0
  233. {divejson-0.35.1 → divejson-0.35.2}/fixtures/uddf/opendiving.divejson +0 -0
  234. {divejson-0.35.1 → divejson-0.35.2}/fixtures/uddf/opendiving.uddf +0 -0
  235. {divejson-0.35.1 → divejson-0.35.2}/fixtures/uddf/owner-profile-only.divejson +0 -0
  236. {divejson-0.35.1 → divejson-0.35.2}/fixtures/uddf/owner-profile-only.uddf +0 -0
  237. {divejson-0.35.1 → divejson-0.35.2}/fixtures/uddf/people.divejson +0 -0
  238. {divejson-0.35.1 → divejson-0.35.2}/fixtures/uddf/people.uddf +0 -0
  239. {divejson-0.35.1 → divejson-0.35.2}/fixtures/uddf/shearwater-cloud-cns.divejson +0 -0
  240. {divejson-0.35.1 → divejson-0.35.2}/fixtures/uddf/shearwater-cloud-cns.uddf +0 -0
  241. {divejson-0.35.1 → divejson-0.35.2}/fixtures/uddf/shearwater-cloud.divejson +0 -0
  242. {divejson-0.35.1 → divejson-0.35.2}/fixtures/uddf/shearwater-cloud.uddf +0 -0
  243. {divejson-0.35.1 → divejson-0.35.2}/fixtures/uddf/sites.divejson +0 -0
  244. {divejson-0.35.1 → divejson-0.35.2}/fixtures/uddf/sites.uddf +0 -0
  245. {divejson-0.35.1 → divejson-0.35.2}/fixtures/uddf/subsurface.divejson +0 -0
  246. {divejson-0.35.1 → divejson-0.35.2}/fixtures/uddf/subsurface.uddf +0 -0
  247. {divejson-0.35.1 → divejson-0.35.2}/fixtures/valid/demo-logbook.divejson +0 -0
  248. {divejson-0.35.1 → divejson-0.35.2}/fixtures/valid/minimal.divejson +0 -0
  249. {divejson-0.35.1 → divejson-0.35.2}/fixtures/valid/technical-dive.divejson +0 -0
  250. {divejson-0.35.1 → divejson-0.35.2}/fixtures/valid/two-computers.divejson +0 -0
  251. {divejson-0.35.1 → divejson-0.35.2}/fixtures/write/uddf/contacts.divejson +0 -0
  252. {divejson-0.35.1 → divejson-0.35.2}/fixtures/write/uddf/contacts.uddf +0 -0
  253. {divejson-0.35.1 → divejson-0.35.2}/fixtures/write/uddf/opendiving.divejson +0 -0
  254. {divejson-0.35.1 → divejson-0.35.2}/fixtures/write/uddf/opendiving.uddf +0 -0
  255. {divejson-0.35.1 → divejson-0.35.2}/fixtures/write/uddf/owner-profile-only.divejson +0 -0
  256. {divejson-0.35.1 → divejson-0.35.2}/fixtures/write/uddf/owner-profile-only.uddf +0 -0
  257. {divejson-0.35.1 → divejson-0.35.2}/fixtures/write/uddf/people.divejson +0 -0
  258. {divejson-0.35.1 → divejson-0.35.2}/fixtures/write/uddf/people.uddf +0 -0
  259. {divejson-0.35.1 → divejson-0.35.2}/fixtures/write/uddf/technical-dive.divejson +0 -0
  260. {divejson-0.35.1 → divejson-0.35.2}/fixtures/write/uddf/technical-dive.uddf +0 -0
  261. {divejson-0.35.1 → divejson-0.35.2}/pyproject.toml +0 -0
  262. {divejson-0.35.1 → divejson-0.35.2}/schema/1.0/divejson.schema.json +0 -0
  263. {divejson-0.35.1 → divejson-0.35.2}/tests/fitbuild.py +0 -0
  264. {divejson-0.35.1 → divejson-0.35.2}/tests/fixtures/README.md +0 -0
  265. {divejson-0.35.1 → divejson-0.35.2}/tests/fixtures/uddf_3.2.2.xsd +0 -0
  266. {divejson-0.35.1 → divejson-0.35.2}/tests/helpers.py +0 -0
  267. {divejson-0.35.1 → divejson-0.35.2}/tests/shearwaterbuild.py +0 -0
  268. {divejson-0.35.1 → divejson-0.35.2}/tests/test_cli.py +0 -0
  269. {divejson-0.35.1 → divejson-0.35.2}/tests/test_conform.py +0 -0
  270. {divejson-0.35.1 → divejson-0.35.2}/tests/test_converter.py +0 -0
  271. {divejson-0.35.1 → divejson-0.35.2}/tests/test_findings.py +0 -0
  272. {divejson-0.35.1 → divejson-0.35.2}/tests/test_package.py +0 -0
  273. {divejson-0.35.1 → divejson-0.35.2}/tests/test_registry.py +0 -0
  274. {divejson-0.35.1 → divejson-0.35.2}/tests/test_release_bump.py +0 -0
  275. {divejson-0.35.1 → divejson-0.35.2}/tests/test_series.py +0 -0
  276. {divejson-0.35.1 → divejson-0.35.2}/tests/test_shearwater_db.py +0 -0
  277. {divejson-0.35.1 → divejson-0.35.2}/tests/test_shearwater_xml.py +0 -0
  278. {divejson-0.35.1 → divejson-0.35.2}/tests/test_sources.py +0 -0
  279. {divejson-0.35.1 → divejson-0.35.2}/tests/test_spec_pin.py +0 -0
  280. {divejson-0.35.1 → divejson-0.35.2}/tests/test_ssrf_fixtures.py +0 -0
  281. {divejson-0.35.1 → divejson-0.35.2}/tests/test_ssrf_parsing.py +0 -0
  282. {divejson-0.35.1 → divejson-0.35.2}/tests/test_ssrf_units.py +0 -0
  283. {divejson-0.35.1 → divejson-0.35.2}/tests/test_suunto_json_fixtures.py +0 -0
  284. {divejson-0.35.1 → divejson-0.35.2}/tests/test_suunto_json_parsing.py +0 -0
  285. {divejson-0.35.1 → divejson-0.35.2}/tests/test_suunto_json_units.py +0 -0
  286. {divejson-0.35.1 → divejson-0.35.2}/tests/test_suunto_xml_fixtures.py +0 -0
  287. {divejson-0.35.1 → divejson-0.35.2}/tests/test_suunto_xml_parsing.py +0 -0
  288. {divejson-0.35.1 → divejson-0.35.2}/tests/test_suunto_xml_units.py +0 -0
  289. {divejson-0.35.1 → divejson-0.35.2}/tests/test_uddf_fixtures.py +0 -0
  290. {divejson-0.35.1 → divejson-0.35.2}/tests/test_uddf_parsing.py +0 -0
  291. {divejson-0.35.1 → divejson-0.35.2}/tests/test_uddf_units.py +0 -0
  292. {divejson-0.35.1 → divejson-0.35.2}/tests/test_uddf_write_fixtures.py +0 -0
  293. {divejson-0.35.1 → divejson-0.35.2}/tests/test_uddf_writing.py +0 -0
  294. {divejson-0.35.1 → divejson-0.35.2}/tests/test_validate.py +0 -0
  295. {divejson-0.35.1 → divejson-0.35.2}/tests/test_xmlsource.py +0 -0
@@ -7,6 +7,17 @@ this file is about the package, whose version moves independently.
7
7
 
8
8
  ## Unreleased
9
9
 
10
+ ## 0.35.2
11
+
12
+ - **Garmin Connect FIT exports keep their samples when the session precedes them.**
13
+ The reader carries the native no-decompression time and time to surface in seconds,
14
+ ppO₂ in hundredths of a bar and CNS in tenths of a percent. Events keep their own
15
+ timestamps on the samples' recording origin, including between samples and after the
16
+ last sample, without extending the profile duration. A summary-first export with
17
+ multiple sessions is refused with a request to export each dive separately, rather
18
+ than silently losing samples or mixing untimed gas definitions. The anonymised Garmin
19
+ Connect fixture covers both gases, the four channels, gas switches and dive alerts.
20
+
10
21
  ## 0.35.1
11
22
 
12
23
  - **Reading a measurement takes linear time in every reader.** Subsurface's measured
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: divejson
3
- Version: 0.35.1
3
+ Version: 0.35.2
4
4
  Summary: Validator, converters and conformance runner for DiveJSON, an open dive-log interchange format
5
5
  Project-URL: Homepage, https://divejson.org
6
6
  Project-URL: Repository, https://github.com/divejson/divejson-py
@@ -0,0 +1 @@
1
+ 7e31b341fb636414fe1cfc543e13fa518545dbb9
@@ -25,7 +25,7 @@ specification commit named in the repository's ``SPEC_REF``, so that an installe
25
25
  resolves its own schema and needs no checkout of anything.
26
26
  """
27
27
 
28
- __version__ = "0.35.1"
28
+ __version__ = "0.35.2"
29
29
 
30
30
  SPEC_VERSION = "1.0"
31
31
 
@@ -110,6 +110,18 @@ _READING_LABELS: dict[str, str] = {
110
110
  "ceiling": "decompression ceiling",
111
111
  "temperature": "water temperature",
112
112
  "heart_rate": "heart rate",
113
+ "ndl": "no-decompression time",
114
+ "tts": "time to surface",
115
+ "ppo2": "ppO₂ reading",
116
+ "cns": "CNS reading",
117
+ }
118
+
119
+ HUNDREDTHS_PER_BAR = Decimal(100)
120
+ SAMPLED_READOUTS: dict[str, tuple[str, Decimal]] = {
121
+ "ndl": ("ndl_time", Decimal(1)),
122
+ "tts": ("time_to_surface", Decimal(1)),
123
+ "ppo2": ("po2", HUNDREDTHS_PER_BAR),
124
+ "cns": ("cns_load", TENTHS_PER_UNIT),
113
125
  }
114
126
 
115
127
  # uuid5(NAMESPACE_URL, "https://divejson.org/ns/fit"). Fixed forever: changing it would
@@ -200,16 +212,17 @@ SALINITIES = {"fresh": "fresh", "salt": "salt", "en13319": "en13319"}
200
212
  # shared enum carries — have to come out as nothing rather than be forced into a type of
201
213
  # this format's.
202
214
  #
203
- # `timer` is the deliberate omission. It is the only `event` any file in hand writes, and
204
- # its start/stop pair says where the dive begins and ends, which §6.4's `started_at` and
205
- # the profile's own axis already say twice over.
215
+ # `timer` is the deliberate omission. Its start/stop pair says where the dive begins and
216
+ # ends, which §6.4's `started_at` and the profile's own axis already say twice over. It is
217
+ # the only `event` the Suunto fixtures write; the Garmin Connect pair also carries gas
218
+ # switches and dive alerts.
206
219
  #
207
220
  # **`dive_alert` maps to `None`**, which here means an event with no `type` at all and the
208
221
  # device's wording as its `label` — §6.6's spelling of an unclassified event. The alert
209
222
  # names are deliberately *not* mapped onto §6.6's vocabulary, though several of them plainly
210
- # line up with it: no FIT file in hand carries a `dive_alert` of any kind, and this corpus
211
- # does not adopt a mapping no pair exercises. The Suunto app JSON reader has that table
212
- # because its files have the alerts.
223
+ # line up with it. The Garmin Connect pair exercises their native labels; a mapping onto
224
+ # this format's event types remains unadopted. The Suunto app JSON reader has that table
225
+ # because its files exercise that mapping.
213
226
  EVENT_TYPES: dict[str, str | None] = {
214
227
  "dive_gas_switched": "gas_switch",
215
228
  "user_marker": "bookmark",
@@ -328,17 +341,17 @@ class _Point:
328
341
  `tank_update` at one timestamp are one sample rather than two, the later of which the
329
342
  axis would drop.
330
343
 
331
- `eq=False` so a point stays hashable and compares by identity. A dataclass that
332
- generates `__eq__` sets `__hash__` to `None`, and these are used as dictionary keys —
333
- an event finds its place by looking its own instant's point up in the axis. Identity
334
- is also the comparison that means anything here: two instants that happened to record
335
- the same depth are still two samples.
344
+ `eq=False` keeps points distinct when two instants happen to record the same readings.
336
345
  """
337
346
 
338
347
  depth: Decimal | None = None
339
348
  ceiling: Decimal | None = None
340
349
  temperature: Decimal | None = None
341
350
  heart_rate: Decimal | None = None
351
+ ndl: Decimal | None = None
352
+ tts: Decimal | None = None
353
+ ppo2: Decimal | None = None
354
+ cns: Decimal | None = None
342
355
  latitude: Decimal | None = None
343
356
  longitude: Decimal | None = None
344
357
  # `gps_accuracy`, the receiver's stated horizontal error in metres, off the `record`
@@ -351,16 +364,16 @@ class _Point:
351
364
  class _Scan:
352
365
  """Everything one pass over a FIT file keeps.
353
366
 
354
- A FIT file is a stream whose summary messages come *after* the samples they summarise,
355
- so there is no cheap way to read a header: the file is decoded once and this is what
356
- survives it. Summaries are kept as frames, of which there are a handful; the sample
357
- stream is reduced to `_Point`s as it goes past.
367
+ Summaries can precede or follow the samples, so the file is decoded once and this is
368
+ what survives it. Summaries are kept as frames; the sample stream is reduced to
369
+ `_Point`s as it goes past.
358
370
  """
359
371
 
360
372
  protocol: str | None = None
361
373
  file_id: fitdecode.FitDataMessage | None = None
362
374
  session: fitdecode.FitDataMessage | None = None
363
375
  sessions: int = 0
376
+ summary_first: bool = False
364
377
  activity: fitdecode.FitDataMessage | None = None
365
378
  settings: fitdecode.FitDataMessage | None = None
366
379
  summaries: list[fitdecode.FitDataMessage] = field(default_factory=list)
@@ -429,11 +442,23 @@ def _collect(scan: _Scan, frame: fitdecode.FitDataMessage) -> None:
429
442
  `dive_summary` and `tank_summary` sit **above** that cut, because both are written
430
443
  after the session they describe and gating them on it would discard every one. They
431
444
  are bounded at the second session instead.
445
+
446
+ Garmin Connect can put the session before all samples. That single-session ordering
447
+ keeps the following stream. Multiple summary-first sessions are refused: untimed gas
448
+ definitions cannot be assigned to a dive reliably, and silently dropping or mixing
449
+ their samples would produce a misleading logbook.
432
450
  """
433
451
  name = frame.name
434
452
  if name == "file_id":
435
453
  scan.file_id = scan.file_id or frame
436
454
  elif name == "session":
455
+ if scan.sessions == 0:
456
+ scan.summary_first = not (scan.points or scan.undated)
457
+ elif scan.summary_first:
458
+ raise MalformedFitError(
459
+ "this FIT file puts a session summary before its samples and contains multiple sessions; "
460
+ "their samples and gas lists cannot be separated reliably, so export each dive as a separate FIT file"
461
+ )
437
462
  scan.sessions += 1
438
463
  scan.session = scan.session or frame
439
464
  elif name == "activity":
@@ -449,7 +474,7 @@ def _collect(scan: _Scan, frame: fitdecode.FitDataMessage) -> None:
449
474
  elif name == "tank_summary":
450
475
  if scan.sessions < 2:
451
476
  scan.tanks.append(frame)
452
- elif scan.session is not None:
477
+ elif scan.session is not None and not scan.summary_first:
453
478
  return
454
479
  elif name == "dive_gas":
455
480
  scan.gases.append(frame)
@@ -506,6 +531,8 @@ def _collect_record(scan: _Scan, frame: fitdecode.FitDataMessage) -> None:
506
531
  _set(scan, point, "temperature", _number(_native(frame, "temperature")))
507
532
  # Beats per minute already, which is the channel's unit.
508
533
  _set(scan, point, "heart_rate", _number(_native(frame, "heart_rate")))
534
+ for channel, (source, _) in SAMPLED_READOUTS.items():
535
+ _set(scan, point, channel, _number(_native(frame, source)))
509
536
  unfixed = point.latitude is None
510
537
  _set(scan, point, "latitude", _degrees(_native(frame, "position_lat")))
511
538
  _set(scan, point, "longitude", _degrees(_native(frame, "position_long")))
@@ -1452,6 +1479,11 @@ class _Converter:
1452
1479
 
1453
1480
  # -- the profile -------------------------------------------------------------
1454
1481
 
1482
+ def time_origin(self) -> datetime | None:
1483
+ """The shared origin for elapsed sample and event timestamps."""
1484
+ start = _native(self.scan.session, "start_time")
1485
+ return start if isinstance(start, datetime) else min(self.scan.points, default=None)
1486
+
1455
1487
  def axis(self, where: str) -> SampleAxis:
1456
1488
  """The dive's time axis, offered every instant the file recorded a reading at.
1457
1489
 
@@ -1474,11 +1506,10 @@ class _Converter:
1474
1506
  code="readings_at_one_instant",
1475
1507
  member=f"{RECORDING}/profile",
1476
1508
  )
1477
- if not self.scan.points:
1509
+ origin = self.time_origin()
1510
+ if origin is None:
1478
1511
  return axis
1479
1512
 
1480
- start = _native(self.scan.session, "start_time")
1481
- origin = start if isinstance(start, datetime) else min(self.scan.points)
1482
1513
  for at, point in self.scan.points.items():
1483
1514
  axis.offer(milliseconds(Decimal(str((at - origin).total_seconds()))), point)
1484
1515
  return axis
@@ -1506,6 +1537,7 @@ class _Converter:
1506
1537
  ceiling = Channel("ceiling")
1507
1538
  temperature = Channel("temperature")
1508
1539
  heart_rate = Channel("heart_rate")
1540
+ readouts = {name: Channel(name) for name in SAMPLED_READOUTS}
1509
1541
  pressures = {sensor: Channel("pressures") for sensor in sensors}
1510
1542
  for at, point in samples.ordered():
1511
1543
  if point.depth is not None:
@@ -1516,14 +1548,18 @@ class _Converter:
1516
1548
  temperature.record(at, rounded(point.temperature * HUNDREDTHS_PER_DEGREE))
1517
1549
  if point.heart_rate is not None:
1518
1550
  heart_rate.record(at, rounded(point.heart_rate))
1551
+ for name, channel in readouts.items():
1552
+ value = getattr(point, name)
1553
+ if value is not None:
1554
+ channel.record(at, rounded(value * SAMPLED_READOUTS[name][1]))
1519
1555
  for sensor, bar in point.pressures.items():
1520
1556
  if sensor in pressures and 0 <= bar <= MAX_CYLINDER_PRESSURE:
1521
1557
  pressures[sensor].record(at, rounded(bar * TENTHS_PER_UNIT))
1522
1558
 
1523
- events = self.read_events(samples, where)
1559
+ events = self.read_events(where)
1524
1560
  numbered = [(number, pressures[sensor]) for number, sensor in enumerate(sensors) if sensor in pressures]
1525
1561
  profile = samples.profile(
1526
- {"depth": depth, "ceiling": ceiling, "temperature": temperature, "heart_rate": heart_rate},
1562
+ {"depth": depth, "ceiling": ceiling, "temperature": temperature, "heart_rate": heart_rate, **readouts},
1527
1563
  pressures=numbered,
1528
1564
  events=events,
1529
1565
  )
@@ -1535,7 +1571,7 @@ class _Converter:
1535
1571
  cylinder["gas_number"] = number
1536
1572
  return profile
1537
1573
 
1538
- def read_events(self, samples: SampleAxis, where: str) -> list[dict[str, Any]]:
1574
+ def read_events(self, where: str) -> list[dict[str, Any]]:
1539
1575
  """The `event` messages that describe the dive, as §6.5 events.
1540
1576
 
1541
1577
  The one that needs work is `dive_gas_switched`, whose `data` field holds the
@@ -1549,8 +1585,9 @@ class _Converter:
1549
1585
  happened, and saying "a gas switch, to something this file does not describe" is
1550
1586
  honest where guessing a position would not be.
1551
1587
 
1552
- **Untested against a real file**: the only `event` any file in hand writes is
1553
- `timer`, which this table deliberately does not carry.
1588
+ The Garmin Connect fixture carries gas switches and labelled dive alerts.
1589
+ Bookmarks still have no device fixture; the Suunto fixtures carry only `timer`,
1590
+ which this table deliberately does not carry.
1554
1591
  """
1555
1592
  if not self.scan.events:
1556
1593
  return []
@@ -1559,11 +1596,7 @@ class _Converter:
1559
1596
  for number, index in enumerate(_native_raw(gas, "message_index") for gas in self.gases)
1560
1597
  if isinstance(index, int) and not isinstance(index, bool)
1561
1598
  }
1562
- # The axis is what decided which instants have a place and where each landed, so
1563
- # an event asks it rather than recomputing from the session's start time: a sample
1564
- # the axis dropped for sharing its millisecond with an earlier one is an instant the
1565
- # profile does not reach, and an event there has nowhere to go either.
1566
- places = {point: at for at, point in samples.ordered()}
1599
+ origin = self.time_origin()
1567
1600
 
1568
1601
  events: list[dict[str, Any]] = []
1569
1602
  for frame in self.scan.events:
@@ -1576,13 +1609,11 @@ class _Converter:
1576
1609
  at = _native(frame, "timestamp")
1577
1610
  if not isinstance(at, datetime):
1578
1611
  continue
1579
- point = self.scan.points.get(at)
1580
- placed = places.get(point) if point is not None else None
1581
- if placed is None:
1612
+ placed = milliseconds(Decimal(str((at - origin).total_seconds()))) if origin is not None else None
1613
+ if placed is None or placed < 0:
1582
1614
  self.note(
1583
1615
  where,
1584
- "An event is recorded at an instant the dive's profile does not reach, so it has no place in "
1585
- "it and is left out.",
1616
+ "An event has no recording time origin or occurs before the recording began, so it is left out.",
1586
1617
  "dropped",
1587
1618
  code="event_outside_profile",
1588
1619
  member=f"{RECORDING}/profile/events",
@@ -54,7 +54,11 @@ _CHUNK = 64 * 1024
54
54
 
55
55
 
56
56
  class DoctypeRefusingTarget(ET.TreeBuilder):
57
- """A parse target that stops the parse the moment a DTD is declared.
57
+ """A parse target that refuses a DTD the prolog scan let through.
58
+
59
+ Its error surfaces only once expat has parsed the chunk that carried the declaration,
60
+ entity references in it included, so it is the backstop for an encoding the scan
61
+ misreads and not the refusal itself.
58
62
 
59
63
  The hook is on the *target* rather than on the parser: `XMLParser.parser`, which the
60
64
  equivalent expat handler would need, no longer exists on Python 3.14, while this one
@@ -81,11 +81,14 @@ XML parser blocks external entities on its own, but it caps entity *amplificatio
81
81
  recent versions of the underlying library — a several-hundredfold blowup still parses on
82
82
  older ones, and that is a property of the library version rather than a guarantee the
83
83
  language makes. Refusing the declaration is the guarantee, it costs nothing real, and it
84
- saves taking on a hardening dependency for something one hook already settles.
85
-
86
- The refusal fires from the parser's doctype hook, which runs before a single entity
87
- reference in the content has been expanded. Every XML adapter shares one parse target, so
88
- the refusal is written once rather than per format.
84
+ saves taking on a hardening dependency for something one check already settles.
85
+
86
+ The refusal happens before the parser reads anything: the prolog is scanned for a
87
+ declaration first, and a document that carries one is never handed to the parser at all. A
88
+ refusal raised from inside the parser comes too late to bound anything, since a parser may
89
+ report the declaration only once it has worked through the input that carried it, entity
90
+ references included. Every XML adapter reads through one entry point, so the refusal is
91
+ written once rather than per format.
89
92
 
90
93
  ## Units and arithmetic
91
94
 
@@ -3,15 +3,13 @@
3
3
  **Non-normative.** The specification is [`spec/divejson.md`](https://github.com/divejson/divejson/blob/main/spec/divejson.md); nothing
4
4
  here changes what a conforming document is.
5
5
 
6
- **Several of the messages below have never been read from a device that wrote them.**
7
- `dive_summary`, `tank_summary`, `tank_update` and every `dive_gas` field except
8
- `oxygen_content`, `helium_content`, `status` and `message_index` are Garmin's, and no
9
- Garmin file is in hand: every FIT file this mapping was written against is a Suunto one, and
10
- Suunto's exporter writes none of those four messages. What stands in for a device is
11
- messages built with an encoder driven by the same profile a reader decodes through, which
12
- proves the mapping and does not prove the device. Their rows are marked **untested** below,
13
- and they stay marked until a real Descent export has been converted — a pair for one is what
14
- `fixtures/fit/` most wants next.
6
+ The corpus includes Suunto device exports and an anonymised Garmin Descent activity
7
+ exported through Garmin Connect, `fixtures/fit/garmin-connect-summary-first.fit`.
8
+ The Garmin pair exercises a session summary before its samples, native decompression
9
+ readouts, enabled gases and dive summaries. `tank_summary` and `tank_update` still have
10
+ no device fixture; their rows, and other unexercised fields, remain marked **untested**.
11
+ The fixture provenance and anonymisation are documented in
12
+ [`fixtures/README.md`](../fixtures/README.md#fit).
15
13
 
16
14
  **The rules that hold for every source format are in
17
15
  [`converting.md`](converting.md)** — leniency, identity, units and arithmetic, what a
@@ -28,8 +26,8 @@ invents its own spelling and has to be read one writer at a time.
28
26
  That cuts both ways. There is almost no unit table here, and there is no scale for a reader
29
27
  to settle — the one `resolved` finding this reader can raise is `converting.md`'s choice of
30
28
  a dive's entry or exit fix, below. What it has instead is one very sharp trap, below, and a
31
- file whose summary is written *after* the samples it summarises, so nothing can be read
32
- cheaply from a header.
29
+ stream whose summary can precede or follow its samples, so conversion reads the whole
30
+ file before building the dive.
33
31
 
34
32
  ## Parsing
35
33
 
@@ -74,8 +72,8 @@ profile.
74
72
 
75
73
  ### The file is decoded once, and the decode is bounded
76
74
 
77
- A FIT file is a stream whose `session` comes after the samples, so there is no header to
78
- read: the file is decoded in one pass and the messages a dive is built from are kept.
75
+ A device can write its `session` after the samples, while Garmin Connect can move it
76
+ before them. The file is decoded in one pass and the messages a dive is built from are kept.
79
77
 
80
78
  At most **100,000 frames** are decoded, after which the file is refused as an activity log
81
79
  rather than a dive log. Decoding is linear in frames and is the whole cost of reading a FIT,
@@ -84,15 +82,14 @@ a device really encodes a long log — is where an unbounded read hurts. The ful
84
82
  this corpus decodes to 4,339 frames for a 72-minute dive, so the cap is about 23
85
83
  times that, or roughly 28 hours of continuous logging.
86
84
 
87
- It **refuses rather than truncating**, because the summary comes last: stopping early and
88
- keeping what had arrived would discard the start time, the time in the water and the depths,
89
- and convert a confidently empty dive.
85
+ It **refuses rather than truncating**: stopping early could discard the summary or part of
86
+ the sample stream and produce an incomplete dive.
90
87
 
91
88
  **The protocol version is recorded and not gated on.** It goes into
92
- `extensions.divejson.fit_protocol_version` — 2.0 on every file in this corpus, which
93
- is the closest thing FIT has to `.ssrf`'s `@version` — and nothing branches on it. What a
94
- reader has to agree with a writer about is the message and field numbers, and those come
95
- from the profile.
89
+ `extensions.divejson.fit_protocol_version` — 1.0 on the Garmin Connect fixture and 2.0
90
+ on the Suunto fixtures, the closest thing FIT has to `.ssrf`'s `@version` — and nothing
91
+ branches on it. A reader and writer have to agree on message and field numbers, which
92
+ come from the profile.
96
93
 
97
94
  Unlike the archive's `max_members` and `max_member_size`, this cap is the adapter's rather
98
95
  than the caller's. Those bound an upload; this bounds the work one already-bounded file can
@@ -118,16 +115,26 @@ sport other than `diving` is refused too — unless it carried depth samples, wh
118
115
  stronger evidence and costs nothing to check. `sport = diving` covers every dive sub-sport:
119
116
  single and multi-gas, gauge, apnea.
120
117
 
121
- A second `session` is a second dive, and is reported and not converted. The sample stream is
122
- cut at the first one, positionally rather than by timestamp, because a `dive_gas` carries no
123
- timestamp to filter on. `dive_summary` and `tank_summary` sit above that cut, both being
124
- written after the session they describe, and are bounded at the second session instead.
118
+ For device streams whose first session follows the samples, a second `session` is a
119
+ second dive and is reported and not converted. The sample stream is cut at the first
120
+ session, positionally rather than by timestamp, because a `dive_gas` carries no timestamp
121
+ to filter on. `dive_summary` and `tank_summary` sit above that cut, both being written after
122
+ the session they describe, and are bounded at the second session instead.
123
+
124
+ A first session before any samples identifies the summary-first ordering used by Garmin
125
+ Connect. Its following samples and gas definitions belong to that session and are kept.
126
+ Gas configuration or timer events before the session do not change that ordering.
127
+ **Summary-first exports support one session only.** If another session appears, the reader
128
+ refuses the file and asks the diver to export each dive as a separate FIT file. It cannot
129
+ assign untimed gas definitions reliably across such sessions, and must not silently drop
130
+ the first dive's samples or mix profiles.
125
131
 
126
132
  ## Units
127
133
 
128
- The profile states every one, so there is nothing here for a magnitude test to settle. The
129
- scale factors below are the profile's own, applied by the decoder before this reader sees a
130
- value.
134
+ The profile supplies the units and scale factors below, applied by the decoder before
135
+ this reader sees a value. Its `po2` unit label is an exception: the profile says `percent`,
136
+ but the Garmin Connect fixture records bar scaled by 100. The readings agree with its
137
+ 21% and 50% gases at the recorded depths, so `po2` is read as bar, not percent.
131
138
 
132
139
  | what | in the file | in DiveJSON |
133
140
  | --- | --- | --- |
@@ -137,7 +144,10 @@ value.
137
144
  | heart rate | `uint8` beats per minute | whole beats per minute on a §6.5 channel |
138
145
  | elapsed and timer time | `uint32` seconds scaled by 1000 | whole seconds, halves away from zero |
139
146
  | a sample's place on the axis | `uint32` whole seconds, a `record`'s `timestamp` | milliseconds on a §6.5 axis, × 1000 |
140
- | CNS | `uint8` percent | percent |
147
+ | CNS summary | `uint8` percent | percent |
148
+ | sampled CNS | `uint8` percent | tenths of a percent |
149
+ | NDL, time to surface | `uint32` seconds | whole seconds |
150
+ | sampled ppO₂ | `uint8` bar scaled by 100 | hundredths of a bar |
141
151
  | OTU | `uint16` "OTUs" | the same number |
142
152
  | oxygen, helium | `uint8` whole percent | whole percent |
143
153
  | coordinates | `sint32` **semicircles** | decimal degrees at six places |
@@ -241,12 +251,12 @@ FIT has no field for what a device calls itself, so §6.4b's `name` has no sourc
241
251
  | field | | into |
242
252
  | --- | --- | --- |
243
253
  | `session.start_time` (2) | | `started_at`, in the zone below |
244
- | `dive_summary.bottom_time` (11) **untested**, else the derivation, else `session.total_elapsed_time` (7), else `total_timer_time` (8) | | `submerged_time` |
245
- | `session.max_depth` (141), else `dive_summary.max_depth` (3) **untested**, else the depth samples | | `max_depth` |
246
- | `dive_summary.avg_depth` (2) **untested**, else the derivation, else `session.avg_depth` (140) | | `avg_depth` |
247
- | `dive_summary.start_cns` (5) **untested**, else `session.start_cns` (143) | | the recording's `cns_start` |
248
- | `dive_summary.end_cns` (6) **untested**, else `session.end_cns` (144) | | the recording's `cns_end` |
249
- | `dive_summary.o2_toxicity` (9) **untested**, else `session.o2_toxicity` (155) | | the recording's `otu_end` |
254
+ | `dive_summary.bottom_time` (11), else the derivation, else `session.total_elapsed_time` (7), else `total_timer_time` (8) | | `submerged_time` |
255
+ | `session.max_depth` (141), else `dive_summary.max_depth` (3), else the depth samples | | `max_depth` |
256
+ | `dive_summary.avg_depth` (2), else the derivation, else `session.avg_depth` (140) | | `avg_depth` |
257
+ | `dive_summary.start_cns` (5), else `session.start_cns` (143) | | the recording's `cns_start` |
258
+ | `dive_summary.end_cns` (6), else `session.end_cns` (144) | | the recording's `cns_end` |
259
+ | `dive_summary.o2_toxicity` (9), else `session.o2_toxicity` (155) | | the recording's `otu_end` |
250
260
  | `dive_settings.water_type` (4) **untested** | | the recording's `salinity` |
251
261
 
252
262
  **The session's figures are the activity's, not the dive's.** `total_elapsed_time` is the
@@ -264,15 +274,15 @@ derives its `submerged_time` and `avg_depth` by the rule in [`converting.md`](co
264
274
  yields nothing, as readings and with no mark.
265
275
 
266
276
  `dive_summary.bottom_time` is read first as the computer's own figure for the dive, which is
267
- the one field Subsurface's Garmin parser takes a dive time from. The profile defines it no
268
- further than its name, and whether a Descent's is the dive time it displays waits on a file;
269
- the row is untested until one arrives.
277
+ the one field Subsurface's Garmin parser takes a dive time from. The Garmin Connect pair
278
+ carries this field, so the mapped time comes from its dive summary rather than the longer
279
+ session or a derivation from the sample stream.
270
280
 
271
281
  **The time in the water, the mean depth and the oxygen accounting read the summary first,
272
282
  and the maximum depth reads the session first.** On a multi-dive Garmin file the session's
273
283
  figures cover the whole activity while the `dive_summary` describes the dive being read,
274
284
  which is why the dive's own figures take the summary where there is one. A maximum has no
275
- surface time to leave out, so the session's is the dive's on every file in hand, and the
285
+ surface time to leave out, so the session is preferred where it states a maximum, and the
276
286
  summary is the fallback for a device that summarises a dive in one message and not the
277
287
  other. The CNS and OTU totals, being the computer's own figures, land on the file's one
278
288
  recording (§6.4a) rather than on the dive.
@@ -320,10 +330,11 @@ nothing is scaled. They are written **both or neither** (§6.4c), so a file stat
320
330
  yields neither and a note.
321
331
 
322
332
  **`model` is read only where it states a value.** `tissue_model_type` has exactly one member
323
- in the FIT profile, `zhl_16c`. Four of the five recordings in `fixtures/fit/` carry a
324
- `dive_settings` at all, and each of those states a gradient-factor pair with no `model`
333
+ in the FIT profile, `zhl_16c`. The four Suunto Ocean recordings in `fixtures/fit/` carry a
334
+ `dive_settings`, and each states a gradient-factor pair with no `model`
325
335
  beside it — so each produces a `deco_model` of a pair and no family, which is the honest
326
- shape, while `suunto-d5.fit` writes no `dive_settings` and gets no `deco_model`. Reading
336
+ shape, while `suunto-d5.fit` writes no `dive_settings` and gets no `deco_model`. The anonymised
337
+ Garmin pair omits configuration messages and likewise makes no deco-model claim. Reading
327
338
  "there is only one value in the enum" as "the family must be Bühlmann" would be the
328
339
  converter deciding what the device ran, and a Suunto watch writing Garmin's format is
329
340
  exactly the file that would get it wrong: the same computer's app export names an RGBM
@@ -473,6 +484,10 @@ source defect rather than a scale to reinterpret: the profile states the unit ou
473
484
  | `next_stop_depth` (93) | | the `ceiling` channel, centimetres |
474
485
  | `temperature` (13) | | the `temperature` channel, hundredths of a degree |
475
486
  | `heart_rate` (3) | | the `heart_rate` channel, whole beats per minute |
487
+ | `ndl_time` (96) | | the `ndl` channel, whole seconds |
488
+ | `time_to_surface` (95) | | the `tts` channel, whole seconds |
489
+ | `po2` (129) | | the `ppo2` channel, hundredths of a bar |
490
+ | `cns_load` (97) | | the `cns` channel, tenths of a percent |
476
491
  | `position_lat` (0) / `position_long` (1) | | `entry_position` / `exit_position` |
477
492
  | `gps_accuracy` (31) | | which fix is the entry or the exit, under *Positions*; never written. **untested** |
478
493
 
@@ -499,6 +514,12 @@ scaled like `depth` beside it. **Not** `next_stop_time` (94), `time_to_surface`
499
514
  A zero in it is not a ceiling, by `converting.md`'s rule: zero says the diver may surface
500
515
  rather than that an obligation sits at 0 m.
501
516
 
517
+ The Garmin Connect fixture carries all four native decompression channels. Zero is a
518
+ recorded value on each; FIT invalid sentinels remain absent. The decoder already returns
519
+ `po2` in bar, so the reader multiplies by 100 for hundredths of a bar. `cns_load` is percent,
520
+ so it is multiplied by 10 for tenths of a percent. These scales apply only to profile
521
+ channels; the recording's CNS summary readouts remain in percent.
522
+
502
523
  ### Positions
503
524
 
504
525
  A `record`'s `position_lat` / `position_long` pair is a fix, and which surface interval a
@@ -509,7 +530,7 @@ is stated in.
509
530
 
510
531
  **`gps_accuracy` (31) is a fix's stated error**, a `uint8` in metres that the profile defines
511
532
  on `record`, and the reader reads it off a `record` that carries a fix. It is **untested**:
512
- no file in hand writes it — not one of the five recordings in `fixtures/fit/`, and not one of
533
+ no file in hand writes it — not one of the recordings in `fixtures/fit/`, and not one of
513
534
  the 792 fix records across a personal set of 25 Suunto Ocean exports this repository does
514
535
  not carry — and whether a Garmin Descent writes it on a dive is unverified. Messages built
515
536
  with an encoder stand in for a device, as they do for the other untested rows.
@@ -525,20 +546,26 @@ because the two files do, and this one states nothing the rule could act on.
525
546
 
526
547
  ### Events — `event` (21)
527
548
 
549
+ Events use their own timestamps on the same recording origin as the samples. They remain
550
+ in the profile between samples, before the first sample or after the final sample, without
551
+ extending `profile.duration`. An event before the recording origin is reported and dropped.
552
+
528
553
  | `event` (0) | into |
529
554
  | --- | --- |
530
- | `dive_gas_switched` | `gas_switch` **untested** |
555
+ | `dive_gas_switched` | `gas_switch` |
531
556
  | `user_marker` | `bookmark` **untested** |
532
- | `dive_alert` | an event with **no `type`**, labelled **untested** |
557
+ | `dive_alert` | an event with **no `type`**, labelled |
533
558
 
534
559
  A table rather than a cast: this is Garmin's vocabulary, and the other 43 members of its
535
560
  46-member enum — `battery`, `off_course`, `power_down`, every cycling and running alert the
536
561
  shared enum holds — have to come out as nothing rather than be forced into a type of this
537
562
  format's.
538
563
 
539
- **`timer` is the deliberate omission.** It is the only `event` any file in this corpus
540
- writes, and its start/stop pair says where the dive begins and ends, which §6.4's `started_at`
541
- and the profile's own axis already say twice over.
564
+ **`timer` is the deliberate omission.** Its start/stop pair says where the dive begins and
565
+ ends, which §6.4's `started_at` and the profile's own axis already say twice over. It is
566
+ the only `event` the Suunto fixtures write. The anonymised Garmin Connect pair carries
567
+ two gas switches, 36 dive alerts and a start/stop timer pair. All retain their native
568
+ event fields and the same timestamp shift as the samples.
542
569
 
543
570
  `dive_gas_switched` carries the switched-to gas's **`message_index`** in `data` (3), which is
544
571
  the device's own key for a `dive_gas` entry and not the position §6.3 numbers a cylinder by.
@@ -553,9 +580,9 @@ the device's wording — `deco_ceiling_broken`, not a number — and an alert ou
553
580
  decodes to the bare integer, which is still more than "something happened". §6.6 requires a
554
581
  label on an event with no type, so an alert with nothing at all to say is dropped rather than
555
582
  failing the whole conversion. **The alert names are not mapped onto §6.6's vocabulary**,
556
- though several of them plainly line up with it: no FIT file in hand carries a `dive_alert` at
557
- all, and this corpus does not adopt a mapping no pair exercises. The Suunto app JSON reader
558
- has that table because its files have the alerts.
583
+ though several of them plainly line up with it. The Garmin Connect pair exercises their
584
+ native labels; a mapping onto this format's event types remains unadopted. The Suunto app
585
+ JSON reader has that table because its files exercise that mapping.
559
586
 
560
587
  **`gas_number` is asserted only where something depends on it.** §6.3 calls it a label rather
561
588
  than an array index, so the cylinders are numbered when the profile carries a pressure channel
@@ -594,24 +621,16 @@ which the `extensions.divejson.inferred` list is ever written.
594
621
  beside it until §6.4b gave a device's counter a home; it is carried now, under *Device*
595
622
  above, and a dive's `number` is still the diver's and still not this.
596
623
  - **`dive_summary.dive_number` (10)** — the same counter in a second place, **untested**:
597
- no file in hand carries a `dive_summary` at all, so nothing says whether the two ever
598
- disagree. libdivecomputer declares the field and ignores it, which is the answer here too
599
- until a file arrives that has one.
624
+ the anonymised Garmin pair omits this counter, so it does not establish whether the
625
+ session and dive-summary counters ever disagree. libdivecomputer declares the field and
626
+ ignores it, which is the answer here too until a file arrives that has one.
600
627
  - **`record.vertical_speed`, `distance`, `speed`, `altitude`, `n2_load`,
601
628
  `absolute_pressure`** — §6.5 fixes the channels a profile carries, and none of these is one
602
629
  of them.
603
- - **`record.ndl_time`, `time_to_surface`, `cns_load`, `po2` and `next_stop_time`, and
604
- `session.sub_sport`** — §6.4 now has a channel for the first four and §6.4a a `mode` the
605
- last would fill, and all six stay unmapped for a different reason: **no file in hand writes
606
- any of them.** Every FIT recording in `fixtures/fit/` carries `record` messages with
607
- every one of these fields empty, and a mapping written against a profile listing rather than
608
- a dive is the speculation this format's core rule exists to keep out. Each lands the day a
609
- file arrives that has it. `gps_accuracy` is read under *Positions* although no file writes
610
- it either, and is not this case: it maps onto no member, so reading it adds nothing to a
611
- document, and it feeds a rule `converting.md` states for every format, which a FIT file that
612
- states it should get as a Suunto app export does. `next_stop_time` appears above under *The
613
- ceiling*, as the field a reader must not mistake for a ceiling; that warning stands either
614
- way.
630
+ - **`record.next_stop_time` and `session.sub_sport`** remain unmapped. The first is not a
631
+ depth and has no dedicated channel; the second would need a fixture-backed mapping onto
632
+ the recording's `mode`. Neither field is retained in the Garmin fixture. The four native
633
+ decompression channels above are exercised by that pair and are mapped.
615
634
  - **`dive_settings.repeat_dive_interval` (17)** — "Time between surfacing and ending the
616
635
  activity": the end-of-dive delay that keeps a session running at the surface. The
617
636
  derivation needs no setting, and no file in hand states one.
@@ -49,7 +49,8 @@ namespace and no uppercase dialect that needs it, and it costs nothing to inheri
49
49
  ### A `<!DOCTYPE>` is refused outright
50
50
 
51
51
  Subsurface has no legitimate use for a document type declaration. The refusal and its
52
- reasoning are `converting.md`'s, and this reader shares the parse target that carries it.
52
+ reasoning are `converting.md`'s, and this reader parses through the entry point that carries
53
+ it.
53
54
 
54
55
  ### Every measurement carries its unit, and an unknown one is refused
55
56
 
@@ -70,7 +70,7 @@ The rules are in `converting.md`; these are the elements that produced each of t
70
70
  ### A `<!DOCTYPE>` is refused outright
71
71
 
72
72
  UDDF has no legitimate use for a document type declaration. The refusal and its reasoning
73
- are `converting.md`'s, and this reader shares the parse target that carries it.
73
+ are `converting.md`'s, and this reader parses through the entry point that carries it.
74
74
 
75
75
  ## Units
76
76