Skip to content

Commit b68f52f

Browse files
authored
Merge pull request #615 from openclimatefix/development
✨ Quartz Solar v0.5.8 → Staging
2 parents 59117b2 + 51cdd8d commit b68f52f

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

apps/nowcasting-app/components/charts/gsp-pv-remix-chart/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,12 @@ const GspPvRemixChart: FC<{
8080
//
8181

8282
// get the latest Actual pv value in GW
83-
const latestPvActualInMW = KWtoMW(pvRealDataIn?.[0]?.solarGenerationKw || 0);
83+
const latestPvActualInMW = KWtoMW(
84+
pvRealDataIn?.[pvRealDataIn.length - 1]?.solarGenerationKw || 0
85+
);
8486

8587
// get pv time
86-
const latestPvActualDatetime = pvRealDataIn?.[0]?.datetimeUtc || timeNow;
88+
const latestPvActualDatetime = pvRealDataIn?.[pvRealDataIn.length - 1]?.datetimeUtc || timeNow;
8789

8890
// Use the same time for the Forecast historic
8991
const pvForecastDatetime = formatISODateString(latestPvActualDatetime);

apps/nowcasting-app/components/charts/gsp-pv-remix-chart/use-get-gsp-data.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,20 @@ import { useLoadDataFromApi } from "../../hooks/useLoadDataFromApi";
88
import { NationalAggregation } from "../../map/types";
99
import { components } from "../../../types/quartz-api";
1010
import { getEarliestForecastTimestamp } from "../../helpers/data";
11+
import * as Sentry from "@sentry/react";
1112

1213
const aggregateTruthData = (
1314
pvDataRaw: components["schemas"]["GSPYieldGroupByDatetime"][] | undefined,
1415
gspIds: number[],
1516
key: string
1617
) => {
1718
if (!pvDataRaw?.length) return [];
19+
20+
if (pvDataRaw[0].datetimeUtc > pvDataRaw[pvDataRaw.length - 1].datetimeUtc) {
21+
// If the data is not in chronological order, i.e. oldest first, reverse it
22+
Sentry.captureMessage("Reversing pvDataRaw order in aggregateTruthData", "info");
23+
pvDataRaw = pvDataRaw.reverse();
24+
}
1825
return pvDataRaw?.map((d) => {
1926
return {
2027
datetimeUtc: d.datetimeUtc,

apps/nowcasting-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@openclimatefix/nowcasting-app",
3-
"version": "0.5.7",
3+
"version": "0.5.8",
44
"private": true,
55
"scripts": {
66
"dev": "next dev -p 3002",

0 commit comments

Comments
 (0)