Skip to content

Commit

Permalink
Added unit to time series matrix module channel
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenthoms committed Nov 28, 2023
1 parent fdbb336 commit 0864c5b
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion frontend/src/modules/SimulationTimeSeriesMatrix/view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,33 @@ export const view = ({ moduleContext, workbenchSession, workbenchSettings }: Mod
})),
dataGenerator: (vectorName: string) => {
const data: { key: number; value: number }[] = [];
let metaData: {
unit: string;
ensemble: string;
} | null = null;
loadedVectorSpecificationsAndRealizationData.forEach((vec) => {
if (vec.vectorSpecification.vectorName === vectorName) {
let unit = "";
vec.data.forEach((el) => {
unit = el.unit;
const indexOfTimestamp = indexOf(el.timestamps_utc_ms, activeTimestampUtcMs);
data.push({
key: el.realization,
value: indexOfTimestamp === -1 ? el.values[0] : el.values[indexOfTimestamp],
});
});
if (metaData === null) {
metaData = {
unit,
ensemble: vec.vectorSpecification.ensembleIdent.toString(),
};
}
}
});
return data;
return {
data,
metaData: metaData ?? undefined,
};
},
});

Expand Down

0 comments on commit 0864c5b

Please sign in to comment.