{
  "version": 2,
  "grades": ["E", "V", "G", "F", "P"],
  "ranges": {
    "table":         { "E": [52, 62],     "V": [50, 66],     "G": [47, 69],     "F": [44, 72] },
    "crownAngle":    { "E": [31.5, 36.5], "V": [26.5, 38.5], "G": [22.0, 40.0], "F": [20.0, 41.5] },
    "pavilionAngle": { "E": [40.6, 41.8], "V": [39.8, 42.4], "G": [38.8, 43.0], "F": [37.4, 44.0] },
    "crownHeight":   { "E": [12.5, 17.0], "V": [10.5, 18.0], "G": [9.0, 19.5],  "F": [7.0, 21.0] },
    "totalDepth":    { "E": [57.5, 63.0], "V": [56.0, 64.5], "G": [53.0, 66.5], "F": [51.9, 70.9] },
    "star":          { "E": [45, 65],     "V": [40, 70],     "G": [null, null], "F": [null, null] },
    "lowerHalf":     { "E": [70, 85],     "V": [65, 90],     "G": [null, null], "F": [null, null] },
    "girdlePct":     { "E": [2.5, 4.5],   "V": [null, 5.5],  "G": [null, 7.5],  "F": [null, 10.5] }
  },
  "rangeSemantics": "Bounds are inclusive and the ranges nest (E inside V inside G inside F). A value in the E range grades E, else in V grades V, else G, else F, else P. null is an open bound.",
  "girdlePctNote": "Below 2.5% the limit is nearly always set by the girdle description, so the % rule is not applied there.",
  "culet":    { "none": "E", "verySmall": "E", "small": "E", "medium": "V", "slightlyLarge": "G", "large": "G", "veryLarge": "F", "extremelyLarge": "P" },
  "culetTypicalPct": { "none": 0, "verySmall": null, "small": 1.5, "medium": 3, "slightlyLarge": 5, "large": 7, "veryLarge": 11, "extremelyLarge": 15 },
  "culetTypicalPctNote": "Typical values for octagonal culets, not boundaries. Very small has no published value; a mesh may use 0.7, labelled as an illustration.",
  "finish":   { "EX": "E", "VG": "E", "G": "V", "F": "G", "P": "P" },
  "painting": { "negligible": "E", "moderate": "V", "significant": "G", "severe": "F" },
  "paintingNote": "The same four categories cover painting and digging out, on the crown, the pavilion or both. There is no category for the extreme digging that one worked example grades Poor.",
  "girdleVerbalOrder": ["ETN", "VTN", "THN", "MED", "STK", "THK", "VTK", "ETK"],
  "girdleVerbalMatrix": {
    "ETN": { "ETN": "G", "VTN": "V", "THN": "V", "MED": "V", "STK": "V", "THK": "V", "VTK": "G", "ETK": "F" },
    "VTN": {             "VTN": "V", "THN": "V", "MED": "V", "STK": "V", "THK": "V", "VTK": "G", "ETK": "F" },
    "THN": {                         "THN": "E", "MED": "E", "STK": "E", "THK": "V", "VTK": "G", "ETK": "F" },
    "MED": {                                     "MED": "E", "STK": "E", "THK": "V", "VTK": "G", "ETK": "F" },
    "STK": {                                                 "STK": "E", "THK": "V", "VTK": "G", "ETK": "F" },
    "THK": {                                                             "THK": "V", "VTK": "G", "ETK": "F" },
    "VTK": {                                                                         "VTK": "G", "ETK": "F" },
    "ETK": {                                                                                     "ETK": "F" }
  },
  "girdleVerbalMatrixNote": "Rows are the thinnest portion, columns the thickest (min <= max in girdleVerbalOrder).",
  "girdleTypicalValleyPct": { "ETN": 0, "VTN": null, "THN": 1.2, "MED": 1.8, "STK": 2.5, "THK": 3.5, "VTK": 5.0, "ETK": 7.5 },
  "girdleTypicalHillPct":   { "ETN": null, "VTN": null, "THN": 2.9, "MED": 3.5, "STK": 4.2, "THK": 5.2, "VTK": 6.7, "ETK": 9.2 },
  "girdleTypicalPctNote": "Typical values for evenly scalloped girdles, not boundaries. Extremely thin is a knife edge; very thin has no published value.",
  "girdlePctToVerbal": [ [1.0, "ETN"], [1.5, "VTN"], [2.0, "THN"], [3.5, "MED"], [4.5, "STK"], [6.0, "THK"], [7.5, "VTK"], [99, "ETK"] ],
  "girdlePctToVerbalNote": "Heuristic, not a published rule: the first entry whose bound is >= the girdle % gives the description. Built from the worked examples (2.5-3.5% Medium, 4.0% Slightly thick, 5.5% Thick, 8.0% Extremely thick).",
  "crownAngleBands": { "shallow": [null, 32.5], "balanced": [32.5, 35.5], "steep": [35.5, null] },
  "reportingSteps": { "table": 1, "crownAngle": 0.5, "pavilionAngle": 0.2, "star": 5, "lowerHalf": 5, "girdlePct": 0.5 },
  "derived": {
    "note": "Limits apply to values derived from the rounded key proportions, not to measurements. Diameter = 100. grade.js reads reportingSteps, both capRounding values, the offset and pavilionDepth.displayRounding from this file; its constants are only a fallback.",
    "crownHeight":   { "formula": "((100 - table) / 2) * tan(crownAngle)", "capRounding": 0.5, "displayRounding": 0.5 },
    "pavilionDepth": { "formula": "50 * tan(pavilionAngle)", "ignoresCulet": true, "displayRounding": 0.5 },
    "totalDepth":    { "formula": "crownHeight + girdlePct + pavilionDepth + offset", "offset": -0.25, "capRounding": 0.1, "displayRounding": 0.1,
                       "insideGrid": "Anchored to the cell: a cell graded X at the grid's girdle is read as having at least the lowest depth X allows. shift = max(0, low bound of X - depth at the grid's girdle), 0 for a Poor cell; the cap binds when the grade of (depth + shift) is worse than the cell. The shift is non-zero only in the 183 low-side conflict cells, so elsewhere this is the plain rule. Otherwise the depth shows a ceiling no worse than the cell, or none (covered by the grid). The displayed depth is never shifted." }
  },
  "sources": {
    "documents": {
      "ecg": "Estimating-a-cut-grade-booklet.pdf (the wall chart Estimating-a-cut-grade-hires.pdf carries the same tables)",
      "tables": "booklet_cut_estimation_tables_highres.pdf",
      "fcg": "booklet_finish_culet_girdle.pdf (the poster Poster_finish_culet_girdle_highres.pdf carries the same panels)"
    },
    "grades": "ecg p1",
    "ranges.table": "ecg p4, Table size",
    "ranges.crownAngle": "ecg p4, Crown angle",
    "ranges.pavilionAngle": "ecg p4, Pavilion angle",
    "ranges.crownHeight": "ecg p5, Crown height",
    "ranges.totalDepth": "ecg p5, Total depth",
    "ranges.star": "ecg p5, Star facet length",
    "ranges.lowerHalf": "ecg p5, Lower half facet length",
    "ranges.girdlePct": "ecg p5, Girdle thickness %, with its footnote",
    "rangeSemantics": "ecg pp4-5 (Poor rows); tables p1 (crown 36.5 graded Excellent)",
    "culet": "ecg p4, Culet size; size order fcg p7",
    "culetTypicalPct": "fcg p7, culet chart",
    "finish": "ecg p5, Polish and Symmetry; fcg p1",
    "painting": "fcg p12, Painting and Digging out; example P-3 on ecg p10",
    "girdleVerbalOrder": "fcg p8",
    "girdleVerbalMatrix": "ecg p5, Girdle thickness verbal description",
    "girdleTypicalValleyPct": "fcg p9, girdle chart",
    "girdleTypicalHillPct": "fcg p9, girdle chart",
    "girdlePctToVerbal": "heuristic from the worked examples, ecg pp6-10",
    "crownAngleBands": "Brilliani Labs chart convention, not from the grading documents",
    "reportingSteps": "tables p1 (pavilion rounding example); the other steps are observed in the worked examples, ecg pp6-10",
    "derived.derivedFromRounded": "ecg p4",
    "derived.crownHeight.capRounding": "the 18 grids in tables pp3-8 (nearest 0.5 is the only rounding with no conflicts)",
    "derived.pavilionDepth.ignoresCulet": "ecg p7, example VG-1 (medium culet, printed pavilion depth equals the culet-free value)",
    "derived.totalDepth.offset": "tables p2 (two software screenshots: 62.8 at girdle 3.0 and 63.3 at girdle 3.5) and the 18 grids; see NOTES.md, Grade engine",
    "derived.totalDepth.insideGrid": "model decision, not from the documents; see NOTES.md, Grade engine, Inside the tables",
    "gridFixedParams": "tables p1"
  }
}
