Public
Edited
May 17, 2023
Insert cell
Insert cell
// equation found on google doc for hours of daylight + solar declination angle
// sources:https://vega.github.io/vega/docs/expressions/#math-functions
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/acos
Insert cell
import {vl} from '@vega/vega-lite-api-v5'
Insert cell
import {uniqueValid} from '@jonfroehlich/data-utilities'
Insert cell
import {printTable} from '@jonfroehlich/data-utilities'
Insert cell
citydata = FileAttachment("cities.csv").csv({typed: true})
Insert cell
latitudeData = FileAttachment("world_country_and_usa_states_latitude_and_longitude_values.csv").csv({typed: true})
Insert cell
vl.data(latitudeData)
//idea is to set the latitude data to a variable, and then take the acos of it, and then plug into the rest of the equation (probably in multiple steps) to get the final value for t
// for the solar declination angle, it would be the same method but with the cities.csv file instead for the data
// the one thing need to figure out is how to set value/values to variable rather than
Insert cell
const angle = Math.acos()
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more