SELECT `justfunctions.eu.find_moon_illumination__`("2090-01-16")
/*--Output--
99.17
*/
CREATE OR REPLACE FUNCTION `your_project_id.your_dataset_id.find_moon_illumination__`(`date_string` STRING) RETURNS FLOAT64
LANGUAGE js AS r'''var phase = Astronomy.MoonPhase(date_string);
let illum = Astronomy.Illumination(Astronomy.Body.Moon, date_string);
return (illum.phase_fraction * 100).toFixed(2)
''' OPTIONS ( description = '''Helper function for find_moon_illumination, using a <date_string>.''' , library = [ "gs://justfunctions/bigquery-functions/astronomy.js" ] )
JavaScript User Defined Function (JavaScript UDF)
See something wrong? Contact us or report an issue on Github.