all these changes

This commit is contained in:
Jake Kasper
2026-04-09 13:19:47 -05:00
parent e83a51a051
commit 65315f36d1
39102 changed files with 7932979 additions and 567 deletions

20
frontend/node_modules/@turf/moran-index/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2017 TurfJS
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

107
frontend/node_modules/@turf/moran-index/README.md generated vendored Normal file
View File

@@ -0,0 +1,107 @@
# @turf/moran-index
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
## moranIndex
Moran's I measures patterns of attribute values associated with features.
The method reveal whether similar values tend to occur near each other,
or whether high or low values are interspersed.
Moran's I > 0 means a clusterd pattern.
Moran's I &lt; 0 means a dispersed pattern.
Moran's I = 0 means a random pattern.
In order to test the significance of the result. The z score is calculated.
A positive enough z-score (ex. >1.96) indicates clustering,
while a negative enough z-score (ex. &lt;-1.96) indicates a dispersed pattern.
the z-score can be calculated based on a normal or random assumption.
**Bibliography\***
1. [Moran's I](https://en.wikipedia.org/wiki/Moran%27s_I)
2. [pysal](http://pysal.readthedocs.io/en/latest/index.html)
3. Andy Mitchell, The ESRI Guide to GIS Analysis Volume 2: Spatial Measurements & Statistics.
**Parameters**
- `fc` **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)&lt;any>**
- `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
- `options.inputField` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the property name, must contain numeric values
- `options.threshold` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** the distance threshold (optional, default `100000`)
- `options.p` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** the Minkowski p-norm distance parameter (optional, default `2`)
- `options.binary` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** whether transfrom the distance to binary (optional, default `false`)
- `options.alpha` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** the distance decay parameter (optional, default `-1`)
- `options.standardization` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** wheter row standardization the distance (optional, default `true`)
**Examples**
```javascript
const bbox = [-65, 40, -63, 42];
const dataset = turf.randomPoint(100, { bbox: bbox });
const result = moranIndex(pts, {
inputField: 'CRIME',
});
```
Returns **[MoranIndex](#moranindex)**
## mean
get mean of a list
**Parameters**
- `y` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)>**
Returns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**
## variance
get variance of a list
**Parameters**
- `y` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)>**
Returns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**
## MoranIndex
Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
**Properties**
- `moranIndex` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** the moran's Index of the observed feature set
- `expectedMoranIndex` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** the moran's Index of the random distribution
- `stdNorm` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** the standard devitaion of the random distribution
- `zNorm` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** the z-score of the observe samples with regard to the random distribution
<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->
---
This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.
### Installation
Install this module individually:
```sh
$ npm install @turf/moran-index
```
Or install the Turf module that includes it as a function:
```sh
$ npm install @turf/turf
```

133
frontend/node_modules/@turf/moran-index/dist/es/index.js generated vendored Executable file
View File

@@ -0,0 +1,133 @@
import spatialWeight from "@turf/distance-weight";
import { featureEach } from "@turf/meta";
/**
* Moran's I measures patterns of attribute values associated with features.
* The method reveal whether similar values tend to occur near each other,
* or whether high or low values are interspersed.
*
* Moran's I > 0 means a clusterd pattern.
* Moran's I < 0 means a dispersed pattern.
* Moran's I = 0 means a random pattern.
*
* In order to test the significance of the result. The z score is calculated.
* A positive enough z-score (ex. >1.96) indicates clustering,
* while a negative enough z-score (ex. <-1.96) indicates a dispersed pattern.
*
* the z-score can be calculated based on a normal or random assumption.
*
* **Bibliography***
*
* 1. [Moran's I](https://en.wikipedia.org/wiki/Moran%27s_I)
*
* 2. [pysal](http://pysal.readthedocs.io/en/latest/index.html)
*
* 3. Andy Mitchell, The ESRI Guide to GIS Analysis Volume 2: Spatial Measurements & Statistics.
*
* @name moranIndex
* @param {FeatureCollection<any>} fc
* @param {Object} options
* @param {string} options.inputField the property name, must contain numeric values
* @param {number} [options.threshold=100000] the distance threshold
* @param {number} [options.p=2] the Minkowski p-norm distance parameter
* @param {boolean} [options.binary=false] whether transfrom the distance to binary
* @param {number} [options.alpha=-1] the distance decay parameter
* @param {boolean} [options.standardization=true] wheter row standardization the distance
* @returns {MoranIndex}
* @example
*
* const bbox = [-65, 40, -63, 42];
* const dataset = turf.randomPoint(100, { bbox: bbox });
*
* const result = turf.moranIndex(dataset, {
* inputField: 'CRIME',
* });
*/
export default function (fc, options) {
var inputField = options.inputField;
var threshold = options.threshold || 100000;
var p = options.p || 2;
var binary = options.binary || false;
var alpha = options.alpha || -1;
var standardization = options.standardization || true;
var weight = spatialWeight(fc, {
alpha: alpha,
binary: binary,
p: p,
standardization: standardization,
threshold: threshold,
});
var y = [];
featureEach(fc, function (feature) {
var feaProperties = feature.properties || {};
// validate inputField exists
y.push(feaProperties[inputField]);
});
var yMean = mean(y);
var yVar = variance(y);
var weightSum = 0;
var s0 = 0;
var s1 = 0;
var s2 = 0;
var n = weight.length;
// validate y.length is the same as weight.length
for (var i = 0; i < n; i++) {
var subS2 = 0;
for (var j = 0; j < n; j++) {
weightSum += weight[i][j] * (y[i] - yMean) * (y[j] - yMean);
s0 += weight[i][j];
s1 += Math.pow(weight[i][j] + weight[j][i], 2);
subS2 += weight[i][j] + weight[j][i];
}
s2 += Math.pow(subS2, 2);
}
s1 = 0.5 * s1;
var moranIndex = weightSum / s0 / yVar;
var expectedMoranIndex = -1 / (n - 1);
var vNum = n * n * s1 - n * s2 + 3 * (s0 * s0);
var vDen = (n - 1) * (n + 1) * (s0 * s0);
var vNorm = vNum / vDen - expectedMoranIndex * expectedMoranIndex;
var stdNorm = Math.sqrt(vNorm);
var zNorm = (moranIndex - expectedMoranIndex) / stdNorm;
return {
expectedMoranIndex: expectedMoranIndex,
moranIndex: moranIndex,
stdNorm: stdNorm,
zNorm: zNorm,
};
}
/**
* get mean of a list
* @param {number[]} y
* @returns {number}
*
*/
function mean(y) {
var sum = 0;
for (var _i = 0, y_1 = y; _i < y_1.length; _i++) {
var item = y_1[_i];
sum += item;
}
return sum / y.length;
}
/**
* get variance of a list
* @param {number[]} y
* @returns {number}
*
*/
function variance(y) {
var yMean = mean(y);
var sum = 0;
for (var _i = 0, y_2 = y; _i < y_2.length; _i++) {
var item = y_2[_i];
sum += Math.pow(item - yMean, 2);
}
return sum / y.length;
}
/**
* @typedef {Object} MoranIndex
* @property {number} moranIndex the moran's Index of the observed feature set
* @property {number} expectedMoranIndex the moran's Index of the random distribution
* @property {number} stdNorm the standard devitaion of the random distribution
* @property {number} zNorm the z-score of the observe samples with regard to the random distribution
*/

View File

@@ -0,0 +1 @@
{"type":"module"}

63
frontend/node_modules/@turf/moran-index/dist/js/index.d.ts generated vendored Executable file
View File

@@ -0,0 +1,63 @@
import { FeatureCollection } from "@turf/helpers";
/**
* Moran's I measures patterns of attribute values associated with features.
* The method reveal whether similar values tend to occur near each other,
* or whether high or low values are interspersed.
*
* Moran's I > 0 means a clusterd pattern.
* Moran's I < 0 means a dispersed pattern.
* Moran's I = 0 means a random pattern.
*
* In order to test the significance of the result. The z score is calculated.
* A positive enough z-score (ex. >1.96) indicates clustering,
* while a negative enough z-score (ex. <-1.96) indicates a dispersed pattern.
*
* the z-score can be calculated based on a normal or random assumption.
*
* **Bibliography***
*
* 1. [Moran's I](https://en.wikipedia.org/wiki/Moran%27s_I)
*
* 2. [pysal](http://pysal.readthedocs.io/en/latest/index.html)
*
* 3. Andy Mitchell, The ESRI Guide to GIS Analysis Volume 2: Spatial Measurements & Statistics.
*
* @name moranIndex
* @param {FeatureCollection<any>} fc
* @param {Object} options
* @param {string} options.inputField the property name, must contain numeric values
* @param {number} [options.threshold=100000] the distance threshold
* @param {number} [options.p=2] the Minkowski p-norm distance parameter
* @param {boolean} [options.binary=false] whether transfrom the distance to binary
* @param {number} [options.alpha=-1] the distance decay parameter
* @param {boolean} [options.standardization=true] wheter row standardization the distance
* @returns {MoranIndex}
* @example
*
* const bbox = [-65, 40, -63, 42];
* const dataset = turf.randomPoint(100, { bbox: bbox });
*
* const result = turf.moranIndex(dataset, {
* inputField: 'CRIME',
* });
*/
export default function (fc: FeatureCollection<any>, options: {
inputField: string;
threshold?: number;
p?: number;
binary?: boolean;
alpha?: number;
standardization?: boolean;
}): {
moranIndex: number;
expectedMoranIndex: number;
stdNorm: number;
zNorm: number;
};
/**
* @typedef {Object} MoranIndex
* @property {number} moranIndex the moran's Index of the observed feature set
* @property {number} expectedMoranIndex the moran's Index of the random distribution
* @property {number} stdNorm the standard devitaion of the random distribution
* @property {number} zNorm the z-score of the observe samples with regard to the random distribution
*/

139
frontend/node_modules/@turf/moran-index/dist/js/index.js generated vendored Executable file
View File

@@ -0,0 +1,139 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var distance_weight_1 = __importDefault(require("@turf/distance-weight"));
var meta_1 = require("@turf/meta");
/**
* Moran's I measures patterns of attribute values associated with features.
* The method reveal whether similar values tend to occur near each other,
* or whether high or low values are interspersed.
*
* Moran's I > 0 means a clusterd pattern.
* Moran's I < 0 means a dispersed pattern.
* Moran's I = 0 means a random pattern.
*
* In order to test the significance of the result. The z score is calculated.
* A positive enough z-score (ex. >1.96) indicates clustering,
* while a negative enough z-score (ex. <-1.96) indicates a dispersed pattern.
*
* the z-score can be calculated based on a normal or random assumption.
*
* **Bibliography***
*
* 1. [Moran's I](https://en.wikipedia.org/wiki/Moran%27s_I)
*
* 2. [pysal](http://pysal.readthedocs.io/en/latest/index.html)
*
* 3. Andy Mitchell, The ESRI Guide to GIS Analysis Volume 2: Spatial Measurements & Statistics.
*
* @name moranIndex
* @param {FeatureCollection<any>} fc
* @param {Object} options
* @param {string} options.inputField the property name, must contain numeric values
* @param {number} [options.threshold=100000] the distance threshold
* @param {number} [options.p=2] the Minkowski p-norm distance parameter
* @param {boolean} [options.binary=false] whether transfrom the distance to binary
* @param {number} [options.alpha=-1] the distance decay parameter
* @param {boolean} [options.standardization=true] wheter row standardization the distance
* @returns {MoranIndex}
* @example
*
* const bbox = [-65, 40, -63, 42];
* const dataset = turf.randomPoint(100, { bbox: bbox });
*
* const result = turf.moranIndex(dataset, {
* inputField: 'CRIME',
* });
*/
function default_1(fc, options) {
var inputField = options.inputField;
var threshold = options.threshold || 100000;
var p = options.p || 2;
var binary = options.binary || false;
var alpha = options.alpha || -1;
var standardization = options.standardization || true;
var weight = distance_weight_1.default(fc, {
alpha: alpha,
binary: binary,
p: p,
standardization: standardization,
threshold: threshold,
});
var y = [];
meta_1.featureEach(fc, function (feature) {
var feaProperties = feature.properties || {};
// validate inputField exists
y.push(feaProperties[inputField]);
});
var yMean = mean(y);
var yVar = variance(y);
var weightSum = 0;
var s0 = 0;
var s1 = 0;
var s2 = 0;
var n = weight.length;
// validate y.length is the same as weight.length
for (var i = 0; i < n; i++) {
var subS2 = 0;
for (var j = 0; j < n; j++) {
weightSum += weight[i][j] * (y[i] - yMean) * (y[j] - yMean);
s0 += weight[i][j];
s1 += Math.pow(weight[i][j] + weight[j][i], 2);
subS2 += weight[i][j] + weight[j][i];
}
s2 += Math.pow(subS2, 2);
}
s1 = 0.5 * s1;
var moranIndex = weightSum / s0 / yVar;
var expectedMoranIndex = -1 / (n - 1);
var vNum = n * n * s1 - n * s2 + 3 * (s0 * s0);
var vDen = (n - 1) * (n + 1) * (s0 * s0);
var vNorm = vNum / vDen - expectedMoranIndex * expectedMoranIndex;
var stdNorm = Math.sqrt(vNorm);
var zNorm = (moranIndex - expectedMoranIndex) / stdNorm;
return {
expectedMoranIndex: expectedMoranIndex,
moranIndex: moranIndex,
stdNorm: stdNorm,
zNorm: zNorm,
};
}
exports.default = default_1;
/**
* get mean of a list
* @param {number[]} y
* @returns {number}
*
*/
function mean(y) {
var sum = 0;
for (var _i = 0, y_1 = y; _i < y_1.length; _i++) {
var item = y_1[_i];
sum += item;
}
return sum / y.length;
}
/**
* get variance of a list
* @param {number[]} y
* @returns {number}
*
*/
function variance(y) {
var yMean = mean(y);
var sum = 0;
for (var _i = 0, y_2 = y; _i < y_2.length; _i++) {
var item = y_2[_i];
sum += Math.pow(item - yMean, 2);
}
return sum / y.length;
}
/**
* @typedef {Object} MoranIndex
* @property {number} moranIndex the moran's Index of the observed feature set
* @property {number} expectedMoranIndex the moran's Index of the random distribution
* @property {number} stdNorm the standard devitaion of the random distribution
* @property {number} zNorm the z-score of the observe samples with regard to the random distribution
*/

66
frontend/node_modules/@turf/moran-index/package.json generated vendored Normal file
View File

@@ -0,0 +1,66 @@
{
"name": "@turf/moran-index",
"version": "6.5.0",
"description": "turf moran-index module",
"author": "Turf Authors",
"contributors": [
"Haoming Zhuang <@zhuang-hao-ming>"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/Turfjs/turf/issues"
},
"homepage": "https://github.com/Turfjs/turf",
"repository": {
"type": "git",
"url": "git://github.com/Turfjs/turf.git"
},
"funding": "https://opencollective.com/turf",
"publishConfig": {
"access": "public"
},
"keywords": [
"turf",
"moran-index"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"exports": {
"./package.json": "./package.json",
".": {
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "ts-node bench.js",
"build": "npm-run-all build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"docs": "node ../../scripts/generate-readmes",
"test": "npm-run-all test:*",
"test:tape": "ts-node -r esm test.js"
},
"devDependencies": {
"@types/tape": "*",
"benchmark": "*",
"load-json-file": "*",
"npm-run-all": "*",
"tape": "*",
"ts-node": "*",
"tslint": "*",
"typescript": "*",
"write-json-file": "*"
},
"dependencies": {
"@turf/distance-weight": "^6.5.0",
"@turf/helpers": "^6.5.0",
"@turf/meta": "^6.5.0"
},
"gitHead": "5375941072b90d489389db22b43bfe809d5e451e"
}