w-geo 1.1.20 → 1.1.21
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 +1 -1
- package/dist/w-geo.umd.js +2 -2
- package/dist/w-geo.umd.js.map +1 -1
- package/docs/-_class.mjs.html +1 -1
- package/docs/calcDepthByDepthStartEnd.mjs.html +1 -1
- package/docs/calcDepthStartEndByConnect.mjs.html +1 -1
- package/docs/calcDepthStartEndByDepth.mjs.html +1 -1
- package/docs/calcDepthStartEndByGroup.mjs.html +1 -1
- package/docs/calcLiquefaction.mjs.html +1 -1
- package/docs/calcVerticalStress.mjs.html +1 -1
- package/docs/checkDepth.mjs.html +1 -1
- package/docs/checkDepthStartEnd.mjs.html +1 -1
- package/docs/complementDepthData.mjs.html +1 -1
- package/docs/groupByDepthStartEnd.mjs.html +1 -1
- package/docs/index.html +1 -1
- package/docs/mergeByDepthStartEnd.mjs.html +1 -1
- package/docs/relaPlasticityParams.mjs.html +1 -1
- package/docs/relaPorousParams.mjs.html +1 -1
- package/docs/sepDepthStartEndByDepth.mjs.html +1 -1
- package/docs/smoothDepthByKey.mjs.html +1 -1
- package/docs/w-geo.html +1 -1
- package/g_7_1-intrpPsdBySize.mjs +52 -0
- package/{g_7_9-calcPropInterfaceFrictionAngle.mjs → g_7_a1-calcPropInterfaceFrictionAngle.mjs} +1 -1
- package/g_8_1-dtIntrpPsdBySize.mjs +50 -0
- package/package.json +1 -1
- package/src/WGeo.mjs +2 -0
- package/src/dtIntrpPsdBySize.mjs +137 -0
- package/src/intrpPsdBySize.mjs +125 -0
- package/test/dtIntrpPsdBySize.test.mjs +50 -0
- package/test/intrpPsdBySize.test.mjs +29 -0
package/docs/-_class.mjs.html
CHANGED
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
<br class="clear">
|
|
63
63
|
|
|
64
64
|
<footer>
|
|
65
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on
|
|
65
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Wed May 08 2024 22:17:07 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
66
66
|
</footer>
|
|
67
67
|
|
|
68
68
|
<script>prettyPrint();</script>
|
|
@@ -233,7 +233,7 @@ export default calcDepthByDepthStartEnd
|
|
|
233
233
|
<br class="clear">
|
|
234
234
|
|
|
235
235
|
<footer>
|
|
236
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on
|
|
236
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Wed May 08 2024 22:17:07 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
237
237
|
</footer>
|
|
238
238
|
|
|
239
239
|
<script>prettyPrint();</script>
|
|
@@ -322,7 +322,7 @@ export default calcDepthStartEndByConnect
|
|
|
322
322
|
<br class="clear">
|
|
323
323
|
|
|
324
324
|
<footer>
|
|
325
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on
|
|
325
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Wed May 08 2024 22:17:07 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
326
326
|
</footer>
|
|
327
327
|
|
|
328
328
|
<script>prettyPrint();</script>
|
|
@@ -347,7 +347,7 @@ export default calcDepthStartEndByDepth
|
|
|
347
347
|
<br class="clear">
|
|
348
348
|
|
|
349
349
|
<footer>
|
|
350
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on
|
|
350
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Wed May 08 2024 22:17:07 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
351
351
|
</footer>
|
|
352
352
|
|
|
353
353
|
<script>prettyPrint();</script>
|
|
@@ -566,7 +566,7 @@ export default calcDepthStartEndByGroup
|
|
|
566
566
|
<br class="clear">
|
|
567
567
|
|
|
568
568
|
<footer>
|
|
569
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on
|
|
569
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Wed May 08 2024 22:17:07 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
570
570
|
</footer>
|
|
571
571
|
|
|
572
572
|
<script>prettyPrint();</script>
|
|
@@ -7801,7 +7801,7 @@ export default calcLiquefaction
|
|
|
7801
7801
|
<br class="clear">
|
|
7802
7802
|
|
|
7803
7803
|
<footer>
|
|
7804
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on
|
|
7804
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Wed May 08 2024 22:17:07 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
7805
7805
|
</footer>
|
|
7806
7806
|
|
|
7807
7807
|
<script>prettyPrint();</script>
|
|
@@ -733,7 +733,7 @@ export default { //整合輸出預設得要有default
|
|
|
733
733
|
<br class="clear">
|
|
734
734
|
|
|
735
735
|
<footer>
|
|
736
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on
|
|
736
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Wed May 08 2024 22:17:07 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
737
737
|
</footer>
|
|
738
738
|
|
|
739
739
|
<script>prettyPrint();</script>
|
package/docs/checkDepth.mjs.html
CHANGED
|
@@ -214,7 +214,7 @@ export default checkDepth
|
|
|
214
214
|
<br class="clear">
|
|
215
215
|
|
|
216
216
|
<footer>
|
|
217
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on
|
|
217
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Wed May 08 2024 22:17:07 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
218
218
|
</footer>
|
|
219
219
|
|
|
220
220
|
<script>prettyPrint();</script>
|
|
@@ -273,7 +273,7 @@ export default checkDepthStartEnd
|
|
|
273
273
|
<br class="clear">
|
|
274
274
|
|
|
275
275
|
<footer>
|
|
276
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on
|
|
276
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Wed May 08 2024 22:17:07 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
277
277
|
</footer>
|
|
278
278
|
|
|
279
279
|
<script>prettyPrint();</script>
|
|
@@ -506,7 +506,7 @@ export default complementDepthData
|
|
|
506
506
|
<br class="clear">
|
|
507
507
|
|
|
508
508
|
<footer>
|
|
509
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on
|
|
509
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Wed May 08 2024 22:17:07 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
510
510
|
</footer>
|
|
511
511
|
|
|
512
512
|
<script>prettyPrint();</script>
|
|
@@ -492,7 +492,7 @@ export default groupByDepthStartEnd
|
|
|
492
492
|
<br class="clear">
|
|
493
493
|
|
|
494
494
|
<footer>
|
|
495
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on
|
|
495
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Wed May 08 2024 22:17:07 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
496
496
|
</footer>
|
|
497
497
|
|
|
498
498
|
<script>prettyPrint();</script>
|
package/docs/index.html
CHANGED
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
<br class="clear">
|
|
72
72
|
|
|
73
73
|
<footer>
|
|
74
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on
|
|
74
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Wed May 08 2024 22:17:07 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
75
75
|
</footer>
|
|
76
76
|
|
|
77
77
|
<script>prettyPrint();</script>
|
|
@@ -907,7 +907,7 @@ export default mergeByDepthStartEnd
|
|
|
907
907
|
<br class="clear">
|
|
908
908
|
|
|
909
909
|
<footer>
|
|
910
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on
|
|
910
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Wed May 08 2024 22:17:07 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
911
911
|
</footer>
|
|
912
912
|
|
|
913
913
|
<script>prettyPrint();</script>
|
|
@@ -334,7 +334,7 @@ export default relaPlasticityParams
|
|
|
334
334
|
<br class="clear">
|
|
335
335
|
|
|
336
336
|
<footer>
|
|
337
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on
|
|
337
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Wed May 08 2024 22:17:07 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
338
338
|
</footer>
|
|
339
339
|
|
|
340
340
|
<script>prettyPrint();</script>
|
|
@@ -524,7 +524,7 @@ export default relaPorousParams
|
|
|
524
524
|
<br class="clear">
|
|
525
525
|
|
|
526
526
|
<footer>
|
|
527
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on
|
|
527
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Wed May 08 2024 22:17:07 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
528
528
|
</footer>
|
|
529
529
|
|
|
530
530
|
<script>prettyPrint();</script>
|
|
@@ -324,7 +324,7 @@ export default sepDepthStartEndByDepth
|
|
|
324
324
|
<br class="clear">
|
|
325
325
|
|
|
326
326
|
<footer>
|
|
327
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on
|
|
327
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Wed May 08 2024 22:17:07 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
328
328
|
</footer>
|
|
329
329
|
|
|
330
330
|
<script>prettyPrint();</script>
|
|
@@ -280,7 +280,7 @@ export default smoothDepthByKey
|
|
|
280
280
|
<br class="clear">
|
|
281
281
|
|
|
282
282
|
<footer>
|
|
283
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on
|
|
283
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Wed May 08 2024 22:17:07 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
284
284
|
</footer>
|
|
285
285
|
|
|
286
286
|
<script>prettyPrint();</script>
|
package/docs/w-geo.html
CHANGED
|
@@ -9658,7 +9658,7 @@
|
|
|
9658
9658
|
<br class="clear">
|
|
9659
9659
|
|
|
9660
9660
|
<footer>
|
|
9661
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on
|
|
9661
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Wed May 08 2024 22:17:07 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
9662
9662
|
</footer>
|
|
9663
9663
|
|
|
9664
9664
|
<script>prettyPrint();</script>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import fs from 'fs'
|
|
2
|
+
import _ from 'lodash-es'
|
|
3
|
+
import w from 'wsemi'
|
|
4
|
+
import intrpPsdBySize from './src/intrpPsdBySize.mjs'
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
let psd = [101.6, 76.2, 50.8, 25.4, 19.0, 9.5, 4.75, 2.0, 0.85, 0.425, 0.25, 0.15, 0.106, 0.075, 0.027, 0.018, 0.011, 0.008, 0.006, 0.003, 0.001, 0.0, 0.0, 0.0]
|
|
8
|
+
let psf = [100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, -1.0, 100.0, 99.0, 96.0, 86.0, 74.0, 61.0, 51.0, 32.0, 16.0, 0.0, 0.0, 0.0]
|
|
9
|
+
let pfss = _.map(psd, (_v, k) => {
|
|
10
|
+
let s = _.get(psd, k)
|
|
11
|
+
let f = _.get(psf, k)
|
|
12
|
+
return {
|
|
13
|
+
size: s,
|
|
14
|
+
fraction: f,
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
console.log('pfss', pfss)
|
|
18
|
+
// => pfss [
|
|
19
|
+
// { size: 101.6, fraction: 100 },
|
|
20
|
+
// { size: 76.2, fraction: 100 },
|
|
21
|
+
// { size: 50.8, fraction: 100 },
|
|
22
|
+
// { size: 25.4, fraction: 100 },
|
|
23
|
+
// { size: 19, fraction: 100 },
|
|
24
|
+
// { size: 9.5, fraction: 100 },
|
|
25
|
+
// { size: 4.75, fraction: 100 },
|
|
26
|
+
// { size: 2, fraction: 100 },
|
|
27
|
+
// { size: 0.85, fraction: 100 },
|
|
28
|
+
// { size: 0.425, fraction: 100 },
|
|
29
|
+
// { size: 0.25, fraction: 100 },
|
|
30
|
+
// { size: 0.15, fraction: -1 },
|
|
31
|
+
// { size: 0.106, fraction: 100 },
|
|
32
|
+
// { size: 0.075, fraction: 99 },
|
|
33
|
+
// { size: 0.027, fraction: 96 },
|
|
34
|
+
// { size: 0.018, fraction: 86 },
|
|
35
|
+
// { size: 0.011, fraction: 74 },
|
|
36
|
+
// { size: 0.008, fraction: 61 },
|
|
37
|
+
// { size: 0.006, fraction: 51 },
|
|
38
|
+
// { size: 0.003, fraction: 32 },
|
|
39
|
+
// { size: 0.001, fraction: 16 },
|
|
40
|
+
// { size: 0, fraction: 0 },
|
|
41
|
+
// { size: 0, fraction: 0 },
|
|
42
|
+
// { size: 0, fraction: 0 }
|
|
43
|
+
// ]
|
|
44
|
+
|
|
45
|
+
let psizes = 0.063
|
|
46
|
+
|
|
47
|
+
let r = intrpPsdBySize(pfss, psizes)
|
|
48
|
+
console.log(r)
|
|
49
|
+
// => 98.4880247416152
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
//node --experimental-modules g_7_1-intrpPsdBySize.mjs
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import fs from 'fs'
|
|
2
|
+
import _ from 'lodash-es'
|
|
3
|
+
import w from 'wsemi'
|
|
4
|
+
import dtIntrpPsdBySize from './src/dtIntrpPsdBySize.mjs'
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
let dt = {
|
|
8
|
+
GSD: `[101.6, 76.2, 50.8, 25.4, 19.0, 9.5, 4.75, 2.0, 0.85, 0.425, 0.25, 0.15, 0.106, 0.075, 0.027, 0.018, 0.011, 0.008, 0.006, 0.003, 0.001, 0.0, 0.0, 0.0]`,
|
|
9
|
+
GSP: `[100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, -1.0, 100.0, 99.0, 96.0, 86.0, 74.0, 61.0, 51.0, 32.0, 16.0, 0.0, 0.0, 0.0]`,
|
|
10
|
+
}
|
|
11
|
+
console.log('dt', dt)
|
|
12
|
+
// => dt {
|
|
13
|
+
// GSD: '[101.6, 76.2, 50.8, 25.4, 19.0, 9.5, 4.75, 2.0, 0.85, 0.425, 0.25, 0.15, 0.106, 0.075, 0.027, 0.018, 0.011, 0.008, 0.006, 0.003, 0.001, 0.0, 0.0, 0.0]',
|
|
14
|
+
// GSP: '[100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, -1.0, 100.0, 99.0, 96.0, 86.0, 74.0, 61.0, 51.0, 32.0, 16.0, 0.0, 0.0, 0.0]'
|
|
15
|
+
// }
|
|
16
|
+
|
|
17
|
+
let psizes = [
|
|
18
|
+
630,
|
|
19
|
+
200,
|
|
20
|
+
63,
|
|
21
|
+
20,
|
|
22
|
+
6.3,
|
|
23
|
+
2,
|
|
24
|
+
0.63,
|
|
25
|
+
0.2,
|
|
26
|
+
0.063,
|
|
27
|
+
0.02,
|
|
28
|
+
0.0063,
|
|
29
|
+
0.002,
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
let fss = dtIntrpPsdBySize(dt, psizes)
|
|
33
|
+
console.log('fss', fss)
|
|
34
|
+
// => [
|
|
35
|
+
// { size: 630, fraction: 100 },
|
|
36
|
+
// { size: 200, fraction: 100 },
|
|
37
|
+
// { size: 63, fraction: 99.99999999999999 },
|
|
38
|
+
// { size: 20, fraction: 99.99999999999999 },
|
|
39
|
+
// { size: 6.3, fraction: 100.00000000000001 },
|
|
40
|
+
// { size: 2, fraction: 100 },
|
|
41
|
+
// { size: 0.63, fraction: 100.00000000000001 },
|
|
42
|
+
// { size: 0.2, fraction: 100 },
|
|
43
|
+
// { size: 0.063, fraction: 98.4880247416152 },
|
|
44
|
+
// { size: 0.02, fraction: 88.59851004564663 },
|
|
45
|
+
// { size: 0.0063, fraction: 52.69597513510718 },
|
|
46
|
+
// { size: 0.002, fraction: 26.094876057143324 }
|
|
47
|
+
// ]
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
//node --experimental-modules g_8_1-dtIntrpPsdBySize.mjs
|
package/package.json
CHANGED
package/src/WGeo.mjs
CHANGED
|
@@ -25,10 +25,12 @@ export { default as checkDepth } from './checkDepth.mjs'
|
|
|
25
25
|
export { default as checkDepthStartEnd } from './checkDepthStartEnd.mjs'
|
|
26
26
|
export { default as cnst } from './cnst.mjs'
|
|
27
27
|
export { default as complementDepthData } from './complementDepthData.mjs'
|
|
28
|
+
export { default as dtIntrpPsdBySize } from './dtIntrpPsdBySize.mjs'
|
|
28
29
|
export { default as getCptDepthHcOpt } from './getCptDepthHcOpt.mjs'
|
|
29
30
|
export { default as getDepthMaxMin } from './getDepthMaxMin.mjs'
|
|
30
31
|
export { default as groupByDepthStartEnd } from './groupByDepthStartEnd.mjs'
|
|
31
32
|
export { default as intrpDefParam } from './intrpDefParam.mjs'
|
|
33
|
+
export { default as intrpPsdBySize } from './intrpPsdBySize.mjs'
|
|
32
34
|
export { default as judge } from './judge.mjs'
|
|
33
35
|
export { default as mergeByDepthStartEnd } from './mergeByDepthStartEnd.mjs'
|
|
34
36
|
export { default as relaPlasticityParams } from './relaPlasticityParams.mjs'
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import each from 'lodash-es/each.js'
|
|
2
|
+
import map from 'lodash-es/map.js'
|
|
3
|
+
import get from 'lodash-es/get.js'
|
|
4
|
+
import j2o from 'wsemi/src/j2o.mjs'
|
|
5
|
+
import isearr from 'wsemi/src/isearr.mjs'
|
|
6
|
+
import isestr from 'wsemi/src/isestr.mjs'
|
|
7
|
+
import isnum from 'wsemi/src/isnum.mjs'
|
|
8
|
+
import cdbl from 'wsemi/src/cdbl.mjs'
|
|
9
|
+
import intrpPsdBySize from './intrpPsdBySize.mjs'
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
//parseStrArray
|
|
13
|
+
let parseStrArray = (c) => {
|
|
14
|
+
let r = j2o(c)
|
|
15
|
+
if (!isearr(r)) {
|
|
16
|
+
console.log('c', c)
|
|
17
|
+
throw new Error('無法解析JSON字串型陣列')
|
|
18
|
+
}
|
|
19
|
+
return r
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
function dtIntrpPsdBySize(dt, psizes, opt = {}) {
|
|
24
|
+
|
|
25
|
+
//keySize
|
|
26
|
+
let keySize = get(opt, 'keySize', '')
|
|
27
|
+
if (!isestr(keySize)) {
|
|
28
|
+
keySize = 'size'
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//keyFraction
|
|
32
|
+
let keyFraction = get(opt, 'keyFraction', '')
|
|
33
|
+
if (!isestr(keyFraction)) {
|
|
34
|
+
keyFraction = 'fraction'
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
//GSD
|
|
38
|
+
let GSD = get(dt, 'GSD', '')
|
|
39
|
+
if (!isestr(GSD) && !isearr(GSD)) {
|
|
40
|
+
throw new Error('invalid GSD')
|
|
41
|
+
}
|
|
42
|
+
if (isestr(GSD)) {
|
|
43
|
+
GSD = parseStrArray(GSD)
|
|
44
|
+
}
|
|
45
|
+
// console.log('GSD', GSD)
|
|
46
|
+
|
|
47
|
+
//GSP
|
|
48
|
+
let GSP = get(dt, 'GSP', '')
|
|
49
|
+
if (!isestr(GSP) && !isearr(GSP)) {
|
|
50
|
+
throw new Error('invalid GSP')
|
|
51
|
+
}
|
|
52
|
+
if (isestr(GSP)) {
|
|
53
|
+
GSP = parseStrArray(GSP)
|
|
54
|
+
}
|
|
55
|
+
// console.log('GSP', GSP)
|
|
56
|
+
|
|
57
|
+
//psizes
|
|
58
|
+
if (!isearr(psizes)) {
|
|
59
|
+
//ASTM
|
|
60
|
+
psizes = [
|
|
61
|
+
101.6,
|
|
62
|
+
76.2,
|
|
63
|
+
50.8,
|
|
64
|
+
25.4,
|
|
65
|
+
19.0,
|
|
66
|
+
9.5,
|
|
67
|
+
4.75,
|
|
68
|
+
2.0,
|
|
69
|
+
0.85,
|
|
70
|
+
0.425,
|
|
71
|
+
0.25,
|
|
72
|
+
0.15,
|
|
73
|
+
0.106,
|
|
74
|
+
0.075,
|
|
75
|
+
0.034,
|
|
76
|
+
0.022,
|
|
77
|
+
0.013,
|
|
78
|
+
0.009,
|
|
79
|
+
0.007,
|
|
80
|
+
0.003,
|
|
81
|
+
0.001,
|
|
82
|
+
]
|
|
83
|
+
// //ISO
|
|
84
|
+
// psizes = [
|
|
85
|
+
// 630,
|
|
86
|
+
// 200,
|
|
87
|
+
// 63,
|
|
88
|
+
// 20,
|
|
89
|
+
// 6.3,
|
|
90
|
+
// 2,
|
|
91
|
+
// 0.63,
|
|
92
|
+
// 0.2,
|
|
93
|
+
// 0.063,
|
|
94
|
+
// 0.02,
|
|
95
|
+
// 0.0063,
|
|
96
|
+
// 0.002,
|
|
97
|
+
// ]
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
//fss
|
|
101
|
+
let fss = []
|
|
102
|
+
each(GSD, (_v, k) => {
|
|
103
|
+
let size = get(GSD, k, '')
|
|
104
|
+
if (!isnum(size)) {
|
|
105
|
+
console.log(k, 'size', size)
|
|
106
|
+
throw new Error(`size[${size}] is not an effective number`)
|
|
107
|
+
}
|
|
108
|
+
size = cdbl(size)
|
|
109
|
+
let fraction = get(GSP, k, '')
|
|
110
|
+
if (!isnum(fraction)) {
|
|
111
|
+
console.log(k, 'fraction', fraction)
|
|
112
|
+
throw new Error(`fraction[${fraction}] is not an effective number`)
|
|
113
|
+
}
|
|
114
|
+
fraction = cdbl(fraction)
|
|
115
|
+
fss.push({
|
|
116
|
+
[keySize]: size,
|
|
117
|
+
[keyFraction]: fraction,
|
|
118
|
+
})
|
|
119
|
+
})
|
|
120
|
+
// console.log('fss', fss)
|
|
121
|
+
|
|
122
|
+
//重算各size處之通過百分比
|
|
123
|
+
let rs = intrpPsdBySize(fss, psizes, { keySize, keyFraction })
|
|
124
|
+
rs = map(rs, (fraction, k) => {
|
|
125
|
+
let size = get(psizes, k)
|
|
126
|
+
return {
|
|
127
|
+
[keySize]: size,
|
|
128
|
+
[keyFraction]: fraction,
|
|
129
|
+
}
|
|
130
|
+
})
|
|
131
|
+
// console.log('rs', rs)
|
|
132
|
+
|
|
133
|
+
return rs
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
export default dtIntrpPsdBySize
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import get from 'lodash-es/get.js'
|
|
2
|
+
import size from 'lodash-es/size.js'
|
|
3
|
+
import filter from 'lodash-es/filter.js'
|
|
4
|
+
import map from 'lodash-es/map.js'
|
|
5
|
+
import maxBy from 'lodash-es/maxBy.js'
|
|
6
|
+
import minBy from 'lodash-es/minBy.js'
|
|
7
|
+
import isnum from 'wsemi/src/isnum.mjs'
|
|
8
|
+
import isearr from 'wsemi/src/isearr.mjs'
|
|
9
|
+
import isestr from 'wsemi/src/isestr.mjs'
|
|
10
|
+
import cdbl from 'wsemi/src/cdbl.mjs'
|
|
11
|
+
import interp1 from 'wsemi/src/interp1.mjs'
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
function intrpPsdBySize(pfss, psizes, opt = {}) {
|
|
15
|
+
|
|
16
|
+
//keySize
|
|
17
|
+
let keySize = get(opt, 'keySize', '')
|
|
18
|
+
if (!isestr(keySize)) {
|
|
19
|
+
keySize = 'size'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//keyFraction
|
|
23
|
+
let keyFraction = get(opt, 'keyFraction', '')
|
|
24
|
+
if (!isestr(keyFraction)) {
|
|
25
|
+
keyFraction = 'fraction'
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//check
|
|
29
|
+
let pfs0 = get(pfss, 0)
|
|
30
|
+
let size0 = get(pfs0, keySize, '')
|
|
31
|
+
let fraction0 = get(pfs0, keyFraction, '')
|
|
32
|
+
if (!isnum(size0)) {
|
|
33
|
+
throw new Error(`pfssp[0][${keySize}] is not an effective number`)
|
|
34
|
+
}
|
|
35
|
+
if (!isnum(fraction0)) {
|
|
36
|
+
throw new Error(`fraction0[0][${keyFraction}] is not an effective number`)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//check
|
|
40
|
+
if (!isnum(psizes) && !isearr(psizes)) {
|
|
41
|
+
console.log('psizes', psizes)
|
|
42
|
+
throw new Error('psizes is not a number or an effective array')
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
//one
|
|
46
|
+
let one = false
|
|
47
|
+
if (isnum(psizes)) {
|
|
48
|
+
one = true
|
|
49
|
+
psizes = [cdbl(psizes)]
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
//取粒徑size與fraction為數字, 且size大於0(因要轉log內插), fraction要大於等於0, 且無施篩孔時值為-1亦須剔除
|
|
53
|
+
let rs = filter(pfss, (v) => {
|
|
54
|
+
let bs = cdbl(v[keySize]) > 0
|
|
55
|
+
let bf = cdbl(v[keyFraction]) >= 0
|
|
56
|
+
// console.log('bs', bs, v[keySize])
|
|
57
|
+
// console.log('bf', bf, v[keyFraction])
|
|
58
|
+
return bs && bf
|
|
59
|
+
})
|
|
60
|
+
// console.log('rs', rs)
|
|
61
|
+
|
|
62
|
+
//check
|
|
63
|
+
if (size(rs) === 0) {
|
|
64
|
+
console.log('pfss', pfss)
|
|
65
|
+
throw new Error(`invalid rs`)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
//lrs
|
|
69
|
+
let lrs = map(rs, (v) => {
|
|
70
|
+
v[keySize] = Math.log(v[keySize])
|
|
71
|
+
return v
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
//sizeLogMax, sizeLogMin
|
|
75
|
+
let sizeLogMax = maxBy(lrs, keySize)
|
|
76
|
+
let sizeLogMin = minBy(lrs, keySize)
|
|
77
|
+
|
|
78
|
+
//ifs
|
|
79
|
+
let ifs = map(psizes, (psize) => {
|
|
80
|
+
|
|
81
|
+
//sizeLog
|
|
82
|
+
let sizeLog = Math.log(psize)
|
|
83
|
+
// console.log('psize', psize)
|
|
84
|
+
// console.log('sizeLog', sizeLog)
|
|
85
|
+
|
|
86
|
+
//check
|
|
87
|
+
if (sizeLog >= sizeLogMax[keySize]) {
|
|
88
|
+
return sizeLogMax[keyFraction]
|
|
89
|
+
}
|
|
90
|
+
if (sizeLog <= sizeLogMin[keySize]) {
|
|
91
|
+
return sizeLogMin[keyFraction]
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
//interp1
|
|
95
|
+
let optP = {
|
|
96
|
+
keyX: keySize,
|
|
97
|
+
keyY: keyFraction,
|
|
98
|
+
}
|
|
99
|
+
let pfraction = interp1(lrs, sizeLog, optP)
|
|
100
|
+
// console.log('pfraction', pfraction)
|
|
101
|
+
|
|
102
|
+
//check
|
|
103
|
+
if (get(pfraction, 'err')) {
|
|
104
|
+
console.log('lrs', lrs)
|
|
105
|
+
console.log('sizeLog', sizeLog)
|
|
106
|
+
console.log('optP', optP)
|
|
107
|
+
console.log('pfraction', pfraction)
|
|
108
|
+
return null
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return pfraction
|
|
112
|
+
})
|
|
113
|
+
// console.log('ifs', ifs)
|
|
114
|
+
|
|
115
|
+
//r
|
|
116
|
+
let r = ifs
|
|
117
|
+
if (one) {
|
|
118
|
+
r = ifs[0]
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return r
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
export default intrpPsdBySize
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import assert from 'assert'
|
|
2
|
+
import _ from 'lodash-es'
|
|
3
|
+
import w from 'wsemi'
|
|
4
|
+
import dtIntrpPsdBySize from '../src/dtIntrpPsdBySize.mjs'
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
describe(`dtIntrpPsdBySize`, function() {
|
|
8
|
+
|
|
9
|
+
let dt = {
|
|
10
|
+
GSD: `[101.6, 76.2, 50.8, 25.4, 19.0, 9.5, 4.75, 2.0, 0.85, 0.425, 0.25, 0.15, 0.106, 0.075, 0.027, 0.018, 0.011, 0.008, 0.006, 0.003, 0.001, 0.0, 0.0, 0.0]`,
|
|
11
|
+
GSP: `[100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, -1.0, 100.0, 99.0, 96.0, 86.0, 74.0, 61.0, 51.0, 32.0, 16.0, 0.0, 0.0, 0.0]`,
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let psizes = [
|
|
15
|
+
630,
|
|
16
|
+
200,
|
|
17
|
+
63,
|
|
18
|
+
20,
|
|
19
|
+
6.3,
|
|
20
|
+
2,
|
|
21
|
+
0.63,
|
|
22
|
+
0.2,
|
|
23
|
+
0.063,
|
|
24
|
+
0.02,
|
|
25
|
+
0.0063,
|
|
26
|
+
0.002,
|
|
27
|
+
]
|
|
28
|
+
// let fss = dtIntrpPsdBySize(dt, psizes)
|
|
29
|
+
|
|
30
|
+
let out1 = [
|
|
31
|
+
{ size: 630, fraction: 100 },
|
|
32
|
+
{ size: 200, fraction: 100 },
|
|
33
|
+
{ size: 63, fraction: 99.99999999999999 },
|
|
34
|
+
{ size: 20, fraction: 99.99999999999999 },
|
|
35
|
+
{ size: 6.3, fraction: 100.00000000000001 },
|
|
36
|
+
{ size: 2, fraction: 100 },
|
|
37
|
+
{ size: 0.63, fraction: 100.00000000000001 },
|
|
38
|
+
{ size: 0.2, fraction: 100 },
|
|
39
|
+
{ size: 0.063, fraction: 98.4880247416152 },
|
|
40
|
+
{ size: 0.02, fraction: 88.59851004564663 },
|
|
41
|
+
{ size: 0.0063, fraction: 52.69597513510718 },
|
|
42
|
+
{ size: 0.002, fraction: 26.094876057143324 }
|
|
43
|
+
]
|
|
44
|
+
it(`should return ${out1} when dtIntrpPsdBySize(dt, ${psizes})`, function() {
|
|
45
|
+
let r = dtIntrpPsdBySize(dt, psizes)
|
|
46
|
+
let rr = out1
|
|
47
|
+
assert.strict.deepStrictEqual(r, rr)
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
})
|