perbu / powercost

MIT License
6 stars 1 forks source link

Suggestion: show prices in øre instead of kr #6

Closed oven closed 1 year ago

oven commented 1 year ago

Prices typically vary between 0 and 5 kr, with the "normal" price range between 0 and 1. Would it be easier to read the graph if prices were given in øre (without decimals) instead of kr?

perbu commented 1 year ago

When prices are very low the 0.08 isn't great to read, agreed. Perhaps we should scan the prices and if the highest price is below 1.00 we switch to øre and the annotate the graph?

oven commented 1 year ago

Hm, I remember being confused on nov 11, when prices peaked at 6 øre and I thought prices were quite high in the evening, but then it turned out I only read the y labels wrong. Maybe switching between øre and kr will be more confusing.

Here's what it looked like with the current code:

~/git/powercost (main ✔) ᐅ pwrcost -date "2022-11-11"
 0.061 ┤                                                   ╭─╮
 0.055 ┤                                                 ╭─╯ ╰╮
 0.049 ┤                                                ╭╯    ╰╮
 0.043 ┤                                               ╭╯      ╰╮
 0.037 ┤                                               │        ╰╮
 0.031 ┤                       ╭───────────╮         ╭─╯         ╰╮
 0.025 ┤                      ╭╯           ╰─────────╯            ╰╮
 0.019 ┤                    ╭─╯                                    ╰╮
 0.013 ┼╮                 ╭─╯                                       ╰───╮
 0.007 ┤╰──╮            ╭─╯                                             ╰─────╮
 0.000 ┤   ╰────────────╯                                                     ╰
                              Prices for 2022-11-11 in NO1
      00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

If we simply multiplied all prices by 100, we get this (still maybe not perfect):

~/git/powercost (main ✘)✹ ᐅ pwrcost -date "2022-11-11"
 6.12 ┤                                                   ╭─╮
 5.51 ┤                                                 ╭─╯ ╰╮
 4.91 ┤                                                ╭╯    ╰╮
 4.30 ┤                                               ╭╯      ╰╮
 3.69 ┤                                               │        ╰╮
 3.08 ┤                       ╭───────────╮         ╭─╯         ╰╮
 2.47 ┤                      ╭╯           ╰─────────╯            ╰╮
 1.87 ┤                    ╭─╯                                    ╰╮
 1.26 ┼╮                 ╭─╯                                       ╰───╮
 0.65 ┤╰──╮            ╭─╯                                             ╰─────╮
 0.04 ┤   ╰────────────╯                                                     ╰
                             Prices for 2022-11-11 in NO1
     00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

Then I thought, maybe set the precision to 0, but that made it even worse ;) Notice the labels are repeated on the y-axis

~/git/powercost (main ✘)✹ ᐅ pwrcost -date "2022-11-11"
  6┤                                                   ╭─╮
  6┤                                                 ╭─╯ ╰╮
  5┤                                                ╭╯    ╰╮
  4┤                                               ╭╯      ╰╮
  4┤                                               │        ╰╮
  3┤                       ╭───────────╮         ╭─╯         ╰╮
  2┤                      ╭╯           ╰─────────╯            ╰╮
  2┤                    ╭─╯                                    ╰╮
  1┼╮                 ╭─╯                                       ╰───╮
  1┤╰──╮            ╭─╯                                             ╰─────╮
  0┤   ╰────────────╯                                                     ╰
                          Prices for 2022-11-11 in NO1
  00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

Given how asciigraph scales its y axis, maybe the best option is to either show prices in øre with two decimals, or leave it as it is. Maybe a command line option for øre?

oven commented 1 year ago

This is what it could look like if we added a command line option for øre:

~/git/powercost (main ✘)✹ ᐅ pwrcost -date "2022-11-11"                                   ~/git/powercost (main ✘)✹ ᐅ pwrcost -date "2022-11-11" -ore
 0.061 ┤                                                   ╭─╮                            6.12 ┤                                                   ╭─╮
 0.055 ┤                                                 ╭─╯ ╰╮                           5.51 ┤                                                 ╭─╯ ╰╮
 0.049 ┤                                                ╭╯    ╰╮                          4.91 ┤                                                ╭╯    ╰╮
 0.043 ┤                                               ╭╯      ╰╮                         4.30 ┤                                               ╭╯      ╰╮
 0.037 ┤                                               │        ╰╮                        3.69 ┤                                               │        ╰╮
 0.031 ┤                       ╭───────────╮         ╭─╯         ╰╮                       3.08 ┤                       ╭───────────╮         ╭─╯         ╰╮
 0.025 ┤                      ╭╯           ╰─────────╯            ╰╮                      2.47 ┤                      ╭╯           ╰─────────╯            ╰╮
 0.019 ┤                    ╭─╯                                    ╰╮                     1.87 ┤                    ╭─╯                                    ╰╮
 0.013 ┼╮                 ╭─╯                                       ╰───╮                 1.26 ┼╮                 ╭─╯                                       ╰───╮
 0.007 ┤╰──╮            ╭─╯                                             ╰─────╮           0.65 ┤╰──╮            ╭─╯                                             ╰─────╮
 0.000 ┤   ╰────────────╯                                                     ╰           0.04 ┤   ╰────────────╯                                                     ╰
                         Prices for 2022-11-11 in NO1 (Kr/kWh)                                                  Prices for 2022-11-11 in NO1 (øre/kWh)
      00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24              00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

~/git/powercost (main ✘)✹ ᐅ pwrcost -date "2022-11-20"                                    ~/git/powercost (main ✘)✹ ᐅ pwrcost -date "2022-11-20" -ore                   
 1.94 ┤                                                      ╭─╮                           194 ┤                                                      ╭─╮               
 1.89 ┤                                                    ╭─╯ ╰╮                          189 ┤                                                    ╭─╯ ╰╮              
 1.84 ┤                                                   ╭╯    ╰─╮                        184 ┤                                                   ╭╯    ╰─╮            
 1.79 ┼╮                                               ╭──╯       ╰─╮                      179 ┼╮                                               ╭──╯       ╰─╮          
 1.75 ┤╰╮                                            ╭─╯            ╰─╮                    175 ┤╰╮                                            ╭─╯            ╰─╮        
 1.70 ┤ ╰─╮                                        ╭─╯                ╰─╮                  170 ┤ ╰─╮                                        ╭─╯                ╰─╮      
 1.65 ┤   ╰╮                                 ╭─────╯                    ╰─────             165 ┤   ╰╮                                 ╭─────╯                    ╰───── 
 1.60 ┤    ╰─╮                        ╭──────╯                                             160 ┤    ╰─╮                        ╭──────╯                                 
 1.55 ┤      ╰─╮                    ╭─╯                                                    155 ┤      ╰─╮                    ╭─╯                                        
 1.51 ┤        ╰───────────────╮ ╭──╯                                                      151 ┤        ╰───────────────╮ ╭──╯                                          
 1.46 ┤                        ╰─╯                                                         146 ┤                        ╰─╯                                             
                        Prices for 2022-11-20 in NO1 (Kr/kWh)                                                   Prices for 2022-11-20 in NO1 (øre/kWh)                  
     00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24               00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
oven commented 1 year ago

Created pull request #7 for a flag, if you want to try it out