File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed
components/charts/gsp-pv-remix-chart Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff 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 ) ;
Original file line number Diff line number Diff line change @@ -8,13 +8,20 @@ import { useLoadDataFromApi } from "../../hooks/useLoadDataFromApi";
88import { NationalAggregation } from "../../map/types" ;
99import { components } from "../../../types/quartz-api" ;
1010import { getEarliestForecastTimestamp } from "../../helpers/data" ;
11+ import * as Sentry from "@sentry/react" ;
1112
1213const 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 ,
Original file line number Diff line number Diff line change 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" ,
You can’t perform that action at this time.
0 commit comments