{
  "schemaVersion": 1,
  "slug": "plant-watering-calculator",
  "category": "gardening",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "3e7f574bb2a68a5ffd1f41514ec1498f2c81eb4901d75159cab45fc1c7060b98",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/plant-watering-calculator.json",
    "src/engine.js"
  ],
  "runtimeSource": "/sources/engine.txt",
  "runtimeHash": "5c888d8898afbdee36267bb9977829e1e2ac568f6677c8ee87469c139864645c",
  "scope": "The compute function records implemented equations, constants, lookup tables and custom rules. Inputs record defaults and allowed values; outputs record precision and units. Defaults are examples, not recommendations. General background references are not evidence for this specific algorithm.",
  "publishedFormula": {
    "formula": "G = max(0.3, π × (d ÷ 2)^2 × 0.62 × b × 12 × e)",
    "vars": [
      [
        "G",
        "Water per week (gal)"
      ],
      [
        "d",
        "Canopy spread (ft)"
      ],
      [
        "b",
        "Plant-type factor"
      ],
      [
        "e",
        "Sun-exposure factor"
      ]
    ],
    "note": "Containers: G = pot gallons × 0.25 × e; b = 0.04–0.10, e = 0.7–1.4; litres = gal × 3.7854."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const B = { seedling:0.04, vegetable:0.08, perennial:0.06, shrub:0.05, tree:0.1, container:0 }; const E = { shade:0.7, partial:1, full:1.2, hot:1.4 }; const e = E[sunExposure] || 1; const rootArea = Math.PI*Math.pow(spread/2, 2); let gallonsPerWeek; if (plantType === 'container') { gallonsPerWeek = potGallons*0.25*e; } else { gallonsPerWeek = Math.max(0.3, rootArea*0.62*(B[plantType] || 0.08)*12*e); } return { gallonsPerWeek, litresPerWeek: gallonsPerWeek*3.785411784, totalGallons: gallonsPerWeek*count, note: 'Rough planning estimate only; rainfall, soil, species, root depth, and local weather can change water needs substantially'  };",
    "inputs": [
      {
        "name": "plantType",
        "type": "select",
        "default": "vegetable",
        "options": [
          {
            "value": "seedling"
          },
          {
            "value": "vegetable"
          },
          {
            "value": "perennial"
          },
          {
            "value": "shrub"
          },
          {
            "value": "tree"
          },
          {
            "value": "container"
          }
        ]
      },
      {
        "name": "spread",
        "type": "number",
        "default": 1.5,
        "min": 0.2,
        "max": 40,
        "step": 0.1,
        "slider": true
      },
      {
        "name": "count",
        "type": "number",
        "default": 1,
        "min": 1,
        "max": 2000,
        "step": 1,
        "slider": true
      },
      {
        "name": "potGallons",
        "type": "number",
        "default": 5,
        "min": 0.5,
        "max": 200,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "sunExposure",
        "type": "select",
        "default": "full",
        "options": [
          {
            "value": "shade"
          },
          {
            "value": "partial"
          },
          {
            "value": "full"
          },
          {
            "value": "hot"
          }
        ]
      }
    ],
    "outputs": [
      {
        "name": "gallonsPerWeek",
        "precision": 2,
        "unit": "gal"
      },
      {
        "name": "litresPerWeek",
        "precision": 2,
        "unit": "L"
      },
      {
        "name": "totalGallons",
        "precision": 1,
        "unit": "gal"
      },
      {
        "name": "note",
        "precision": 0,
        "unit": "",
        "type": "text"
      }
    ],
    "interpret": null
  }
}
