crc-framework 0.5.2__tar.gz → 0.5.3__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 (146) hide show
  1. {crc_framework-0.5.2 → crc_framework-0.5.3}/.all-contributorsrc +2 -1
  2. {crc_framework-0.5.2 → crc_framework-0.5.3}/.github/workflows/release.yaml +1 -2
  3. {crc_framework-0.5.2 → crc_framework-0.5.3}/Cargo.lock +3 -3
  4. {crc_framework-0.5.2 → crc_framework-0.5.3}/Cargo.toml +1 -1
  5. crc_framework-0.5.3/PKG-INFO +159 -0
  6. crc_framework-0.5.3/README.md +131 -0
  7. crc_framework-0.5.3/docs/README.md +35 -0
  8. crc_framework-0.5.3/docs/development.md +142 -0
  9. crc_framework-0.5.3/docs/history/wasm-quantile-consumer.md +315 -0
  10. crc_framework-0.5.3/docs/impact-contracts.md +55 -0
  11. crc_framework-0.5.2/js/README.md → crc_framework-0.5.3/docs/javascript.md +7 -58
  12. crc_framework-0.5.3/docs/python.md +307 -0
  13. crc_framework-0.5.3/docs/releases.md +72 -0
  14. crc_framework-0.5.3/js/README.md +76 -0
  15. {crc_framework-0.5.2 → crc_framework-0.5.3}/js/build.mjs +4 -1
  16. {crc_framework-0.5.2 → crc_framework-0.5.3}/js/package-lock.json +2 -2
  17. {crc_framework-0.5.2 → crc_framework-0.5.3}/js/package.json +1 -1
  18. crc_framework-0.5.3/js/publish.mjs +29 -0
  19. {crc_framework-0.5.2 → crc_framework-0.5.3}/js/test/consumer.mjs +4 -4
  20. {crc_framework-0.5.2 → crc_framework-0.5.3}/js/test/publish.test.mjs +17 -2
  21. crc_framework-0.5.2/PKG-INFO +0 -655
  22. crc_framework-0.5.2/README.md +0 -627
  23. crc_framework-0.5.2/js/publish.mjs +0 -16
  24. {crc_framework-0.5.2 → crc_framework-0.5.3}/.github/workflows/npm.yaml +0 -0
  25. {crc_framework-0.5.2 → crc_framework-0.5.3}/.gitignore +0 -0
  26. {crc_framework-0.5.2 → crc_framework-0.5.3}/.python-version +0 -0
  27. {crc_framework-0.5.2 → crc_framework-0.5.3}/LICENSE +0 -0
  28. {crc_framework-0.5.2 → crc_framework-0.5.3}/THIRD_PARTY_NOTICES.md +0 -0
  29. {crc_framework-0.5.2 → crc_framework-0.5.3}/build.rs +0 -0
  30. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/Cargo.toml +0 -0
  31. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/canonical.rs +0 -0
  32. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/constants.rs +0 -0
  33. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/distribution/lmoments.rs +0 -0
  34. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/distribution.rs +0 -0
  35. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/error.rs +0 -0
  36. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/impact/definition.rs +0 -0
  37. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/impact/error.rs +0 -0
  38. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/impact/expectation.rs +0 -0
  39. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/impact/json.rs +0 -0
  40. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/impact/kernel.rs +0 -0
  41. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/impact/mod.rs +0 -0
  42. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/impact/pushforward.rs +0 -0
  43. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/impact/quadrature.rs +0 -0
  44. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/impact/record.rs +0 -0
  45. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/impact/reference.rs +0 -0
  46. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/impact/registry.rs +0 -0
  47. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/impact/source.rs +0 -0
  48. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/lib.rs +0 -0
  49. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/metrics.rs +0 -0
  50. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/reference/climate/ag_params.rs +0 -0
  51. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/reference/climate/energy_params.rs +0 -0
  52. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/reference/climate/flood_params.rs +0 -0
  53. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/reference/climate/mod.rs +0 -0
  54. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/reference/climate/precipitation_thresholds.rs +0 -0
  55. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/reference/climate/spei_params.rs +0 -0
  56. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/reference/climate/wind_params.rs +0 -0
  57. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/reference/curve_fitting.rs +0 -0
  58. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/reference/mod.rs +0 -0
  59. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/reference/spatial/continent_r4.rs +0 -0
  60. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/reference/spatial/geography_r5.rs +0 -0
  61. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/reference/spatial/ipcc.rs +0 -0
  62. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/reference/spatial/mod.rs +0 -0
  63. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/risk.rs +0 -0
  64. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/spatial.rs +0 -0
  65. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/src/transform.rs +0 -0
  66. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/tests/canonical_consumer.rs +0 -0
  67. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/tests/censored_quantile_fit.rs +0 -0
  68. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/tests/impact_contract_canonical.rs +0 -0
  69. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/tests/impact_definition_conformance.rs +0 -0
  70. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/tests/impact_operations.rs +0 -0
  71. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/tests/impact_registry_conformance.rs +0 -0
  72. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/tests/quantile_fit_golden.rs +0 -0
  73. {crc_framework-0.5.2 → crc_framework-0.5.3}/crates/core/tests/quantile_fit_golden.txt +0 -0
  74. {crc_framework-0.5.2 → crc_framework-0.5.3}/js/.nvmrc +0 -0
  75. {crc_framework-0.5.2 → crc_framework-0.5.3}/js/src/index.d.ts +0 -0
  76. {crc_framework-0.5.2 → crc_framework-0.5.3}/js/src/index.js +0 -0
  77. {crc_framework-0.5.2 → crc_framework-0.5.3}/js/test/benchmark.mjs +0 -0
  78. {crc_framework-0.5.2 → crc_framework-0.5.3}/js/test/browser.html +0 -0
  79. {crc_framework-0.5.2 → crc_framework-0.5.3}/js/test/browser.mjs +0 -0
  80. {crc_framework-0.5.2 → crc_framework-0.5.3}/js/test/parity.test.mjs +0 -0
  81. {crc_framework-0.5.2 → crc_framework-0.5.3}/pyproject.toml +0 -0
  82. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/__init__.py +0 -0
  83. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/_core.pyi +0 -0
  84. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/constants.py +0 -0
  85. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/__init__.py +0 -0
  86. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/catalogs/error-codes.json +0 -0
  87. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/catalogs/hazard-exposures.json +0 -0
  88. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/catalogs/native-capabilities.json +0 -0
  89. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/catalogs/registry-overrides.json +0 -0
  90. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/catalogs/semantics-constants.json +0 -0
  91. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/catalogs/unit-aliases.json +0 -0
  92. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/fixtures/canonical-json.json +0 -0
  93. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/fixtures/definitions.json +0 -0
  94. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/fixtures/evaluation-records.json +0 -0
  95. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/fixtures/monotonicity.json +0 -0
  96. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/fixtures/operations.json +0 -0
  97. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/fixtures/point-evaluations.json +0 -0
  98. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/fixtures/registry-references.json +0 -0
  99. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/fixtures/spatial-policies.json +0 -0
  100. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/fixtures/spatial-records.json +0 -0
  101. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/manifest.json +0 -0
  102. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/schemas/impact-definition-1.0.schema.json +0 -0
  103. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/schemas/impact-evaluation-record-1.0.schema.json +0 -0
  104. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/schemas/registry-impact-reference-1.0.schema.json +0 -0
  105. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/schemas/spatial-combination-policy-1.0.schema.json +0 -0
  106. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/contracts/impact/schemas/spatial-impact-evaluation-record-1.0.schema.json +0 -0
  107. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/distributions/__init__.py +0 -0
  108. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/distributions/base.py +0 -0
  109. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/distributions/empirical.py +0 -0
  110. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/distributions/fitted.py +0 -0
  111. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/distributions/fitting.py +0 -0
  112. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/distributions/hurdle.py +0 -0
  113. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/distributions/point_mass.py +0 -0
  114. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/distributions/tabulated.py +0 -0
  115. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/impacts/__init__.py +0 -0
  116. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/metrics/__init__.py +0 -0
  117. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/metrics/distribution.py +0 -0
  118. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/metrics/microscores.py +0 -0
  119. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/metrics/risk.py +0 -0
  120. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/metrics/spanning.py +0 -0
  121. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/models.py +0 -0
  122. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/py.typed +0 -0
  123. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/spatial.py +0 -0
  124. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/transforms/__init__.py +0 -0
  125. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/transforms/base.py +0 -0
  126. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/transforms/builtin.py +0 -0
  127. {crc_framework-0.5.2 → crc_framework-0.5.3}/python/crc_framework/transforms/climate.py +0 -0
  128. {crc_framework-0.5.2 → crc_framework-0.5.3}/src/impact.rs +0 -0
  129. {crc_framework-0.5.2 → crc_framework-0.5.3}/src/lib.rs +0 -0
  130. {crc_framework-0.5.2 → crc_framework-0.5.3}/tests/fixtures/canonical-quantiles.json +0 -0
  131. {crc_framework-0.5.2 → crc_framework-0.5.3}/tests/test_consumer_parity.py +0 -0
  132. {crc_framework-0.5.2 → crc_framework-0.5.3}/tests/test_impact_contracts.py +0 -0
  133. {crc_framework-0.5.2 → crc_framework-0.5.3}/tests/test_impact_expression.py +0 -0
  134. {crc_framework-0.5.2 → crc_framework-0.5.3}/tests/test_impacts.py +0 -0
  135. {crc_framework-0.5.2 → crc_framework-0.5.3}/tests/test_lmoments.py +0 -0
  136. {crc_framework-0.5.2 → crc_framework-0.5.3}/tests/test_sdk.py +0 -0
  137. {crc_framework-0.5.2 → crc_framework-0.5.3}/tests/typing_smoke.py +0 -0
  138. {crc_framework-0.5.2 → crc_framework-0.5.3}/tools/benchmark_lmoments.py +0 -0
  139. {crc_framework-0.5.2 → crc_framework-0.5.3}/tools/benchmarks/lmoments-audit-m2-pro.json +0 -0
  140. {crc_framework-0.5.2 → crc_framework-0.5.3}/tools/generate_consumer_fixtures.py +0 -0
  141. {crc_framework-0.5.2 → crc_framework-0.5.3}/tools/impact_contracts/cases.py +0 -0
  142. {crc_framework-0.5.2 → crc_framework-0.5.3}/tools/impact_contracts/generate.py +0 -0
  143. {crc_framework-0.5.2 → crc_framework-0.5.3}/tools/impact_contracts/reference.py +0 -0
  144. {crc_framework-0.5.2 → crc_framework-0.5.3}/tools/impact_contracts/schemas.py +0 -0
  145. {crc_framework-0.5.2 → crc_framework-0.5.3}/tools/requirements-lmoments-benchmark.txt +0 -0
  146. {crc_framework-0.5.2 → crc_framework-0.5.3}/uv.lock +0 -0
@@ -4,7 +4,8 @@
4
4
  "repoType": "github",
5
5
  "repoHost": "https://github.com",
6
6
  "files": [
7
- "README.md"
7
+ "README.md",
8
+ "js/README.md"
8
9
  ],
9
10
  "imageSize": 80,
10
11
  "contributorsPerLine": 7,
@@ -111,7 +111,6 @@ jobs:
111
111
  environment: production
112
112
  runs-on: ubuntu-latest
113
113
  needs: [linux, macos, sdist]
114
- continue-on-error: true
115
114
  steps:
116
115
  - uses: actions/checkout@v4
117
116
 
@@ -129,7 +128,7 @@ jobs:
129
128
  generate_release_notes: true
130
129
  fail_on_unmatched_files: true
131
130
  draft: false
132
- prerelease: false
131
+ prerelease: ${{ contains(github.ref_name, '-') }}
133
132
  files: ${{ steps.download.outputs.download-path }}/*
134
133
 
135
134
  - name: Publish package distributions to PyPI
@@ -67,7 +67,7 @@ dependencies = [
67
67
 
68
68
  [[package]]
69
69
  name = "crc-framework-core"
70
- version = "0.5.2"
70
+ version = "0.5.3"
71
71
  dependencies = [
72
72
  "h3o",
73
73
  "phf",
@@ -79,7 +79,7 @@ dependencies = [
79
79
 
80
80
  [[package]]
81
81
  name = "crc-framework-rs"
82
- version = "0.5.2"
82
+ version = "0.5.3"
83
83
  dependencies = [
84
84
  "crc-framework-core",
85
85
  "h3o",
@@ -88,7 +88,7 @@ dependencies = [
88
88
 
89
89
  [[package]]
90
90
  name = "crc-framework-wasm"
91
- version = "0.5.2"
91
+ version = "0.5.3"
92
92
  dependencies = [
93
93
  "crc-framework-core",
94
94
  "js-sys",
@@ -12,7 +12,7 @@ readme = "README.md"
12
12
  members = ["crates/core"]
13
13
 
14
14
  [workspace.package]
15
- version = "0.5.2"
15
+ version = "0.5.3"
16
16
 
17
17
  [lib]
18
18
  name = "_core"
@@ -0,0 +1,159 @@
1
+ Metadata-Version: 2.4
2
+ Name: crc-framework
3
+ Version: 0.5.3
4
+ Classifier: Development Status :: 3 - Alpha
5
+ Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
6
+ Classifier: Operating System :: OS Independent
7
+ Classifier: Programming Language :: Rust
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: Implementation :: CPython
10
+ Classifier: Typing :: Typed
11
+ Requires-Dist: numpy>=1.23
12
+ Requires-Dist: jsonschema>=4.18 ; extra == 'test'
13
+ Requires-Dist: mypy ; extra == 'test'
14
+ Requires-Dist: pytest ; extra == 'test'
15
+ Provides-Extra: test
16
+ License-File: LICENSE
17
+ License-File: THIRD_PARTY_NOTICES.md
18
+ Summary: Rust computation core and Python bindings for the Climate Risk Commons Framework
19
+ Keywords: climate-risk,probability-distributions,risk-metrics,rust
20
+ Author: Riskthinking.AI
21
+ License-Expression: AGPL-3.0-or-later
22
+ Requires-Python: >=3.11
23
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
24
+ Project-URL: Homepage, https://github.com/RiskThinking/crc-framework-rs
25
+ Project-URL: Issues, https://github.com/RiskThinking/crc-framework-rs/issues
26
+ Project-URL: Repository, https://github.com/RiskThinking/crc-framework-rs
27
+
28
+ # Climate Risk Commons Framework
29
+
30
+ CRC Framework provides a shared Rust computation core with official Python and
31
+ JavaScript/WebAssembly bindings for climate-risk calculations. It turns hazard
32
+ distributions into comparable impact microscores, scenario branches, and
33
+ portfolio-level VaR/CVaR risk metrics.
34
+
35
+ | Interface | Package | Scope |
36
+ | --- | --- | --- |
37
+ | Python | `crc-framework` on PyPI; import `crc_framework` | Distributions, fitting, impacts, microscores, risk aggregation, and geography |
38
+ | JavaScript / WASM | `@climateriskcommons/crc-framework` on npm | Canonical CRC curve consumption: quantile evaluation, batches, prepared handles, and TypeScript declarations |
39
+ | Rust | `crates/core` | Shared algorithms and reference data used by both bindings |
40
+
41
+ The JavaScript binding consumes canonical curves, including PMTiles/MVT
42
+ properties. Python also supports fitting, impacts, and portfolio risk.
43
+ Application-specific workflows belong in packages built on this framework.
44
+
45
+ [Installation](#installation) · [Quick start](#quick-start) · [Guides](#guides-and-next-steps)
46
+
47
+ ## Contributors
48
+
49
+ Thanks to the people who shape this project through code, reviews, research,
50
+ and internal discussions and ideas.
51
+
52
+ <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
53
+ <!-- prettier-ignore-start -->
54
+ <!-- markdownlint-disable -->
55
+ <table>
56
+ <tbody>
57
+ <tr>
58
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/ChrisHampu"><img src="https://avatars.githubusercontent.com/u/6600532?s=80" width="80" alt="@ChrisHampu" /><br /><sub><b>@ChrisHampu</b></sub></a><br /><a href="https://github.com/RiskThinking/crc-framework-rs/commits?author=ChrisHampu" title="Code">💻</a> <a href="https://github.com/RiskThinking/crc-framework-rs/pulls?q=is%3Apr+reviewed-by%3AChrisHampu" title="Reviewed Pull Requests">👀</a></td>
59
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/woozyking"><img src="https://avatars.githubusercontent.com/u/2837532?s=80" width="80" alt="@woozyking" /><br /><sub><b>@woozyking</b></sub></a><br /><a href="https://github.com/RiskThinking/crc-framework-rs/commits?author=woozyking" title="Code">💻</a> <a href="https://github.com/RiskThinking/crc-framework-rs/pulls?q=is%3Apr+reviewed-by%3Awoozyking" title="Reviewed Pull Requests">👀</a></td>
60
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/awiebe42"><img src="https://avatars.githubusercontent.com/u/65562157?s=80" width="80" alt="@awiebe42" /><br /><sub><b>@awiebe42</b></sub></a><br /><a href="https://github.com/RiskThinking/crc-framework-rs/commits?author=awiebe42" title="Code">💻</a> <a href="https://github.com/RiskThinking/crc-framework-rs/pulls?q=is%3Apr+reviewed-by%3Aawiebe42" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/awiebe42" title="Research">🔬</a></td>
61
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/kylalangotsky"><img src="https://avatars.githubusercontent.com/u/91707255?s=80" width="80" alt="@kylalangotsky" /><br /><sub><b>@kylalangotsky</b></sub></a><br /><a href="https://github.com/kylalangotsky" title="Research">🔬</a></td>
62
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/reshmasoman"><img src="https://avatars.githubusercontent.com/u/102987481?s=80" width="80" alt="@reshmasoman" /><br /><sub><b>@reshmasoman</b></sub></a><br /><a href="https://github.com/reshmasoman" title="Research">🔬</a></td>
63
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/rkodamana"><img src="https://avatars.githubusercontent.com/u/84455891?s=80" width="80" alt="@rkodamana" /><br /><sub><b>@rkodamana</b></sub></a><br /><a href="https://github.com/rkodamana" title="Research">🔬</a> <a href="https://github.com/RiskThinking/crc-framework-rs/pulls?q=is%3Apr+reviewed-by%3Arkodamana" title="Reviewed Pull Requests">👀</a></td>
64
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/dilshank"><img src="https://avatars.githubusercontent.com/u/1534562?s=80" width="80" alt="@dilshank" /><br /><sub><b>@dilshank</b></sub></a><br /><a href="https://github.com/dilshank" title="Research">🔬</a></td>
65
+ </tr>
66
+ </tbody>
67
+ </table>
68
+
69
+ <!-- markdownlint-restore -->
70
+ <!-- prettier-ignore-end -->
71
+
72
+ <!-- ALL-CONTRIBUTORS-LIST:END -->
73
+
74
+ Contribution types: 💻 code · 👀 review · 🔬 research. We recognize contributions
75
+ both on and off GitHub using [All Contributors](https://allcontributors.org/).
76
+
77
+ ## Installation
78
+
79
+ ### Python
80
+
81
+ ```sh
82
+ python -m pip install crc-framework
83
+ # To opt into prereleases:
84
+ python -m pip install --upgrade --pre crc-framework
85
+ ```
86
+
87
+ Python 3.11 or later is required. Compatible prebuilt wheels need no Rust
88
+ toolchain. Building from source requires Rust 1.85 or later and a C compiler
89
+ suitable for Python extensions.
90
+
91
+ ### JavaScript / WebAssembly
92
+
93
+ ```sh
94
+ npm install @climateriskcommons/crc-framework
95
+ ```
96
+
97
+ Stable releases use npm's `latest` channel. Add `@alpha` to opt into
98
+ alpha prereleases. The package is ESM, requires WebAssembly, and includes TypeScript
99
+ declarations. See the [JavaScript guide](docs/javascript.md) for browser, bundler, Node,
100
+ and SSR setup, canonical input rules, and prepared collection APIs.
101
+
102
+ ## Quick start
103
+
104
+ ### Python: evaluate a return-period curve
105
+
106
+ ```python
107
+ from crc_framework import TabulatedDistribution
108
+
109
+ exposure = TabulatedDistribution.from_return_periods(
110
+ periods=[10, 20, 50, 100, 200, 500],
111
+ values=[0.1, 0.2, 0.5, 0.9, 1.4, 2.0],
112
+ tail="upper",
113
+ )
114
+ print(exposure.ppf(0.99)) # 100-year return level: 0.9
115
+ ```
116
+
117
+ ### JavaScript: consume a canonical curve
118
+
119
+ ```js
120
+ import init, { evaluateCurve } from '@climateriskcommons/crc-framework';
121
+
122
+ await init(); // initialize once at client startup
123
+ const properties = {
124
+ curve_kind: 'fitted',
125
+ curve_type: 'gumbel_r',
126
+ curve_location: 1,
127
+ curve_scale: 2,
128
+ };
129
+ const value = evaluateCurve(properties, 0.99);
130
+ ```
131
+
132
+ Evaluation is synchronous after initialization. Imports are SSR-safe; initialize
133
+ in the client, or load WASM bytes explicitly for Node evaluation. For repeated
134
+ viewport or percentile queries, use `prepareCurves` to validate and transfer a
135
+ collection once, then call `evaluate(q)` and free the handle when finished.
136
+
137
+ ## Guides and next steps
138
+
139
+ | Task | Read next |
140
+ | --- | --- |
141
+ | Use distributions, fitting, impacts, microscores, or risk metrics | [Python guide](docs/python.md) |
142
+ | Initialize WASM, prepare collections, or understand canonical inputs and errors | [JavaScript guide](docs/javascript.md) |
143
+ | Pin schemas, validate identities, or record impact provenance | [Impact contracts](docs/impact-contracts.md) |
144
+ | Set up the repository, run checks, or update contributor credits | [Development](docs/development.md) |
145
+ | Bump versions, migrate the npm scope, or publish a release | [Releases](docs/releases.md) |
146
+
147
+ Start with the [documentation index](docs/README.md) for the reading order and
148
+ repository boundaries. Historical implementation notes are linked there separately.
149
+
150
+ ## License
151
+
152
+ CRC Framework is licensed under the GNU Affero General Public License, version
153
+ 3 or any later version (`AGPL-3.0-or-later`). See [LICENSE](LICENSE).
154
+
155
+ Parts of the numerical distribution implementation are derived from or
156
+ informed by SciPy and Cephes. Their applicable copyright notices and license
157
+ terms are preserved in
158
+ [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
159
+
@@ -0,0 +1,131 @@
1
+ # Climate Risk Commons Framework
2
+
3
+ CRC Framework provides a shared Rust computation core with official Python and
4
+ JavaScript/WebAssembly bindings for climate-risk calculations. It turns hazard
5
+ distributions into comparable impact microscores, scenario branches, and
6
+ portfolio-level VaR/CVaR risk metrics.
7
+
8
+ | Interface | Package | Scope |
9
+ | --- | --- | --- |
10
+ | Python | `crc-framework` on PyPI; import `crc_framework` | Distributions, fitting, impacts, microscores, risk aggregation, and geography |
11
+ | JavaScript / WASM | `@climateriskcommons/crc-framework` on npm | Canonical CRC curve consumption: quantile evaluation, batches, prepared handles, and TypeScript declarations |
12
+ | Rust | `crates/core` | Shared algorithms and reference data used by both bindings |
13
+
14
+ The JavaScript binding consumes canonical curves, including PMTiles/MVT
15
+ properties. Python also supports fitting, impacts, and portfolio risk.
16
+ Application-specific workflows belong in packages built on this framework.
17
+
18
+ [Installation](#installation) · [Quick start](#quick-start) · [Guides](#guides-and-next-steps)
19
+
20
+ ## Contributors
21
+
22
+ Thanks to the people who shape this project through code, reviews, research,
23
+ and internal discussions and ideas.
24
+
25
+ <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
26
+ <!-- prettier-ignore-start -->
27
+ <!-- markdownlint-disable -->
28
+ <table>
29
+ <tbody>
30
+ <tr>
31
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/ChrisHampu"><img src="https://avatars.githubusercontent.com/u/6600532?s=80" width="80" alt="@ChrisHampu" /><br /><sub><b>@ChrisHampu</b></sub></a><br /><a href="https://github.com/RiskThinking/crc-framework-rs/commits?author=ChrisHampu" title="Code">💻</a> <a href="https://github.com/RiskThinking/crc-framework-rs/pulls?q=is%3Apr+reviewed-by%3AChrisHampu" title="Reviewed Pull Requests">👀</a></td>
32
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/woozyking"><img src="https://avatars.githubusercontent.com/u/2837532?s=80" width="80" alt="@woozyking" /><br /><sub><b>@woozyking</b></sub></a><br /><a href="https://github.com/RiskThinking/crc-framework-rs/commits?author=woozyking" title="Code">💻</a> <a href="https://github.com/RiskThinking/crc-framework-rs/pulls?q=is%3Apr+reviewed-by%3Awoozyking" title="Reviewed Pull Requests">👀</a></td>
33
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/awiebe42"><img src="https://avatars.githubusercontent.com/u/65562157?s=80" width="80" alt="@awiebe42" /><br /><sub><b>@awiebe42</b></sub></a><br /><a href="https://github.com/RiskThinking/crc-framework-rs/commits?author=awiebe42" title="Code">💻</a> <a href="https://github.com/RiskThinking/crc-framework-rs/pulls?q=is%3Apr+reviewed-by%3Aawiebe42" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/awiebe42" title="Research">🔬</a></td>
34
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/kylalangotsky"><img src="https://avatars.githubusercontent.com/u/91707255?s=80" width="80" alt="@kylalangotsky" /><br /><sub><b>@kylalangotsky</b></sub></a><br /><a href="https://github.com/kylalangotsky" title="Research">🔬</a></td>
35
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/reshmasoman"><img src="https://avatars.githubusercontent.com/u/102987481?s=80" width="80" alt="@reshmasoman" /><br /><sub><b>@reshmasoman</b></sub></a><br /><a href="https://github.com/reshmasoman" title="Research">🔬</a></td>
36
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/rkodamana"><img src="https://avatars.githubusercontent.com/u/84455891?s=80" width="80" alt="@rkodamana" /><br /><sub><b>@rkodamana</b></sub></a><br /><a href="https://github.com/rkodamana" title="Research">🔬</a> <a href="https://github.com/RiskThinking/crc-framework-rs/pulls?q=is%3Apr+reviewed-by%3Arkodamana" title="Reviewed Pull Requests">👀</a></td>
37
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/dilshank"><img src="https://avatars.githubusercontent.com/u/1534562?s=80" width="80" alt="@dilshank" /><br /><sub><b>@dilshank</b></sub></a><br /><a href="https://github.com/dilshank" title="Research">🔬</a></td>
38
+ </tr>
39
+ </tbody>
40
+ </table>
41
+
42
+ <!-- markdownlint-restore -->
43
+ <!-- prettier-ignore-end -->
44
+
45
+ <!-- ALL-CONTRIBUTORS-LIST:END -->
46
+
47
+ Contribution types: 💻 code · 👀 review · 🔬 research. We recognize contributions
48
+ both on and off GitHub using [All Contributors](https://allcontributors.org/).
49
+
50
+ ## Installation
51
+
52
+ ### Python
53
+
54
+ ```sh
55
+ python -m pip install crc-framework
56
+ # To opt into prereleases:
57
+ python -m pip install --upgrade --pre crc-framework
58
+ ```
59
+
60
+ Python 3.11 or later is required. Compatible prebuilt wheels need no Rust
61
+ toolchain. Building from source requires Rust 1.85 or later and a C compiler
62
+ suitable for Python extensions.
63
+
64
+ ### JavaScript / WebAssembly
65
+
66
+ ```sh
67
+ npm install @climateriskcommons/crc-framework
68
+ ```
69
+
70
+ Stable releases use npm's `latest` channel. Add `@alpha` to opt into
71
+ alpha prereleases. The package is ESM, requires WebAssembly, and includes TypeScript
72
+ declarations. See the [JavaScript guide](docs/javascript.md) for browser, bundler, Node,
73
+ and SSR setup, canonical input rules, and prepared collection APIs.
74
+
75
+ ## Quick start
76
+
77
+ ### Python: evaluate a return-period curve
78
+
79
+ ```python
80
+ from crc_framework import TabulatedDistribution
81
+
82
+ exposure = TabulatedDistribution.from_return_periods(
83
+ periods=[10, 20, 50, 100, 200, 500],
84
+ values=[0.1, 0.2, 0.5, 0.9, 1.4, 2.0],
85
+ tail="upper",
86
+ )
87
+ print(exposure.ppf(0.99)) # 100-year return level: 0.9
88
+ ```
89
+
90
+ ### JavaScript: consume a canonical curve
91
+
92
+ ```js
93
+ import init, { evaluateCurve } from '@climateriskcommons/crc-framework';
94
+
95
+ await init(); // initialize once at client startup
96
+ const properties = {
97
+ curve_kind: 'fitted',
98
+ curve_type: 'gumbel_r',
99
+ curve_location: 1,
100
+ curve_scale: 2,
101
+ };
102
+ const value = evaluateCurve(properties, 0.99);
103
+ ```
104
+
105
+ Evaluation is synchronous after initialization. Imports are SSR-safe; initialize
106
+ in the client, or load WASM bytes explicitly for Node evaluation. For repeated
107
+ viewport or percentile queries, use `prepareCurves` to validate and transfer a
108
+ collection once, then call `evaluate(q)` and free the handle when finished.
109
+
110
+ ## Guides and next steps
111
+
112
+ | Task | Read next |
113
+ | --- | --- |
114
+ | Use distributions, fitting, impacts, microscores, or risk metrics | [Python guide](docs/python.md) |
115
+ | Initialize WASM, prepare collections, or understand canonical inputs and errors | [JavaScript guide](docs/javascript.md) |
116
+ | Pin schemas, validate identities, or record impact provenance | [Impact contracts](docs/impact-contracts.md) |
117
+ | Set up the repository, run checks, or update contributor credits | [Development](docs/development.md) |
118
+ | Bump versions, migrate the npm scope, or publish a release | [Releases](docs/releases.md) |
119
+
120
+ Start with the [documentation index](docs/README.md) for the reading order and
121
+ repository boundaries. Historical implementation notes are linked there separately.
122
+
123
+ ## License
124
+
125
+ CRC Framework is licensed under the GNU Affero General Public License, version
126
+ 3 or any later version (`AGPL-3.0-or-later`). See [LICENSE](LICENSE).
127
+
128
+ Parts of the numerical distribution implementation are derived from or
129
+ informed by SciPy and Cephes. Their applicable copyright notices and license
130
+ terms are preserved in
131
+ [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
@@ -0,0 +1,35 @@
1
+ # CRC Framework documentation
2
+
3
+ Start at the [project README](../README.md) for package choices, installation,
4
+ contributors, and runnable quick starts. Then follow the guide for your task:
5
+
6
+ 1. **Use the framework:** [Python](python.md) or [JavaScript / WebAssembly](javascript.md).
7
+ 2. **Understand shared contracts:** [impact contracts and provenance](impact-contracts.md).
8
+ 3. **Change the framework:** [development and contribution](development.md).
9
+ 4. **Ship a version:** [versioning, scope migration, and releases](releases.md).
10
+
11
+ ## Ownership and source map
12
+
13
+ | Concern | Source of truth |
14
+ | --- | --- |
15
+ | Numerical algorithms, canonical validation, reference data | `crates/core/` |
16
+ | Typed Python interface and native binding | `python/crc_framework/`, `src/` |
17
+ | WASM exports and JavaScript adapter | `crates/wasm/`, `js/src/` |
18
+ | Impact schemas, catalogs, fixtures, manifest | Generated `python/crc_framework/contracts/impact/`; edit `tools/impact_contracts/` |
19
+ | Package version | Root `Cargo.toml`, `[workspace.package].version` |
20
+ | Contributor roster | `.all-contributorsrc`; generate both package READMEs |
21
+
22
+ Paths above are relative to the repository root. Humans and agents should use
23
+ these guides before following source details. Treat generated artifacts as outputs;
24
+ change their documented sources and regenerate them.
25
+
26
+ This directory covers the framework only. Dataset discovery, ingestion, and
27
+ Parquet workflows belong to CRC-SDK; tile loading, caches, and UI behavior belong
28
+ to consuming applications. These boundaries keep a future shared documentation
29
+ structure possible without duplicating other projects' guides here.
30
+
31
+ ## Historical context
32
+
33
+ [Initial WASM rollout and performance investigation](history/wasm-quantile-consumer.md)
34
+ records past decisions and measurements. Use the current guides above for setup
35
+ and publishing instructions.
@@ -0,0 +1,142 @@
1
+ # Development and contribution
2
+
3
+ [Documentation index](README.md) · [Project README](../README.md)
4
+
5
+ ## Repository layout
6
+
7
+ | Path | Responsibility |
8
+ | --- | --- |
9
+ | `crates/core` | Shared Rust algorithms and reference data |
10
+ | `src/lib.rs` | PyO3 extension |
11
+ | `python/crc_framework` | Typed Python API shipped with the extension |
12
+ | `python/crc_framework/contracts/impact` | Generated impact schemas, catalogs, conformance fixtures, and digest manifest |
13
+ | `tools/impact_contracts` | Contract generator, schema sources, fixture cases, and independent Python reference implementation |
14
+ | `crates/wasm` | WASM exports backed by the Rust core |
15
+ | `js` | JS adapter, TypeScript declarations, build tooling, and consumer tests |
16
+ | `tests` | Python tests and shared parity fixtures |
17
+
18
+ Python consumers should import `crc_framework`; `crc_framework._core` is an
19
+ implementation detail that may change between releases.
20
+
21
+ ## Python setup and checks
22
+
23
+ Run these commands from the repository root:
24
+
25
+ ```sh
26
+ python -m venv .venv
27
+ .venv/bin/python -m pip install --upgrade pip maturin
28
+ .venv/bin/python -m pip install -e ".[test]"
29
+
30
+ cargo fmt --all -- --check
31
+ cargo clippy --workspace --all-targets -- -D warnings
32
+ cargo test --workspace --locked
33
+ .venv/bin/python -m mypy
34
+ .venv/bin/python -m pytest
35
+ .venv/bin/maturin build --release --locked
36
+ ```
37
+
38
+ After changing Rust code, run `.venv/bin/maturin develop` to rebuild the Python
39
+ extension. Python-only edits are available directly from the editable install.
40
+
41
+ ## Impact contract generation and regression checks
42
+
43
+ Edit the sources in [`tools/impact_contracts`](../tools/impact_contracts), then
44
+ regenerate the artifact from the repository root:
45
+
46
+ ```sh
47
+ .venv/bin/python tools/impact_contracts/generate.py
48
+ ```
49
+
50
+ Commit the generator sources and generated artifact together. The generator and
51
+ reference implementation are development tooling; Python consumers load the
52
+ generated resources through `crc_framework.contracts`. No separate tools package
53
+ is needed. When the manifest changes, update the SDK's pinned manifest digest
54
+ together with any required consumer changes.
55
+
56
+ After the Python setup above, run the focused checks:
57
+
58
+ ```sh
59
+ .venv/bin/python tools/impact_contracts/generate.py --check
60
+ .venv/bin/python -m pytest tests/test_impact_contracts.py -q
61
+ cargo test -p crc-framework-core --test impact_contract_canonical --locked
62
+ cargo test -p crc-framework-core --no-default-features --test impact_contract_canonical --locked
63
+ ```
64
+
65
+ The Python suite checks generation freshness, schema agreement, canonical
66
+ identities, validation errors, numerical reference cases, and provenance rules.
67
+ Numerical cases specify tolerances; canonical bytes and hashes require exact
68
+ agreement. Monotonicity cases allow documented weaker classifications, including
69
+ both monotone directions for constant functions. Rust tests consume the same
70
+ artifact to check canonical serialization, native integer limits, and source
71
+ distribution reconstruction with and without default features.
72
+
73
+ ## JavaScript setup and checks
74
+
75
+ Use the Node version in [`js/.nvmrc`](../js/.nvmrc), install the
76
+ `wasm32-unknown-unknown` Rust target and `wasm-pack 0.15.0`, then:
77
+
78
+ ```sh
79
+ cd js
80
+ npm ci
81
+ npm run build
82
+ npm test
83
+ npx playwright install chromium
84
+ npm run test:browser
85
+ npm run test:consumer
86
+ ```
87
+
88
+ The consumer test packs the generated distribution and checks it with Vite,
89
+ TypeScript, SSR, and Chromium. See the [JavaScript build and test guide](development.md#javascript-packaging)
90
+ for packaging and validation commands.
91
+
92
+ Native and WASM transcendental math can differ slightly. Numerical regression
93
+ and parity tests use explicit tolerances; structural validation stays exact.
94
+ The [quantile fitting golden test](../crates/core/tests/quantile_fit_golden.rs)
95
+ documents the optional exact-comparison mode for refactors in a fixed environment.
96
+
97
+
98
+ ## JavaScript packaging
99
+
100
+
101
+ Use the Node version in `.nvmrc`, install Rust's `wasm32-unknown-unknown` target
102
+ and `wasm-pack 0.15.0`, then run from this directory:
103
+
104
+ ```sh
105
+ npm ci
106
+ npm run build
107
+ npm test
108
+ npx playwright install chromium
109
+ npm run test:browser
110
+ npm run test:consumer # packed Vite + TypeScript + SSR/browser checks
111
+ npm run benchmark
112
+ npm run pack -- --dry-run
113
+ npm run pack
114
+ ```
115
+
116
+ The tracked `package.json` is a private, versionless development manifest;
117
+ `package-lock.json` pins its build/test dependencies. Keep both in Git. The build
118
+ reads Cargo metadata and writes the public package to ignored `dist/`, including
119
+ the derived version, JS adapter, declarations, WASM glue/asset, and licenses.
120
+ Development scripts, dev dependencies, and the private flag are omitted.
121
+ Source manifests and lockfiles are not rewritten by the build.
122
+
123
+ `npm run pack` (or `npm pack ./dist`) requires a successful build for the current
124
+ workspace version and creates the tarball under `dist/`. The consumer test
125
+ installs that artifact. The private development package itself cannot be published.
126
+
127
+
128
+ ## Contributor credits
129
+
130
+ The roster in `.all-contributorsrc` generates the contributor tables in both
131
+ `README.md` (also the Python package README) and `js/README.md` (the npm README).
132
+ Run from the repository root:
133
+
134
+ ```sh
135
+ npx --yes all-contributors-cli@6.26.1 add HANDLE code,review
136
+ npx --yes all-contributors-cli@6.26.1 add HANDLE research
137
+ npx --yes all-contributors-cli@6.26.1 generate
138
+ ```
139
+
140
+ Use `code,review` for code contributors and specify other types explicitly.
141
+ Edit the roster for corrections, then regenerate both tables; do not edit the
142
+ generated tables directly.