diff --git a/meta/object-model.json b/meta/object-model.json index df4b553..56f8339 100644 --- a/meta/object-model.json +++ b/meta/object-model.json @@ -911,6 +911,16 @@ "conditional": "RASTER", "doc": "A georeferenced raster of one or more bands, the value every raster accessor, clip, warp and polygonization takes. MEOS registers it in no enum, so it names no temptype." }, + "BandStats": { + "kind": "leaf", + "parent": "Value", + "prefixes": [ + "bandstats" + ], + "temptype": null, + "conditional": "RASTER", + "doc": "What a raster band's pixels amount to, taken in one pass: how many pixels hold a value and their sum, mean, standard deviation, least and greatest, the record PostGIS's ST_SummaryStats states. Raster.summaryStats answers one and the summaryStats aggregate gathers one over rasters; MEOS registers it in no enum, so it names no temptype." + }, "Pcschema": { "kind": "leaf", "parent": "Value", diff --git a/tests/test_object_model.py b/tests/test_object_model.py index e7e7086..ecd917c 100644 --- a/tests/test_object_model.py +++ b/tests/test_object_model.py @@ -447,6 +447,19 @@ def test_a_member_of_a_leafs_box_is_named_with_its_value_type(self): "tbigintbox_expand": "expandBigint"}) self.assertEqual(om["functionToClass"]["tintbox_expand"]["class"], "TBox") + def test_the_statistics_of_a_band_are_a_class_of_their_own(self): + # As #test_the_ever_and_always_forms_of_a_member_stand_beside_it: the record + # raster_summary_stats answers is the class BandStats, whose accessors are + # its members named by what they read. + idl = attach_object_model({"functions": [ + self._fn("bandstats_count", "const BandStats *"), + self._fn("bandstats_mean", "const BandStats *", "double *"), + ]}, MODEL, None) + om = idl["objectModel"] + names = {m["function"]: m["ooName"] for m in om["classes"]["BandStats"]["methods"]} + self.assertEqual(names, {"bandstats_count": "count", "bandstats_mean": "mean"}) + self.assertEqual(om["functionToClass"]["bandstats_mean"]["class"], "BandStats") + def test_the_ever_and_always_forms_of_a_member_stand_beside_it(self): # As #test_a_member_of_a_leafs_box_is_named_with_its_value_type, for the # e and a forms #_candidates derives: eraster_value is the @@ -743,8 +756,8 @@ def test_a_type_meos_registers_in_no_enum_still_gets_a_class(self): unregistered = {n for n, s in nodes.items() if s["kind"] == "leaf" and s["temptype"] is None} self.assertEqual(unregistered, - {"Pcschema", "Raster", "RTree", "RTreeNNCursor", "SPTree", - "SPNNCursor", "MeosArray", "SkipList"}) + {"Pcschema", "Raster", "BandStats", "RTree", "RTreeNNCursor", + "SPTree", "SPNNCursor", "MeosArray", "SkipList"}) def test_the_aggregate_state_is_a_class_and_numeric_is_none(self): # A SkipList is what every temporal aggregate's transition function