Degree Days

You can compute cooling and heating degree days with the PVGIS CLI:

pvgis meteo degree-days --help
 Usage: pvgis meteo degree-days [OPTIONS] [longitude] [latitude] [timestamps]   

 🌦 Degree days                                                                  

╭─ Arguments ──────────────────────────────────────────────────────────────────╮
│   longitude      <float range>  Longitude in decimal degrees ranging in      │
│                                 [-180, 360]. If ranging in [0, 360],         │
│                                 consider the `--convert-longitude-360`       │
│                                 option.                                      │
│   latitude       <float range>  Latitude in decimal degrees ranging in [-90, │
│                                 90]                                          │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Timestamps ─────────────────────────────────────────────────────────────────╮
│   timestamps      <parse_timestamp_series>  Quoted date-time strings of data │
│                                             to extract from series, example: │
│                                             '2112-12-21, 2112-12-21          │
│                                             12:21:21, 2112-12-21 21:12:12''  │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --mode                          <heating|cooling|all  Heating, cooling, or   │
│                                 >                     both                   │
│                                                       [default: all]         │
│ --period                        <daily|weekly|monthl  Aggregation period     │
│                                 y|yearly>             [default: monthly]     │
│ --temperature-output-…          <parse_temperature_o  Temperature output     │
│                                 utput_unit>           unit (C, F, or K)      │
│                                                       [default: C]           │
│ --heating-threshold             <float>               Heating threshold      │
│                                                       (temperature below     │
│                                                       triggers heating       │
│                                                       degree days) in        │
│                                                       degrees Celsius        │
│                                                       [default: 15.0]        │
│ --cooling-threshold             <float>               Cooling threshold      │
│                                                       (temperature above     │
│                                                       triggers cooling       │
│                                                       degree days) in        │
│                                                       degrees Celsius        │
│                                                       [default: 24.0]        │
│ --heating-cutoff                <float>               Heating cutoff (base   │
│                                                       temperature for        │
│                                                       heating degree day     │
│                                                       sum) in degrees        │
│                                                       Celsius                │
│                                                       [default: 18.0]        │
│ --cooling-cutoff                <float>               Cooling cutoff (base   │
│                                                       temperature for        │
│                                                       cooling degree day     │
│                                                       sum) in degrees        │
│                                                       Celsius                │
│                                                       [default: 21.0]        │
│ --log                   -l      <int>                 Enable logging         │
│                                                       [default: 0]           │
│ --help                                                Show this message and  │
│                                                       exit.                  │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ External meteorological time series ────────────────────────────────────────╮
│ --temperature-series        <parse_temperature_ser  Ambient temperature time │
│                             ies>                    series                   │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Timestamps ─────────────────────────────────────────────────────────────────╮
│ --start-time,--st        <parse_timestamp>  Start timestamp of the period.   │
│                                             Overrides the `timestamps`       │
│                                             parameter!                       │
│ --periods                <int>              Number of timestamps to generate │
│ --frequency              <str>              A common date/time frequency     │
│                                             unit optionally with a multiples │
│                                             number, such as H(hourly),       │
│                                             min(utely), S(econdly), D(aily), │
│                                             W(eekly), M(onth end), Y(early)  │
│                                             or 30min. See Pandas time series │
│                                             offset aliases.                  │
│ --end-time,--et          <parse_timestamp>  End timestamp of the period.     │
│                                             Overrides the `timestamps`       │
│                                             parameter!                       │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ External time series selection ─────────────────────────────────────────────╮
│ --variable                               <str>             Variable name     │
│ --neighbor-lookup                        <none|pad|backfi  Enable nearest    │
│                                          ll|nearest>       neighbor          │
│                                                            (inexact)         │
│                                                            lookups. Read     │
│                                                            Xarray manual on  │
│                                                            nearest-neighbor… │
│                                                            [default:         │
│                                                            nearest]          │
│ --tolerance                              <float>           Maximum distance  │
│                                                            between original  │
│                                                            & new labels for  │
│                                                            inexact matches.  │
│                                                            Read Xarray       │
│                                                            manual on         │
│                                                            nearest-neighbor… │
│                                                            [default: 0.1]    │
│ --mask-and-scale     --no-mask-and-s…                      Mask and scale    │
│                                                            the series        │
│                                                            [default:         │
│                                                            no-mask-and-scal… │
│ --in-memory          --no-in-memory                        Use in-memory     │
│                                                            processing        │
│                                                            [default:         │
│                                                            no-in-memory]     │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ > Input : < Output ─────────────────────────────────────────────────────────╮
│ --csv                           <path>  CSV output filename                  │
│ --rounding-places     -r        <int>   Number of digits to round results to │
│                                         [default: 3]                         │
│ --angle-output-units  -aou      <str>   Angular units for solar geometry     │
│                                         calculations (degrees or radians). ⚠ │
│                                         Under development                    │
│                                         [default: radians]                   │
│ --verbose             -v        <int>   Show details while executing         │
│                                         commands                             │
│                                         [default: 0]                         │
│ --quiet                                 Do not print out the output          │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Metadata ───────────────────────────────────────────────────────────────────╮
│ --metadata            --no-metadata      Print command metadata              │
│                                          [default: no-metadata]              │
│ --fingerprint,--fp                       Fingerprint the output time series  │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Data processing ────────────────────────────────────────────────────────────╮
│ --dtype                <str>  Data type [default: float32]                   │
│ --array-backend        <str>  Array backend [default: numpy]                 │
╰──────────────────────────────────────────────────────────────────────────────╯

You can select different modes and adjust thresholds. For example, for the location (longitude=8.628, latitude=45.812), using a temperature series from 2014 to 2024, you can calculate:

  1. Cooling degree days for a month:
pvgis meteo degree-days 8.628 45.812 \
--start-time '2014-01-01' \
--end-time '2014-01-31' \
--temperature-series data/sample_era5landplus_t2m_over_esti.nc \
--mode cooling
                              Degree Days                               

  Year / Month     Cooling degree days [°C]   Average temperature [°C]  
 ────────────────────────────────────────────────────────────────────── 
  2014 / January                        0.0                      3.867  
  μ                                     0.0                      3.867  

╭──────────────────────────────────────────────────────────────────────────────╮
│ Mode        cooling                                                          │
│ Period      monthly                                                          │
│ Unit        °C                                                               │
│ Location    0.1506 rad, 0.7996 rad                                           │
│ Time range 2014-01-01 00:00:00 | 2014-01-31 00:00:00                         │
│                                                                              │
│           Threshold  Cutoff                                                  │
│  Heating     15.0°C  18.0°C                                                  │
│  Cooling     24.0°C  21.0°C                                                  │
╰─────────────────────────────────────────────────────────────────── Metadata ─╯
  1. Heating degree days for a month:
pvgis meteo degree-days 8.628 45.812 \
--start-time '2014-01-01' \
--end-time '2014-01-31' \
--temperature-series data/sample_era5landplus_t2m_over_esti.nc \
--mode heating
                              Degree Days                               

  Year / Month     Heating degree days [°C]   Average temperature [°C]  
 ────────────────────────────────────────────────────────────────────── 
  2014 / January                    438.122                      3.867  
  μ                                 438.122                      3.867  

╭──────────────────────────────────────────────────────────────────────────────╮
│ Mode        heating                                                          │
│ Period      monthly                                                          │
│ Unit        °C                                                               │
│ Location    0.1506 rad, 0.7996 rad                                           │
│ Time range 2014-01-01 00:00:00 | 2014-01-31 00:00:00                         │
│                                                                              │
│           Threshold  Cutoff                                                  │
│  Heating     15.0°C  18.0°C                                                  │
│  Cooling     24.0°C  21.0°C                                                  │
╰─────────────────────────────────────────────────────────────────── Metadata ─╯
  1. Or both over a longer period:
pvgis meteo degree-days 8.628 45.812 \
--start-time '2014-01-01' \
--end-time '2024-12-31' \
--temperature-series data/sample_era5landplus_t2m_over_esti.nc \
--mode all
                                  Degree Days                                   

                        Heating degree      Cooling degree             Average  
  Year / Month               days [°C]           days [°C]    temperature [°C]  
 ────────────────────────────────────────────────────────────────────────────── 
  2014 / January               436.662                 0.0               3.914  
  2014 / February              357.738                 0.0               5.224  
  2014 / March                 281.435                 0.0               8.921  
  2014 / April                 141.291                 0.0              12.989  
  2014 / May                    66.385                 0.0              15.176  
  2014 / June                      0.0              24.781              20.141  
  2014 / July                      0.0               6.663              20.497  
  2014 / August                    0.0                 0.0              19.329  
  2014 / September               7.723                 0.0              17.836  
  2014 / October                85.328                 0.0              14.375  
  2014 / November              248.081                 0.0               9.731  
  2014 / December              392.924                 0.0               5.325  
  2015 / January               448.102                 0.0               3.545  
  2015 / February              402.677                 0.0               3.619  
  2015 / March                 304.395                 0.0               8.181  
  2015 / April                 172.261                 0.0              11.973  
  2015 / May                    18.812                 0.0              16.512  
  2015 / June                      0.0               7.626              20.721  
  2015 / July                      0.0             107.689              25.053  
  2015 / August                    0.0              41.902              22.295  
  2015 / September                21.5                 0.0              16.551  
  2015 / October               160.509                 0.0               12.58  
  2015 / November              267.407                 0.0               9.086  
  2015 / December               394.85                 0.0               5.263  
  2016 / January               445.864                 0.0               3.617  
  2016 / February              363.449                 0.0               5.467  
  2016 / March                 334.176                 0.0                7.22  
  2016 / April                 171.541                 0.0              12.183  
  2016 / May                    82.834                 0.0              14.831  
  2016 / June                      0.0                7.27              19.197  
  2016 / July                      0.0              30.285              22.552  
  2016 / August                    0.0               7.519              22.138  
  2016 / September                 0.0                 0.0              19.979  
  2016 / October               173.478                 0.0              12.141  
  2016 / November              313.434                 0.0               7.552  
  2016 / December              426.094                 0.0               4.255  
  2017 / January                516.05                 0.0               1.353  
  2017 / February              345.782                 0.0               5.651  
  2017 / March                 248.554                 0.0               9.982  
  2017 / April                 148.957                 0.0              12.534  
  2017 / May                    70.543                 0.0              16.287  
  2017 / June                      0.0              43.091              22.094  
  2017 / July                      0.0              18.911              22.357  
  2017 / August                    0.0              55.598              23.237  
  2017 / September              26.334                 0.0              16.679  
  2017 / October                 90.13                 0.0              14.265  
  2017 / November              323.544                 0.0               7.215  
  2017 / December              501.372                 0.0               1.827  
  2018 / January                413.58                 0.0               4.659  
  2018 / February              440.827                 0.0               2.256  
  2018 / March                  373.77                 0.0               5.943  
  2018 / April                 134.617                 0.0               13.09  
  2018 / May                    31.587                 0.0              16.595  
  2018 / June                      0.0               4.402              20.815  
  2018 / July                      0.0              45.319              23.378  
  2018 / August                    0.0              66.774               23.65  
  2018 / September               3.838                 0.0              19.714  
  2018 / October                74.255                 0.0              14.612  
  2018 / November              275.674                 0.0               8.811  
  2018 / December              423.632                 0.0               4.334  
  2019 / January               477.648                 0.0               2.592  
  2019 / February              348.743                 0.0               5.545  
  2019 / March                 273.919                 0.0               9.164  
  2019 / April                 196.544                 0.0              11.357  
  2019 / May                   116.803                 0.0              13.678  
  2019 / June                      0.0               35.96               21.72  
  2019 / July                      0.0              73.964              23.768  
  2019 / August                    0.0              12.921              22.659  
  2019 / September               3.182                 0.0              18.616  
  2019 / October                86.483                 0.0              14.464  
  2019 / November              311.621                 0.0               7.613  
  2019 / December               398.25                 0.0               5.153  
  2020 / January               423.439                 0.0               4.341  
  2020 / February              322.376                 0.0               6.884  
  2020 / March                 324.371                 0.0               7.536  
  2020 / April                 117.983                 0.0              13.283  
  2020 / May                    14.076                 0.0              16.876  
  2020 / June                    3.294                 0.0              19.197  
  2020 / July                      0.0              36.049              22.803  
  2020 / August                    0.0              52.377              23.059  
  2020 / September              21.606                 0.0              18.619  
  2020 / October               182.431                 0.0              12.115  
  2020 / November              271.491                 0.0                8.95  
  2020 / December              440.162                 0.0               3.801  
  2021 / January               476.556                 0.0               2.627  
  2021 / February              344.582                 0.0               5.694  
  2021 / March                 315.282                 0.0               7.735  
  2021 / April                 221.268                 0.0              10.401  
  2021 / May                    102.37                 0.0               14.09  
  2021 / June                      0.0               15.42              21.783  
  2021 / July                      0.0              13.377              21.581  
  2021 / August                    0.0              13.187              21.145  
  2021 / September                 0.0                 0.0              19.034  
  2021 / October               159.775                 0.0               12.52  
  2021 / November              313.263                 0.0               7.558  
  2021 / December              464.027                 0.0               3.031  
  2022 / January               454.409                 0.0               3.342  
  2022 / February              337.914                 0.0               5.932  
  2022 / March                 319.232                 0.0               7.702  
  2022 / April                 177.722                 0.0              11.798  
  2022 / May                    35.713                 0.0              18.414  
  2022 / June                      0.0              36.219              22.322  
  2022 / July                      0.0             118.063              25.375  
  2022 / August                    0.0              51.372              23.686  
  2022 / September              31.037                 0.0              17.715  
  2022 / October                13.709                 0.0              15.935  
  2022 / November              271.559                 0.0               8.948  
  2022 / December              425.453                 0.0               4.276  
  2023 / January               447.495                 0.0               3.565  
  2023 / February              360.912                 0.0                5.11  
  2023 / March                 286.172                 0.0               8.769  
  2023 / April                 197.038                 0.0               11.37  
  2023 / May                    53.696                 0.0              15.819  
  2023 / June                      0.0              18.911              20.803  
  2023 / July                      0.0              40.259              23.033  
  2023 / August                    0.0              78.363              23.247  
  2023 / September                 0.0                 0.0              19.665  
  2023 / October                82.342                 0.0               15.64  
  2023 / November              316.503                 0.0                7.45  
  2023 / December                399.6                 0.0                5.11  
  2024 / January               444.057                 0.0               3.676  
  2024 / February              314.423                 0.0               7.158  
  2024 / March                 281.718                 0.0               8.912  
  2024 / April                 175.705                 0.0              11.868  
  2024 / May                    58.124                 0.0              15.168  
  2024 / June                      0.0               3.436              19.378  
  2024 / July                      0.0                55.1              23.091  
  2024 / August                    0.0              98.752              24.827  
  2024 / September              35.647               3.894              17.212  
  2024 / October                99.775                 0.0              14.364  
  2024 / November              300.979                 0.0               7.967  
  2024 / December              437.729                 0.0                3.88  
  μ                            182.214               9.284              12.991  

╭──────────────────────────────────────────────────────────────────────────────╮
│ Mode        all                                                              │
│ Period      monthly                                                          │
│ Unit        °C                                                               │
│ Location    0.1506 rad, 0.7996 rad                                           │
│ Time range 2014-01-01 00:00:00 | 2024-12-31 00:00:00                         │
│                                                                              │
│           Threshold  Cutoff                                                  │
│  Heating     15.0°C  18.0°C                                                  │
│  Cooling     24.0°C  21.0°C                                                  │
╰─────────────────────────────────────────────────────────────────── Metadata ─╯

You can also request different output units and aggregation periods using --temperature-output-unit and --period, as in the example below:

pvgis meteo degree-days 8.628 45.812 \
--start-time '2014-01-01' \
--end-time '2024-12-31' \
--temperature-series data/sample_era5landplus_t2m_over_esti.nc \
--mode all \
--temperature-output-unit K \
--period yearly
                                  Degree Days                                   

           Heating degree days     Cooling degree days     Average temperature  
  Year                     [K]                     [K]                     [K]  
 ────────────────────────────────────────────────────────────────────────────── 
  2014                2290.717                 304.594                 285.974  
  2015                2463.663                 430.366                 286.157  
  2016                 2584.02                 318.225                  285.76  
  2017                2544.415                  390.75                 285.979  
  2018                2444.931                 389.645                 286.368  
  2019                2486.343                 395.995                 286.219  
  2020                2394.379                 361.575                 286.285  
  2021                2670.273                 315.134                 285.444  
  2022                2339.898                 478.804                 286.986  
  2023                2416.908                 410.684                 286.499  
  2024                2421.308                 434.332                 286.297  
  μ                   2186.564                 111.405                 286.179  

╭──────────────────────────────────────────────────────────────────────────────╮
│ Mode        all                                                              │
│ Period      yearly                                                           │
│ Unit        K                                                                │
│ Location    0.1506 rad, 0.7996 rad                                           │
│ Time range 2014-01-01 00:00:00 | 2024-12-31 00:00:00                         │
│                                                                              │
│           Threshold   Cutoff                                                 │
│  Heating    288.15K  291.15K                                                 │
│  Cooling    297.15K  294.15K                                                 │
╰─────────────────────────────────────────────────────────────────── Metadata ─╯

Or for one year, aggregated weekly:

pvgis meteo degree-days 8.628 45.812 \
--start-time '2014-01-01' \
--end-time '2014-12-31' \
--temperature-series data/sample_era5landplus_t2m_over_esti.nc \
--mode all \
--temperature-output-unit C \
--period weekly
                                  Degree Days                                   

                       Heating degree       Cooling degree             Average  
  ISO Year / Week           days [°C]            days [°C]    temperature [°C]  
 ────────────────────────────────────────────────────────────────────────────── 
  2014 / 1                     75.275                  0.0               2.945  
  2014 / 2                     89.193                  0.0               5.258  
  2014 / 3                    100.057                  0.0               3.706  
  2014 / 4                      94.72                  0.0               4.469  
  2014 / 5                    102.884                  0.0               3.302  
  2014 / 6                     96.848                  0.0               4.165  
  2014 / 7                     92.693                  0.0               4.758  
  2014 / 8                     77.845                  0.0               6.879  
  2014 / 9                     90.643                  0.0               5.051  
  2014 / 10                    71.567                  0.0               7.776  
  2014 / 11                    57.623                  0.0               9.768  
  2014 / 12                    50.656                  0.0              10.763  
  2014 / 13                     69.78                  0.0               8.031  
  2014 / 14                    37.028                  0.0               12.71  
  2014 / 15                    28.635                  0.0              13.909  
  2014 / 16                    41.825                  0.0              11.648  
  2014 / 17                    21.807                  0.0              13.972  
  2014 / 18                    36.867                  0.0              12.733  
  2014 / 19                    19.634                  0.0               14.92  
  2014 / 20                    24.906                  0.0              13.831  
  2014 / 21                     3.025                  0.0               16.63  
  2014 / 22                       0.0                  0.0              16.711  
  2014 / 23                       0.0                3.358              19.055  
  2014 / 24                       0.0               21.423              23.561  
  2014 / 25                       0.0                  0.0              19.414  
  2014 / 26                       0.0                  0.0              19.148  
  2014 / 27                       0.0                  0.0              19.341  
  2014 / 28                       0.0                  0.0              18.934  
  2014 / 29                       0.0                6.663              22.715  
  2014 / 30                       0.0                  0.0              20.698  
  2014 / 31                       0.0                  0.0              20.347  
  2014 / 32                       0.0                  0.0              21.041  
  2014 / 33                       0.0                  0.0              19.283  
  2014 / 34                       0.0                  0.0              18.028  
  2014 / 35                       0.0                  0.0              18.644  
  2014 / 36                       0.0                  0.0              18.666  
  2014 / 37                       0.0                  0.0              18.749  
  2014 / 38                       0.0                  0.0              17.811  
  2014 / 39                     7.723                  0.0              16.254  
  2014 / 40                       0.0                  0.0              16.897  
  2014 / 41                    11.268                  0.0              15.337  
  2014 / 42                     3.201                  0.0              16.092  
  2014 / 43                    32.919                  0.0              12.857  
  2014 / 44                    50.185                  0.0              10.831  
  2014 / 45                    50.222                  0.0              10.825  
  2014 / 46                    51.289                  0.0              10.673  
  2014 / 47                     72.77                  0.0               7.604  
  2014 / 48                    61.555                  0.0               9.206  
  2014 / 49                    64.066                  0.0               8.848  
  2014 / 50                     89.89                  0.0               5.159  
  2014 / 51                    82.157                  0.0               6.263  
  2014 / 52                   102.615                  0.0               3.341  
  2015 / 1                     52.575                  0.0               0.475  
  μ                            38.037                0.593              12.642  

╭──────────────────────────────────────────────────────────────────────────────╮
│ Mode        all                                                              │
│ Period      weekly                                                           │
│ Unit        °C                                                               │
│ Location    0.1506 rad, 0.7996 rad                                           │
│ Time range 2014-01-01 00:00:00 | 2014-12-31 00:00:00                         │
│                                                                              │
│           Threshold  Cutoff                                                  │
│  Heating     15.0°C  18.0°C                                                  │
│  Cooling     24.0°C  21.0°C                                                  │
╰─────────────────────────────────────────────────────────────────── Metadata ─╯