# Verify Coefficient Creation

Started June 3, 2019

### Steps in running model

• get weather data from source
• cron running on arcus.sws.uiuc.edu
• data 2 days behind current date
• verified
• daily weather
• convert to cm and celsius
• average min and max temps
• put into year-month-week dictionary
• (verified  )
• `calculate_seasonal_weather`
• problem with seasons
• change made large difference in winter seasonal values (below)
• values:
• temp avg summed and divided by 13
• precip avg is summed (not divided by 13) (changed  to divided by 13)
• calculate_weekly_30yr_normals
• looks ok
• calculate_seasonal_30yr_normals
• mistake  divided season average by 13 not 30
calculate_seasonal_weatherNotesoutput winter 2016Coefficients
before
```        for epi_week in weekly_weather[epi_year]:

if count_years > 1:
if 1 <= epi_week <= 9:
seasonal_weather[epi_year]["winter"]["degree_week_average_c"] += weekly_weather[epi_year-1][epi_week]["degree_week_c"]
seasonal_weather[epi_year]["winter"]["precip_week_average_cm"] += weekly_weather[epi_year-1][epi_week]["precip_cm"]
if 49 <= epi_week <= 52:
seasonal_weather[epi_year]["winter"]["degree_week_average_c"] += weekly_weather[epi_year][epi_week]["degree_week_c"]
seasonal_weather[epi_year]["winter"]["precip_week_average_cm"] += weekly_weather[epi_year][epi_week]["precip_cm"]
if 23 <= epi_week <= 35:
seasonal_weather[epi_year]["summer"]["degree_week_average_c"] += weekly_weather[epi_year][epi_week]["degree_week_c"]
seasonal_weather[epi_year]["summer"]["precip_week_average_cm"] += weekly_weather[epi_year][epi_week]["precip_cm"]
if 10 <= epi_week <= 22:
seasonal_weather[epi_year]["spring"]["degree_week_average_c"] += weekly_weather[epi_year][epi_week]["degree_week_c"]
seasonal_weather[epi_year]["spring"]["precip_week_average_cm"] += weekly_weather[epi_year][epi_week]["precip_cm"]
if 36 <= epi_week <= 48:
seasonal_weather[epi_year]["fall"]["degree_week_average_c"] += weekly_weather[epi_year][epi_week]["degree_week_c"]
seasonal_weather[epi_year]["fall"]["precip_week_average_cm"] += weekly_weather[epi_year][epi_week]["precip_cm"]```
• For winter, previous calendar year should be for weeks 49-52(3) not 1-9
• for first year of data, all seasons within if count_years > 1 block
before
```2016: {'fall': {'degree_week_average_c': 16.087301587301575,
'precip_week_average_cm': 21.488400000000002},
'spring': {'degree_week_average_c': 0,
'precip_week_average_cm': 28.5242},
'summer': {'degree_week_average_c': 6.838827838827833,
'precip_week_average_cm': 40.9194},
'winter': {'degree_week_average_c': 4.9499389499389475,
'precip_week_average_cm': 11.556999999999999}},```
before
```  "2": {
"dw2preci4": "-0.0005795453",
"lastsummertemp": "0",
"wintertemp": "0.1617251",
"dw2preci3": "-0.1668376",
"dw2preci2": "0.003797379",
"dw2preci1": "-0.3367884",
"dw3preci1": "0.293194",
"dw1preci4": "-0.02145926",
"precilag1": "-0.04565507",
"dwlag1": "0.6759879",
"winterpreci": "0",
"dwlag3": "-0.3623205",
"springtemp": "-1.443487",
"dw3preci3": "0.08177531",
"dw1preci2": "-0.06263824",
"dw1preci3": "0.02926325"
}```
after
```            for epi_week in weekly_weather[epi_year]:
if 1 <= epi_week <= 9:
seasonal_weather[epi_year]["winter"]["degree_week_average_c"] += weekly_weather[epi_year][epi_week]["degree_week_c"]
seasonal_weather[epi_year]["winter"]["precip_week_average_cm"] += weekly_weather[epi_year][epi_week]["precip_cm"]
if 49 <= epi_week <= 52:
seasonal_weather[epi_year]["winter"]["degree_week_average_c"] += weekly_weather[epi_year-1][epi_week]["degree_week_c"]
seasonal_weather[epi_year]["winter"]["precip_week_average_cm"] += weekly_weather[epi_year-1][epi_week]["precip_cm"]
if 23 <= epi_week <= 35:
seasonal_weather[epi_year]["summer"]["degree_week_average_c"] += weekly_weather[epi_year][epi_week]["degree_week_c"]
seasonal_weather[epi_year]["summer"]["precip_week_average_cm"] += weekly_weather[epi_year][epi_week]["precip_cm"]
if 10 <= epi_week <= 22:
seasonal_weather[epi_year]["spring"]["degree_week_average_c"] += weekly_weather[epi_year][epi_week]["degree_week_c"]
seasonal_weather[epi_year]["spring"]["precip_week_average_cm"] += weekly_weather[epi_year][epi_week]["precip_cm"]
if 36 <= epi_week <= 48:
seasonal_weather[epi_year]["fall"]["degree_week_average_c"] += weekly_weather[epi_year][epi_week]["degree_week_c"]
seasonal_weather[epi_year]["fall"]["precip_week_average_cm"] += weekly_weather[epi_year][epi_week]["precip_cm"]```

after
``` 2016: {'fall': {'degree_week_average_c': 16.087301587301575,
'precip_week_average_cm': 21.488400000000002},
'spring': {'degree_week_average_c': 0,
'precip_week_average_cm': 28.5242},
'summer': {'degree_week_average_c': 6.838827838827833,
'precip_week_average_cm': 40.9194},
'winter': {'degree_week_average_c': 2.1733821733821777,
'precip_week_average_cm': 18.7706}},```
after
` `
{
"2": {
"dw2preci4": "0.05358239",
"lastsummertemp": "0.8415992",
"wintertemp": "-1.313953",
"dw2preci3": "-0.1343593",
"dw2preci2": "-0.05608847",
"dw2preci1": "-0.3259052",
"dw3preci1": "0.2693502",
"dw1preci4": "-0.07662612",
"precilag1": "-0.01489565",
"dwlag1": "0.6213925",
"winterpreci": "-0.07753674",
"dwlag3": "-0.3471082",
"springtemp": "1.298059",
"dw3preci3": "0.06238141",
"dw1preci2": "-0.01130325",
"dw1preci3": "0.007980013"
}
}

#### Compare input parameters (diffs) for 2005 week 18 illinois climate div 2 18 Jun 2019

precip-1.83-1.83looks like all are the same
precip_lag_1-1.54-0.15other lags with order of mag diff

• No labels