---
title: "Sunsets đđ"
order: 4
#author:
# - name: "Declan Naughton đ§Žđ¨âđģ"
# url: "https://calcwithdec.dev/about.html"
#description: "Sunsets đ over Cave Hill"
format:
html:
echo: false
---
<details><summary>coordinates (default Cave Hill)</summary>
```{ojs}
//viewof point = worldMapCoordinates([-5.9537511, 54.647343]) // cave hill
viewof point = location({value: [-5.9537511, 54.647343], label: "Co-ords"})
```
</details>
```{ojs}
title = d3.timeFormat('%B')(d)
embed(calcuvizspec({
models: [main],
input_cursors: [{
lat_in:point[1], lng_in:point[0], obj_in:'sun',
}],
mark: {type:'point',size:2000,filled:true,tooltip:true, clip},
encodings: {
y: {grid: false,name: 'altitude_obj', type:'quantitative', scale: {zero: false, domain: [0,1]}},
x: {grid:false,name: 'azimuth_obj', type: 'quantitative', scale: {zero: false, domain: [0,2]}},
color: {name: 'date_in', sort:'ascending', type: 'quantitative', legend:true, domain:
d3.timeHour.range(
new Date(d).setHours(clip2 ? 13 : 0),
new Date(d).setHours(clip2? 22 : 24),
1
),}//_.range(-60,24*60,30).map(d => date_fns.addMinutes(new Date(date_in), d))},
// row: additional months ..?
},
width:500 * (clip ? 1 : 0.5),
height:400 * (clip ? 1 : 0.5),
spec_post_process: s => { s.encoding.color.timeUnit = 'hours'; s.title = title; s.titleFontSize = 40;
s.encoding.color.scale = {"scheme": "lightmulti"}; return s }
}), {actions:true, config: {view: {fill:'#fdfaff'}}})
```
<details><summary>controls đšī¸</summary>
```{ojs}
actions = true
viewof clip = Inputs.toggle({label: "clip", value: true})
viewof clip2 = Inputs.toggle({label: "clip2", value: true})
import { location } from "@roelandschoukens/inputs"
viewof date_in = Inputs.date({label: "start date", value: new Date(2023,8,20,18,0,0)})
md`**offset days:**`
//viewof offset = Inputs.range([0,365], {value:0, label:'offset', step:1})
offset = i
d = date_fns.addDays(date_in, offset)
viewof i = Scrubber(_.range(0,365,fast? 2 :1), {autoplay: false, delay:fast ? 3 : 60, label:'offset'})
viewof fast = Inputs.toggle({label:'fast', value:false})
```
</details>
```{ojs}
import { calcuvizspec, calcudata } from "@declann/little-calcu-helpers"
embed = require('vega-embed');
import {Scrubber} from "@mbostock/scrubber"
date_fns = import("https://cdn.skypack.dev/date-fns@2.30.0")
main = require('https://calcy-quarty-vizys-online.pages.dev/models/heavens/sunsets.js')
introspection_fetch = await fetch(`https://calcy-quarty-vizys-online.pages.dev/models/heavens/sunsets.introspection.json`)
introspection = introspection_fetch.json({typed:true})
introspection_nomemo_fetch = await fetch(`https://calcy-quarty-vizys-online.pages.dev/models/heavens/sunsets-nomemo.introspection.json`)
introspection_nomemo = introspection_nomemo_fetch.json({typed:true})
inputs = Object.values(introspection.cul_functions).filter(d => d.reason == 'input definition').map(d => d.name).sort()
formulae = Object.values(introspection.cul_functions).filter(d => d.reason == 'definition').map(d => d.name)
// formulae excluding pure inputs
formulae_not_inputs = Object.values(introspection.cul_functions).filter(d => d.reason == 'definition' && inputs.indexOf(d.name+'_in') == -1).map(d => d.name)
```