Skip to content

Instantly share code, notes, and snippets.

@Didgeridrew
Created July 5, 2024 20:13
Show Gist options
  • Save Didgeridrew/a90136e5faa6dd59661cd8d3bfb5d880 to your computer and use it in GitHub Desktop.
Save Didgeridrew/a90136e5faa6dd59661cd8d3bfb5d880 to your computer and use it in GitHub Desktop.
HA - LUT w/ MAcro for alexamend shade predictor
{% set y_day_azi = {
1:
{"north": none,
"east": none,
"south": [126,207],
"west": [202,232]},
13:
{"north": none,
"east": none,
"south": [123,207],
"west": [202,236]},
104:
{"north": [78,106],
"east": [74,128],
"south": [74,207],
"west": [202,285]},
117:
{"north": [70,106],
"east": [66,128],
"south": [66,207],
"west": [202,294]},
130:
{"north": [67,106],
"east": [63,128],
"south": [63,207],
"west": [202,297]},
143:
{"north": [61,106],
"east": [57,128],
"south": [57,207],
"west": [202,300]},
168:
{"north": [55,106],
"east": [51,128],
"south": [51,207],
"west": [202,308]},
312:
{"north": none,
"east": [120,128],
"south": [124,207],
"west": [202,239]},
325:
{"north": none,
"east": [124,128],
"south": [124,207],
"west": [202,234]},
338:
{"north": none,
"east": none,
"south": [127,207],
"west": [202,232]},
351:
{"north": none,
"east": none,
"south": [126,207],
"west": [202,232]},
} %}
{% macro directional_azi(direction, current_azimuth) %}
{% set yd = now().timetuple().tm_yday %}
{% set keys = y_day_azi.keys() | sort | list %}
{% if yd in keys %}
{% set dir_dict = y_day_azi.get(yd) %}
{% else %}
{% set start_ind = ((keys + [yd]) | sort).index(yd) - 1 %}
{% set dir_dict = y_day_azi.get(keys[start_ind]) %}
{% endif %}
{% set dir_list = dir_dict.get(direction) %}
{{ false if dir_list is none else
dir_list[0] < current_azimuth|int <= dir_list[1] }}
{% endmacro %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment