How do I analyse a generated texture in Python?
A generated polygon texture is a Client File holding a stack of frames in one blob, with a generation block on the record describing how to read them: the raster size, the geographic extent it covers, the value range the greyscale was quantised into, and where each frame sits in the blob. A simulation writes one per attribute, so a flood model might publish water level, velocity and wave height as separate textures over the same area.
The question this answers is "what did the event touch". The texture says what the values were and where, and a Data Lab query says which of your Entities were there, so the two together say which records the event reached and when.
Reading a texture needs the optional extra, which a base install does not have.
Finding a texture
Textures are Client Files stored under the Polygon Texture purpose, so they are found the same way as any other file. Each one names the attribute it was generated from in its generation block.
Reading what it holds
Opening a texture downloads the blob once and reads the generation block off the record. From there everything is local, so walking every frame costs no requests at all.
Two things are worked out from the frames rather than asked of you. Cells that report the same value in every frame carry nothing a change can be read from, whether that is a permanent feature or an artefact of the model, and they are excluded. The threshold that separates "wet" from "dry" is read off the series too: the level whose selection varies most between frames is the one carrying the event, so a number that suits one archive is not quietly applied to the next.
What the event reached
Each area a frame holds is a Bruce geometry, so it goes straight into a Data Lab query as a spatial criterion. Walking the frames of interest and asking which Entities each area covers gives you the records the event reached, and the frame's timestamp says when.
An Entity resolves to the texels it covers, and the raster does not move, so that is worked out once and reused for every frame. Reading its own value per frame is then local.
Things worth knowing
The outline can never be finer than a texel. Areas are traced off the raster, so the shape you query with steps around whole cells. On a coarse texture a texel can be hundreds of metres across, which is much larger than a building or a parcel.
Values are quantised to 8 bits over the archive's own range. A frame that reaches the top of that range is saturated rather than measured, and two thresholds closer together than one step select the same texels.
A texture is not a depth map unless the attribute is a depth. A water surface elevation is measured against a datum, so a negative value is a real reading rather than dry ground. Checktexture.attribute before deciding what a number means.
Repeated readings on one Entity need allow_multi_same_entity. A Change Set built without it merges edits per Entity, so a series of timestamped readings would collapse to the last one. A builder created with it can only be applied, not saved as a Change Set record, because a record holds one item per Entity.