Created
February 24, 2026 21:48
-
-
Save thoughtfulbloke/c5c895dc61cabddfa4ccca6cd944dd9f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(readr) | |
| library(dplyr) | |
| library(tidyr) | |
| library(lubridate) | |
| library(ggplot2) | |
| library(ggthemes) | |
| gn <- read_csv("202601_Generation_MD.csv") | |
| ex <- read_csv("202601_Grid_export.csv") | |
| MERI_gn <- gn |> | |
| filter(Tech_Code == "BAT", POC_Code == "BRB0331", Nwk_Code=="MERI") |> | |
| pivot_longer(TP1:TP50, names_to = "Trading Period", values_to = "genmeri_val") |> | |
| arrange(Trading_Date,`Trading Period`) | |
| NPOW_gn <- gn |> | |
| filter(Tech_Code == "BAT", POC_Code == "BRB0331", Nwk_Code=="NPOW") |> | |
| pivot_longer(TP1:TP50, names_to = "Trading Period", values_to = "gennpow_val") |> | |
| arrange(Trading_Date,`Trading Period`) | |
| MERI_ex <- ex |> | |
| filter(POC == "BRB0331", Nwk_Code=="MERI") |> | |
| pivot_longer(TP1:TP50, names_to = "Trading Period", values_to = "exmeri_val") |> | |
| arrange(Trading_Date,`Trading Period`) | |
| NPOW_ex <- ex |> | |
| filter(POC == "BRB0331", Nwk_Code=="NPOW") |> | |
| pivot_longer(TP1:TP50, names_to = "Trading Period", values_to = "exnpow_val") |> | |
| arrange(Trading_Date,`Trading Period`) | |
| MERI <- MERI_gn |> | |
| inner_join(MERI_ex, by = join_by(Trading_Date, `Trading Period`)) | |
| MERI |> | |
| filter(!is.na(genmeri_val), !is.na(exmeri_val)) |> | |
| mutate(usage = case_when(genmeri_val > 0 & exmeri_val > 0 ~ "gen +, ex +", | |
| genmeri_val == 0 & exmeri_val > 0 ~ "gen 0, ex +", | |
| genmeri_val > 0 & exmeri_val == 0 ~ "gen +, ex 0", | |
| genmeri_val == 0 & exmeri_val == 0 ~ "gen 0, ex 0"), | |
| TradingPeriod = as.numeric(gsub("TP","",`Trading Period`))) |> | |
| ggplot(aes(x=Trading_Date, y=TradingPeriod, fill=usage)) + | |
| geom_tile()+ scale_fill_colorblind() + theme_minimal() + | |
| labs(title="Is MERI at 0 or not in each file in the same Trading Period", | |
| subtitle="gen = generation file, ex = export file") | |
| ggsave(filename="~/Desktop/ggsky.jpg", width=2016, height=1134, units="px") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment