igs-slm 0.1.0b0__py3-none-any.whl

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 (447) hide show
  1. igs_slm-0.1.0b0.dist-info/LICENSE +21 -0
  2. igs_slm-0.1.0b0.dist-info/METADATA +151 -0
  3. igs_slm-0.1.0b0.dist-info/RECORD +447 -0
  4. igs_slm-0.1.0b0.dist-info/WHEEL +4 -0
  5. igs_slm-0.1.0b0.dist-info/entry_points.txt +3 -0
  6. igs_tools/__init__.py +0 -0
  7. igs_tools/connection.py +88 -0
  8. igs_tools/defines/__init__.py +8 -0
  9. igs_tools/defines/constellation.py +21 -0
  10. igs_tools/defines/data_center.py +75 -0
  11. igs_tools/defines/rinex.py +49 -0
  12. igs_tools/directory.py +247 -0
  13. igs_tools/utils.py +66 -0
  14. slm/__init__.py +21 -0
  15. slm/admin.py +674 -0
  16. slm/api/edit/__init__.py +0 -0
  17. slm/api/edit/serializers.py +316 -0
  18. slm/api/edit/views.py +1632 -0
  19. slm/api/fields.py +89 -0
  20. slm/api/filter.py +504 -0
  21. slm/api/pagination.py +55 -0
  22. slm/api/permissions.py +65 -0
  23. slm/api/public/__init__.py +0 -0
  24. slm/api/public/serializers.py +249 -0
  25. slm/api/public/views.py +606 -0
  26. slm/api/serializers.py +132 -0
  27. slm/api/views.py +148 -0
  28. slm/apps.py +323 -0
  29. slm/authentication.py +198 -0
  30. slm/bin/__init__.py +0 -0
  31. slm/bin/startproject.py +262 -0
  32. slm/bin/templates/{{ project_dir }}/pyproject.toml +35 -0
  33. slm/bin/templates/{{ project_dir }}/sites/__init__.py +0 -0
  34. slm/bin/templates/{{ project_dir }}/sites/{{ site }}/__init__.py +0 -0
  35. slm/bin/templates/{{ project_dir }}/sites/{{ site }}/base.py +15 -0
  36. slm/bin/templates/{{ project_dir }}/sites/{{ site }}/develop/__init__.py +56 -0
  37. slm/bin/templates/{{ project_dir }}/sites/{{ site }}/develop/local.py +4 -0
  38. slm/bin/templates/{{ project_dir }}/sites/{{ site }}/develop/wsgi.py +16 -0
  39. slm/bin/templates/{{ project_dir }}/sites/{{ site }}/manage.py +34 -0
  40. slm/bin/templates/{{ project_dir }}/sites/{{ site }}/production/__init__.py +61 -0
  41. slm/bin/templates/{{ project_dir }}/sites/{{ site }}/production/wsgi.py +16 -0
  42. slm/bin/templates/{{ project_dir }}/sites/{{ site }}/urls.py +7 -0
  43. slm/bin/templates/{{ project_dir }}/sites/{{ site }}/validation.py +11 -0
  44. slm/bin/templates/{{ project_dir }}/{{ extension_app }}/__init__.py +0 -0
  45. slm/bin/templates/{{ project_dir }}/{{ extension_app }}/admin.py +5 -0
  46. slm/bin/templates/{{ project_dir }}/{{ extension_app }}/apps.py +14 -0
  47. slm/bin/templates/{{ project_dir }}/{{ extension_app }}/management/__init__.py +0 -0
  48. slm/bin/templates/{{ project_dir }}/{{ extension_app }}/management/commands/__init__.py +0 -0
  49. slm/bin/templates/{{ project_dir }}/{{ extension_app }}/management/commands/import_archive.py +64 -0
  50. slm/bin/templates/{{ project_dir }}/{{ extension_app }}/migrations/__init__.py +0 -0
  51. slm/bin/templates/{{ project_dir }}/{{ extension_app }}/models.py +6 -0
  52. slm/bin/templates/{{ project_dir }}/{{ extension_app }}/templates/slm/base.html +8 -0
  53. slm/bin/templates/{{ project_dir }}/{{ extension_app }}/urls.py +10 -0
  54. slm/bin/templates/{{ project_dir }}/{{ extension_app }}/views.py +5 -0
  55. slm/defines/AlertLevel.py +24 -0
  56. slm/defines/AntennaCalibration.py +25 -0
  57. slm/defines/AntennaFeatures.py +27 -0
  58. slm/defines/AntennaReferencePoint.py +22 -0
  59. slm/defines/Aspiration.py +13 -0
  60. slm/defines/CardinalDirection.py +19 -0
  61. slm/defines/CollocationStatus.py +12 -0
  62. slm/defines/EquipmentState.py +22 -0
  63. slm/defines/FlagSeverity.py +14 -0
  64. slm/defines/FractureSpacing.py +15 -0
  65. slm/defines/FrequencyStandardType.py +15 -0
  66. slm/defines/GeodesyMLVersion.py +48 -0
  67. slm/defines/ISOCountry.py +1194 -0
  68. slm/defines/Instrumentation.py +19 -0
  69. slm/defines/LogEntryType.py +30 -0
  70. slm/defines/SLMFileType.py +18 -0
  71. slm/defines/SiteFileUploadStatus.py +61 -0
  72. slm/defines/SiteLogFormat.py +49 -0
  73. slm/defines/SiteLogStatus.py +78 -0
  74. slm/defines/TectonicPlates.py +28 -0
  75. slm/defines/__init__.py +46 -0
  76. slm/forms.py +1126 -0
  77. slm/jinja2/slm/sitelog/ascii_9char.log +346 -0
  78. slm/jinja2/slm/sitelog/legacy.log +346 -0
  79. slm/jinja2/slm/sitelog/xsd/0.4/collocationInformation.xml +12 -0
  80. slm/jinja2/slm/sitelog/xsd/0.4/condition.xml +12 -0
  81. slm/jinja2/slm/sitelog/xsd/0.4/contact.xml +52 -0
  82. slm/jinja2/slm/sitelog/xsd/0.4/formInformation.xml +5 -0
  83. slm/jinja2/slm/sitelog/xsd/0.4/frequencyStandard.xml +12 -0
  84. slm/jinja2/slm/sitelog/xsd/0.4/gnssAntenna.xml +16 -0
  85. slm/jinja2/slm/sitelog/xsd/0.4/gnssReceiver.xml +11 -0
  86. slm/jinja2/slm/sitelog/xsd/0.4/humiditySensor.xml +13 -0
  87. slm/jinja2/slm/sitelog/xsd/0.4/localEpisodicEffect.xml +10 -0
  88. slm/jinja2/slm/sitelog/xsd/0.4/moreInformation.xml +22 -0
  89. slm/jinja2/slm/sitelog/xsd/0.4/multipathSource.xml +10 -0
  90. slm/jinja2/slm/sitelog/xsd/0.4/otherInstrumentation.xml +5 -0
  91. slm/jinja2/slm/sitelog/xsd/0.4/pressureSensor.xml +12 -0
  92. slm/jinja2/slm/sitelog/xsd/0.4/radioInterference.xml +11 -0
  93. slm/jinja2/slm/sitelog/xsd/0.4/sensor.xml +16 -0
  94. slm/jinja2/slm/sitelog/xsd/0.4/signalObstruction.xml +10 -0
  95. slm/jinja2/slm/sitelog/xsd/0.4/siteIdentification.xml +22 -0
  96. slm/jinja2/slm/sitelog/xsd/0.4/siteLocation.xml +21 -0
  97. slm/jinja2/slm/sitelog/xsd/0.4/surveyedLocalTie.xml +20 -0
  98. slm/jinja2/slm/sitelog/xsd/0.4/temperatureSensor.xml +13 -0
  99. slm/jinja2/slm/sitelog/xsd/0.4/waterVaporSensor.xml +11 -0
  100. slm/jinja2/slm/sitelog/xsd/0.5/document.xml +10 -0
  101. slm/jinja2/slm/sitelog/xsd/geodesyml_0.4.xml +99 -0
  102. slm/jinja2/slm/sitelog/xsd/geodesyml_0.5.xml +112 -0
  103. slm/management/__init__.py +0 -0
  104. slm/management/commands/__init__.py +53 -0
  105. slm/management/commands/build_index.py +96 -0
  106. slm/management/commands/generate_sinex.py +675 -0
  107. slm/management/commands/head_from_index.py +541 -0
  108. slm/management/commands/import_archive.py +908 -0
  109. slm/management/commands/import_equipment.py +351 -0
  110. slm/management/commands/set_site.py +56 -0
  111. slm/management/commands/sitelog.py +144 -0
  112. slm/management/commands/synchronize.py +60 -0
  113. slm/management/commands/update_data_availability.py +167 -0
  114. slm/management/commands/validate_db.py +186 -0
  115. slm/management/commands/validate_gml.py +73 -0
  116. slm/map/__init__.py +1 -0
  117. slm/map/admin.py +5 -0
  118. slm/map/api/__init__.py +0 -0
  119. slm/map/api/edit/__init__.py +0 -0
  120. slm/map/api/edit/serializers.py +28 -0
  121. slm/map/api/edit/views.py +46 -0
  122. slm/map/api/public/__init__.py +0 -0
  123. slm/map/api/public/serializers.py +29 -0
  124. slm/map/api/public/views.py +64 -0
  125. slm/map/apps.py +7 -0
  126. slm/map/defines.py +53 -0
  127. slm/map/migrations/0001_initial.py +115 -0
  128. slm/map/migrations/__init__.py +0 -0
  129. slm/map/models.py +63 -0
  130. slm/map/static/slm/css/map.css +86 -0
  131. slm/map/static/slm/js/map.js +159 -0
  132. slm/map/templates/slm/map.html +374 -0
  133. slm/map/templates/slm/station/base.html +11 -0
  134. slm/map/templates/slm/station/edit.html +10 -0
  135. slm/map/templates/slm/top_nav.html +17 -0
  136. slm/map/templatetags/__init__.py +0 -0
  137. slm/map/templatetags/slm_map.py +18 -0
  138. slm/map/urls.py +25 -0
  139. slm/map/views.py +36 -0
  140. slm/middleware.py +29 -0
  141. slm/migrations/0001_alter_siteantenna_marker_enu_alter_sitelocation_llh_and_more.py +47 -0
  142. slm/migrations/0001_initial.py +4826 -0
  143. slm/migrations/0002_alter_dataavailability_site.py +22 -0
  144. slm/migrations/0003_remove_logentry_slm_logentr_site_lo_7a2af7_idx_and_more.py +80 -0
  145. slm/migrations/0004_alter_logentry_timestamp_and_more.py +25 -0
  146. slm/migrations/0005_alter_logentry_options_alter_logentry_section_and_more.py +46 -0
  147. slm/migrations/0006_alter_logentry_options_alter_logentry_index_together.py +24 -0
  148. slm/migrations/0007_alter_dataavailability_rate.py +23 -0
  149. slm/migrations/0008_alter_archiveindex_options_and_more.py +64 -0
  150. slm/migrations/0009_alter_archiveindex_end.py +21 -0
  151. slm/migrations/0010_alter_dataavailability_rinex_version_and_more.py +844 -0
  152. slm/migrations/0011_alter_siteidentification_fracture_spacing.py +33 -0
  153. slm/migrations/0012_alter_logentry_type.py +36 -0
  154. slm/migrations/0013_unpublishedfilesalert.py +48 -0
  155. slm/migrations/0014_sitelogpublished.py +48 -0
  156. slm/migrations/0015_alter_siteantenna_options_and_more.py +181 -0
  157. slm/migrations/0016_alter_antenna_description_alter_radome_description_and_more.py +42 -0
  158. slm/migrations/0017_alter_logentry_unique_together_and_more.py +54 -0
  159. slm/migrations/0018_afix_deleted.py +34 -0
  160. slm/migrations/0018_alter_siteantenna_options_and_more.py +244 -0
  161. slm/migrations/0019_remove_siteantenna_marker_enu_siteantenna_marker_une_and_more.py +101 -0
  162. slm/migrations/0020_alter_manufacturer_options.py +16 -0
  163. slm/migrations/0021_alter_siteform_report_type.py +23 -0
  164. slm/migrations/0022_rename_antcal_antenna_radome_slm_antcal_antenna_20827a_idx_and_more.py +297 -0
  165. slm/migrations/0023_archivedsitelog_gml_version_and_more.py +55 -0
  166. slm/migrations/0024_alter_agency_name_alter_agency_shortname.py +24 -0
  167. slm/migrations/0025_alter_archivedsitelog_log_format_and_more.py +61 -0
  168. slm/migrations/0026_alter_archivedsitelog_log_format_and_more.py +61 -0
  169. slm/migrations/0027_importalert_file_contents_importalert_findings_and_more.py +41 -0
  170. slm/migrations/0028_antenna_replaced_manufacturer_url_radome_replaced_and_more.py +46 -0
  171. slm/migrations/0029_manufacturer_full_name.py +17 -0
  172. slm/migrations/0030_alter_antenna_state_alter_radome_state_and_more.py +43 -0
  173. slm/migrations/__init__.py +0 -0
  174. slm/migrations/load_satellitesystems.py +27 -0
  175. slm/models/__init__.py +118 -0
  176. slm/models/about.py +14 -0
  177. slm/models/alerts.py +1204 -0
  178. slm/models/data.py +58 -0
  179. slm/models/equipment.py +229 -0
  180. slm/models/help.py +14 -0
  181. slm/models/index.py +428 -0
  182. slm/models/sitelog.py +4279 -0
  183. slm/models/system.py +723 -0
  184. slm/models/user.py +304 -0
  185. slm/parsing/__init__.py +786 -0
  186. slm/parsing/legacy/__init__.py +4 -0
  187. slm/parsing/legacy/binding.py +817 -0
  188. slm/parsing/legacy/parser.py +377 -0
  189. slm/parsing/xsd/__init__.py +34 -0
  190. slm/parsing/xsd/binding.py +86 -0
  191. slm/parsing/xsd/geodesyml/0.4/commonTypes.xsd +133 -0
  192. slm/parsing/xsd/geodesyml/0.4/contact.xsd +29 -0
  193. slm/parsing/xsd/geodesyml/0.4/dataStreams.xsd +129 -0
  194. slm/parsing/xsd/geodesyml/0.4/document.xsd +64 -0
  195. slm/parsing/xsd/geodesyml/0.4/equipment.xsd +427 -0
  196. slm/parsing/xsd/geodesyml/0.4/fieldMeasurement.xsd +170 -0
  197. slm/parsing/xsd/geodesyml/0.4/geodesyML.xsd +71 -0
  198. slm/parsing/xsd/geodesyml/0.4/geodeticEquipment.xsd +343 -0
  199. slm/parsing/xsd/geodesyml/0.4/geodeticMonument.xsd +147 -0
  200. slm/parsing/xsd/geodesyml/0.4/lineage.xsd +614 -0
  201. slm/parsing/xsd/geodesyml/0.4/localInterferences.xsd +131 -0
  202. slm/parsing/xsd/geodesyml/0.4/measurement.xsd +473 -0
  203. slm/parsing/xsd/geodesyml/0.4/monumentInfo.xsd +251 -0
  204. slm/parsing/xsd/geodesyml/0.4/observationSystem.xsd +429 -0
  205. slm/parsing/xsd/geodesyml/0.4/project.xsd +38 -0
  206. slm/parsing/xsd/geodesyml/0.4/quality.xsd +176 -0
  207. slm/parsing/xsd/geodesyml/0.4/referenceFrame.xsd +194 -0
  208. slm/parsing/xsd/geodesyml/0.4/siteLog.xsd +71 -0
  209. slm/parsing/xsd/geodesyml/0.5/commonTypes.xsd +133 -0
  210. slm/parsing/xsd/geodesyml/0.5/contact.xsd +29 -0
  211. slm/parsing/xsd/geodesyml/0.5/dataStreams.xsd +129 -0
  212. slm/parsing/xsd/geodesyml/0.5/document.xsd +64 -0
  213. slm/parsing/xsd/geodesyml/0.5/equipment.xsd +427 -0
  214. slm/parsing/xsd/geodesyml/0.5/fieldMeasurement.xsd +170 -0
  215. slm/parsing/xsd/geodesyml/0.5/geodesyML.xsd +71 -0
  216. slm/parsing/xsd/geodesyml/0.5/geodeticEquipment.xsd +343 -0
  217. slm/parsing/xsd/geodesyml/0.5/geodeticMonument.xsd +147 -0
  218. slm/parsing/xsd/geodesyml/0.5/lineage.xsd +614 -0
  219. slm/parsing/xsd/geodesyml/0.5/localInterferences.xsd +131 -0
  220. slm/parsing/xsd/geodesyml/0.5/measurement.xsd +473 -0
  221. slm/parsing/xsd/geodesyml/0.5/monumentInfo.xsd +306 -0
  222. slm/parsing/xsd/geodesyml/0.5/observationSystem.xsd +429 -0
  223. slm/parsing/xsd/geodesyml/0.5/project.xsd +38 -0
  224. slm/parsing/xsd/geodesyml/0.5/quality.xsd +176 -0
  225. slm/parsing/xsd/geodesyml/0.5/referenceFrame.xsd +194 -0
  226. slm/parsing/xsd/geodesyml/0.5/siteLog.xsd +73 -0
  227. slm/parsing/xsd/parser.py +116 -0
  228. slm/parsing/xsd/resolver.py +28 -0
  229. slm/receivers/__init__.py +11 -0
  230. slm/receivers/alerts.py +87 -0
  231. slm/receivers/cleanup.py +41 -0
  232. slm/receivers/event_loggers.py +175 -0
  233. slm/receivers/index.py +67 -0
  234. slm/settings/__init__.py +55 -0
  235. slm/settings/auth.py +15 -0
  236. slm/settings/ckeditor.py +14 -0
  237. slm/settings/debug.py +47 -0
  238. slm/settings/internationalization.py +12 -0
  239. slm/settings/logging.py +113 -0
  240. slm/settings/platform/__init__.py +0 -0
  241. slm/settings/platform/darwin.py +10 -0
  242. slm/settings/rest.py +21 -0
  243. slm/settings/root.py +152 -0
  244. slm/settings/routines.py +43 -0
  245. slm/settings/secrets.py +37 -0
  246. slm/settings/security.py +5 -0
  247. slm/settings/slm.py +188 -0
  248. slm/settings/static_templates.py +53 -0
  249. slm/settings/templates.py +29 -0
  250. slm/settings/uploads.py +8 -0
  251. slm/settings/urls.py +126 -0
  252. slm/settings/validation.py +196 -0
  253. slm/signals.py +250 -0
  254. slm/singleton.py +49 -0
  255. slm/static/rest_framework/css/bootstrap-tweaks.css +204 -0
  256. slm/static/rest_framework/css/bootstrap.min.css +7 -0
  257. slm/static/rest_framework/css/bootstrap.min.css.map +1 -0
  258. slm/static/rest_framework/css/default.css +82 -0
  259. slm/static/rest_framework/css/prettify.css +30 -0
  260. slm/static/rest_framework/docs/css/base.css +344 -0
  261. slm/static/rest_framework/docs/css/highlight.css +125 -0
  262. slm/static/rest_framework/docs/css/jquery.json-view.min.css +11 -0
  263. slm/static/rest_framework/docs/img/favicon.ico +0 -0
  264. slm/static/rest_framework/docs/img/grid.png +0 -0
  265. slm/static/rest_framework/docs/js/api.js +321 -0
  266. slm/static/rest_framework/docs/js/highlight.pack.js +2 -0
  267. slm/static/rest_framework/docs/js/jquery.json-view.min.js +7 -0
  268. slm/static/rest_framework/img/grid.png +0 -0
  269. slm/static/rest_framework/js/ajax-form.js +127 -0
  270. slm/static/rest_framework/js/bootstrap.bundle.min.js +7 -0
  271. slm/static/rest_framework/js/bootstrap.bundle.min.js.map +1 -0
  272. slm/static/rest_framework/js/bootstrap.min.js.map +1 -0
  273. slm/static/rest_framework/js/coreapi-0.1.1.js +2043 -0
  274. slm/static/rest_framework/js/csrf.js +52 -0
  275. slm/static/rest_framework/js/default.js +47 -0
  276. slm/static/rest_framework/js/jquery-3.5.1.min.js +2 -0
  277. slm/static/rest_framework/js/prettify-min.js +28 -0
  278. slm/static/slm/css/admin.css +3 -0
  279. slm/static/slm/css/defines.css +82 -0
  280. slm/static/slm/css/forms.css +1 -0
  281. slm/static/slm/css/style.css +1004 -0
  282. slm/static/slm/img/email-branding.png +0 -0
  283. slm/static/slm/img/favicon.ico +0 -0
  284. slm/static/slm/img/login-bg.jpg +0 -0
  285. slm/static/slm/img/slm-logo.svg +4 -0
  286. slm/static/slm/js/autocomplete.js +341 -0
  287. slm/static/slm/js/enums.js +322 -0
  288. slm/static/slm/js/fileIcons.js +30 -0
  289. slm/static/slm/js/form.js +404 -0
  290. slm/static/slm/js/formWidget.js +23 -0
  291. slm/static/slm/js/persistable.js +33 -0
  292. slm/static/slm/js/slm.js +1028 -0
  293. slm/static/slm/js/time24.js +212 -0
  294. slm/static_templates/slm/css/defines.css +26 -0
  295. slm/static_templates/slm/js/enums.js +28 -0
  296. slm/static_templates/slm/js/fileIcons.js +16 -0
  297. slm/static_templates/slm/js/urls.js +5 -0
  298. slm/templates/account/base.html +20 -0
  299. slm/templates/account/email/base.html +43 -0
  300. slm/templates/account/email/base_message.txt +7 -0
  301. slm/templates/account/email/email_confirmation_message.html +16 -0
  302. slm/templates/account/email/email_confirmation_message.txt +7 -0
  303. slm/templates/account/email/email_confirmation_signup_message.html +1 -0
  304. slm/templates/account/email/email_confirmation_signup_message.txt +1 -0
  305. slm/templates/account/email/email_confirmation_signup_subject.txt +1 -0
  306. slm/templates/account/email/email_confirmation_subject.txt +4 -0
  307. slm/templates/account/email/password_reset_key_message.html +28 -0
  308. slm/templates/account/email/password_reset_key_message.txt +9 -0
  309. slm/templates/account/email/password_reset_key_subject.txt +4 -0
  310. slm/templates/account/email/unknown_account_message.html +25 -0
  311. slm/templates/account/email/unknown_account_message.txt +12 -0
  312. slm/templates/account/email/unknown_account_subject.txt +4 -0
  313. slm/templates/account/login.html +67 -0
  314. slm/templates/account/logout.html +38 -0
  315. slm/templates/account/password_change.html +48 -0
  316. slm/templates/account/password_reset.html +51 -0
  317. slm/templates/account/password_reset_done.html +20 -0
  318. slm/templates/account/password_reset_from_key.html +52 -0
  319. slm/templates/account/password_reset_from_key_done.html +17 -0
  320. slm/templates/admin/base.html +7 -0
  321. slm/templates/messages.html +8 -0
  322. slm/templates/rest_framework/README +16 -0
  323. slm/templates/rest_framework/admin/detail.html +10 -0
  324. slm/templates/rest_framework/admin/dict_value.html +11 -0
  325. slm/templates/rest_framework/admin/list.html +32 -0
  326. slm/templates/rest_framework/admin/list_value.html +11 -0
  327. slm/templates/rest_framework/admin/simple_list_value.html +2 -0
  328. slm/templates/rest_framework/admin.html +282 -0
  329. slm/templates/rest_framework/api.html +3 -0
  330. slm/templates/rest_framework/base.html +334 -0
  331. slm/templates/rest_framework/docs/auth/basic.html +42 -0
  332. slm/templates/rest_framework/docs/auth/session.html +40 -0
  333. slm/templates/rest_framework/docs/auth/token.html +41 -0
  334. slm/templates/rest_framework/docs/document.html +37 -0
  335. slm/templates/rest_framework/docs/error.html +71 -0
  336. slm/templates/rest_framework/docs/index.html +55 -0
  337. slm/templates/rest_framework/docs/interact.html +57 -0
  338. slm/templates/rest_framework/docs/langs/javascript-intro.html +5 -0
  339. slm/templates/rest_framework/docs/langs/javascript.html +15 -0
  340. slm/templates/rest_framework/docs/langs/python-intro.html +3 -0
  341. slm/templates/rest_framework/docs/langs/python.html +13 -0
  342. slm/templates/rest_framework/docs/langs/shell-intro.html +3 -0
  343. slm/templates/rest_framework/docs/langs/shell.html +6 -0
  344. slm/templates/rest_framework/docs/link.html +113 -0
  345. slm/templates/rest_framework/docs/sidebar.html +78 -0
  346. slm/templates/rest_framework/filters/base.html +16 -0
  347. slm/templates/rest_framework/filters/ordering.html +17 -0
  348. slm/templates/rest_framework/filters/search.html +13 -0
  349. slm/templates/rest_framework/horizontal/checkbox.html +23 -0
  350. slm/templates/rest_framework/horizontal/checkbox_multiple.html +32 -0
  351. slm/templates/rest_framework/horizontal/dict_field.html +11 -0
  352. slm/templates/rest_framework/horizontal/fieldset.html +16 -0
  353. slm/templates/rest_framework/horizontal/form.html +6 -0
  354. slm/templates/rest_framework/horizontal/input.html +21 -0
  355. slm/templates/rest_framework/horizontal/list_field.html +11 -0
  356. slm/templates/rest_framework/horizontal/list_fieldset.html +13 -0
  357. slm/templates/rest_framework/horizontal/radio.html +42 -0
  358. slm/templates/rest_framework/horizontal/select.html +36 -0
  359. slm/templates/rest_framework/horizontal/select_multiple.html +38 -0
  360. slm/templates/rest_framework/horizontal/textarea.html +21 -0
  361. slm/templates/rest_framework/inline/checkbox.html +8 -0
  362. slm/templates/rest_framework/inline/checkbox_multiple.html +14 -0
  363. slm/templates/rest_framework/inline/dict_field.html +9 -0
  364. slm/templates/rest_framework/inline/fieldset.html +6 -0
  365. slm/templates/rest_framework/inline/form.html +8 -0
  366. slm/templates/rest_framework/inline/input.html +9 -0
  367. slm/templates/rest_framework/inline/list_field.html +9 -0
  368. slm/templates/rest_framework/inline/list_fieldset.html +3 -0
  369. slm/templates/rest_framework/inline/radio.html +25 -0
  370. slm/templates/rest_framework/inline/select.html +24 -0
  371. slm/templates/rest_framework/inline/select_multiple.html +25 -0
  372. slm/templates/rest_framework/inline/textarea.html +9 -0
  373. slm/templates/rest_framework/login.html +3 -0
  374. slm/templates/rest_framework/login_base.html +65 -0
  375. slm/templates/rest_framework/pagination/numbers.html +47 -0
  376. slm/templates/rest_framework/pagination/previous_and_next.html +21 -0
  377. slm/templates/rest_framework/raw_data_form.html +11 -0
  378. slm/templates/rest_framework/schema.js +3 -0
  379. slm/templates/rest_framework/vertical/checkbox.html +16 -0
  380. slm/templates/rest_framework/vertical/checkbox_multiple.html +30 -0
  381. slm/templates/rest_framework/vertical/dict_field.html +7 -0
  382. slm/templates/rest_framework/vertical/fieldset.html +13 -0
  383. slm/templates/rest_framework/vertical/form.html +6 -0
  384. slm/templates/rest_framework/vertical/input.html +17 -0
  385. slm/templates/rest_framework/vertical/list_field.html +7 -0
  386. slm/templates/rest_framework/vertical/list_fieldset.html +7 -0
  387. slm/templates/rest_framework/vertical/radio.html +40 -0
  388. slm/templates/rest_framework/vertical/select.html +34 -0
  389. slm/templates/rest_framework/vertical/select_multiple.html +31 -0
  390. slm/templates/rest_framework/vertical/textarea.html +17 -0
  391. slm/templates/slm/about.html +21 -0
  392. slm/templates/slm/alerts/alert.html +15 -0
  393. slm/templates/slm/alerts/geodesymlinvalid.html +8 -0
  394. slm/templates/slm/alerts/importalert.html +10 -0
  395. slm/templates/slm/alerts.html +18 -0
  396. slm/templates/slm/auth_menu.html +41 -0
  397. slm/templates/slm/base.html +195 -0
  398. slm/templates/slm/emails/alert_issued.html +31 -0
  399. slm/templates/slm/emails/alert_issued.txt +9 -0
  400. slm/templates/slm/emails/base.html +6 -0
  401. slm/templates/slm/emails/changes_rejected.txt +7 -0
  402. slm/templates/slm/emails/review_requested.txt +7 -0
  403. slm/templates/slm/forms/widgets/auto_complete.html +21 -0
  404. slm/templates/slm/forms/widgets/auto_complete_multiple.html +18 -0
  405. slm/templates/slm/forms/widgets/checkbox_multiple.html +6 -0
  406. slm/templates/slm/forms/widgets/inline_multi.html +1 -0
  407. slm/templates/slm/forms/widgets/splitdatetime.html +14 -0
  408. slm/templates/slm/forms/widgets/time24.html +37 -0
  409. slm/templates/slm/help.html +54 -0
  410. slm/templates/slm/messages.html +13 -0
  411. slm/templates/slm/new_site.html +88 -0
  412. slm/templates/slm/profile.html +57 -0
  413. slm/templates/slm/register.html +40 -0
  414. slm/templates/slm/reports/file_log.html +43 -0
  415. slm/templates/slm/reports/head_log.html +23 -0
  416. slm/templates/slm/reports/head_report.html +55 -0
  417. slm/templates/slm/reports/index_log.html +23 -0
  418. slm/templates/slm/reports/index_report.html +71 -0
  419. slm/templates/slm/station/alert.html +8 -0
  420. slm/templates/slm/station/alerts.html +19 -0
  421. slm/templates/slm/station/base.html +104 -0
  422. slm/templates/slm/station/download.html +87 -0
  423. slm/templates/slm/station/edit.html +283 -0
  424. slm/templates/slm/station/form.html +110 -0
  425. slm/templates/slm/station/log.html +18 -0
  426. slm/templates/slm/station/review.html +461 -0
  427. slm/templates/slm/station/upload.html +295 -0
  428. slm/templates/slm/station/uploads/attachment.html +20 -0
  429. slm/templates/slm/station/uploads/geodesyml.html +1 -0
  430. slm/templates/slm/station/uploads/image.html +27 -0
  431. slm/templates/slm/station/uploads/json.html +0 -0
  432. slm/templates/slm/station/uploads/legacy.html +77 -0
  433. slm/templates/slm/top_nav.html +14 -0
  434. slm/templates/slm/user_activity.html +16 -0
  435. slm/templates/slm/widgets/alert_scroll.html +135 -0
  436. slm/templates/slm/widgets/filelist.html +258 -0
  437. slm/templates/slm/widgets/legend.html +12 -0
  438. slm/templates/slm/widgets/log_scroll.html +88 -0
  439. slm/templates/slm/widgets/stationlist.html +233 -0
  440. slm/templatetags/__init__.py +0 -0
  441. slm/templatetags/jinja2.py +9 -0
  442. slm/templatetags/slm.py +459 -0
  443. slm/urls.py +148 -0
  444. slm/utils.py +299 -0
  445. slm/validators.py +297 -0
  446. slm/views.py +654 -0
  447. slm/widgets.py +134 -0
@@ -0,0 +1,817 @@
1
+ import re
2
+ from functools import partial
3
+ from typing import Any, Callable, Dict, List, Tuple, Union
4
+
5
+ from django.utils.translation import gettext as _
6
+
7
+ from slm.defines import (
8
+ AntennaReferencePoint,
9
+ Aspiration,
10
+ CollocationStatus,
11
+ FractureSpacing,
12
+ FrequencyStandardType,
13
+ ISOCountry,
14
+ TectonicPlates,
15
+ )
16
+ from slm.models import SatelliteSystem
17
+ from slm.parsing import (
18
+ ACCURACY_PREFIXES,
19
+ METERS,
20
+ BaseBinder,
21
+ Finding,
22
+ _Ignored,
23
+ _Warning,
24
+ remove_from_start,
25
+ to_alignment,
26
+ to_antenna,
27
+ to_date,
28
+ to_datetime,
29
+ to_decimal_degrees,
30
+ to_enum,
31
+ to_float,
32
+ to_point,
33
+ to_pressure,
34
+ to_radome,
35
+ to_receiver,
36
+ to_satellites,
37
+ to_seconds,
38
+ to_str,
39
+ )
40
+ from slm.parsing.legacy.parser import (
41
+ Error,
42
+ Ignored,
43
+ ParsedSection,
44
+ SiteLogParser,
45
+ Warn,
46
+ normalize,
47
+ )
48
+
49
+ TEMP_RANGE_REGEX = re.compile(
50
+ r"(\d+(?:[.]\d*)?)[\s()°degrsDEGRSCc]*(?:(?:-)|(?:to))\s*"
51
+ r"(\d+(?:[.]\d*)?)[\s()°degrsDEGRSCc]*"
52
+ )
53
+ TEMP_STAB_REGEX = re.compile(
54
+ r"(\d+(?:[.]\d*)?)?[\s()°degrsDEGRSCc]*(?:(?:±)|"
55
+ r"(?:\+/?-))?\s*(\d+(?:[.]\d*)?)?[\s()°degrsDEGRSCc]*"
56
+ )
57
+
58
+ DATE_PLACEHOLDERS = ["CCYY-MM-DD", "DD-MMM-YYYY"]
59
+
60
+ TEMP_STAB_PREFIXES = ["Tolerance = ", "Tolerance", "=", "~"]
61
+
62
+ param_registry = {}
63
+
64
+
65
+ def reg(name, header_index, bindings):
66
+ for binding in [bindings] if isinstance(bindings, tuple) else bindings:
67
+ param_registry.setdefault(header_index, {})[binding[0]] = name
68
+ return normalize(name)
69
+
70
+
71
+ def ignored(_, msg=""):
72
+ if msg:
73
+ return _Ignored(msg)
74
+ return _Ignored
75
+
76
+
77
+ def to_temp_stab(value):
78
+ value = remove_from_start(value, TEMP_STAB_PREFIXES)
79
+ value = value.replace("º", "") if value else value
80
+ if value.strip().lower() == "none":
81
+ return False, None, None
82
+
83
+ def get_tuple():
84
+ nominal = None
85
+ deviation = None
86
+ if value:
87
+ range_mtch = TEMP_RANGE_REGEX.match(value)
88
+ if range_mtch:
89
+ v1 = float(range_mtch.group(1))
90
+ v2 = float(range_mtch.group(2))
91
+ return True, (v1 + v2) / 2, abs(v1 - v2) / 2
92
+
93
+ deviation_mtch = TEMP_STAB_REGEX.match(value)
94
+ if deviation_mtch:
95
+ nominal = (
96
+ float(deviation_mtch.group(1)) if deviation_mtch.group(1) else None
97
+ )
98
+ deviation = (
99
+ float(deviation_mtch.group(2)) if deviation_mtch.group(2) else None
100
+ )
101
+
102
+ if deviation is None and nominal is not None and nominal <= 10:
103
+ deviation = nominal
104
+ nominal = None
105
+
106
+ return (
107
+ (nominal is not None or deviation is not None) or None,
108
+ nominal,
109
+ deviation,
110
+ )
111
+
112
+ stabilized, nominal, deviation = get_tuple()
113
+ if value and stabilized is None and nominal is None and deviation is None:
114
+ # special EPN null case, where the null value is 'deg C +/- deg C'
115
+ if (
116
+ value.lower().replace(" ", "").replace("(", "").replace(")", "")
117
+ == "degc+/-degc"
118
+ ):
119
+ return _Ignored, _Ignored, _Ignored
120
+
121
+ if "yes" in value.lower() or "indoors" in value.lower():
122
+ return _Warning(value=True, msg="Interpreted as 'stabilized'"), None, None
123
+ if value.startswith("("):
124
+ return _Ignored("Looks like a placeholder."), None, None
125
+ raise ValueError(
126
+ f'Unable to parse "{value}" into a temperature stabilization. '
127
+ f"format: deg C +/- deg C"
128
+ )
129
+ return stabilized, nominal, deviation
130
+
131
+
132
+ def effective_start(value):
133
+ try:
134
+ start_str = ""
135
+ if value.strip():
136
+ sep = "/" if "/" in value else " - "
137
+ start_str = value.split(sep)[0]
138
+ return to_date(start_str)
139
+ return None
140
+ except ValueError as ve:
141
+ if start_str.upper() in DATE_PLACEHOLDERS:
142
+ return None
143
+ raise ValueError(
144
+ f"Unable to parse {value} into an expected start date. Expected "
145
+ f"format: CCYY-MM-DD/CCYY-MM-DD"
146
+ ) from ve
147
+
148
+
149
+ def effective_end(value):
150
+ try:
151
+ end_str = ""
152
+ if value.strip():
153
+ sep = "/" if "/" in value else " - "
154
+ splt = value.split(sep)
155
+ if len(splt) > 1:
156
+ end_str = value.split(sep)[1]
157
+ return to_date(end_str)
158
+ return None
159
+ except ValueError as ve:
160
+ if end_str.upper() in DATE_PLACEHOLDERS:
161
+ return None
162
+ raise ValueError(
163
+ f"Unable to parse {value} into an expected end date. Expected "
164
+ f"format: CCYY-MM-DD/CCYY-MM-DD"
165
+ ) from ve
166
+
167
+
168
+ def no_sat_warning(line_no, parser, satellites):
169
+ if not satellites:
170
+ good_sats = " \n".join([sat.name for sat in SatelliteSystem.objects.all()])
171
+ return [
172
+ Warn(
173
+ line_no,
174
+ parser,
175
+ f"Expected constellation list delineated by '+' "
176
+ f"(e.g. GPS+GLO). Must be one of \n{good_sats}",
177
+ )
178
+ ]
179
+ return []
180
+
181
+
182
+ class SiteLogBinder(BaseBinder):
183
+ EFFECTIVE_DATES = [
184
+ (
185
+ "Effective Dates",
186
+ [("effective_start", effective_start), ("effective_end", effective_end)],
187
+ ),
188
+ ]
189
+
190
+ METEROLOGICAL_TRANSLATION = [
191
+ ("Manufacturer", ("manufacturer", to_str)),
192
+ ("Serial Number", ("serial_number", to_str)),
193
+ (
194
+ "Height Diff to Ant",
195
+ (
196
+ "height_diff",
197
+ partial(to_float, units=METERS, prefixes=ACCURACY_PREFIXES),
198
+ ),
199
+ ),
200
+ ("Calibration date", ("calibration", to_date)),
201
+ *EFFECTIVE_DATES,
202
+ ("Notes", ("notes", to_str)),
203
+ ]
204
+
205
+ ONGOING_CONDITIONS = [
206
+ *EFFECTIVE_DATES,
207
+ ("Additional Information", ("additional_information", to_str)),
208
+ ]
209
+
210
+ AGENCY_POC = [
211
+ ("Agency", ("agency", to_str)),
212
+ ("Preferred Abbreviation", ("preferred_abbreviation", to_str)),
213
+ ("Mailing Address", ("mailing_address", to_str)),
214
+ ("Primary Contact::Contact Name", ("primary_name", to_str)),
215
+ ("Primary Contact::Telephone (primary)", ("primary_phone1", to_str)),
216
+ ("Primary Contact::Telephone (secondary)", ("primary_phone2", to_str)),
217
+ ("Primary Contact::Fax", ("primary_fax", to_str)),
218
+ ("Primary Contact::E-mail", ("primary_email", to_str)),
219
+ ("Secondary Contact::Contact Name", ("secondary_name", to_str)),
220
+ ("Secondary Contact::Telephone (primary)", ("secondary_phone1", to_str)),
221
+ ("Secondary Contact::Telephone (secondary)", ("secondary_phone2", to_str)),
222
+ ("Secondary Contact::Fax", ("secondary_fax", to_str)),
223
+ ("Secondary Contact::E-mail", ("secondary_email", to_str)),
224
+ ("Additional Information", ("additional_information", to_str)),
225
+ ]
226
+
227
+ # the translation table maps binding functions and names to normalized
228
+ # parameter names. Multiple normalized parameter names can be bound to the
229
+ # same binding name and are to allow slight permissible variations in
230
+ # site log parameter names. In all cases - the "canonical" name for each
231
+ # parameter should be listed *last* in the list.
232
+
233
+ TRANSLATION_TABLE: Dict[
234
+ Union[int, Tuple[int, int]],
235
+ Dict[
236
+ str,
237
+ Union[
238
+ Tuple[str, Callable],
239
+ List[Tuple[str, Callable]],
240
+ Tuple[
241
+ str, Callable, Callable[[int, SiteLogParser, Any], List[Finding]]
242
+ ],
243
+ List[
244
+ Tuple[
245
+ str,
246
+ Callable,
247
+ Callable[[int, SiteLogParser, Any], List[Finding]],
248
+ ]
249
+ ],
250
+ Tuple[Tuple[Tuple[str, ...], str, Callable]],
251
+ ],
252
+ ],
253
+ ] = {
254
+ 0: {
255
+ reg(log_name, 0, bindings): bindings
256
+ for log_name, bindings in [
257
+ ("Prepared By", ("prepared_by", to_str)),
258
+ ("Prepared by (full name)", ("prepared_by", to_str)),
259
+ ("Date", ("date_prepared", to_date)),
260
+ ("Date Prepared", ("date_prepared", to_date)),
261
+ ("Report Type", ("report_type", to_str)),
262
+ ("If Update", ("", ignored)),
263
+ ("Previous Site Log", ("previous_log", ignored)),
264
+ ("Modified/Added Sections", ("modified_section", to_str)),
265
+ ]
266
+ },
267
+ 1: {
268
+ reg(log_name, 1, bindings): bindings
269
+ for log_name, bindings in [
270
+ ("Site Name", ("site_name", to_str)),
271
+ ("4 char ID", ("nine_character_id", ignored)),
272
+ ("Four Character ID", ("nine_character_id", ignored)),
273
+ ("Nine Character ID", ("nine_character_id", ignored)),
274
+ ("Monument Inscription", ("monument_inscription", to_str)),
275
+ ("IERS DOMES Number", ("iers_domes_number", to_str)),
276
+ ("CDP Number", ("cdp_number", to_str)),
277
+ ("Date", ("date_installed", to_datetime)),
278
+ ("Date Installed", ("date_installed", to_datetime)),
279
+ ("Monument Description", ("monument_description", to_str)),
280
+ (
281
+ "Height of the Monument (m)",
282
+ ("monument_height", partial(to_float, units=METERS)),
283
+ ),
284
+ (
285
+ "Height of the Monument",
286
+ ("monument_height", partial(to_float, units=METERS)),
287
+ ),
288
+ ("Monument Foundation", ("monument_foundation", to_str)),
289
+ (
290
+ "Foundation Depth (m)",
291
+ ("foundation_depth", partial(to_float, units=METERS)),
292
+ ),
293
+ (
294
+ "Foundation Depth",
295
+ ("foundation_depth", partial(to_float, units=METERS)),
296
+ ),
297
+ ("Marker Description", ("marker_description", to_str)),
298
+ ("Geologic Characteristic", ("geologic_characteristic", to_str)),
299
+ ("Bedrock Type", ("bedrock_type", to_str)),
300
+ ("Bedrock Condition", ("bedrock_condition", to_str)),
301
+ (
302
+ "Fracture Spacing",
303
+ ("fracture_spacing", partial(to_enum, FractureSpacing)),
304
+ ),
305
+ ("Fault Zones Nearby", ("fault_zones", to_str)),
306
+ ("Distance/activity", ("distance", to_str)),
307
+ ("Additional Information", ("additional_information", to_str)),
308
+ ]
309
+ },
310
+ 2: {
311
+ **{
312
+ reg(log_name, 2, bindings): bindings
313
+ for log_name, bindings in [
314
+ ("City", ("city", to_str)),
315
+ ("City or Town", ("city", to_str)),
316
+ ("State or Province", ("state", to_str)),
317
+ (
318
+ "Country",
319
+ ("country", partial(to_enum, ISOCountry, strict=False)),
320
+ ),
321
+ (
322
+ "Country or Region",
323
+ ("country", partial(to_enum, ISOCountry, strict=False)),
324
+ ),
325
+ ("Tectonic Plate", ("tectonic", partial(to_enum, TectonicPlates))),
326
+ ("Approximate Position", ("", ignored)),
327
+ ("X coordinate", ("x", to_float)),
328
+ ("Y coordinate", ("y", to_float)),
329
+ ("Z coordinate", ("z", to_float)),
330
+ ("Latitude", ("latitude", to_decimal_degrees)),
331
+ ("Longitude", ("longitude", to_decimal_degrees)),
332
+ ("Elevation", ("elevation", to_float)),
333
+ ("Latitude (deg)", ("latitude", to_decimal_degrees)),
334
+ ("Longitude (deg)", ("longitude", to_decimal_degrees)),
335
+ ("Elevation (m)", ("elevation", to_float)),
336
+ ("X coordinate (m)", ("x", to_float)),
337
+ ("Y coordinate (m)", ("y", to_float)),
338
+ ("Z coordinate (m)", ("z", to_float)),
339
+ ("Latitude (N is +)", ("latitude", to_decimal_degrees)),
340
+ ("Longitude (E is +)", ("longitude", to_decimal_degrees)),
341
+ ("Elevation (m,ellips.)", ("elevation", to_float)),
342
+ ("Additional Information", ("additional_information", to_str)),
343
+ ]
344
+ },
345
+ "collations": (
346
+ (("x", "y", "z"), "xyz", to_point),
347
+ (("latitude", "longitude", "elevation"), "llh", to_point),
348
+ ),
349
+ },
350
+ 3: {
351
+ reg(log_name, 3, bindings): bindings
352
+ for log_name, bindings in [
353
+ ("Type", ("receiver_type", to_receiver)),
354
+ ("Receiver Type", ("receiver_type", to_receiver)),
355
+ (
356
+ "Satellite System",
357
+ ("satellite_system", to_satellites, no_sat_warning),
358
+ ),
359
+ ("Serial Number", ("serial_number", to_str)),
360
+ ("Firmware Version", ("firmware", to_str)),
361
+ (
362
+ "Elevation Cutoff Setting",
363
+ ("elevation_cutoff", partial(to_float, units=["deg", "degrees"])),
364
+ ),
365
+ ("Date", ("installed", to_datetime)),
366
+ ("Date Installed", ("installed", to_datetime)),
367
+ ("Date Removed", ("removed", to_datetime)),
368
+ (
369
+ "Temperature Stabiliz.",
370
+ [
371
+ ("temp_stabilized", lambda val: to_temp_stab(val)[0]),
372
+ ("temp_nominal", lambda val: to_temp_stab(val)[1]),
373
+ ("temp_deviation", lambda val: to_temp_stab(val)[2]),
374
+ ],
375
+ ),
376
+ ("Additional Information", ("additional_info", to_str)),
377
+ ]
378
+ },
379
+ 4: {
380
+ **{
381
+ reg(log_name, 4, bindings): bindings
382
+ for log_name, bindings in [
383
+ ("Type", ("antenna_type", to_antenna)),
384
+ ("Antenna Type", ("antenna_type", to_antenna)),
385
+ ("Serial Number", ("serial_number", to_str)),
386
+ (
387
+ "Antenna Reference Point",
388
+ (
389
+ "reference_point",
390
+ partial(
391
+ to_enum, AntennaReferencePoint, ignored=["ARP", "n/a"]
392
+ ),
393
+ ),
394
+ ),
395
+ (
396
+ "Marker->ARP Up Ecc.",
397
+ ("marker_up", partial(to_float, units=METERS)),
398
+ ),
399
+ (
400
+ "Marker->ARP North Ecc",
401
+ ("marker_north", partial(to_float, units=METERS)),
402
+ ),
403
+ (
404
+ "Marker->ARP East Ecc",
405
+ ("marker_east", partial(to_float, units=METERS)),
406
+ ),
407
+ (
408
+ "Marker->ARP Up Ecc. (m)",
409
+ ("marker_up", partial(to_float, units=METERS)),
410
+ ),
411
+ (
412
+ "Marker->ARP North Ecc(m)",
413
+ ("marker_north", partial(to_float, units=METERS)),
414
+ ),
415
+ (
416
+ "Marker->ARP East Ecc(m)",
417
+ ("marker_east", partial(to_float, units=METERS)),
418
+ ),
419
+ # this legacy parameter was replaced by marker_une, but lots of older files
420
+ # have it so might as well parse it.
421
+ (
422
+ "Antenna Height",
423
+ ("antenna_height", partial(to_float, units=METERS)),
424
+ ),
425
+ (
426
+ "Antenna Height (m)",
427
+ ("antenna_height", partial(to_float, units=METERS)),
428
+ ),
429
+ ############################################################################
430
+ ("Alignment from True N", ("alignment", to_alignment)),
431
+ ("Degree Offset from North", ("alignment", to_alignment)),
432
+ ("Antenna Radome Type", ("radome_type", to_radome)),
433
+ ("Radome Serial Number", ("radome_serial_number", to_str)),
434
+ ("Antenna Cable Type", ("cable_type", to_str)),
435
+ (
436
+ "Antenna Cable Length",
437
+ (
438
+ "cable_length",
439
+ partial(to_float, units=METERS, prefixes=ACCURACY_PREFIXES),
440
+ ),
441
+ ),
442
+ ("Date Installed", ("installed", to_datetime)),
443
+ ("Date", ("installed", to_datetime)),
444
+ ("Date Removed", ("removed", to_datetime)),
445
+ ("Additional Information", ("additional_information", to_str)),
446
+ ]
447
+ },
448
+ "collations": (
449
+ (("marker_up", "marker_north", "marker_east"), "marker_une", to_point),
450
+ ),
451
+ "optional": {"antenna_height"},
452
+ },
453
+ 5: {
454
+ **{
455
+ reg(log_name, 5, bindings): bindings
456
+ for log_name, bindings in [
457
+ # older names
458
+ ("Monument Name", ("name", to_str)),
459
+ ("Site Ref CDP Number", ("cdp_number", to_str)),
460
+ ("Site Ref Domes Number", ("domes_number", to_str)),
461
+ ("Tied Marker Name", ("name", to_str)),
462
+ ("Tied Marker Usage", ("usage", to_str)),
463
+ ("Tied Marker CDP Number", ("cdp_number", to_str)),
464
+ ("Tied Marker DOMES Number", ("domes_number", to_str)),
465
+ ("dx", ("dx", to_float)),
466
+ ("dy", ("dy", to_float)),
467
+ ("dz", ("dz", to_float)),
468
+ ("dx (m)", ("dx", to_float)),
469
+ ("dy (m)", ("dy", to_float)),
470
+ ("dz (m)", ("dz", to_float)),
471
+ (
472
+ "Accuracy",
473
+ (
474
+ "accuracy",
475
+ partial(
476
+ to_float,
477
+ units=["mm"],
478
+ prefixes=ACCURACY_PREFIXES,
479
+ take_first=False,
480
+ ),
481
+ ),
482
+ ),
483
+ (
484
+ "Accuracy (mm)",
485
+ (
486
+ "accuracy",
487
+ partial(
488
+ to_float,
489
+ units=["mm"],
490
+ prefixes=ACCURACY_PREFIXES,
491
+ take_first=False,
492
+ ),
493
+ ),
494
+ ),
495
+ ("Survey method", ("survey_method", to_str)),
496
+ ("Date", ("measured", to_datetime)),
497
+ ("Date Measured", ("measured", to_datetime)),
498
+ ("Additional Information", ("additional_information", to_str)),
499
+ ]
500
+ },
501
+ "collations": ((("dx", "dy", "dz"), "diff_xyz", to_point),),
502
+ },
503
+ 6: {
504
+ reg(log_name, 6, bindings): bindings
505
+ for log_name, bindings in [
506
+ (
507
+ "Standard Type",
508
+ ("standard_type", partial(to_enum, FrequencyStandardType)),
509
+ ),
510
+ (
511
+ "Input Frequency",
512
+ ("input_frequency", partial(to_float, units=["MHz"])),
513
+ ),
514
+ ("Frequency", ("input_frequency", partial(to_float, units=["MHz"]))),
515
+ *EFFECTIVE_DATES,
516
+ ("Notes", ("notes", to_str)),
517
+ ]
518
+ },
519
+ 7: {
520
+ reg(log_name, 7, bindings): bindings
521
+ for log_name, bindings in [
522
+ ("Instrumentation Type", ("instrument_type", to_str)),
523
+ ("Status", ("status", partial(to_enum, CollocationStatus))),
524
+ *EFFECTIVE_DATES,
525
+ ("Notes", ("notes", to_str)),
526
+ ]
527
+ },
528
+ (8, 1): {
529
+ reg(log_name, (8, 1), bindings): bindings
530
+ for log_name, bindings in [
531
+ (
532
+ "Accuracy",
533
+ (
534
+ "accuracy",
535
+ partial(
536
+ to_float,
537
+ units=["%", "rel h", "% rel h"],
538
+ prefixes=ACCURACY_PREFIXES,
539
+ take_first=False,
540
+ ),
541
+ ),
542
+ ),
543
+ ("Humidity Sensor Model", ("model", to_str)),
544
+ ("Data Sampling Interval", ("sampling_interval", to_seconds)),
545
+ (
546
+ "Accuracy (% rel h)",
547
+ (
548
+ "accuracy",
549
+ partial(
550
+ to_float,
551
+ units=["%", "rel h", "% rel h"],
552
+ prefixes=ACCURACY_PREFIXES,
553
+ take_first=False,
554
+ ),
555
+ ),
556
+ ),
557
+ ("Aspiration", ("aspiration", partial(to_enum, Aspiration))),
558
+ *METEROLOGICAL_TRANSLATION,
559
+ ]
560
+ },
561
+ (8, 2): {
562
+ reg(log_name, (8, 2), bindings): bindings
563
+ for log_name, bindings in [
564
+ ("Pressure Sensor Model", ("model", to_str)),
565
+ ("Data Sampling Interval", ("sampling_interval", to_seconds)),
566
+ ("Accuracy", ("accuracy", to_pressure)),
567
+ *METEROLOGICAL_TRANSLATION,
568
+ ]
569
+ },
570
+ (8, 3): {
571
+ reg(log_name, (8, 3), bindings): bindings
572
+ for log_name, bindings in [
573
+ ("Temp. Sensor Model", ("model", to_str)),
574
+ ("Data Sampling Interval", ("sampling_interval", to_seconds)),
575
+ (
576
+ "Accuracy",
577
+ (
578
+ "accuracy",
579
+ partial(
580
+ to_float,
581
+ units=["deg C", "C"],
582
+ prefixes=ACCURACY_PREFIXES,
583
+ take_first=False,
584
+ ),
585
+ ),
586
+ ),
587
+ ("Aspiration", ("aspiration", partial(to_enum, Aspiration))),
588
+ *METEROLOGICAL_TRANSLATION,
589
+ ]
590
+ },
591
+ (8, 4): {
592
+ reg(log_name, (8, 4), bindings): bindings
593
+ for log_name, bindings in [
594
+ ("Water Vapor Radiometer", ("model", to_str)),
595
+ (
596
+ "Distance to Antenna",
597
+ ("distance_to_antenna", partial(to_float, units=METERS)),
598
+ ),
599
+ *METEROLOGICAL_TRANSLATION,
600
+ ]
601
+ },
602
+ (8, 5): {
603
+ reg(log_name, (8, 5), bindings): bindings
604
+ for log_name, bindings in [
605
+ ("Other Instrumentation", ("instrumentation", to_str))
606
+ ]
607
+ },
608
+ (9, 1): {
609
+ reg(log_name, (9, 1), bindings): bindings
610
+ for log_name, bindings in [
611
+ *ONGOING_CONDITIONS,
612
+ ("Radio Interferences", ("interferences", to_str)),
613
+ ("Observed Degradations", ("degradations", to_str)),
614
+ ]
615
+ },
616
+ (9, 2): {
617
+ reg(log_name, (9, 2), bindings): bindings
618
+ for log_name, bindings in [
619
+ *ONGOING_CONDITIONS,
620
+ ("Multipath Sources", ("sources", to_str)),
621
+ ]
622
+ },
623
+ (9, 3): {
624
+ reg(log_name, (9, 3), bindings): bindings
625
+ for log_name, bindings in [
626
+ *ONGOING_CONDITIONS,
627
+ ("Signal Obstructions", ("obstructions", to_str)),
628
+ ]
629
+ },
630
+ 10: {
631
+ reg(log_name, 10, bindings): bindings
632
+ for log_name, bindings in [
633
+ ("Date", EFFECTIVE_DATES[0][1]),
634
+ ("Event", ("event", to_str)),
635
+ ]
636
+ },
637
+ 11: {
638
+ reg(log_name, 11, bindings): bindings for log_name, bindings in AGENCY_POC
639
+ },
640
+ 12: {
641
+ reg(log_name, 12, bindings): bindings for log_name, bindings in AGENCY_POC
642
+ },
643
+ 13: {
644
+ reg(log_name, 13, bindings): bindings
645
+ for log_name, bindings in [
646
+ ("Primary Data Center", ("primary", to_str)),
647
+ ("Secondary Data Center", ("secondary", to_str)),
648
+ ("URL for More Information", ("more_info", to_str)),
649
+ ("Site Map", ("sitemap", to_str)),
650
+ ("Site Diagram", ("site_diagram", to_str)),
651
+ ("Horizon Mask", ("horizon_mask", to_str)),
652
+ ("Monument Description", ("monument_description", to_str)),
653
+ ("Site Pictures", ("site_picture", to_str)),
654
+ ("Additional Information", ("additional_information", to_str)),
655
+ ]
656
+ },
657
+ }
658
+
659
+ def __init__(self, parsed: SiteLogParser):
660
+ super().__init__(parsed)
661
+ for _1, section in self.parsed.sections.items():
662
+ if section.example or not section.contains_values:
663
+ continue
664
+ if section.heading_index not in self.TRANSLATION_TABLE:
665
+ for line_no in range(section.line_no, section.line_end):
666
+ self.parsed.add_finding(
667
+ Warn(
668
+ section.line_no,
669
+ self.parsed,
670
+ f"Unexpected section {section.index_string}",
671
+ section=section,
672
+ )
673
+ )
674
+ else:
675
+ self.bind_section(
676
+ section=section,
677
+ translations=self.TRANSLATION_TABLE[section.heading_index],
678
+ )
679
+
680
+ def bind_section(
681
+ self,
682
+ section: ParsedSection,
683
+ translations: Dict[
684
+ str,
685
+ Union[
686
+ Tuple[str, Callable],
687
+ List[Tuple[str, Callable]],
688
+ Tuple[
689
+ str, Callable, Callable[[int, SiteLogParser, Any], List[Finding]]
690
+ ],
691
+ List[
692
+ Tuple[
693
+ str,
694
+ Callable,
695
+ Callable[[int, SiteLogParser, Any], List[Finding]],
696
+ ]
697
+ ],
698
+ Tuple[Tuple[Tuple[str, ...], str, Callable]],
699
+ ],
700
+ ],
701
+ ) -> None:
702
+ expected = set()
703
+ binding_errors = set()
704
+ ignored = set()
705
+ optional = translations.get("optional", set())
706
+ for _1, bindings in translations.items():
707
+ if _1 in ["collations", "optional"]:
708
+ continue
709
+ for param in bindings if isinstance(bindings, list) else [bindings]:
710
+ expected.add(param[0])
711
+
712
+ for norm_name, parameter in section.parameters.items():
713
+ translation = translations.get(norm_name, None)
714
+ while not translation and "::" in norm_name:
715
+ norm_name = [part for part in norm_name.split("::") if part.strip()][0]
716
+ translation = translations.get(norm_name, None)
717
+
718
+ if not translation:
719
+ self.parsed.add_finding(
720
+ Warn(
721
+ parameter.line_no,
722
+ self.parsed,
723
+ f"Unrecognized parameter: {parameter.name}",
724
+ section=section,
725
+ )
726
+ )
727
+ continue
728
+
729
+ for param in (
730
+ translation if isinstance(translation, list) else [translation]
731
+ ):
732
+ value_check = param[2] if len(param) > 2 else lambda _1, _2, _3: []
733
+ parse = param[1]
734
+ param = param[0]
735
+ try:
736
+ value = (
737
+ parse("")
738
+ if parameter.is_placeholder
739
+ else parse(parameter.value)
740
+ )
741
+ if value == _Ignored or isinstance(value, _Ignored):
742
+ self.parsed.add_finding(
743
+ Ignored(
744
+ parameter.line_no,
745
+ self.parsed,
746
+ getattr(value, "msg", _("Parameter is ignored")),
747
+ section=section,
748
+ )
749
+ )
750
+ ignored.add(param)
751
+ elif isinstance(value, _Warning):
752
+ self.parsed.add_finding(
753
+ Warn(
754
+ parameter.line_no,
755
+ self.parsed,
756
+ value.msg,
757
+ section=section,
758
+ )
759
+ )
760
+ parameter.bind(param, value.value)
761
+ else:
762
+ parameter.bind(param, value)
763
+ for finding in value_check(
764
+ parameter.line_no, self.parsed, value
765
+ ):
766
+ self.parsed.add_finding(finding)
767
+
768
+ except Exception as err:
769
+ binding_errors.add(param)
770
+ for line_no in range(parameter.line_no, parameter.line_end + 1):
771
+ self.parsed.add_finding(
772
+ Error(line_no, self.parsed, str(err), section=section)
773
+ )
774
+
775
+ # if any binding parameters were not found attach a listing
776
+ # of them as an error to the relevant header line
777
+ missing = [
778
+ param
779
+ for param in expected
780
+ if param
781
+ and not section.get_params(param)
782
+ and param not in binding_errors
783
+ and param not in ignored
784
+ and param not in optional
785
+ ]
786
+ if missing and not self.parsed.findings.get(section.line_no):
787
+ missing = "\n".join(
788
+ {param_registry[section.heading_index][missing] for missing in missing}
789
+ )
790
+ self.parsed.add_finding(
791
+ Warn(
792
+ section.line_no,
793
+ self.parsed,
794
+ f"Missing parameters:\n{missing}",
795
+ section=section,
796
+ )
797
+ )
798
+
799
+ # run through collations and adjust bindings
800
+ if section.binding:
801
+ for collation in translations.get("collations", []):
802
+ assert len(collation) == 3
803
+ if any(param in section.binding for param in collation[0]):
804
+ try:
805
+ section.collate(
806
+ collation[0],
807
+ collation[1],
808
+ collation[2](
809
+ *[
810
+ section.binding.get(param, None)
811
+ for param in collation[0]
812
+ ]
813
+ ),
814
+ )
815
+ except Exception:
816
+ # todo
817
+ pass