Skip to content

Commit c60ea9d

Browse files
authored
Merge pull request #617 from openclimatefix/staging
πŸš€ Quartz Solar v0.5.8 β†’ Production (/pvlive/all sort order)
2 parents 367b79c + 47b2d53 commit c60ea9d

File tree

7 files changed

+32
-17
lines changed

7 files changed

+32
-17
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/data/dno_gsp_groupings.jsonβ€Ž

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"WPD (South West)": [
2+
"NGED (South West)": [
33
1,
44
8,
55
13,
@@ -74,7 +74,7 @@
7474
311,
7575
313
7676
],
77-
"WPD (South Wales)": [
77+
"NGED (South Wales)": [
7878
3,
7979
7,
8080
55,
@@ -235,7 +235,7 @@
235235
258,
236236
315
237237
],
238-
"WPD (East Midlands)": [
238+
"NGED (East Midlands)": [
239239
23,
240240
24,
241241
66,
@@ -265,7 +265,7 @@
265265
292,
266266
316
267267
],
268-
"WPD (Midlands)": [
268+
"NGED (Midlands)": [
269269
26,
270270
48,
271271
49,

β€Žapps/nowcasting-app/data/dno_license_areas_20200506.jsonβ€Ž

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3578,7 +3578,7 @@
35783578
},
35793579
{
35803580
"type": "Feature",
3581-
"properties": { "ID": 11, "Name": "_B", "LongName": "WPD (East Midlands)" },
3581+
"properties": { "ID": 11, "Name": "_B", "LongName": "NGED (East Midlands)" },
35823582
"geometry": {
35833583
"type": "MultiPolygon",
35843584
"coordinates": [
@@ -14505,7 +14505,7 @@
1450514505
},
1450614506
{
1450714507
"type": "Feature",
14508-
"properties": { "ID": 14, "Name": "_E", "LongName": "WPD (Midlands)" },
14508+
"properties": { "ID": 14, "Name": "_E", "LongName": "NGED (Midlands)" },
1450914509
"geometry": {
1451014510
"type": "MultiPolygon",
1451114511
"coordinates": [
@@ -43401,7 +43401,7 @@
4340143401
},
4340243402
{
4340343403
"type": "Feature",
43404-
"properties": { "ID": 21, "Name": "_K", "LongName": "WPD (South Wales)" },
43404+
"properties": { "ID": 21, "Name": "_K", "LongName": "NGED (South Wales)" },
4340543405
"geometry": {
4340643406
"type": "MultiPolygon",
4340743407
"coordinates": [
@@ -46208,7 +46208,7 @@
4620846208
},
4620946209
{
4621046210
"type": "Feature",
46211-
"properties": { "ID": 22, "Name": "_L", "LongName": "WPD (South West)" },
46211+
"properties": { "ID": 22, "Name": "_L", "LongName": "NGED (South West)" },
4621246212
"geometry": {
4621346213
"type": "MultiPolygon",
4621446214
"coordinates": [

β€Žapps/nowcasting-app/data/dno_regions_lat_long_converted.jsonβ€Ž

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14246,7 +14246,7 @@
1424614246
"properties": {
1424714247
"ID": 11,
1424814248
"Name": "_B",
14249-
"LongName": "WPD (East Midlands)"
14249+
"LongName": "NGED (East Midlands)"
1425014250
},
1425114251
"geometry": {
1425214252
"type": "MultiPolygon",
@@ -57831,7 +57831,7 @@
5783157831
"properties": {
5783257832
"ID": 14,
5783357833
"Name": "_E",
57834-
"LongName": "WPD (Midlands)"
57834+
"LongName": "NGED (Midlands)"
5783557835
},
5783657836
"geometry": {
5783757837
"type": "MultiPolygon",
@@ -171992,7 +171992,7 @@
171992171992
"properties": {
171993171993
"ID": 21,
171994171994
"Name": "_K",
171995-
"LongName": "WPD (South Wales)"
171995+
"LongName": "NGED (South Wales)"
171996171996
},
171997171997
"geometry": {
171998171998
"type": "MultiPolygon",
@@ -183113,7 +183113,7 @@
183113183113
"properties": {
183114183114
"ID": 22,
183115183115
"Name": "_L",
183116-
"LongName": "WPD (South West)"
183116+
"LongName": "NGED (South West)"
183117183117
},
183118183118
"geometry": {
183119183119
"type": "MultiPolygon",

β€Ž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.9",
44
"private": true,
55
"scripts": {
66
"dev": "next dev -p 3002",

β€Žapps/nowcasting-app/pages/index.tsxβ€Ž

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ export default function Home({ dashboardModeServer }: { dashboardModeServer: str
7575
const [, setSitesLoadingState] = useGlobalState("sitesLoadingState");
7676
const [, setLoadingState] = useGlobalState("loadingState");
7777
const [nHourForecast] = useGlobalState("nHourForecast");
78-
const [nationalAggregationLevel] = useGlobalState("nationalAggregationLevel");
78+
const [nationalAggregationLevel, setNationalAggregationLevel] = useGlobalState(
79+
"nationalAggregationLevel"
80+
);
7981
const [, setClickedGspId] = useGlobalState("clickedGspId");
8082

8183
const [forecastLastFetch30MinISO, setForecastLastFetch30MinISO] = useState(get30MinNow(-30));
@@ -112,11 +114,15 @@ export default function Home({ dashboardModeServer }: { dashboardModeServer: str
112114
setArraySettingInCookieStorage(CookieStorageKeys.VISIBLE_LINES, visibleLines);
113115
}, [visibleLines]);
114116

115-
// On view change, unset the clicked "GSP" if the aggregation is not GSP
117+
// On view change, unset the clicked region if the aggregation is not GSP,
118+
// and set the national aggregation level to GSP if we're now on Delta view
116119
useEffect(() => {
117120
if (nationalAggregationLevel !== NationalAggregation.GSP) {
118121
setClickedGspId(undefined);
119122
}
123+
if (view === VIEWS.DELTA) {
124+
setNationalAggregationLevel(NationalAggregation.GSP);
125+
}
120126
}, [view]);
121127

122128
const currentView = (v: VIEWS) => v === view;

0 commit comments

Comments
Β (0)