ncss-tech / aqp

Algorithms for Quantitative Pedology
http://ncss-tech.github.io/aqp/
54 stars 14 forks source link

munsell2rgb: color value of 8.5 and 9.5 #318

Closed brownag closed 1 month ago

brownag commented 1 month ago

I noticed when working with the KSSL pedon morphologic companion database recently that there are some non-standard color warnings issued: non-standard notation in Munsell value, use getClosestMunsellChip()

I was curious if these were obsolete values in the database, but it turns out that colorvalue of 8.5 and 9.5 are legitimate choices (on the "white" page). Unlike some chromas (0, 5, 7) the half chip color values are not obsolete in the NASIS domains.

Probably these can be handled by interpolation similar to how we handled colorvalue 2.5 (i.e https://github.com/ncss-tech/aqp/issues/178)

There are 56 instances of this in the morphologic database corresponding to KSSL pedons (latest dated 2021-09-14), and 560 total in full NASIS pedon snapshot (latest dated 2024-09-06)

library(soilDB)
dbQueryNASIS(NASIS(dsn = "D:/Geodata/soils/NASIS_Morphological_09142021/NASIS_Morphological_09142021.sqlite"),
             "SELECT * FROM phcolor") |> 
  uncode() |> 
  subset(colorvalue %in% c("8.5", "9.5"))
#> Loading required namespace: RSQLite
#>        OBJECTID phiidref seqnum colorpct colorhue colorvalue colorchroma
#> 2846       2846  6640453      1       NA     10YR        8.5           0
#> 2889       2889  6640454      1       NA     10YR        8.5           1
#> 214507   214507  6641422     NA       NA    7.5YR        8.5           3
#> 214834   214834  6640474     NA       70    7.5YR        8.5           2
#> 214835   214835  6640475     NA       70    7.5YR        8.5           2
#> 214836   214836  6640476     NA       70    7.5YR        8.5           2
#> 214837   214837  6641411     NA       25    7.5YR        8.5           2
#> 214838   214838  6641414     NA       75    7.5YR        8.5           2
#> 215742   215742  6640485     NA       70    7.5YR        8.5           1
#> 215743   215743  6641426     NA       NA    7.5YR        8.5           1
#> 215744   215744  6641427     NA       NA    7.5YR        8.5           1
#> 215745   215745  6641428     NA       NA    7.5YR        8.5           1
#> 216454   216454  6641428     NA       NA    7.5YR        8.5           1
#> 266846   266846   986282     NA       NA     10YR        8.5           0
#> 266847   266847   986283     NA       NA     10YR        8.5           0
#> 266864   266864   986262     NA       NA     10YR        8.5           1
#> 266865   266865   986263     NA       NA     10YR        8.5           1
#> 266866   266866   986284     NA       NA     10YR        8.5           1
#> 266867   266867  1177389     NA       NA     10YR        8.5           1
#> 267591   267591   985695     NA       70     10YR        8.5           0
#> 267592   267592   986258     NA       70     10YR        8.5           0
#> 267593   267593   986259     NA       NA     10YR        8.5           0
#> 267594   267594   986260     NA       NA     10YR        8.5           0
#> 267595   267595   985693     NA       NA     10YR        8.5           0
#> 267625   267625   986281     NA       NA     10YR        8.5           1
#> 453843   453843  3006370     NA       NA    7.5YR        8.5           1
#> 453844   453844  3006370     NA       NA    7.5YR        8.5           1
#> 453845   453845  3006364     NA       85    7.5YR        8.5           1
#> 453846   453846  3006364     NA       85    7.5YR        8.5           1
#> 453993   453993  3006371     NA       NA    7.5YR        8.5           0
#> 453994   453994  3006371     NA       NA    7.5YR        8.5           0
#> 453995   453995  3006435     NA       NA    7.5YR        8.5           0
#> 453996   453996  3006435     NA       NA    7.5YR        8.5           0
#> 492014   492014  3133144     NA       15        N        8.5          NA
#> 492158   492158  2759301     NA      100     10YR        8.5           1
#> 492159   492159  2759317     NA      100     10YR        8.5           1
#> 492181   492181  2759318     NA      100     10YR        8.5           0
#> 492182   492182  2759319     NA      100     10YR        8.5           0
#> 492183   492183  3133143     NA       60     10YR        8.5           0
#> 492230   492230  2759310     NA      100     10YR        8.5           1
#> 492264   492264  1924698     NA       NA     2.5Y        8.5           0
#> 492265   492265  2759317     NA      100     10YR        8.5           0
#> 492266   492266  1924701     NA       NA    7.5YR        8.5           0
#> 492267   492267  4714554     NA       NA    7.5YR        8.5           0
#> 493588   493588  1924693     NA       NA     2.5Y        8.5           0
#> 493589   493589  1924694     NA       NA     2.5Y        8.5           0
#> 503190   503190  4576557     NA       NA     10YR        8.5           0
#> 503252   503252  4576562     NA       NA     2.5Y        8.5           0
#> 520365   520365  5427501      3       15    7.5YR        8.5           6
#> 521789   521789  6786981     NA       NA    7.5YR        8.5           0
#> 522301   522301  6786979     NA       NA    7.5YR        8.5           1
#> 522302   522302  6786980     NA       NA    7.5YR        8.5           1
#> 522303   522303  6786981     NA       NA    7.5YR        8.5           1
#> 522906   522906  6793415     NA       NA    7.5YR        8.5           0
#> 523104   523104  6651017     NA       NA    7.5YR        8.5           1
#> 523216   523216  6127860     NA       NA     10YR        8.5           0
#> 523373   523373  6127856     NA       NA    7.5YR        8.5           1
#> 523494   523494  6793415     NA       NA    7.5YR        8.5           0
#>        colorphysst colormoistst recwlupdated recuseriidref phcoloriid
#> 2846          <NA>          Dry      2458452          1115    8611186
#> 2889          <NA>          Dry      2458452          1115    8711191
#> 214507        <NA>          Dry      2458449          1115    8711170
#> 214834        <NA>          Dry      2458414          1115    8611232
#> 214835        <NA>          Dry      2458414          1115    8611236
#> 214836        <NA>          Dry      2458414          1115    8611240
#> 214837        <NA>          Dry      2458449          1115    8711154
#> 214838        <NA>          Dry      2458449          1115    8711148
#> 215742        <NA>          Dry      2458414          1115    8611248
#> 215743        <NA>          Dry      2458449          1115    8711178
#> 215744        <NA>          Dry      2458449          1115    8711180
#> 215745        <NA>          Dry      2458449          1115    8711182
#> 216454        <NA>        Moist      2458449          1115    8711183
#> 266846     Crushed          Dry      2455898          1115    1335226
#> 266847     Crushed          Dry      2455898          1115    1335228
#> 266864     Crushed          Dry      2455901          1115    1335175
#> 266865     Crushed          Dry      2455901          1115    1335176
#> 266866     Crushed          Dry      2455898          1115    1335230
#> 266867     Crushed          Dry      2455901          1115    1644334
#> 267591     Crushed        Moist      2455898          1115    1334250
#> 267592     Crushed        Moist      2455901          1115    1335185
#> 267593     Crushed        Moist      2455901          1115    1335183
#> 267594     Crushed        Moist      2455901          1115    1335181
#> 267595     Crushed        Moist      2455898          1115    1334256
#> 267625     Crushed        Moist      2455898          1115    1335225
#> 453843        <NA>          Dry      2455916          2908    3859391
#> 453844        <NA>        Moist      2455916          2908    3859392
#> 453845        <NA>        Moist      2455916          2908    3859377
#> 453846        <NA>          Dry      2455916          2908    3859379
#> 453993        <NA>          Dry      2455916          2908    3859393
#> 453994        <NA>        Moist      2455916          2908    3859394
#> 453995        <NA>          Dry      2455916          2908    3859533
#> 453996        <NA>        Moist      2455916          2908    3859534
#> 492014     Crushed        Moist      2456084          2887    4016522
#> 492158     Crushed        Moist      2456083          2621    3513445
#> 492159     Crushed        Moist      2456084          2621    3513473
#> 492181     Crushed        Moist      2456084          2621    3513477
#> 492182     Crushed        Moist      2456084          2621    3513475
#> 492183     Crushed        Moist      2456084          2887    4016517
#> 492230     Crushed          Dry      2456084          2621    3513460
#> 492264     Crushed          Dry      2456084          1115    3437440
#> 492265     Crushed          Dry      2456084          2621    3513472
#> 492266     Crushed          Dry      2456084          1115    3437445
#> 492267     Crushed          Dry      2456654          2912    6101621
#> 493588 Broken face          Dry      2456083          1115    3437429
#> 493589 Broken face          Dry      2456083          1115    3437431
#> 503190    Interior          Dry      2456708          2912    5944423
#> 503252 Broken face          Dry      2456708          2912    5944432
#> 520365 Broken face        Moist      2458078          2630    6882168
#> 521789 Broken face          Dry      2458555          2887    8811302
#> 522301 Broken face        Moist      2458555          2887    8811299
#> 522302 Broken face        Moist      2458555          2887    8811301
#> 522303 Broken face        Moist      2458555          2887    8811303
#> 522906        <NA>          Dry      2458611          1096    8820440
#> 523104        <NA>          Dry      2458548          3004    8625915
#> 523216        <NA>        Moist      2457968          2738    7906596
#> 523373        <NA>        Moist      2457968          2738    7906588
#> 523494        <NA>        Moist      2458611          1096    8820439
get_NASIS_column_metadata("colorvalue")
#>       DomainID  DomainName DomainRanked DisplayLabel ChoiceSequence ChoiceValue
#> 14702     1244 color_value            1            0              1           1
#> 14703     1244 color_value            1            0              2           2
#> 14704     1244 color_value            1            0              3           3
#> 14705     1244 color_value            1            0              4           4
#> 14706     1244 color_value            1            0              5           5
#> 14707     1244 color_value            1            0              6           6
#> 14708     1244 color_value            1            0              7           7
#> 14709     1244 color_value            1            0              8           8
#> 14710     1244 color_value            1            0              9           9
#> 14711     1244 color_value            1            0             10          10
#> 14712     1244 color_value            1            0             11          11
#>       ChoiceName ChoiceLabel ChoiceObsolete ColumnPhysicalName
#> 14702          2           2              0         colorvalue
#> 14703        2.5         2.5              0         colorvalue
#> 14704          3           3              0         colorvalue
#> 14705          4           4              0         colorvalue
#> 14706          5           5              0         colorvalue
#> 14707          6           6              0         colorvalue
#> 14708          7           7              0         colorvalue
#> 14709          8           8              0         colorvalue
#> 14710        8.5         8.5              0         colorvalue
#> 14711          9           9              0         colorvalue
#> 14712        9.5         9.5              0         colorvalue
#>       ColumnLogicalName
#> 14702       color_value
#> 14703       color_value
#> 14704       color_value
#> 14705       color_value
#> 14706       color_value
#> 14707       color_value
#> 14708       color_value
#> 14709       color_value
#> 14710       color_value
#> 14711       color_value
#> 14712       color_value
dylanbeaudette commented 1 month ago

Adding 8.5 and 9.5 value chips wasn't a big deal. Adding all 1/2 chips turns out to be a little more complex for any function that estimates Munsell colors from other colorspace coordinates. Working through this in #319.