LAGWM

Drop green weights which are zero or NULL.

-- © Copyright 2026 The Kahawai Collective
-- SPDX-License-Identifier: MIT
INSERT INTO grooming_rules
VALUES ('LAGWM', 'edw', 'landings', 'Drop', 'Missing greenweights that cannot be estimated');

CREATE OR REPLACE FUNCTION LAGWM() RETURNS VOID AS $$

INSERT INTO groomed.checks(code, "table", id)
SELECT 'LAGWM', 'landings', id
FROM   groomed.landings
WHERE  (green_weight = 0 OR green_weight IS NULL)
AND    (unit_num IS NULL OR unit_weight IS NULL);

UPDATE groomed.landings
SET    checks=array_append(checks, 'LAGWM'), dropped=TRUE
WHERE  id IN (SELECT id FROM groomed.checks WHERE code = 'LAGWM');

$$ LANGUAGE SQL;
SELECT LAGWM();
Effects of grooming
Figure 1: The number of records affected by the LAGWM rule, by year and source.