- Daylight Hours
- Load CD_Daylight.csv as dictionary
Average over climate divisions
Organize by week
Code Block title Daylight hours of illinois climate divisions by week {'1': {'HRS_DYLT_DIV1': '9.228', 'HRS_DYLT_DIV2': '9.228', 'HRS_DYLT_DIV3': '9.367', 'HRS_DYLT_DIV4': '9.367', 'HRS_DYLT_DIV5': '9.350', 'HRS_DYLT_DIV6': '9.467', 'HRS_DYLT_DIV7': '9.489', 'HRS_DYLT_DIV8': '9.600', 'HRS_DYLT_DIV9': '9.600', 'WEEK': '1', 'average': 9.410666666666664}, '10': {'HRS_DYLT_DIV1': '11.400', ...
wrong to use average for daylight, use daylight for geographic region
Do these weeks match with cdc_week old or new?
30 Year Normals
In the 'get_weather' endpoint, create file '11avg' which is average of weather for all illinois climate divisions
Add temps from all climate divs and divide by 18
Add precip from all climate divs and divide by 9
load 11avg
convert temp to celsius
- average daily temps: if > 22.0 subtract 22, if =< 22.0 set to 0
convert precip to cm
Weather Data - Create weather dictionary for geographic region - structured calendar year/month/day
load 110x
run node function for getting epi week/year from date: https://www.npmjs.com/package/epidemiological-week
convert Fahrenheit to Celsius
convert inches to cm
calculate average of temp max and min
Organize by year/month/day
Code Block title Weather Dictionary Year/Month/Day '2016': {'1': {'1': {'cdc_week': {u'dow': 5, u'week': 52, u'year': 2015}, 'climate_div': '9', 'precip': 0.0, 'state': 'IL', 'temp_avg': -0.7500000000000008, 'temp_max': 1.2777777777777761, 'temp_min': -2.7777777777777777}, '10': {'cdc_week': {u'dow': 0, u'week': 2, u'year': 2016}, 'climate_div': '9', 'precip': 2.2098, 'state': 'IL', 'temp_avg': -0.833333333333333, 'temp_max': 8.88888888888889, 'temp_min': -10.555555555555555}, ...
Weather Data - Create weather dictionary for geographic region - structured EPI year/week
30 Year Normals
same thing, not averages of climate divs, but use data for geographic region
sum both precip and temp and divide by number of rows
For each week calculate normal, not for all weeks total
Code Block Temp 30 year total: 123310.944444 Temp 30 year normal 11.2540790768 Precip 30 year total: 2821.6098 Precip 30 year normal 0.257516637766
Weather Data
Create weather dictionary
load 11avg
convert Fahrenheit to Celsius
convert inches to cm
Organize by year/month/day
Code Block | ||
---|---|---|
| ||
{ '2017':
{'1':
{'1':
{'climate_div': '9', 'precip': 0.0762, 'state': 'IL', 'temp_max': 7.777777777777778, 'temp_min': 0.7222222222222207}, '10':
{'climate_div': '9',
... |
Create degree/precip week dictionary for a single climate division
Loop through years and weeks
get list of dates for week from database
average week's temps: Sum(daily averages -22)7
start creating data for first week > 0Create degree/precip week dictionary for a single climate division
Loop through years and weeks
degree week = (Sum(daily averages)/7 -22) + last weeks degree
get list of dates for week from database
average week's temps: (Sum(daily averages)/7 -22)
start creating data for first week > 0
need to include zero weeks
sum weekly averages
if <0, add zero, else: add next week
abnormal week (difference) (df) = degree week - 30 year normal (for geographic region)
precipitation is total not average like degree week
Code Block {2015: {21: {'degree_week': -10.567571140287205, 'degree_week_total_year': -10.567571140287205, 'temp': 0.6865079365079367, 'temps_total_year': 0.6865079365079367}, 22: {'degree_week': -14.67471399743006, 'degree_week_total_year': -25.242285137717268, 'temp': -3.42063492063492, 'temps_total_year': -2.7341269841269833}, 23: {'degree_week': -7.70249177520784, 'degree_week_total_year': -32.94477691292511, 'temp': 3.5515873015873014, 'temps_total_year': 0.8174603174603181}, 24: {'degree_week': -7.555666378382444, 'degree_week_total_year': -40.50044329130755, 'temp': 3.6984126984126973, 'temps_total_year': 4.515873015873016}, 25: {'degree_week': -7.678682251398316, 'degree_week_total_year': -48.17912554270586, 'temp': 3.575396825396826, 'temps_total_year': 8.091269841269842}, 26: {'degree_week': -10.428682251398318, 'degree_week_total_year': -58.607807794104176, 'temp': 0.825396825396825, 'temps_total_year': 8.916666666666666}, 27: {'degree_week': -9.980269552985616, 'degree_week_total_year': -68.5880773470898, 'temp': 1.273809523809525, 'temps_total_year': 10.190476190476192}, 28: {'degree_week': -6.135031457747523, 'degree_week_total_year': -74.72310880483732, 'temp': 5.119047619047619, 'temps_total_year': 15.30952380952381}, 29: {'degree_week': -7.658840981557047, 'degree_week_total_year': -82.38194978639437, 'temp': 3.5952380952380953, 'temps_total_year': 18.904761904761905}, 30: {'degree_week': -6.849317172033236, 'degree_week_total_year': -89.23126695842761, 'temp': 4.404761904761906, 'temps_total_year': 23.30952380952381}, 31: {'degree_week': -8.615190187906252, 'degree_week_total_year': -97.84645714633386, 'temp': 2.638888888888889, 'temps_total_year': 25.9484126984127}, 32: {'degree_week': -9.341380664096729, 'degree_week_total_year': -107.1878378104306, 'temp': 1.9126984126984123, 'temps_total_year': 27.86111111111111}, 33: {'degree_week': -10.369158441874506, 'degree_week_total_year': -117.5569962523051, 'temp': 0.8849206349206362, 'temps_total_year': 28.746031746031747}, 34: {'degree_week': -13.337412410128476, 'degree_week_total_year': -130.89440866243356, 'temp': -2.0833333333333335, 'temps_total_year': 26.662698412698415}, 35: {'degree_week': -8.05169812441419, 'degree_week_total_year': -138.94610678684776, 'temp': 3.2023809523809526, 'temps_total_year': 29.865079365079367}, 36: {'degree_week': -9.24217431489038, 'degree_week_total_year': -148.18828110173814, 'temp': 2.011904761904762, 'temps_total_year': 31.87698412698413}, 37: {'degree_week': -13.96042828314435, 'degree_week_total_year': -162.1487093848825, 'temp': -2.7063492063492065, 'temps_total_year': 29.170634920634924}, 38: {'degree_week': -13.881063203779268, 'degree_week_total_year': -176.02977258866176, 'temp': -2.626984126984127, 'temps_total_year': 26.543650793650798}, 39: {'degree_week': -14.82153939425546, 'degree_week_total_year': -190.85131198291722, 'temp': -3.567460317460317, 'temps_total_year': 22.97619047619048}, 40: {'degree_week': -15.99217431489038, 'degree_week_total_year': -206.8434862978076, 'temp': -4.738095238095239, 'temps_total_year': 18.23809523809524}, 41: {'degree_week': -18.82153939425546, 'degree_week_total_year': -225.66502569206307, 'temp': -7.567460317460316, 'temps_total_year': 10.670634920634924}, 42: {'degree_week': -19.385031457747523, 'degree_week_total_year': -245.05005714981058, 'temp': -8.130952380952381, 'temps_total_year': 2.539682539682543}, 43: {'degree_week': -21.254079076795144, 'degree_week_total_year': -266.30413622660575, 'temp': -10.0, 'temps_total_year': -7.460317460317457}, 44: {'degree_week': -18.58344415616022, 'degree_week_total_year': -284.887580382766, 'temp': -7.329365079365078, 'temps_total_year': -14.789682539682534}, 45: {'degree_week': -24.666777489493555, 'degree_week_total_year': -309.5543578722595, 'temp': -13.412698412698413, 'temps_total_year': -28.20238095238095}, 46: {'degree_week': -23.146936219652282, 'degree_week_total_year': -332.7012940919118, 'temp': -11.892857142857142, 'temps_total_year': -40.09523809523809}, 47: {'degree_week': -25.964396537112602, 'degree_week_total_year': -358.66569062902437, 'temp': -14.71031746031746, 'temps_total_year': -54.80555555555555}, 48: {'degree_week': -29.027888600604662, 'degree_week_total_year': -387.69357922962905, 'temp': -17.773809523809522, 'temps_total_year': -72.57936507936508}, 49: {'degree_week': -24.682650505366567, 'degree_week_total_year': -412.3762297349956, 'temp': -13.428571428571427, 'temps_total_year': -86.0079365079365}, 50: {'degree_week': -24.71836479108085, 'degree_week_total_year': -437.09459452607643, 'temp': -13.464285714285712, 'temps_total_year': -99.47222222222221}, 51: {'degree_week': -24.68265050536657, 'degree_week_total_year': -461.777245031443, 'temp': -13.428571428571429, 'temps_total_year': -112.90079365079364}, 52: {'degree_week': -28.325507648223713, 'degree_week_total_year': -490.1027526796667, 'temp': -17.071428571428573, 'temps_total_year': -129.97222222222223}, 53: {'degree_week': -11.254079076795142, 'degree_week_total_year': -501.3568317564619, 'temp': 0,
Create degree/precip season dictioanary
loop through season weeks
average weeks 13 weeks of each of 5 seasons
Build File
- Create cdc week database
- rules
- first day is sunday
- first week of year has at least 4 days in week
- if january 1 on sunday-wednesday, first week starts on this week
- if january 1 on thursday-saturday, first week start in previous year
- rules