[ncl-talk] Calculating the area below the curve

Rick Brownrigg brownrig at ucar.edu
Mon Dec 9 20:45:49 MST 2019


Hi Anahita,

In stepping through the code to where this error message originates, I
believe it to be due to a bug that was introduced several years ago. Note
that the examples given on the documentation for simpne() (
http://ncl.ucar.edu/Document/Functions/Built-in/simpne.shtml) also fail
with the same message (this function must not get used much).  The test for
"3 non-missings" occurs *after* the call to the underlying fortran routine
that actually calculates the area. With a debugger, I was able to side-step
the test, and for your particular dataset, I get:

print(simpne_sea)
Variable: simpne_sea
Type: float
Total Size: 4 bytes
            1 values
Number of Dimensions: 1
Dimensions and sizes:   [1]
Coordinates:
(0)     1067454

ncl 11> print(simpne_fresh)
Variable: simpne_fresh
Type: float
Total Size: 4 bytes
            1 values
Number of Dimensions: 1
Dimensions and sizes:   [1]
Coordinates:
(0)     363163.4

Do these values make sense? If I similarly do the "side step" for the
examples on the docs page, I get the results shown there, so I'm fairly
confident in the analysis that its the test for non-missings, not the area
computations, that is erroneous.

Unfortunately, this bug occurs in compiled code. I am no longer in a
position to i) officially address the bug, and ii) offer you a temporary
version of NCL until the big-fix appears in the next release. The best I
can do is file an issue on the github site with as much detail as I know
now, and maybe a fix will appear in a future release.

I wish I had a better answer.

Rick

On Mon, Dec 9, 2019 at 3:31 PM Anahita Amiri Farahani via ncl-talk <
ncl-talk at ucar.edu> wrote:

> Hello All,
>
> I tried to calculate the area below the curve but I got the error, I used
> simpne finction. Here is my code and my data:
>
> ana = asciiread("test.csv",(/146,3/),"float")
> ana at _FillValue = 9999
>
> xi= ana(:,0) ; Diameter
> yi= ana(:,1) ;synthetic sea spray
> zi= ana(:,2) ; Fresh water
> simpne_sea = simpne(xi,yi)
> simpne_fresh = simpne(xi,zi)
>
> The error that I got is:
>
> fatal:simpne: Must have three or more non-missing values.
>
> Diameter    Seawater   Freshwater
> 20.2 379.07 62.8549
> 20.9 363.27 91.3129
> 21.7 455.041 97.3195
> 22.5 451.004 106.884
> 23.3 490.321 135.746
> 24.1 571.821 136.587
> 25 619.093 135.276
> 25.9 616.577 153.029
> 26.9 691.639 164.088
> 27.9 664.933 157.471
> 28.9 717.085 196.833
> 30 769.125 203.958
> 31.1 784.47 192.036
> 32.2 871.042 242.472
> 33.4 881.308 224.274
> 34.6 871.322 236.221
> 35.9 902.276 283.161
> 37.2 1005.14 277.881
> 38.5 997.639 302.734
> 40 1007.47 320.725
> 41.4 1060.78 318.618
> 42.9 1046.8 328.856
> 44.5 1095.6 336.364
> 46.1 1164.61 381.286
> 47.8 1192.6 393.798
> 49.6 1226.13 410.977
> 51.4 1184.22 416.643
> 53.3 1253.15 419.43
> 55.2 1297.6 476.518
> 57.3 1355.38 484.361
> 59.4 1336.36 496.661
> 61.5 1409.51 492.204
> 63.8 1399.77 534.932
> 66.1 1441.49 551.7
> 68.5 1537.13 559.25
> 71 1470.6 557.561
> 73.7 1454.18 530.684
> 76.4 1546.17 574.684
> 79.1 1526.6 572.641
> 82 1545.55 550.367
> 85.1 1556.94 584.655
> 88.2 1527.92 580.766
> 91.4 1544.07 585.633
> 94.7 1621.34 595.263
> 98.2 1628.2 603.119
> 101.8 1703.88 639.341
> 105.5 1686.83 610.778
> 109.4 1679.66 658.014
> 113.4 1595.34 660.075
> 117.6 1590.48 677.112
> 121.9 1554.42 680.088
> 126.3 1690.79 713.833
> 131 1714.44 770.754
> 135.8 1661.12 798.023
> 140.7 1574.7 804.933
> 145.9 1463.69 828.813
> 151.2 1359.23 798.361
> 156.8 1319.38 812.687
> 162.5 1231.97 784.559
> 168.5 1241.65 819.803
> 174.7 1244.69 813.677
> 181.1 9999 862.247
> 187.7 9999 828.698
> 194.6 9999 808.084
> 201.7 9999 778.683
> 209.1 9999 768.083
> 216.7 9999 810.226
> 224.7 9999 786.788
> 232.9 9999 812.941
> 241.4 9999 758.239
> 250.3 9999 744.37
> 259.5 9999 704.377
> 269 9999 637.229
> 278.8 9999 648.659
> 289 9999 648.906
> 299.6 9999 636.226
> 310.6 9999 606.987
> 322 9999 616.206
> 333.8 9999 611.99
> 346 9999 582.636
> 358.7 9999 518.618
> 371.8 9999 510.237
> 385.4 9999 464.282
> 399.5 9999 443.98
> 414.2 9999 407.32
> 429.4 9999 461.604
> 445.1 9999 440.411
> 461.4 9999 397.705
> 478.3 9999 382
> 495.8 9999 318.854
> 514 9999 323.109
> 532.8 9999 292.444
> 552.3 9999 263.288
> 572.5 9999 234.776
> 593.5 9999 218.003
> 615.3 9999 208.224
> 637.8 9999 178.02
> 661.2 9999 167.827
> 685.4 9999 141.841
> 710.5 9999 135.773
> 736.5 9999 107.602
> 835 384.306 80.5616
> 898 356.98 63.2435
> 965 328.19 49.151
> 1037 301.18 36.6713
> 1114 274.241 26.4571
> 1197 242.377 20.198
> 1286 215.253 14.8797
> 1382 193.643 11.8462
> 1486 174.463 8.71663
> 1596 159.423 8.04464
> 1715 150.035 5.81748
> 1843 137.426 4.74231
> 1981 121.248 4.20472
> 2129 107.02 3.18714
> 2288 95.7569 2.84154
> 2458 82.8993 2.03516
> 2642 69.2672 1.38237
> 2839 57.6725 0.748785
> 3051 48.669 0.383992
> 3278 40.8249 0.211196
> 3523 32.6918 0.211196
> 3786 23.9757 0.0575989
> 4068 16.7131 0.0191996
> 4371 11.5676 0.0383992
> 4698 7.72549 0
> 5048 4.75836 0
> 5425 2.59956 0
> 5829 1.29723 0
> 6264 0.619433 0
> 6732 0.263469 0
> 7234 0.100302 0
> 7774 0.0339347 0
> 8354 0.010811 0
> 8977 0.0043044 0
> 9647 0.00070072 0
> 10370 0.0001001 0
> 11140 0.0001001 0
> 11970 0.0001001 0
> 12860 0.00020021 0
> 13820 0 0
> 14860 0 0
> 15960 0.00020021 0
> 17150 0 0
> 18430 0 0
> 19810 0 0
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20191209/c018b782/attachment-0001.html>


More information about the ncl-talk mailing list