terraproof 0.0.0-stage → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +356 -2
  3. package/bin/terraproof.js +4 -0
  4. package/dist/router/apply.js +147 -0
  5. package/dist/router/classify.js +111 -0
  6. package/dist/router/explain.js +9 -0
  7. package/dist/router/index.js +272 -0
  8. package/dist/router/resolve.js +239 -0
  9. package/dist/router/score.js +60 -0
  10. package/dist/router/types.js +1 -0
  11. package/dist/router/validate.js +81 -0
  12. package/instructions/engineering.md +14 -0
  13. package/instructions/security.md +14 -0
  14. package/instructions/simplicity.md +13 -0
  15. package/package.json +65 -4
  16. package/routing/DOMAIN_ROUTING.md +161 -0
  17. package/routing/ROUTER_DESIGN.md +173 -0
  18. package/routing/SKILL_MANIFEST.md +86 -0
  19. package/routing/checks.json +121 -0
  20. package/routing/collections.json +47 -0
  21. package/routing/registry.json +2211 -0
  22. package/routing/rules.json +64 -0
  23. package/skills/accuracy-assessment/SKILL.md +213 -0
  24. package/skills/accuracy-assessment/UPSTREAM.md +7 -0
  25. package/skills/accuracy-assessment/references/stratified-estimator.md +127 -0
  26. package/skills/accuracy-assessment/skill.json +103 -0
  27. package/skills/brainstorming/SKILL.md +250 -0
  28. package/skills/brainstorming/UPSTREAM.md +29 -0
  29. package/skills/brainstorming/scripts/frame-template.html +213 -0
  30. package/skills/brainstorming/scripts/helper.js +167 -0
  31. package/skills/brainstorming/scripts/server.cjs +723 -0
  32. package/skills/brainstorming/scripts/start-server.sh +209 -0
  33. package/skills/brainstorming/scripts/stop-server.sh +120 -0
  34. package/skills/brainstorming/skill.json +73 -0
  35. package/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
  36. package/skills/brainstorming/visual-companion.md +299 -0
  37. package/skills/crs-and-units/SKILL.md +200 -0
  38. package/skills/crs-and-units/UPSTREAM.md +7 -0
  39. package/skills/crs-and-units/skill.json +74 -0
  40. package/skills/design-postgis-tables/SKILL.md +494 -0
  41. package/skills/design-postgis-tables/UPSTREAM.md +21 -0
  42. package/skills/design-postgis-tables/skill.json +90 -0
  43. package/skills/gdal/SKILL.md +125 -0
  44. package/skills/gdal/UPSTREAM.md +22 -0
  45. package/skills/gdal/references/gdal-recipes.md +103 -0
  46. package/skills/gdal/skill.json +66 -0
  47. package/skills/geomaster/README.md +105 -0
  48. package/skills/geomaster/SKILL.md +366 -0
  49. package/skills/geomaster/UPSTREAM.md +21 -0
  50. package/skills/geomaster/references/advanced-gis.md +376 -0
  51. package/skills/geomaster/references/big-data.md +363 -0
  52. package/skills/geomaster/references/code-examples.md +531 -0
  53. package/skills/geomaster/references/coordinate-systems.md +364 -0
  54. package/skills/geomaster/references/core-libraries.md +273 -0
  55. package/skills/geomaster/references/data-sources.md +330 -0
  56. package/skills/geomaster/references/gis-software.md +369 -0
  57. package/skills/geomaster/references/industry-applications.md +420 -0
  58. package/skills/geomaster/references/machine-learning.md +462 -0
  59. package/skills/geomaster/references/programming-languages.md +456 -0
  60. package/skills/geomaster/references/remote-sensing.md +370 -0
  61. package/skills/geomaster/references/scientific-domains.md +416 -0
  62. package/skills/geomaster/references/specialized-topics.md +428 -0
  63. package/skills/geomaster/references/troubleshooting.md +439 -0
  64. package/skills/geomaster/skill.json +157 -0
  65. package/skills/geopandas/SKILL.md +250 -0
  66. package/skills/geopandas/UPSTREAM.md +22 -0
  67. package/skills/geopandas/references/crs-management.md +231 -0
  68. package/skills/geopandas/references/data-io.md +323 -0
  69. package/skills/geopandas/references/data-structures.md +207 -0
  70. package/skills/geopandas/references/geometric-operations.md +262 -0
  71. package/skills/geopandas/references/spatial-analysis.md +294 -0
  72. package/skills/geopandas/references/visualization.md +230 -0
  73. package/skills/geopandas/scripts/_common.py +605 -0
  74. package/skills/geopandas/scripts/crs_reprojection_plan.py +210 -0
  75. package/skills/geopandas/scripts/export_plan.py +305 -0
  76. package/skills/geopandas/scripts/geometry_validity_report.py +227 -0
  77. package/skills/geopandas/scripts/sensitive_coordinates_checklist.py +230 -0
  78. package/skills/geopandas/scripts/spatial_join_audit.py +368 -0
  79. package/skills/geopandas/scripts/vector_inventory.py +140 -0
  80. package/skills/geopandas/skill.json +116 -0
  81. package/skills/geoparquet-validation/SKILL.md +125 -0
  82. package/skills/geoparquet-validation/UPSTREAM.md +24 -0
  83. package/skills/geoparquet-validation/references/distribution-best-practices.md +118 -0
  84. package/skills/geoparquet-validation/references/gpio-commands.md +264 -0
  85. package/skills/geoparquet-validation/references/tool-comparison.md +155 -0
  86. package/skills/geoparquet-validation/skill.json +71 -0
  87. package/skills/geospatial-data-discovery/SKILL.md +49 -0
  88. package/skills/geospatial-data-discovery/UPSTREAM.md +15 -0
  89. package/skills/geospatial-data-discovery/skill.json +51 -0
  90. package/skills/geospatial-frontend/SKILL.md +86 -0
  91. package/skills/geospatial-frontend/UPSTREAM.md +23 -0
  92. package/skills/geospatial-frontend/references/design-system.md +283 -0
  93. package/skills/geospatial-frontend/references/user-preferences.md +96 -0
  94. package/skills/geospatial-frontend/skill.json +87 -0
  95. package/skills/geozarr/SKILL.md +244 -0
  96. package/skills/geozarr/UPSTREAM.md +21 -0
  97. package/skills/geozarr/skill.json +97 -0
  98. package/skills/networkx/SKILL.md +440 -0
  99. package/skills/networkx/UPSTREAM.md +22 -0
  100. package/skills/networkx/references/algorithms.md +384 -0
  101. package/skills/networkx/references/generators.md +385 -0
  102. package/skills/networkx/references/graph-basics.md +284 -0
  103. package/skills/networkx/references/io.md +457 -0
  104. package/skills/networkx/references/visualization.md +531 -0
  105. package/skills/networkx/skill.json +93 -0
  106. package/skills/raster-processing/SKILL.md +222 -0
  107. package/skills/raster-processing/UPSTREAM.md +7 -0
  108. package/skills/raster-processing/skill.json +81 -0
  109. package/skills/sar-basics/SKILL.md +202 -0
  110. package/skills/sar-basics/UPSTREAM.md +7 -0
  111. package/skills/sar-basics/references/calibration-lut.md +98 -0
  112. package/skills/sar-basics/skill.json +97 -0
  113. package/skills/satellite-preprocessing/SKILL.md +241 -0
  114. package/skills/satellite-preprocessing/UPSTREAM.md +7 -0
  115. package/skills/satellite-preprocessing/skill.json +84 -0
  116. package/skills/scientific-visualization/SKILL.md +285 -0
  117. package/skills/scientific-visualization/UPSTREAM.md +25 -0
  118. package/skills/scientific-visualization/assets/color_palettes.py +263 -0
  119. package/skills/scientific-visualization/assets/nature.mplstyle +68 -0
  120. package/skills/scientific-visualization/assets/presentation.mplstyle +68 -0
  121. package/skills/scientific-visualization/assets/publication.mplstyle +77 -0
  122. package/skills/scientific-visualization/assets/publisher_profiles.json +269 -0
  123. package/skills/scientific-visualization/references/color_palettes.md +227 -0
  124. package/skills/scientific-visualization/references/journal_requirements.md +169 -0
  125. package/skills/scientific-visualization/references/matplotlib_examples.md +336 -0
  126. package/skills/scientific-visualization/references/publication_guidelines.md +196 -0
  127. package/skills/scientific-visualization/references/sources.md +76 -0
  128. package/skills/scientific-visualization/scripts/_common.py +136 -0
  129. package/skills/scientific-visualization/scripts/export_plan.py +493 -0
  130. package/skills/scientific-visualization/scripts/figure_export.py +642 -0
  131. package/skills/scientific-visualization/scripts/image_metadata.py +731 -0
  132. package/skills/scientific-visualization/scripts/palette_audit.py +327 -0
  133. package/skills/scientific-visualization/scripts/style_presets.py +501 -0
  134. package/skills/scientific-visualization/scripts/style_preview.py +232 -0
  135. package/skills/scientific-visualization/skill.json +95 -0
  136. package/skills/spectral-indices/SKILL.md +235 -0
  137. package/skills/spectral-indices/UPSTREAM.md +7 -0
  138. package/skills/spectral-indices/skill.json +88 -0
  139. package/skills/stac-and-cloud-access/SKILL.md +209 -0
  140. package/skills/stac-and-cloud-access/UPSTREAM.md +7 -0
  141. package/skills/stac-and-cloud-access/references/run-manifest.md +94 -0
  142. package/skills/stac-and-cloud-access/skill.json +98 -0
  143. package/skills/statistical-analysis/SKILL.md +446 -0
  144. package/skills/statistical-analysis/UPSTREAM.md +24 -0
  145. package/skills/statistical-analysis/references/assumptions_and_diagnostics.md +379 -0
  146. package/skills/statistical-analysis/references/bayesian_statistics.md +686 -0
  147. package/skills/statistical-analysis/references/effect_sizes_and_power.md +649 -0
  148. package/skills/statistical-analysis/references/reporting_standards.md +482 -0
  149. package/skills/statistical-analysis/references/test_selection_guide.md +129 -0
  150. package/skills/statistical-analysis/scripts/assumption_checks.py +652 -0
  151. package/skills/statistical-analysis/skill.json +127 -0
  152. package/skills/systematic-debugging/SKILL.md +283 -0
  153. package/skills/systematic-debugging/UPSTREAM.md +28 -0
  154. package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  155. package/skills/systematic-debugging/condition-based-waiting.md +115 -0
  156. package/skills/systematic-debugging/defense-in-depth.md +122 -0
  157. package/skills/systematic-debugging/find-polluter.sh +72 -0
  158. package/skills/systematic-debugging/root-cause-tracing.md +169 -0
  159. package/skills/systematic-debugging/skill.json +88 -0
  160. package/skills/time-series-and-change/SKILL.md +217 -0
  161. package/skills/time-series-and-change/UPSTREAM.md +7 -0
  162. package/skills/time-series-and-change/references/change-methods.md +42 -0
  163. package/skills/time-series-and-change/skill.json +116 -0
  164. package/skills/vector-quality/SKILL.md +204 -0
  165. package/skills/vector-quality/UPSTREAM.md +7 -0
  166. package/skills/vector-quality/skill.json +82 -0
  167. package/skills/verification/SKILL.md +120 -0
  168. package/skills/verification/UPSTREAM.md +31 -0
  169. package/skills/verification/skill.json +67 -0
  170. package/skills/writing-plans/SKILL.md +171 -0
  171. package/skills/writing-plans/UPSTREAM.md +23 -0
  172. package/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
  173. package/skills/writing-plans/skill.json +80 -0
  174. package/sources/SOURCES.md +374 -0
  175. package/third_party/isaaccorley-geospatial-skills/LICENSE +176 -0
  176. package/third_party/isaaccorley-geospatial-skills/NOTICE.md +17 -0
  177. package/third_party/kdense-scientific-agent-skills/LICENSE +21 -0
  178. package/third_party/kdense-scientific-agent-skills/NOTICE.md +19 -0
  179. package/third_party/superpowers/LICENSE +21 -0
  180. package/third_party/superpowers/NOTICE.md +17 -0
  181. package/third_party/timescale-pg-aiguide/LICENSE +176 -0
  182. package/third_party/timescale-pg-aiguide/NOTICE.md +14 -0
@@ -0,0 +1,230 @@
1
+ # Static and interactive visualization
2
+
3
+ A map is a derived analytical artifact. It can misstate units, hide missing
4
+ data, expose exact locations, or contact third-party services even when the
5
+ underlying geometry operations are correct.
6
+
7
+ ## Privacy gate
8
+
9
+ Before plotting:
10
+
11
+ 1. classify coordinates, addresses, trajectories, parcels, facilities, and
12
+ small-area attributes for sensitivity;
13
+ 2. decide whether the audience needs exact geometry;
14
+ 3. aggregate, suppress small groups, jitter only with a defensible privacy
15
+ model, or generalize at an appropriate scale;
16
+ 4. remove direct identifiers and sensitive tooltip/popup fields;
17
+ 5. inspect the output itself—HTML, SVG, PDF, and GeoJSON can preserve exact
18
+ coordinates or attributes even when the image looks coarse.
19
+
20
+ The bundled `scripts/sensitive_coordinates_checklist.py` provides a conservative
21
+ release gate. It does not claim legal or privacy compliance.
22
+
23
+ ## Static plotting
24
+
25
+ GeoPandas `.plot()` uses Matplotlib:
26
+
27
+ ```python
28
+ import matplotlib.pyplot as plt
29
+
30
+ fig, ax = plt.subplots(figsize=(8, 6))
31
+ gdf.plot(
32
+ ax=ax,
33
+ column="rate",
34
+ cmap="viridis",
35
+ legend=True,
36
+ missing_kwds={
37
+ "color": "lightgrey",
38
+ "edgecolor": "black",
39
+ "hatch": "///",
40
+ "label": "Missing",
41
+ },
42
+ )
43
+ ax.set_title("Synthetic rate by region")
44
+ ax.set_axis_off()
45
+ fig.savefig("derived/map.png", dpi=300, bbox_inches="tight")
46
+ ```
47
+
48
+ Pin Matplotlib and optional mapping dependencies in the project lock. The
49
+ GeoPandas 1.1 tagged source tests Matplotlib >=3.7 and mapclassify >=2.5.
50
+
51
+ ### Choropleth correctness
52
+
53
+ State in the title/caption or metadata:
54
+
55
+ - variable definition, units, date, and source;
56
+ - whether values are counts, rates, densities, or percentages;
57
+ - normalization denominator and treatment of zero/missing denominators;
58
+ - classification method, number of bins, and explicit boundaries;
59
+ - color-map direction and meaning;
60
+ - missing/suppressed/out-of-scope styling;
61
+ - CRS/projection and any geographic generalization.
62
+
63
+ Raw counts over unequal polygon areas often communicate population size rather
64
+ than rate. Compute an appropriate rate/density first and retain numerator and
65
+ denominator.
66
+
67
+ `scheme=` delegates classification to mapclassify:
68
+
69
+ ```python
70
+ ax = gdf.plot(
71
+ column="rate",
72
+ scheme="quantiles",
73
+ k=5,
74
+ cmap="viridis",
75
+ legend=True,
76
+ )
77
+ ```
78
+
79
+ Quantiles balance feature counts but can place almost equal values in different
80
+ bins. Equal intervals can leave sparse bins; natural breaks are data-dependent
81
+ and make cross-map comparisons difficult. For comparisons, reuse explicit
82
+ boundaries and a common normalization.
83
+
84
+ ### Missing data
85
+
86
+ GeoPandas ignores missing values by default. That can make missing areas look
87
+ like background or water. Always count missing values and use `missing_kwds`
88
+ when they are meaningful. Distinguish:
89
+
90
+ - missing attribute;
91
+ - missing geometry;
92
+ - empty geometry;
93
+ - suppressed value;
94
+ - zero;
95
+ - outside the study area.
96
+
97
+ Do not coerce missing values to zero for visual convenience.
98
+
99
+ ### Categorical maps
100
+
101
+ Use `categorical=True` for categories and a qualitative palette. Verify category
102
+ order and legend labels; do not imply magnitude with a sequential palette.
103
+ GeoPandas 1.1.4 fixed custom categorical/boolean `legend_kwds={"labels": ...}`
104
+ being ignored by `explore()`.
105
+
106
+ ### Layering
107
+
108
+ ```python
109
+ fig, ax = plt.subplots(figsize=(8, 6))
110
+ areas.plot(ax=ax, facecolor="none", edgecolor="0.4", zorder=1)
111
+ generalized_points.plot(ax=ax, color="black", markersize=8, zorder=2)
112
+ ```
113
+
114
+ - Reproject every layer to a common CRS.
115
+ - Use `facecolor="none"` for transparent polygon faces; Python `None` means
116
+ something different.
117
+ - Choose `zorder`, alpha, and line width deliberately.
118
+ - Confirm no layer is hidden by a filled polygon.
119
+ - Keep a stable visual scale when comparing panels.
120
+
121
+ ## Projection and extent
122
+
123
+ Choose a map projection for the communication goal:
124
+
125
+ - equal-area for area comparisons;
126
+ - local conformal for local shape/angles;
127
+ - Web Mercator only when required by a web tile system;
128
+ - a suitable global projection for world views.
129
+
130
+ GeoPandas may set a latitude-dependent aspect for geographic plots, but that is
131
+ not a replacement for a chosen projection. Exact metric scale bars require a
132
+ projected CRS with known linear units and limited distortion.
133
+
134
+ Antimeridian-crossing geometries must be split/wrapped before plotting; changing
135
+ axis limits does not repair a line drawn across the map.
136
+
137
+ ## Basemaps are network and licensing dependencies
138
+
139
+ Tile helpers such as contextily and `explore(tiles=...)` can send viewport,
140
+ zoom, IP, and timing information to a provider and can disclose the study area.
141
+ They also introduce attribution, terms-of-use, caching, availability, and
142
+ reproducibility requirements.
143
+
144
+ Do not fetch tiles automatically. If a user explicitly approves a provider:
145
+
146
+ - verify its official URL, license, attribution, and usage limits;
147
+ - generalize sensitive overlays before the request;
148
+ - record provider, style, retrieval date, zoom, and tile hashes/cache;
149
+ - do not put credentials in source or generated HTML;
150
+ - use a vetted cache for reproducible/offline output where permitted.
151
+
152
+ ## Interactive `explore`
153
+
154
+ `GeoDataFrame.explore()` returns a `folium.Map`. Background tiles require CRS
155
+ metadata and normally cause network requests. Start with a no-tile,
156
+ no-attribute local draft:
157
+
158
+ ```python
159
+ interactive = generalized_gdf.explore(
160
+ tiles=None,
161
+ tooltip=False,
162
+ popup=False,
163
+ style_kwds={"fillOpacity": 0.5, "weight": 1},
164
+ )
165
+ interactive.save("derived/local-draft.html")
166
+ ```
167
+
168
+ Even `tiles=None` HTML can reference CDN-hosted JavaScript/CSS depending on the
169
+ Folium configuration. Inspect the generated HTML and use an approved offline
170
+ asset strategy before sensitive or air-gapped use.
171
+
172
+ Privacy hazards:
173
+
174
+ - `popup=True` can expose all columns;
175
+ - tooltip lists can expose addresses or unique IDs;
176
+ - coordinates are embedded in the HTML/GeoJSON;
177
+ - layer names and filenames can disclose project context;
178
+ - user-added tile URLs can leak tokens and viewport;
179
+ - sharing the HTML shares data, not just a screenshot.
180
+
181
+ For multiple layers, add only generalized/allowlisted columns and explicit
182
+ names. Do not use the interactive map as a data-access control boundary.
183
+
184
+ ## Geometry and plotting edge cases
185
+
186
+ - Empty/missing geometries are not visible; report their counts.
187
+ - Invalid polygons can render inconsistently; validate first.
188
+ - Mixed geometry types need explicit styles per type.
189
+ - Polygon holes and ring orientation should be checked after repair/export.
190
+ - Z/M are ignored by 2D plotting.
191
+ - Marker size is in display units, not map units, unless explicitly transformed.
192
+ - Alpha blending can create misleading dark areas from duplicated/overlapping
193
+ features; audit duplicate geometry and join multiplication.
194
+ - Tiny overlay slivers can dominate outlines; fix/audit topology rather than
195
+ merely hiding them.
196
+
197
+ ## Accessibility and honest design
198
+
199
+ - Prefer perceptually uniform, color-vision-aware palettes.
200
+ - Include text labels/patterns when color alone is insufficient.
201
+ - Keep legend order, labels, precision, and units consistent with the data.
202
+ - Avoid rainbow palettes and excessive classes.
203
+ - Use adequate contrast and minimum line/marker sizes.
204
+ - Include alt text/caption summarizing the main pattern and missing/suppressed
205
+ data.
206
+ - Do not imply uncertainty-free precision; display uncertainty or caveats.
207
+
208
+ ## Reproducible output
209
+
210
+ Record:
211
+
212
+ - source/output hashes and privacy/generalization decision;
213
+ - package versions, CRS, projection, extent, and antimeridian handling;
214
+ - plotted column, normalization, classification/bins, palette, missing style;
215
+ - layer order and styling;
216
+ - figure size, DPI, and format;
217
+ - tile provider/license/retrieval metadata or explicit `tiles=None`;
218
+ - tooltip/popup allowlist and HTML external-resource audit.
219
+
220
+ Raster PNG reduces direct coordinate extraction compared with SVG/HTML but is
221
+ not anonymization. Check metadata and visual landmarks before release.
222
+
223
+ ## Sources (verified 2026-07-23)
224
+
225
+ - [GeoPandas mapping and plotting guide](https://geopandas.org/en/stable/docs/user_guide/mapping.html).
226
+ - [GeoPandas interactive mapping guide](https://geopandas.org/en/stable/docs/user_guide/interactive_mapping.html).
227
+ - [GeoDataFrame.plot API](https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoDataFrame.plot.html).
228
+ - [GeoDataFrame.explore API](https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoDataFrame.explore.html).
229
+ - [GeoPandas 1.1.4 release notes](https://github.com/geopandas/geopandas/releases/tag/v1.1.4) — released 2026-06-26.
230
+ - [GeoPandas 1.1.0 release notes](https://github.com/geopandas/geopandas/releases/tag/v1.1.0) — plotting and dependency changes.