@mailwoman/soil 10.8.0 → 11.1.0
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.
- package/README.md +6 -6
- package/lib/index.ts +9 -10
- package/lib/paths.ts +3 -4
- package/lib/schema.ts +32 -24
- package/lib/vocabulary.ts +4 -7
- package/out/index.d.ts +4 -12
- package/out/index.d.ts.map +1 -1
- package/out/index.js +5 -6
- package/out/index.js.map +1 -1
- package/out/paths.d.ts +0 -7
- package/out/paths.d.ts.map +1 -1
- package/out/paths.js +2 -4
- package/out/paths.js.map +1 -1
- package/out/schema.d.ts +29 -24
- package/out/schema.d.ts.map +1 -1
- package/out/schema.js +2 -23
- package/out/schema.js.map +1 -1
- package/out/sdk/acquire.d.ts +2 -4
- package/out/sdk/acquire.d.ts.map +1 -1
- package/out/sdk/acquire.js +2 -7
- package/out/sdk/acquire.js.map +1 -1
- package/out/sdk/build-soil.d.ts +2 -13
- package/out/sdk/build-soil.d.ts.map +1 -1
- package/out/sdk/build-soil.js +11 -10
- package/out/sdk/build-soil.js.map +1 -1
- package/out/sdk/cell-tiers.d.ts +0 -7
- package/out/sdk/cell-tiers.d.ts.map +1 -1
- package/out/sdk/cell-tiers.js +2 -4
- package/out/sdk/cell-tiers.js.map +1 -1
- package/out/sdk/cells.d.ts +2 -5
- package/out/sdk/cells.d.ts.map +1 -1
- package/out/sdk/cells.js +4 -5
- package/out/sdk/cells.js.map +1 -1
- package/out/sdk/client.d.ts +0 -5
- package/out/sdk/client.d.ts.map +1 -1
- package/out/sdk/client.js +2 -5
- package/out/sdk/client.js.map +1 -1
- package/out/sdk/download.d.ts +1 -6
- package/out/sdk/download.d.ts.map +1 -1
- package/out/sdk/download.js +3 -6
- package/out/sdk/download.js.map +1 -1
- package/out/sdk/ingest/chunk.d.ts +0 -18
- package/out/sdk/ingest/chunk.d.ts.map +1 -1
- package/out/sdk/ingest/chunk.js +17 -11
- package/out/sdk/ingest/chunk.js.map +1 -1
- package/out/sdk/ingest/worker.d.ts +0 -7
- package/out/sdk/ingest/worker.d.ts.map +1 -1
- package/out/sdk/ingest/worker.js +3 -5
- package/out/sdk/ingest/worker.js.map +1 -1
- package/out/sdk/ingest.d.ts +0 -5
- package/out/sdk/ingest.d.ts.map +1 -1
- package/out/sdk/ingest.js +2 -5
- package/out/sdk/ingest.js.map +1 -1
- package/out/sdk/measure-resolutions.d.ts +1 -6
- package/out/sdk/measure-resolutions.d.ts.map +1 -1
- package/out/sdk/measure-resolutions.js +3 -6
- package/out/sdk/measure-resolutions.js.map +1 -1
- package/out/sdk/reduce.d.ts +0 -12
- package/out/sdk/reduce.d.ts.map +1 -1
- package/out/sdk/reduce.js +8 -7
- package/out/sdk/reduce.js.map +1 -1
- package/out/sdk/survey-area.d.ts +0 -5
- package/out/sdk/survey-area.d.ts.map +1 -1
- package/out/sdk/survey-area.js +5 -10
- package/out/sdk/survey-area.js.map +1 -1
- package/out/sdk/tabular.d.ts +4 -28
- package/out/sdk/tabular.d.ts.map +1 -1
- package/out/sdk/tabular.js +41 -27
- package/out/sdk/tabular.js.map +1 -1
- package/out/sdk/test-kit.d.ts +0 -5
- package/out/sdk/test-kit.d.ts.map +1 -1
- package/out/sdk/test-kit.js +4 -7
- package/out/sdk/test-kit.js.map +1 -1
- package/out/sdk/verify.d.ts +0 -5
- package/out/sdk/verify.d.ts.map +1 -1
- package/out/sdk/verify.js +2 -5
- package/out/sdk/verify.js.map +1 -1
- package/out/vocabulary.d.ts +2 -7
- package/out/vocabulary.d.ts.map +1 -1
- package/out/vocabulary.js +4 -7
- package/out/vocabulary.js.map +1 -1
- package/package.json +4 -4
- package/sdk/acquire.ts +5 -4
- package/sdk/build-soil.ts +13 -11
- package/sdk/cell-tiers.ts +3 -4
- package/sdk/cells.ts +5 -5
- package/sdk/client.ts +2 -5
- package/sdk/download.ts +3 -6
- package/sdk/ingest/chunk.ts +18 -11
- package/sdk/ingest/worker.ts +4 -5
- package/sdk/ingest.ts +2 -5
- package/sdk/measure-resolutions.ts +3 -6
- package/sdk/reduce.ts +9 -7
- package/sdk/survey-area.ts +5 -10
- package/sdk/tabular.ts +38 -23
- package/sdk/test-kit.ts +4 -7
- package/sdk/verify.ts +2 -5
package/out/vocabulary.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vocabulary.d.ts","sourceRoot":"","sources":["../lib/vocabulary.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vocabulary.d.ts","sourceRoot":"","sources":["../lib/vocabulary.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,sBAAsB,iCAAiC,CAAA;AAEpE;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,OAAO,CAAA;AAErC;;;GAGG;AACH,eAAO,MAAM,kBAAkB,2EAA2E,CAAA;AAE1G;;;GAGG;AACH,eAAO,MAAM,cAAc,mCAAmC,CAAA;AAE9D;;;;;GAKG;AACH,eAAO,MAAM,kCAAkC,+BAA+B,CAAA;AAE9E;;GAEG;AACH,eAAO,MAAM,sBAAsB,QAKY,CAAA;AAE/C;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAAC,MAAM,CAMvD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,yBAAyB,QAEoD,CAAA;AAE1F;;GAEG;AACH,eAAO,MAAM,oBAAoB,sGACmE,CAAA;AAEpG;;GAEG;AACH,eAAO,MAAM,aAAa,yBAAyB,CAAA;AAEnD;;GAEG;AACH,eAAO,MAAM,kBAAkB,OAAO,CAAA;AAEtC;;;GAGG;AACH,eAAO,MAAM,aAAa;aACzB,OAAO,EAAE,SAAS;aAElB,KAAK,EAAE,OAAO;aAEd,KAAK,EAAE,OAAO;aAEd,IAAI,EAAE,MAAM;CACH,CAAA;AAEV;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAA;AAE9E;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,aAAa,CAc7E;AAED;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,WAAW,CAAC,MAAM,CAAiC,CAAA;AAE3F;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,MAAM,CAItD,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,iEAAiE,CAAA;AAEhG;;GAEG;AACH,eAAO,MAAM,2BAA2B,MAAM,CAAA;AAE9C;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,0BAA0B,CAAA;AAE3D;;GAEG;AACH,eAAO,MAAM,gCAAgC,QAIsC,CAAA"}
|
package/out/vocabulary.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
6
3
|
/**
|
|
7
4
|
* The prefix of every soil layer name.
|
|
8
5
|
* The reader rejects an artifact whose layer name lacks it.
|
|
@@ -107,7 +104,7 @@ export function farmlandScope(value) {
|
|
|
107
104
|
*/
|
|
108
105
|
export const SSURGO_NO_MAPPING_SYMBOLS = new Set(["NOTCOM", "NOTPUB"]);
|
|
109
106
|
/**
|
|
110
|
-
* The lower-case map-unit names that mark a delineation without soil mapping when its symbol
|
|
107
|
+
* The lower-case map-unit names that mark a delineation without soil mapping when its symbol doesn't.
|
|
111
108
|
*
|
|
112
109
|
* The match uses the whole name, since a prefix could also match a real soil name.
|
|
113
110
|
*/
|
|
@@ -118,7 +115,7 @@ export const SSURGO_NO_MAPPING_NAMES = new Set([
|
|
|
118
115
|
]);
|
|
119
116
|
/**
|
|
120
117
|
* The `cointerp.mrulename` of the productivity index this layer stores, kept apart from the capability
|
|
121
|
-
* class because a combination of the two would be a number NRCS
|
|
118
|
+
* class because a combination of the two would be a number NRCS doesn't publish.
|
|
122
119
|
*/
|
|
123
120
|
export const NCCPI_V3_RULE_NAME = "NCCPI - National Commodity Crop Productivity Index (Ver 3.0)";
|
|
124
121
|
/**
|
package/out/vocabulary.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vocabulary.js","sourceRoot":"","sources":["../lib/vocabulary.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"vocabulary.js","sourceRoot":"","sources":["../lib/vocabulary.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailwoman/soil",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.1.0",
|
|
4
4
|
"description": "USDA NRCS SSURGO soil capability — acquisition, build, and the soil.db layer reader",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"farmland",
|
|
@@ -107,9 +107,9 @@
|
|
|
107
107
|
"test": "vitest run"
|
|
108
108
|
},
|
|
109
109
|
"dependencies": {
|
|
110
|
-
"@mailwoman/core": "
|
|
111
|
-
"@mailwoman/spatial": "
|
|
112
|
-
"@mailwoman/sqlite": "
|
|
110
|
+
"@mailwoman/core": "11.1.0",
|
|
111
|
+
"@mailwoman/spatial": "11.1.0",
|
|
112
|
+
"@mailwoman/sqlite": "11.1.0",
|
|
113
113
|
"@sister.software/h3": "^1.1.0",
|
|
114
114
|
"kysely": "^0.29.7",
|
|
115
115
|
"path-ts": "^2.5.0",
|
package/sdk/acquire.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
+
* Downloads a region's soil survey areas and turns them into builder inputs.
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
+
* The catalogue's `saverest` date picks the archive and the host rejects `HEAD` and ignores `Range`.
|
|
7
8
|
*/
|
|
8
9
|
|
|
9
10
|
import type { PathBuilderLike } from "path-ts"
|
package/sdk/build-soil.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
5
|
* Builds the sealed `soil.db` polygon layer from NRCS soil survey areas.
|
|
7
6
|
*
|
|
8
|
-
* The builder streams cell touches into a temporary SQL table so that memory
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* The builder streams cell touches into a temporary SQL table so that memory
|
|
8
|
+
* stays flat as the row count grows.
|
|
9
|
+
* Absent data has no row in any table.
|
|
10
|
+
*
|
|
11
|
+
* Land outside a survey area and coverage cells that only `notcom`
|
|
12
|
+
* or access-denied polygons reach, get no coverage row.
|
|
11
13
|
*/
|
|
12
14
|
|
|
13
15
|
import { readFileSize } from "@mailwoman/core/fs/readers/stat"
|
|
@@ -57,7 +59,7 @@ import {
|
|
|
57
59
|
* The schema version of the domain tables.
|
|
58
60
|
*
|
|
59
61
|
* It changes when a column changes meaning.
|
|
60
|
-
* An added column that readers can ignore
|
|
62
|
+
* An added column that readers can ignore doesn't change it.
|
|
61
63
|
*/
|
|
62
64
|
export const SOIL_SCHEMA_VERSION = 1
|
|
63
65
|
|
|
@@ -191,7 +193,7 @@ export interface BuildSoilResult {
|
|
|
191
193
|
topClassUnderHalfCells: number
|
|
192
194
|
topClassUnderHalfShare: number
|
|
193
195
|
/**
|
|
194
|
-
* The number of cells that the survey mapped but
|
|
196
|
+
* The number of cells that the survey mapped but didn't rate.
|
|
195
197
|
*/
|
|
196
198
|
classlessCells: number
|
|
197
199
|
/**
|
|
@@ -642,7 +644,7 @@ function buildCoverageCells(
|
|
|
642
644
|
}
|
|
643
645
|
|
|
644
646
|
// The cell's center decides its survey area, so each cell counts for one area only.
|
|
645
|
-
// This per-area count is informational and
|
|
647
|
+
// This per-area count is informational and doesn't affect the coverage rows.
|
|
646
648
|
const [latitude, longitude] = cellToLatLng(cell)
|
|
647
649
|
const owner = options.areas.find((input) => geometryContains(input.outline, longitude, latitude))
|
|
648
650
|
|
|
@@ -659,7 +661,7 @@ function buildCoverageCells(
|
|
|
659
661
|
/**
|
|
660
662
|
* Returns an outline's polygons in `MultiPolygon` coordinate form.
|
|
661
663
|
*
|
|
662
|
-
* @throws {TypeError} When the outline
|
|
664
|
+
* @throws {TypeError} When the outline isn't a polygon or multipolygon.
|
|
663
665
|
* The build would silently drop that survey area's coverage if it skipped the outline.
|
|
664
666
|
*/
|
|
665
667
|
function outlinePolygons(outline: ParsedGeometry): MultiPolygonRings {
|
package/sdk/cell-tiers.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
5
|
* Turns the build's cell-touch table into the containment index and the per-cell capability reduction.
|
|
7
6
|
*/
|
|
8
7
|
|
package/sdk/cells.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* The delineation-keyed cell index, plus the partial-cell and mixed-top-class shares that choose its resolution.
|
|
5
|
+
* The delineation-keyed cell index, plus the partial-cell and mixed-top-class
|
|
6
|
+
* shares that choose its resolution.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import {
|
package/sdk/client.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
6
3
|
|
|
7
4
|
import { APIClient, type APIClientConfig, type ClockLike, assertNoOGCServiceException } from "@mailwoman/core/api"
|
|
8
5
|
import { buildDiskStorage } from "@mailwoman/core/api/disk-storage"
|
package/sdk/download.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
6
3
|
|
|
7
4
|
import { tryStat } from "@mailwoman/core/fs/readers/stat"
|
|
8
5
|
import { makeDirectories } from "@mailwoman/core/fs/writers"
|
|
@@ -17,7 +14,7 @@ export const WSS_SSA_CACHE_URL = "https://websoilsurvey.sc.egov.usda.gov/DSD/Dow
|
|
|
17
14
|
|
|
18
15
|
/**
|
|
19
16
|
* Returns the archive URL for one survey area at one version date, with the brackets
|
|
20
|
-
* around the date percent-encoded because they
|
|
17
|
+
* around the date percent-encoded because they're not valid in a URL path.
|
|
21
18
|
*/
|
|
22
19
|
export function surveyAreaArchiveURL(areaSymbol: string, versionDate: string): string {
|
|
23
20
|
return `${WSS_SSA_CACHE_URL}/wss_SSA_${areaSymbol}_%5B${versionDate}%5D.zip`
|
package/sdk/ingest/chunk.ts
CHANGED
|
@@ -1,20 +1,27 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
5
|
* This streaming pass writes each delineation to `soil_map_unit_area` and the build's touch table.
|
|
7
6
|
* It can process part of one survey area as a unit of work.
|
|
8
7
|
*
|
|
9
|
-
* H3's wasm heap cannot be reset from JavaScript.
|
|
8
|
+
* H3's wasm heap cannot be reset from JavaScript.
|
|
9
|
+
* It also cannot sustain unlimited polyfill calls.
|
|
10
|
+
*
|
|
10
11
|
* Two runs over the flood layer's real product stopped after roughly 510,000 and 798,000 features.
|
|
11
|
-
* The same geometries classify in milliseconds in a fresh process.
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* The same geometries classify in milliseconds in a fresh process.
|
|
13
|
+
*
|
|
14
|
+
* A build that completes only when fragmentation stays low isn't reproducible.
|
|
15
|
+
* {@linkcode buildSoilDatabase} bounds each process to a range of the shapefile's FIDs.
|
|
16
|
+
* Each range gets a separate process with a fresh heap.
|
|
17
|
+
*
|
|
18
|
+
* Iowa's 99 survey areas contain far more delineations together than each area contains by itself.
|
|
19
|
+
* The bound therefore applies per range.
|
|
20
|
+
*
|
|
21
|
+
* The chunk appends rows to a database created by the parent.
|
|
22
|
+
* The parent seals that database and adds up the counts returned by each chunk.
|
|
15
23
|
*
|
|
16
|
-
*
|
|
17
|
-
* the counts returned by each chunk. Chunks run one at a time against the file, so only one writer uses it.
|
|
24
|
+
* Chunks run one at a time against the file, so only one writer uses it.
|
|
18
25
|
*/
|
|
19
26
|
|
|
20
27
|
import { addCoverageCells, encodeRings, ringAreaReadings, ringsBoundingBox, shortCellToInt } from "@mailwoman/spatial"
|
package/sdk/ingest/worker.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
5
|
* One chunk of the soil ingest as its own process, spawned by `buildSoilDatabase` and never run by hand.
|
|
7
6
|
*/
|
|
8
7
|
|
|
@@ -31,7 +30,7 @@ await runIngestChunkScript({
|
|
|
31
30
|
areaSymbol: requiredArgument("soil ingest-chunk", "area-symbol", values["area-symbol"] ?? null),
|
|
32
31
|
fidFrom: Number(requiredArgument("soil ingest-chunk", "fid-from", values["fid-from"] ?? null)),
|
|
33
32
|
fidTo: Number(requiredArgument("soil ingest-chunk", "fid-to", values["fid-to"] ?? null)),
|
|
34
|
-
// A range's own count
|
|
33
|
+
// A range's own count isn't knowable up front — `ogrinfo` reports the layer's total
|
|
35
34
|
// and no narrower count — so the chunk makes no assertion about its size
|
|
36
35
|
// and the parent checks the per-area sum against the shapefile's.
|
|
37
36
|
declaredFeatureCount: 0,
|
package/sdk/ingest.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
6
3
|
|
|
7
4
|
import { declaredFeatureCount } from "@mailwoman/core/layers"
|
|
8
5
|
import { assertRingsInsideExtent, requireArealPolygons, type MultiPolygonRings } from "@mailwoman/spatial"
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
6
3
|
|
|
7
4
|
import type { ResolutionMeasurementOptions } from "@mailwoman/core/layers"
|
|
8
5
|
|
|
@@ -26,7 +23,7 @@ const DEFAULT_PROGRESS_EVERY = 5000
|
|
|
26
23
|
/**
|
|
27
24
|
* Measure every candidate resolution over one survey area's real delineations.
|
|
28
25
|
*
|
|
29
|
-
* @throws {Error} When the streamed count
|
|
26
|
+
* @throws {Error} When the streamed count doesn't match the count the shapefile declares.
|
|
30
27
|
* A short read produces a well-formed table describing a smaller county.
|
|
31
28
|
* which is the partial result that must throw.
|
|
32
29
|
*/
|
package/sdk/reduce.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
5
|
* Reduces the delineations that reach a cell into that cell's capability-class distribution.
|
|
7
6
|
*
|
|
8
7
|
* The result is a distribution because most map units mix several soil components.
|
|
9
|
-
* The survey cannot separate those components at its mapping scale.
|
|
10
|
-
*
|
|
8
|
+
* The survey cannot separate those components at its mapping scale.
|
|
9
|
+
*
|
|
10
|
+
* Shares are normalized over the mapped part of the cell.
|
|
11
|
+
* `mapped_share` records how large that part is.
|
|
12
|
+
* Capability class 8 is a rated class, so it is stored as a
|
|
11
13
|
* class share. The unrated share, the no-data share and the not-rateable share each have their own column.
|
|
12
14
|
*/
|
|
13
15
|
|
|
@@ -110,7 +112,7 @@ export function mapUnitProfile(
|
|
|
110
112
|
}
|
|
111
113
|
|
|
112
114
|
// A miscellaneous area, such as rock outcrop or water, cannot take a capability rating.
|
|
113
|
-
// Any other component with a NULL rating is a soil that the survey
|
|
115
|
+
// Any other component with a NULL rating is a soil that the survey didn't rate.
|
|
114
116
|
if (component.compkind === "Miscellaneous area") {
|
|
115
117
|
notRateable += weight
|
|
116
118
|
} else {
|
package/sdk/survey-area.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
6
3
|
|
|
7
4
|
import { parseJSONStrict, stringifyJSON } from "@mailwoman/core/json"
|
|
8
5
|
import { runFile } from "@mailwoman/core/process"
|
|
@@ -215,8 +212,7 @@ function isNoMapping(musym: string, muname: string, componentCount: number): boo
|
|
|
215
212
|
/**
|
|
216
213
|
* Refuse a value outside the authority's own declared domain.
|
|
217
214
|
*
|
|
218
|
-
* A blank is a real NULL state rather than a violation, recording that the
|
|
219
|
-
* survey did not rate the component.
|
|
215
|
+
* A blank is a real NULL state rather than a violation, recording that the survey didn't rate the component.
|
|
220
216
|
*/
|
|
221
217
|
function assertDeclared(
|
|
222
218
|
declared: ReadonlySet<string>,
|
|
@@ -240,7 +236,7 @@ function nullable(value: string | null | undefined): string | null {
|
|
|
240
236
|
/**
|
|
241
237
|
* The nccpi v3.0 overall index per component.
|
|
242
238
|
*
|
|
243
|
-
* Sub-rules at greater depths are submodels this layer
|
|
239
|
+
* Sub-rules at greater depths are submodels this layer doesn't include.
|
|
244
240
|
*/
|
|
245
241
|
async function readNCCPI(
|
|
246
242
|
tabularDirectory: PathBuilderLike,
|
|
@@ -388,8 +384,7 @@ function elementBlocks(xml: string, name: string): string[] {
|
|
|
388
384
|
}
|
|
389
385
|
|
|
390
386
|
/**
|
|
391
|
-
* A bare year stays bare, since padding it to January 1 would invent a precision
|
|
392
|
-
* the citation does not claim.
|
|
387
|
+
* A bare year stays bare, since padding it to January 1 would invent a precision the citation doesn't claim.
|
|
393
388
|
*/
|
|
394
389
|
function normalizeFGDCDate(value: string): string {
|
|
395
390
|
const trimmed = value.trim()
|
package/sdk/tabular.ts
CHANGED
|
@@ -1,26 +1,41 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
+
* Reads the pipe-delimited NASIS export inside a survey-area archive.
|
|
6
|
+
*
|
|
7
|
+
* It maps files to tables and columns to positions, then reads the authority's declared domains.
|
|
8
|
+
*
|
|
9
|
+
* The files have no headers.
|
|
10
|
+
* The archive supplies their schema.
|
|
11
|
+
*
|
|
12
|
+
* `mstab.txt` maps each logical table name to a filename
|
|
13
|
+
* (`component` → `comp.txt`, `sacatalog` → `sacatlog.txt`).
|
|
14
|
+
* The filenames cannot be inferred.
|
|
15
|
+
*
|
|
16
|
+
* `mstabcol.txt` gives each column's ordinal position.
|
|
17
|
+
* The reader looks up those positions instead of hard-coding them. {@link readTable} throws
|
|
18
|
+
* when a requested column is absent from the shipped dictionary.
|
|
19
|
+
*
|
|
20
|
+
* An `undefined` result for a renamed column would turn a source change into an apparent absence.
|
|
21
|
+
* That would corrupt the measurement.
|
|
22
|
+
*
|
|
23
|
+
* Quote handling affects the parsed result.
|
|
24
|
+
* `sacatlog.txt` contains 594 newline bytes and one record.
|
|
5
25
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
26
|
+
* Its `fgdcmetadata` column contains a 43,251-character XML document with embedded newlines.
|
|
27
|
+
* `mstabcol.txt`, the column dictionary, contains 913 newlines and 865 records.
|
|
8
28
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* gives each column's ordinal position. The reader looks up those positions instead of hard-coding them.
|
|
12
|
-
* {@link readTable} throws when a requested column is absent from the shipped dictionary. An `undefined` result
|
|
13
|
-
* for a renamed column would turn a source change into an apparent absence. That would corrupt the measurement.
|
|
29
|
+
* A line-splitting reader would create 594 malformed rows from the one-row `sacatlog.txt` file.
|
|
30
|
+
* Each malformed row would still look valid enough to process.
|
|
14
31
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* dictionary, contains 913 newlines and 865 records. A line-splitting reader would create 594 malformed rows from
|
|
18
|
-
* the one-row `sacatlog.txt` file. Each malformed row would still look valid enough to process.
|
|
32
|
+
* The archive also supplies its declared domains.
|
|
33
|
+
* Those values remove the need to transcribe them by hand.
|
|
19
34
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
35
|
+
* `msdomdet.txt` lists every `Choice` column's members and the authority's prose definition.
|
|
36
|
+
* It includes capability classes 1 through 8, subclasses `c`/`e`/`s`/`w`,
|
|
37
|
+
* 28 conditional farmland classifications and six component kinds.
|
|
38
|
+
* The layer stores and validates those values.
|
|
24
39
|
*/
|
|
25
40
|
|
|
26
41
|
import { readLocalBuffer } from "@mailwoman/core/fs/readers"
|
|
@@ -93,7 +108,7 @@ const MSTABCOL_WIDTH = 14
|
|
|
93
108
|
/**
|
|
94
109
|
* Read the archive's table and column dictionaries.
|
|
95
110
|
*
|
|
96
|
-
* @throws {Error} When either bootstrap file is missing or
|
|
111
|
+
* @throws {Error} When either bootstrap file is missing or isn't the declared width.
|
|
97
112
|
*/
|
|
98
113
|
export async function readTabularDictionary(tabularDirectory: PathBuilderLike): Promise<TabularDictionary> {
|
|
99
114
|
const directory = PathBuilder.from(tabularDirectory)
|
|
@@ -160,7 +175,7 @@ export interface TabularTable {
|
|
|
160
175
|
/**
|
|
161
176
|
* Read a logical ssurgo table, projecting `wanted` columns.
|
|
162
177
|
*
|
|
163
|
-
* @throws {Error} When the archive declares no file for the table, when a requested column
|
|
178
|
+
* @throws {Error} When the archive declares no file for the table, when a requested column isn't in
|
|
164
179
|
* the shipped dictionary, or when a record is narrower than the position a requested column sits at.
|
|
165
180
|
*/
|
|
166
181
|
export async function readTable(
|
|
@@ -232,7 +247,7 @@ export interface DomainMember {
|
|
|
232
247
|
*
|
|
233
248
|
* Declared in `mstabcol.txt` under table `msdomdet`, so unlike the two bootstrap
|
|
234
249
|
* files above these could be looked up.
|
|
235
|
-
* They
|
|
250
|
+
* They're listed here because the domain read runs before any dictionary-driven read
|
|
236
251
|
* and the file is five columns wide by its own declaration.
|
|
237
252
|
*/
|
|
238
253
|
const MSDOMDET_WIDTH = 5
|
|
@@ -240,7 +255,7 @@ const MSDOMDET_WIDTH = 5
|
|
|
240
255
|
/**
|
|
241
256
|
* Read the authority's declared domains out of the archive.
|
|
242
257
|
*
|
|
243
|
-
* @throws {Error} When the file
|
|
258
|
+
* @throws {Error} When the file isn't the declared width.
|
|
244
259
|
*/
|
|
245
260
|
export async function readDeclaredDomains(tabularDirectory: PathBuilderLike): Promise<DomainMember[]> {
|
|
246
261
|
const rows = await readPipeDelimited(resolvePathBuilder(tabularDirectory, "msdomdet.txt"))
|
|
@@ -279,7 +294,7 @@ export function domainCodes(members: ReadonlyArray<DomainMember>, domain: string
|
|
|
279
294
|
* The download URL needs `2025-09-09`.
|
|
280
295
|
* Both channels agree only when the code parses the value as a date instead of slicing the string.
|
|
281
296
|
*
|
|
282
|
-
* @throws {Error} When the value
|
|
297
|
+
* @throws {Error} When the value isn't one of those shapes.
|
|
283
298
|
* An incorrect freshness date requests a nonexistent file.
|
|
284
299
|
* The host returns 400 for the request.
|
|
285
300
|
* A 404 would identify a missing file.
|
package/sdk/test-kit.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
6
3
|
|
|
7
4
|
// The exterior and hole ring builders live in `@mailwoman/spatial`; a second copy
|
|
8
5
|
// is a second place for a hole to stop being one.
|
|
@@ -107,10 +104,10 @@ export function fixtureComponents(): SoilComponentTable[] {
|
|
|
107
104
|
component("co-mixed-2", "mu-mixed", 35, "Series", "3", "e"),
|
|
108
105
|
component("co-mixed-3", "mu-mixed", 20, "Series", "6", "s"),
|
|
109
106
|
component("co-class8", "mu-class8", 100, "Series", "8", "s"),
|
|
110
|
-
// A miscellaneous area with no rating
|
|
107
|
+
// A miscellaneous area with no rating isn't rateable.
|
|
111
108
|
// That differs from unrated soil and class 8.
|
|
112
109
|
component("co-water", "mu-water", 100, "Miscellaneous area", null, null),
|
|
113
|
-
// A soil type the survey
|
|
110
|
+
// A soil type the survey didn't rate: unrated.
|
|
114
111
|
component("co-unrated", "mu-unrated", 100, "Series", null, null),
|
|
115
112
|
// A minority component small enough to fall under the truncation floor once the lattice splits it.
|
|
116
113
|
component("co-tail", "mu-mixed", 1, "Series", "7", "e"),
|
package/sdk/verify.ts
CHANGED