How do I analyse a Value Map in Python?
A Value Map is a Client File holding one attribute as a raster over a geographic area and a series of times, with a generation block on the record describing how to read it: what the numbers mean and in what units, the extent they cover, the tiles they are cut into, and where every raster sits in the blob. A simulation writes one per attribute, so a flood model might publish water level, velocity and wave height as separate Value Maps over the same area.
The question this answers is "what did the event touch". The Value Map 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 one needs the optional extra, which a base install does not have.
Finding a Value Map
Value Maps are Client Files, so they are found the same way as any other file. Each one names the attribute and the source it was generated from under Identity in its generation block, and those two together identify it.
Reading what it holds
Opening one 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.
Check is_complete before you read anything. It says whether every timestep that was asked for was actually written, and a series with a gap in the middle of the event otherwise looks exactly like a shorter series.
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 for you.
Your own numbers, where they were corrected
Values are delivered in whatever reference the platform draws them against, which is not always the one your data was authored in. Where a correction was applied the Value Map carries it per texel, so the reading you supplied is recoverable exactly rather than described in prose.
value_source says whether anything was applied.frame(index, source=True) takes it back off, and the same flag runs through mask_above, peak_at andmean_at, so a threshold stated against your own data is compared against your own data. On a Value Map that declares no correction the two are the same numbers.
Sampling one place
When the question is about a site rather than a whole frame, sample it directly.sample_at reads one position andseries_at reads that position through the whole series, each returning the delivered number and your own alongside each other, so a script can report either or both without deciding up front which one it works in.
Both read only the tile the position falls in, so watching one site through a long series costs a fraction of walking the frames. sample_of andseries_of do the same for an Entity, which covers several texels and so reports a peak and a mean rather than a single reading.
A position outside the raster comes back as nothing at all, while one inside it that was never sampled comes back with covered false and no value. Those are different answers and it is worth reporting them differently.
What the event reached
An Entity resolves to the texels it covers, and the raster does not move, so list the Entities once, index them by their texels, and every frame after that is answered locally. The cost then follows the size of the event rather than the number of records, and the match is exact against the raster.
shapes_above is the other way round: it traces each area of a frame into a Bruce geometry you can send to Data Lab as a spatial criterion. Reach for it when you want the outline itself, to draw or to hand to something else.
Things worth knowing
Nothing states what the numbers mean, so the threshold is yours to name. The Value Map publishes what its numbers are worth and in what units, not whether a value counts as present. Zero is the line for something measured up from whatever is beneath it, such as a depth, and is merely wherever the datum sits for a height. Leave the threshold out and one is read off the distribution instead, which separates whichever region dominates the range rather than the event you are looking for.
A texel that was never sampled is not a reading of zero. Every raster carries its own coverage, which is the second value frame returns, and a record over unsampled ground has nothing to report. Coverage belongs to the raster you read it from, so never mask one raster's numbers with another's coverage.
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. A texel can be hundreds of metres across, which is much larger than a building or a parcel.
Values are quantised over the archive's own range. Depending on how wide that range is, a value is packed into either one channel or two, so the step is the range divided by 255 or by 65,535. Read the numbers through the library rather than off the pixels: the same picture read as one channel where it holds two is wrong by up to the whole range.
Water that never recedes is still water. A record standing in a permanent feature reads as covered in every frame, so a count below the length of the series is a record the event arrived at. The reverse is weaker: a full count only says some part of it was covered throughout, which is true both of a record wholly inside the feature and of one straddling its edge. Decide which of the two you are reporting before writing anything, because both are legitimate answers to different questions.
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.