Input Data

helios is an R package that calculates heating and cooling degrees based on high temporal and spatial resolution of climate data (hourly and 12km resolution) and population data (yearly and 12km resolution). In this tutorial, we introduce how to use helios to support GCAM-USA, where we use climate data over CONUS from WRF or those with the same format and spatial resolution. Data are available on NERSC if users have access. Table 1 shows more details on the climate and population data supported by helios.

* This method was developed for the GCAM-USA version as part of the Integrated Multisector, Multiscale Modeling (IM3) project.


Table 1: Description of required input data in this tutorial.

Specification WRF Climate Data Population Data
Input Format NetCDF File CSV File
Spatial Resolution WRF Resolution: 12 x 12 km WRF Resolution: 12 x 12 km
Temporal Resolution Hourly Annual
Required Variable Temperature T2 (K) Population (thousand capita)
Cluster Location (NERSC) /global/cfs/cdirs/m2702/gsharing/tgw-wrf-conus (NERSC) /global/cfs/cdirs/m2702/gcamusa/hddcdd/pop_1km
Full Dataset Download N/A (Pre-processed) https://zenodo.org/record/3756179#.Y5fLK3bMKUl
Example Dataset helios::example_wrf_usa_ncdf helios::example_pop_usa_csv
More Information https://www.mmm.ucar.edu/models/wrf https://www.mdpi.com/2071-1050/12/8/3374

Please note that helios can process multiple climate NetCDF files with one population CSV file for each run. However, parallelizing grouped climate data can improve calculation efficiency for large dataset.


Workflow

helios includes 6 major steps in the workflow for CONUS heating- and cooling-degrees calculation (Figure 1),

  • Step 1: Process climate NetCDF at 12-km resolution.
  • Step 2: Calculate weighted population.
  • Step 3: Calculate heating and cooling degree-hours at grid resolution.
  • Step 4: Aggregate heating and cooling degree-hours by CONUS and building energy demand sector (This can be used as input to GCAM-USA).
  • Step 5: Calculate heating and cooling degree-days at monthly and annual scale for CONUS.
  • Step 6: Post-process for diagnostic and convert to GCAM required format.

*Note: Dispatch segments are defined as 24 day and night segments in each month of the year (e.g., Jan-day, Jan-night, Feb-day, Feb-night, etc), plus a “super-peak” segment that has the top 10% of loads within a year for each grid region. Dispatch segments are specifically used in GCAM-USA.


Figure 1: Helios workflow for CONUS heating and cooling degree-days for GCAM-USA.


Method

helios calculates different units of heating and cooling degrees for different temporal scale. Table 2 shows more details of the method

Table 2: Methods for calculating heating and cooling degrees at different temporal scales.

Temporal Scale Spatial Scale Sector Unit Method
Dispatch Segment U.S. States Building Thermal Service* Degree-hours 1. Calculate heating degree-hours (HDH) and cooling degree-hours (CDH) as the difference between hourly temperature and comfortable temperature (65F).
\[HDH = T_i - T_{comfort}, \ if \ T_i < T_{comfort}\]
\[CDH = T_i - T_{comfort}, \ if \ T_i > T_{comfort}\]
where, \(T_i\) is the hourly temperature at a grid cell; \(T_{comfort}\) is the comfortable temperature (usually 65F for USA).
2. Multiply the weighted population with degree-days within the same grid cell.
3. Aggregate hourly HDH and CDH by dispatch segment, U.S. States, and building energy demand sectors.
Monthly U.S. States N/A Degree-days 1. Calculate daily mean temperature as the average of minimum and maximum daily temperature.
2. Calculate heating degree-days (HDD < 0) and cooling degree-days (CDD > 0) as the difference between mean temperature and comfortable temperature (65F).
3. Aggregate daily HDD (HDD < 0) and CDD (CDD > 0) by monthly, respectively.
Annual U.S. States N/A Degree-days 1.Aggregate monthly HDD (HDD < 0) and CDD (CDD > 0) by year, respectively.


* Building thermal service includes: commercial heating, commercial cooling, residential heating, and residential cooling.


Examples

Example climate and population data

Due to large size of the climate data (NetCDF file), helios provide spatially subset of example data for demonstration purpose.

  • Climate NetCDF File: helios::example_wrf_usa_ncdf subsets an approximately [-119.86,-118.18,37.99, 39.30] longitude and latitude box within the U.S. (12-km resolution) from the WRF hourly data. Data time ranges from 2020-01-01 01:00:00 to 2020-01-08 00:00:00.
  • Population CSV File: helios::example_pop_usa_csv is population for 2020, which is geo-referenced to WRF grid cells.


Read climate and population data

Users can use helios functions to read climate and population data and convert to tabular table with latitudes and longitudes.

# example data: WRF hourly climate at 12-km resolution
path_to_climate_ncdf <- helios::pkg_example('wrfout_d01_2020-01-01_01%3A00%3A00_sub.nc')

temperature <- helios::read_ncdf(ncdf = path_to_climate_ncdf,
                                 model = 'wrf',
                                 var = 'T2',
                                 time_periods = 2020)
## [1] "vobjtovarid4: **** WARNING **** I was asked to get a varid for dimension named west_east BUT this dimension HAS NO DIMVAR! Code will probably fail at this point"
## [1] "vobjtovarid4: **** WARNING **** I was asked to get a varid for dimension named south_north BUT this dimension HAS NO DIMVAR! Code will probably fail at this point"
## [1] "vobjtovarid4: **** WARNING **** I was asked to get a varid for dimension named Time BUT this dimension HAS NO DIMVAR! Code will probably fail at this point"
## [1] "vobjtovarid4: **** WARNING **** I was asked to get a varid for dimension named west_east BUT this dimension HAS NO DIMVAR! Code will probably fail at this point"
## [1] "vobjtovarid4: **** WARNING **** I was asked to get a varid for dimension named south_north BUT this dimension HAS NO DIMVAR! Code will probably fail at this point"
## [1] "vobjtovarid4: **** WARNING **** I was asked to get a varid for dimension named Time BUT this dimension HAS NO DIMVAR! Code will probably fail at this point"
## [1] "vobjtovarid4: **** WARNING **** I was asked to get a varid for dimension named west_east BUT this dimension HAS NO DIMVAR! Code will probably fail at this point"
## [1] "vobjtovarid4: **** WARNING **** I was asked to get a varid for dimension named south_north BUT this dimension HAS NO DIMVAR! Code will probably fail at this point"
## [1] "vobjtovarid4: **** WARNING **** I was asked to get a varid for dimension named Time BUT this dimension HAS NO DIMVAR! Code will probably fail at this point"
Table. Temperature data extracted from WRF NetCDF.
2020-01-01_01:00:00 2020-01-01_02:00:00 2020-01-01_03:00:00 2020-01-01_04:00:00 2020-01-01_05:00:00 2020-01-01_06:00:00 2020-01-01_07:00:00 2020-01-01_08:00:00 2020-01-01_09:00:00 2020-01-01_10:00:00 2020-01-01_11:00:00 2020-01-01_12:00:00 2020-01-01_13:00:00 2020-01-01_14:00:00 2020-01-01_15:00:00 2020-01-01_16:00:00 2020-01-01_17:00:00 2020-01-01_18:00:00 2020-01-01_19:00:00 2020-01-01_20:00:00 2020-01-01_21:00:00 2020-01-01_22:00:00 2020-01-01_23:00:00 2020-01-02_00:00:00 2020-01-02_01:00:00 2020-01-02_02:00:00 2020-01-02_03:00:00 2020-01-02_04:00:00 2020-01-02_05:00:00 2020-01-02_06:00:00 2020-01-02_07:00:00 2020-01-02_08:00:00 2020-01-02_09:00:00 2020-01-02_10:00:00 2020-01-02_11:00:00 2020-01-02_12:00:00 2020-01-02_13:00:00 2020-01-02_14:00:00 2020-01-02_15:00:00 2020-01-02_16:00:00 2020-01-02_17:00:00 2020-01-02_18:00:00 2020-01-02_19:00:00 2020-01-02_20:00:00 2020-01-02_21:00:00 2020-01-02_22:00:00 2020-01-02_23:00:00 2020-01-03_00:00:00 2020-01-03_01:00:00 2020-01-03_02:00:00 2020-01-03_03:00:00 2020-01-03_04:00:00 2020-01-03_05:00:00 2020-01-03_06:00:00 2020-01-03_07:00:00 2020-01-03_08:00:00 2020-01-03_09:00:00 2020-01-03_10:00:00 2020-01-03_11:00:00 2020-01-03_12:00:00 2020-01-03_13:00:00 2020-01-03_14:00:00 2020-01-03_15:00:00 2020-01-03_16:00:00 2020-01-03_17:00:00 2020-01-03_18:00:00 2020-01-03_19:00:00 2020-01-03_20:00:00 2020-01-03_21:00:00 2020-01-03_22:00:00 2020-01-03_23:00:00 2020-01-04_00:00:00 2020-01-04_01:00:00 2020-01-04_02:00:00 2020-01-04_03:00:00 2020-01-04_04:00:00 2020-01-04_05:00:00 2020-01-04_06:00:00 2020-01-04_07:00:00 2020-01-04_08:00:00 2020-01-04_09:00:00 2020-01-04_10:00:00 2020-01-04_11:00:00 2020-01-04_12:00:00 2020-01-04_13:00:00 2020-01-04_14:00:00 2020-01-04_15:00:00 2020-01-04_16:00:00 2020-01-04_17:00:00 2020-01-04_18:00:00 2020-01-04_19:00:00 2020-01-04_20:00:00 2020-01-04_21:00:00 2020-01-04_22:00:00 2020-01-04_23:00:00 2020-01-05_00:00:00 2020-01-05_01:00:00 2020-01-05_02:00:00 2020-01-05_03:00:00 2020-01-05_04:00:00 2020-01-05_05:00:00 2020-01-05_06:00:00 2020-01-05_07:00:00 2020-01-05_08:00:00 2020-01-05_09:00:00 2020-01-05_10:00:00 2020-01-05_11:00:00 2020-01-05_12:00:00 2020-01-05_13:00:00 2020-01-05_14:00:00 2020-01-05_15:00:00 2020-01-05_16:00:00 2020-01-05_17:00:00 2020-01-05_18:00:00 2020-01-05_19:00:00 2020-01-05_20:00:00 2020-01-05_21:00:00 2020-01-05_22:00:00 2020-01-05_23:00:00 2020-01-06_00:00:00 2020-01-06_01:00:00 2020-01-06_02:00:00 2020-01-06_03:00:00 2020-01-06_04:00:00 2020-01-06_05:00:00 2020-01-06_06:00:00 2020-01-06_07:00:00 2020-01-06_08:00:00 2020-01-06_09:00:00 2020-01-06_10:00:00 2020-01-06_11:00:00 2020-01-06_12:00:00 2020-01-06_13:00:00 2020-01-06_14:00:00 2020-01-06_15:00:00 2020-01-06_16:00:00 2020-01-06_17:00:00 2020-01-06_18:00:00 2020-01-06_19:00:00 2020-01-06_20:00:00 2020-01-06_21:00:00 2020-01-06_22:00:00 2020-01-06_23:00:00 2020-01-07_00:00:00 2020-01-07_01:00:00 2020-01-07_02:00:00 2020-01-07_03:00:00 2020-01-07_04:00:00 2020-01-07_05:00:00 2020-01-07_06:00:00 2020-01-07_07:00:00 2020-01-07_08:00:00 2020-01-07_09:00:00 2020-01-07_10:00:00 2020-01-07_11:00:00 2020-01-07_12:00:00 2020-01-07_13:00:00 2020-01-07_14:00:00 2020-01-07_15:00:00 2020-01-07_16:00:00 2020-01-07_17:00:00 2020-01-07_18:00:00 2020-01-07_19:00:00 2020-01-07_20:00:00 2020-01-07_21:00:00 2020-01-07_22:00:00 2020-01-07_23:00:00 2020-01-08_00:00:00 lat lon
276.5300 275.6490 275.3997 276.2654 276.3188 275.3131 275.1793 275.1678 275.4477 274.6594 275.0215 274.5066 274.0973 273.4333 273.1917 273.2197 273.4683 274.2319 274.4253 274.5829 274.6111 274.7595 274.4582 274.1265 272.4343 272.1081 272.4213 272.4012 272.5107 272.1806 271.8319 271.9175 271.8053 271.9059 272.2191 272.6064 272.7346 272.7979 272.9968 273.6599 274.5406 275.3864 276.0518 276.6354 276.6277 276.1523 275.4861 274.7047 274.3335 274.1952 274.1892 274.2293 273.9428 274.4261 274.1110 274.0109 274.4982 273.9119 272.9631 273.0461 273.4452 273.7902 273.9785 274.4789 275.4077 275.9487 276.2252 276.3383 276.2659 276.1937 275.8185 275.2528 273.9643 273.6454 274.1072 274.0459 273.9443 273.5988 273.7031 273.8700 274.9154 274.6056 274.0661 273.6829 273.3907 272.8367 272.8774 273.5490 274.2466 274.6936 275.6333 276.2151 276.7635 276.6874 276.6274 276.0013 275.3850 274.8209 275.0423 275.4397 275.5713 275.5521 275.4211 275.0807 275.4684 275.2352 274.5827 274.8870 274.7747 274.5350 274.5713 275.0025 275.7573 276.5378 276.8432 278.0032 278.5198 278.0701 277.0977 275.7569 277.0160 276.0139 275.3785 274.4422 275.7768 277.2616 276.1501 276.7281 276.7648 276.8806 276.5486 276.3167 275.7559 275.4862 275.3027 275.8199 276.3640 277.2781 278.2332 278.1565 277.5609 277.0736 276.5292 276.0348 275.3117 275.4704 275.4094 275.2180 274.9099 274.4805 274.4451 274.3776 274.1708 273.1686 272.9023 272.9958 273.0955 272.8990 272.7543 273.0616 274.1968 275.6386 276.4114 276.2007 276.0780 276.0026 275.6364 274.7948 39.04633 -119.8572
277.5141 276.6511 276.4965 276.4675 276.6721 276.1877 275.8394 275.2877 275.8579 276.3694 275.4083 275.0790 274.4619 274.3538 274.1082 273.8329 274.4260 274.9395 275.4879 276.1248 276.6231 276.6717 276.1452 274.9381 272.6784 272.2010 273.0173 273.0609 272.9960 272.9965 272.8297 272.6760 272.5325 272.5701 272.7784 272.8768 272.8011 272.7975 272.5889 273.0603 274.5363 275.9919 276.7416 277.4496 277.6798 277.4659 276.7717 275.5746 274.4180 274.3222 274.6838 275.0549 275.0276 275.1476 275.1376 274.3068 273.8412 273.4651 273.8712 274.4512 274.6930 274.3943 274.4009 275.2033 276.1421 276.6801 276.6435 276.9244 277.2086 277.0903 276.7776 276.0005 274.5606 274.5313 274.6798 274.5377 273.9607 273.9301 274.4709 274.2786 273.9256 273.8497 274.0740 274.1812 274.0009 273.9956 273.8887 274.3809 274.8143 275.8507 276.7177 277.8681 278.6509 278.1268 277.3544 276.0275 275.1082 275.3980 275.6841 275.8140 275.6926 275.6695 276.1281 275.8368 275.8124 276.5654 275.9763 275.9733 276.0538 276.0152 275.9520 276.3412 277.4697 278.1335 278.1875 278.8406 279.7073 280.8174 278.4150 277.9463 278.1956 276.6802 275.5489 275.3153 276.3322 277.3853 278.4218 276.2948 276.6752 276.6145 276.5230 276.4247 276.5587 277.3104 276.9005 276.7920 277.1361 278.5967 279.8486 280.3044 280.2184 279.5405 278.8965 278.0336 276.8735 276.4886 276.0832 275.4787 275.3219 274.7709 274.3778 274.4568 274.0514 274.2767 274.4294 274.5095 274.7887 274.8346 273.6943 273.4651 274.9919 276.2297 277.4387 278.1524 277.9485 278.0944 277.7947 276.7672 39.07250 -119.7211
277.4338 277.3451 276.8208 276.5629 276.3838 276.4206 275.5637 275.1495 275.4079 274.7087 274.0557 273.5301 273.8975 273.4431 273.0273 273.4006 274.5069 274.8414 275.4318 275.9485 276.2454 276.2336 275.5822 273.6338 271.9279 271.1920 272.5292 272.1657 271.9913 272.0365 271.9078 271.7598 271.4124 271.0777 271.3087 271.5481 271.5678 271.3572 271.3090 272.3175 274.1086 275.4430 276.2410 276.8939 277.0539 276.9896 276.1978 274.2848 273.4598 274.0288 274.0605 273.9382 274.0850 273.9896 274.0732 274.1925 273.2381 272.9239 273.3215 273.4763 273.3856 273.2394 273.3382 274.1041 275.5028 276.5359 276.6447 277.0298 277.1918 277.0930 276.5129 275.3564 274.2963 274.2750 274.3716 274.0932 273.6718 273.6484 273.8635 274.0537 274.0068 274.0025 274.0842 273.7983 273.9827 273.6584 273.4251 273.7102 274.6863 275.9803 277.0750 277.8293 277.6727 277.1702 276.3065 275.4015 274.7246 274.9166 275.4112 275.4323 275.4433 275.3102 275.6197 275.5220 276.0020 276.0228 275.6092 276.1223 276.1828 276.0825 276.1298 276.4129 277.2372 277.8974 278.2938 279.2236 280.4651 280.3109 277.7477 276.8280 277.2137 276.6455 275.9772 276.2234 277.0934 276.7909 276.9845 276.3396 276.0008 274.9017 275.1274 275.2122 276.7889 276.7823 276.7444 276.7426 276.7131 277.6767 278.2821 278.5796 278.0051 277.5120 276.4938 275.7630 274.8125 274.4836 273.6418 273.3192 273.6409 273.2992 272.8663 272.8728 272.5224 273.2383 273.6937 273.6470 273.6143 273.2316 272.8201 273.4341 274.4675 275.2092 275.9472 276.5947 276.3076 276.2460 275.9823 274.6244 39.09851 -119.5850
276.1456 276.6089 276.2645 276.0904 275.8828 275.7302 274.7753 274.7005 273.7611 273.7706 272.9093 272.3963 272.1255 272.2478 271.9475 272.5542 274.0496 274.5827 275.0481 275.5301 275.7291 275.5295 274.6008 272.9986 271.7695 271.6637 272.1436 272.0763 271.8557 271.7850 271.6707 271.1430 270.9333 270.8156 271.0215 271.3642 271.0447 270.7107 270.6114 271.6955 273.4649 274.1854 274.5420 275.1171 275.2093 275.2749 274.5500 272.9525 272.8267 273.6593 273.4767 273.5377 274.1450 274.1204 273.8391 273.2641 272.1939 271.6876 272.1254 272.5572 272.4587 272.2798 272.2192 273.6588 274.7536 275.2897 275.3186 275.5145 275.6787 275.7152 275.5137 274.8559 274.0413 273.9953 273.8416 273.4784 273.3740 273.5189 273.5863 273.5869 273.4971 273.4205 273.4194 273.2730 273.0462 272.6932 272.8140 273.1826 274.1861 274.7333 275.1110 275.4164 275.3711 275.1987 275.0210 274.9586 274.4376 274.8642 275.4652 275.4933 275.6212 275.0191 274.6194 274.8094 275.2186 274.6300 274.7623 275.7848 275.7439 275.8395 276.2976 275.9301 276.6202 277.2888 277.6465 277.9364 279.3745 279.6475 277.0350 275.2559 276.3464 275.9424 275.2310 275.6198 276.4088 275.8312 275.9510 276.2417 275.5269 275.2292 274.7899 274.2027 275.4911 275.3581 275.3609 275.5811 276.0458 276.4993 276.5338 276.0800 276.0114 276.2060 275.8844 275.0990 274.5387 273.9092 273.1283 273.0601 273.2600 273.2537 273.1850 273.0403 272.8943 272.4073 272.2921 272.3653 272.7559 272.3257 271.8370 272.3258 273.9063 274.6393 275.2941 275.8652 275.6672 275.2633 274.9958 273.8153 39.12438 -119.4488
277.5574 277.1606 276.3387 277.1970 277.0124 275.9257 276.3840 275.5539 274.9964 274.6070 274.0705 273.9977 273.1750 273.4080 273.4267 273.8522 275.1465 276.0978 276.7463 277.2297 277.4701 277.1470 275.7167 274.0936 272.8493 272.8544 273.2525 273.1451 272.9022 272.9698 273.0800 272.5929 272.2767 272.2982 272.5597 272.4359 271.6062 270.9430 270.6098 271.0472 271.7952 272.1649 272.4696 272.6081 272.6893 272.9430 272.9328 271.5771 271.0288 271.1708 270.9561 270.6268 270.5807 270.9570 271.0493 270.8074 270.0400 269.8872 270.3819 270.8673 270.8623 270.4846 269.9919 270.7245 272.0373 273.0488 273.8262 274.4178 275.0051 275.3361 275.0424 274.2755 273.6784 273.6925 273.5287 273.1665 272.9369 272.8120 272.8887 273.1729 272.8366 272.4920 272.5561 272.4862 272.1553 271.7241 271.3921 271.7446 272.7508 273.7265 273.9555 274.3626 274.6337 274.8167 274.4074 273.8510 273.3102 273.4758 273.6809 273.6964 274.5382 275.0141 274.5121 273.6469 273.8307 273.7944 274.4795 274.8350 274.8187 274.9169 275.3838 275.9378 276.7586 277.0553 277.4254 277.9214 278.7803 278.3560 278.0323 277.2965 276.8568 276.2577 276.1409 275.6672 275.8644 274.5813 275.4075 276.5349 275.9372 275.4072 275.1977 275.1949 275.7876 275.3369 275.3577 275.3927 276.1418 276.8679 276.9182 276.6274 276.6988 276.9125 277.0086 276.4327 275.7457 275.1416 275.0683 274.9829 274.9680 274.3209 274.1369 273.8516 273.6762 273.2323 273.0890 273.2127 273.2136 272.7556 272.5639 273.4417 275.1006 275.9895 276.8320 277.0040 277.6437 277.6513 276.7641 275.6492 39.15008 -119.3124
276.6362 276.4886 276.3837 277.1292 277.5344 277.0761 277.1561 276.3749 276.5429 275.9415 275.3298 275.2082 274.4792 274.6838 274.3546 274.9135 276.1785 277.0599 278.5672 279.1985 279.7790 279.8557 279.1856 277.3450 275.2015 274.3091 274.2802 274.1402 273.9168 274.1143 274.3040 274.0294 273.7521 273.5859 273.3768 272.4434 271.5200 271.4015 271.3495 271.4819 271.6245 272.0958 272.8312 273.4870 274.1862 273.8660 273.3923 272.2512 271.2083 270.5250 270.6730 270.4539 270.3042 270.0452 269.8442 269.7107 269.2830 269.1165 269.3252 269.4943 269.7540 269.7180 269.7172 270.2898 270.9779 272.1650 273.4691 274.5907 275.5173 275.9783 275.8399 274.5063 273.7303 273.4798 273.3531 273.1584 272.9585 272.2281 272.5441 272.9510 272.7820 272.3863 271.9530 271.8704 271.8293 271.1426 270.5533 271.1616 272.7609 274.1341 274.7611 275.6989 276.2628 276.3867 275.6536 273.8239 272.9583 272.9818 273.0891 273.0826 273.9201 274.4724 274.5622 274.4401 274.4632 273.7911 273.3518 273.1611 273.4160 273.7315 274.1462 274.9530 276.1523 276.9564 277.5360 277.9356 279.0069 279.2903 279.2244 278.2482 276.9459 277.0415 276.1982 276.9527 277.3260 275.6922 275.0930 275.5206 275.5900 275.7919 275.5002 275.6112 275.2867 275.4781 276.0514 276.0233 276.8167 277.9309 278.8385 279.0706 279.1826 279.2397 279.1642 277.8856 277.2441 277.3467 276.5665 275.9716 275.8318 276.3854 276.1721 275.6964 274.9010 274.0056 274.2306 274.1200 273.8763 273.6025 273.0713 273.8589 275.5552 277.2826 277.5575 278.2564 278.5472 279.1851 279.0857 277.4437 39.17563 -119.1760
276.2963 276.6121 276.2541 276.8140 276.6290 276.9632 276.5995 276.6709 276.0365 276.1100 275.2489 274.7777 273.9265 274.3494 274.4456 274.8008 276.1694 277.3511 278.7174 279.6349 280.0047 280.0694 279.4225 277.7127 275.6732 274.8535 274.1331 273.7986 273.4214 273.5546 273.8021 273.3945 273.0227 272.9539 272.6657 271.6361 271.8269 271.5540 271.5613 271.6844 272.0829 272.5649 273.0470 273.5804 274.1452 274.0459 273.6214 272.1320 271.2590 270.6784 270.2289 270.3208 270.5920 270.0812 269.7522 269.5021 269.7072 270.0575 269.9568 269.7922 269.6241 269.6262 269.7404 270.2112 270.9497 271.6595 273.2072 274.6865 275.6277 275.9276 275.9669 274.9907 273.9891 273.7141 273.4460 273.1572 273.0465 272.5171 272.5580 272.5341 272.3735 272.1211 271.8971 271.7020 271.4621 271.2866 270.7540 271.1844 272.5172 274.0189 275.0211 275.8758 276.8126 276.7267 275.9888 273.9326 272.7770 272.6212 272.4384 272.6735 273.5116 274.4514 274.4038 274.5047 274.7335 273.9295 273.2982 273.4264 273.7062 273.9243 273.8176 274.5712 275.9433 276.9070 277.3366 277.8286 279.2896 279.5755 279.7286 278.7706 277.3856 277.4157 276.2388 276.1969 278.2142 277.4652 274.4645 275.0847 275.4574 276.1287 276.6242 275.9026 275.5157 275.7967 275.7573 276.8502 277.3469 277.9167 278.5349 278.7742 278.9344 278.9853 278.9520 278.1722 277.3676 276.3581 275.8946 275.8795 275.7693 275.3715 274.9284 275.0105 274.4992 274.5377 274.8480 274.6298 273.9529 273.4902 273.1270 273.5658 274.8658 277.0008 277.3558 278.1297 278.3037 278.4222 278.5540 277.4633 39.20103 -119.0394
276.4379 276.8933 276.3231 277.0167 276.6582 277.1019 276.3730 277.1574 275.9712 276.2787 275.8211 275.0320 274.1204 274.3667 274.8317 275.1378 276.1341 277.2547 278.3507 279.4286 279.7080 279.9799 279.5220 278.0905 275.9507 275.5046 275.0261 274.4559 273.4582 273.1310 273.2357 272.9489 272.5832 272.7144 272.4545 271.6514 271.9803 271.6405 271.3302 271.5115 271.7768 272.2100 272.7142 272.9068 273.5273 274.1446 274.1678 272.6223 271.9172 271.2124 271.2262 271.2961 271.0692 270.6841 270.2622 269.9147 269.8617 270.1465 269.7456 269.6786 269.5692 269.5484 269.3379 269.6216 269.8783 271.0949 272.6474 273.9501 275.0127 275.4498 275.6512 274.6992 273.4510 273.1892 272.9397 272.8247 272.5860 272.4595 272.4893 272.3055 272.0563 271.7452 271.4321 271.1940 271.0047 270.7677 270.2565 270.5186 271.8470 273.5811 274.2863 274.8889 275.6752 275.8793 275.5082 273.6963 272.9932 272.6205 272.4362 272.9503 273.9677 275.0739 274.7610 274.4230 274.7618 273.9453 273.2867 273.5633 273.7634 273.9848 274.2432 274.9843 275.9037 276.7125 277.1406 277.4142 278.4420 278.5792 278.4283 278.1028 277.7296 278.1638 276.6209 275.8324 276.9992 276.8207 274.6136 276.1826 275.8783 276.6017 276.2555 275.6486 275.3207 275.5059 275.5987 276.5565 277.1692 277.7535 277.9238 278.3163 278.3680 278.4569 278.4628 277.4140 276.6695 276.5728 275.8547 275.5077 275.1812 274.7299 274.7419 274.7781 274.3143 274.2157 274.5494 274.4983 274.0629 273.4755 273.0145 273.2112 274.5266 276.0755 276.7802 277.3343 277.4138 277.7350 277.7577 276.7287 39.22628 -118.9028
277.1167 277.0620 276.7695 277.0444 276.7961 277.3731 276.5037 276.9947 276.0431 276.5621 276.0296 274.5945 274.3220 274.4857 274.7293 274.6924 275.9088 277.2278 278.5821 279.5623 280.1396 280.4926 280.0145 278.7488 276.4471 276.2380 275.7897 275.2980 274.1073 273.6223 273.5239 273.3415 273.1165 273.0954 272.8290 272.2591 272.4035 272.3036 272.1997 272.0399 272.4974 272.8785 273.6735 273.8044 273.8700 273.9838 274.3726 273.3272 272.4763 272.1916 271.8719 271.6389 271.5988 271.4278 271.2833 271.1048 270.7739 270.7245 270.6742 270.6526 270.7431 270.4582 270.0779 270.5023 270.5863 270.8885 271.9069 273.2590 274.6607 275.6931 276.1277 275.7058 274.6136 274.1273 273.8513 273.6761 273.2264 273.0975 273.0107 272.9329 272.6424 272.2372 271.8620 271.6221 271.4166 271.1098 270.5905 270.9195 271.9250 273.6678 274.0158 274.7234 275.8867 275.9608 275.4776 273.9846 273.5322 272.7969 272.8705 273.5278 274.0771 274.6804 274.9090 274.7454 274.6946 273.9354 273.5759 273.5834 273.7254 273.9752 274.1607 274.8441 275.7167 276.6594 277.2279 277.1647 277.9352 278.3896 279.0757 279.0119 278.2924 278.1585 276.8021 276.3124 277.3176 275.3893 275.5115 275.7507 275.3885 276.4304 275.7621 275.1663 274.5465 275.0132 275.5580 276.1945 276.7315 277.7132 277.8204 278.4711 278.9777 279.1440 279.1247 278.5225 277.6826 276.7433 276.0372 275.8724 275.5506 274.9448 274.7335 274.6502 274.5014 274.1311 274.9364 274.6064 273.6851 273.5462 273.3927 273.4180 274.6096 275.9864 277.0000 277.5066 278.1661 278.6003 278.5086 277.5951 39.25137 -118.7661
277.2552 277.3832 277.1455 276.9172 276.7751 277.0384 276.7365 276.4151 276.2578 276.1789 275.7653 274.8423 274.3571 273.8749 274.2749 274.5484 276.5393 277.5399 278.4653 279.5308 280.3997 280.8011 280.4313 279.1475 276.7415 276.4488 276.1162 275.7077 274.6182 273.9958 273.6461 273.2680 273.1040 273.0687 273.0963 272.9098 273.1409 272.8647 272.7283 272.6208 272.7043 273.0067 273.4982 274.3363 274.7366 275.0040 274.9586 273.7363 273.2126 272.8445 272.5539 272.3567 272.3333 272.2702 271.9602 271.6708 271.3074 271.1045 270.9192 270.8766 271.0182 270.8376 270.6374 270.8886 270.6212 270.9253 272.0952 273.6277 275.1916 276.2575 276.6827 276.1170 275.0607 274.4793 274.2458 273.9888 273.5739 273.5854 273.3496 273.0491 272.4329 272.2160 271.9569 271.7962 271.6453 271.4247 271.3578 271.4896 272.1818 273.7663 274.3321 275.4829 276.4153 276.4406 275.9979 274.6804 273.9972 273.4796 273.7449 274.2661 274.6345 274.6942 275.0323 275.2444 275.1318 274.8805 274.7650 274.3426 274.0858 274.4111 274.7545 275.2231 276.1569 277.2388 277.9303 277.5831 278.5941 279.3911 280.0901 279.9145 279.3365 278.8214 277.5703 276.6717 277.0266 275.4164 276.2921 276.4781 275.6971 276.0178 275.6737 275.3726 274.1363 274.1401 274.4621 275.4663 276.1554 277.5941 277.5861 278.1026 279.4164 279.5989 279.4934 279.2510 278.0062 276.8961 276.1905 275.8318 275.7746 275.3496 275.3437 275.1834 274.7393 274.3904 274.6051 274.3980 273.7921 273.1648 273.2536 273.4294 274.6315 276.1435 277.3985 278.1933 278.9048 279.1982 279.0648 278.0566 39.27631 -118.6293
Note:
This only shows the first 10 lines of the example data.


# example data: population of 2020 at same 12-km resolution as WRF
path_to_population <- helios::pkg_example('population_conus_ssp2_2020wrf_wgs84.csv')

population <- helios::read_population(file = path_to_population,
                                      time_periods = 2020)
Table. Population data.
lat lon year value
21.04686 -120.9716 2020 0
21.07325 -120.8631 2020 0
21.09951 -120.7545 2020 0
21.12567 -120.6458 2020 0
21.15170 -120.5371 2020 0
21.17762 -120.4284 2020 0
21.20343 -120.3196 2020 0
21.22913 -120.2107 2020 0
21.25471 -120.1017 2020 0
21.28017 -119.9927 2020 0
Note:
This only shows the first 10 lines of the example data.


Calculate heating and cooling degrees

The following example specifies the arguments for processing WRF dataset. More information for the arguments can be found in (helios::hdcd Reference)[https://jgcri.github.io/helios/reference/hdcd.html].

  • ncdf_var = 'T2' specifies climate variable to extract from the netCDF, which is temperature in this case.
  • model = 'wrf' specifies the model used to produce the climate forcing data, which is WRF model in this case.
  • model_timestep = 'hourly' indicates the temporal resolution of the climate forcing data, which is hourly in this case.
  • spatial = 'gcam_us49' specifies we are only calculating the cooling and heating degrees within 49 states of USA. This will produce outputs that can be used for GCAM-USA. For tutorial of using helios for global 32 regions, please check out GCAM-regions tutorial page.
  • time_periods = 2020 specifies the time period 2020 to include since the example data only covers 7 days in 2020.
  • dispatch_segment = TRUE asks the model to output heating and cooling degree-hours by segment when the input data is hourly. In addition, these two arguments need to be specified as model_timestep = 'hourly' and spatial = 'gcam_us49', because the currently only GCAM-USA supports dispatch segment.
library(helios)

# example data: WRF hourly climate at 12-km resolution
path_to_climate_ncdf <- helios::pkg_example('wrfout_d01_2020-01-01_01%3A00%3A00_sub.nc')

# example data: population of 2020 at same 12-km resolution as WRF
path_to_population <- helios::pkg_example('population_conus_ssp2_2020wrf_wgs84.csv')

# Calculate heating and coolong degrees for CONUS (e.g., part of USA in the example)
hdcd_usa <- helios::hdcd(ncdf = path_to_climate_ncdf,
                         ncdf_var = 'T2',
                         model = 'wrf',
                         model_timestep = 'hourly',
                         population = path_to_population,
                         spatial = 'gcam_us49',
                         time_periods = 2020,
                         dispatch_segment = TRUE,
                         reference_temp_F = 65,
                         folder = file.path(getwd(), 'output'),
                         diagnostics = F,
                         xml = F,
                         name_append = '',
                         save = T)
## [1] "Starting function process_hdcd..."
## [1] "Processing files provided: /Users/runner/work/_temp/Library/helios/extras/wrfout_d01_2020-01-01_01%3A00%3A00_sub.nc"
## [1] "........................................."
## [1] "Running hdcd for file: /Users/runner/work/_temp/Library/helios/extras/wrfout_d01_2020-01-01_01%3A00%3A00_sub.nc"
## [1] "vobjtovarid4: **** WARNING **** I was asked to get a varid for dimension named west_east BUT this dimension HAS NO DIMVAR! Code will probably fail at this point"
## [1] "vobjtovarid4: **** WARNING **** I was asked to get a varid for dimension named south_north BUT this dimension HAS NO DIMVAR! Code will probably fail at this point"
## [1] "vobjtovarid4: **** WARNING **** I was asked to get a varid for dimension named Time BUT this dimension HAS NO DIMVAR! Code will probably fail at this point"
## [1] "vobjtovarid4: **** WARNING **** I was asked to get a varid for dimension named west_east BUT this dimension HAS NO DIMVAR! Code will probably fail at this point"
## [1] "vobjtovarid4: **** WARNING **** I was asked to get a varid for dimension named south_north BUT this dimension HAS NO DIMVAR! Code will probably fail at this point"
## [1] "vobjtovarid4: **** WARNING **** I was asked to get a varid for dimension named Time BUT this dimension HAS NO DIMVAR! Code will probably fail at this point"
## [1] "vobjtovarid4: **** WARNING **** I was asked to get a varid for dimension named west_east BUT this dimension HAS NO DIMVAR! Code will probably fail at this point"
## [1] "vobjtovarid4: **** WARNING **** I was asked to get a varid for dimension named south_north BUT this dimension HAS NO DIMVAR! Code will probably fail at this point"
## [1] "vobjtovarid4: **** WARNING **** I was asked to get a varid for dimension named Time BUT this dimension HAS NO DIMVAR! Code will probably fail at this point"
## [1] "Starting population weighting ..."
## [1] "Completed population weighting."
## [1] "Processing hdcd completed for file: /Users/runner/work/_temp/Library/helios/extras/wrfout_d01_2020-01-01_01%3A00%3A00_sub.nc"
## [1] "File saved as : /Users/runner/work/helios/helios/vignettes/output/hdcd_wrf_2020_2020_gcam.csv"
## [1] "File saved as : /Users/runner/work/helios/helios/vignettes/output/hdcd_wrf_2020_2020_monthly.csv"
## [1] "File saved as : /Users/runner/work/helios/helios/vignettes/output/hdcd_wrf_2020_2020_annual.csv"
## [1] "process_hdcd completed."


The output is a list containing three tables. Please note the different units (degree-hours or degree-days) for different outputs.

  • hdcd_usa$hdcd_comb_gcam: Heating and cooling degree-hours by dispatch segment for CONUS and by building thermal service. GCAM/GCAM-USA required format.
  • hdcd_usa$hdcd_comb_monthly: Heating and cooling degree-days by month for CONUS (part of USA in the example).
  • hdcd_usa$hdcd_comb_annual: Heating and cooling degree-days by year for CONUS (part of USA in the example).


1. By GCAM-USA Dispatch Segment and Building Thermal Service

# Heating and cooling degree-hours by dispatch segment and by building thermal service for CONUS
hdcd_segment <- hdcd_usa$hdcd_comb_gcam
Table. Annual heating and cooling degree-hours by building thermal service
region subRegion year segment gcam.consumer nodeInput building.node.input thermal.building.service.input unit value
USA CA 2020 Dec_day comm comm comm_building comm heating Dec_day Fahrenheit degree-hours -0.0114599
USA CA 2020 Dec_day resid resid resid_building resid heating Dec_day Fahrenheit degree-hours -0.0114599
USA CA 2020 Dec_night comm comm comm_building comm heating Dec_night Fahrenheit degree-hours -0.0414882
USA CA 2020 Dec_night resid resid resid_building resid heating Dec_night Fahrenheit degree-hours -0.0414882
USA CA 2020 Jan_day comm comm comm_building comm heating Jan_day Fahrenheit degree-hours -0.3393844
USA CA 2020 Jan_day resid resid resid_building resid heating Jan_day Fahrenheit degree-hours -0.3393844
USA CA 2020 Jan_night comm comm comm_building comm heating Jan_night Fahrenheit degree-hours -0.6256360
USA CA 2020 Jan_night resid resid resid_building resid heating Jan_night Fahrenheit degree-hours -0.6256360
USA NV 2020 Dec_day comm comm comm_building comm heating Dec_day Fahrenheit degree-hours -1.0170742
USA NV 2020 Dec_day resid resid resid_building resid heating Dec_day Fahrenheit degree-hours -1.0170742
USA NV 2020 Dec_night comm comm comm_building comm heating Dec_night Fahrenheit degree-hours -3.7933185
USA NV 2020 Dec_night resid resid resid_building resid heating Dec_night Fahrenheit degree-hours -3.7933185
USA NV 2020 Jan_day comm comm comm_building comm heating Jan_day Fahrenheit degree-hours -30.8660315
USA NV 2020 Jan_day resid resid resid_building resid heating Jan_day Fahrenheit degree-hours -30.8660315
USA NV 2020 Jan_night comm comm comm_building comm heating Jan_night Fahrenheit degree-hours -57.7348273
USA NV 2020 Jan_night resid resid resid_building resid heating Jan_night Fahrenheit degree-hours -57.7348273


2. By Month

# Heating and cooling degree-days at monthly scale for CONUS
hdcd_monthly <- hdcd_usa$hdcd_comb_monthly
Table. Monthly heating and cooling degree-days
region subRegion year month HDCD unit value
USA CA 2020 01 CD Fahrenheit degree-days 0.0000000
USA CA 2020 01 HD Fahrenheit degree-days -0.0483388
USA NV 2020 01 CD Fahrenheit degree-days 0.0000000
USA NV 2020 01 HD Fahrenheit degree-days -4.3027594


3. By Year

# Heating and cooling degree-days at annual scale for CONUS
hdcd_annual <- hdcd_usa$hdcd_comb_annual
Table. Annual Heating and Cooling Degree-days
region subRegion year HDCD unit value
USA CA 2020 CD Fahrenheit degree-days 0.0000000
USA CA 2020 HD Fahrenheit degree-days -0.0483388
USA NV 2020 CD Fahrenheit degree-days 0.0000000
USA NV 2020 HD Fahrenheit degree-days -4.3027594


NOTE: Please note that we use a spatial subset of WRF input climate NetCDF data as an example, which only covers 7 days. To get heating and cooling degrees for a complete year, users need to run climate NetCDF files using helios that cover the length of a year. For example, if each climate NetCDF is for 7-days, then user need to include about 52 climate NetCDF to cover a whole year of climate data. Then, users can use helios::diagnostics to create plots to check heating and cooling degree behaviors throughout a year.

Diagnostics

After getting the data table for heating and cooling degrees, users can perform diagnostics and compare with NOAA observations if data covers the U.S. The diagnostics create the following plots at segment and monthly time step:

  • Heating and cooling degrees for each year
  • Comparison of heating and cooling degrees among all years

Users can also use helios::diagnostics to visualize any heating and cooling degree data as long as they include those columns in the monthly data or the segment data: [subRegion, year, month/segment, HDCD, value]


1. By Month

Let’s run helios::diagnostics to the example heating and cooling degree-days by month from 2020 to 2050.

Table. Example data for monthly heating and cooling degree-days from 2020 to 2050 with 5-year interval.
subRegion year month HDCD value
AL 2020 1 HD -554.602736
AL 2020 2 CD 3.119958
AL 2020 2 HD -720.422022
AL 2020 3 CD 6.460285
AL 2020 3 HD -377.592511
AL 2020 4 CD 52.836382
AL 2020 4 HD -121.201889
AL 2020 5 CD 272.250722
AL 2020 5 HD -6.784828
AL 2020 6 CD 480.749542
Note:
This only shows the first 10 lines of the example data.

If the data coverage is too short (e.g., less than 6 months), diagnostics will not create plot by default. Users can change the constraint on numbers of months in the data using argument min_diagnostic_months to enable diagnostics even with short data coverage. The followings show how to use diagnostics with example outputs of heating and cooling degrees at both segment and monthly time step.

# Perform diagnostic on monthly data
helios::diagnostics(hdcd_monthly = helios::example_hdcd_monthly_usa,
                    min_diagnostic_months = 6,
                    folder = file.path(getwd(), 'output'),
                    name_append = 'monthly')


Figure 2: Diagnostics for monthly heating and cooling degree-days from 2020 to 2050.


2. By GCAM-USA Dispatch Segment

Let’s run helios::diagnostics to the example heating and cooling degree-hours by dispatch segment from 2020 to 2050.

Table. Example data for heating and cooling degree-hours by Segment from 2020 to 2050 with 5-year interval.
subRegion year segment value HDCD
AL 2020 Apr_day 1658.28538 CD
AL 2020 Apr_day -927.71234 HD
AL 2020 Apr_night 118.58054 CD
AL 2020 Apr_night -2939.63478 HD
AL 2020 Aug_day 9653.28363 CD
AL 2020 Aug_night 4062.64718 CD
AL 2020 Dec_day 117.39468 CD
AL 2020 Dec_day -4717.31780 HD
AL 2020 Dec_night 1.09673 CD
AL 2020 Dec_night -10669.04390 HD
Note:
This only shows the first 10 lines of the example data.
# Perform diagnostic on segment data
helios::diagnostics(hdcd_segment = helios::example_hdcd_segment_usa,
                    min_diagnostic_months = 6,
                    folder = file.path(getwd(), 'output'),
                    name_append = 'segment')


Figure 3: Diagnostics for heating and cooling degree-hours by dispatch segment from 2020 to 2050.


XML file for GCAM-USA

Finally, for GCAM users, helios can save the outputs by building thermal service to XML format, which is a required format for GCAM inputs. There are two ways to save helios output to XML file:

helios::save_xml(hdcd_gcam = hdcd_segment,
                 folder = file.path(getwd(), 'output'),
                 name_append = 'wrf')
## [1] "Starting function save_xml..."
## [1] "File saved as : /Users/runner/work/helios/helios/vignettes/output/hdcd_wrf_xml.csv"
## [1] "File saved as : /Users/runner/work/helios/helios/vignettes/output/hdcd_wrf.xml"
## [1] "save_xml complete."