diff --git a/demo/c/README.md b/demo/c/README.md index 7e9bc3c7..5d0fe763 100644 --- a/demo/c/README.md +++ b/demo/c/README.md @@ -2,19 +2,6 @@ --- -### [Moon Phase Calculator](moonphase.c) -This example shows how to determine the Moon's current phase, -and how to predict when the next few quarter phases will occur. - -### [Body Positions](positions.c) -An example of how to calculate equatorial and horizontal coordinates for all of the major solar system bodies. - -### [Rise/Set](riseset.c) -Shows how to calculate sunrise, sunset, moonrise, and moonset times. - -### [Seasons](seasons.c) -Calculates the equinoxes and solstices for a given calendar year. - ### [Culmination](culminate.c) Finds when the Sun, Moon, and planets reach their highest position in the sky on a given date, as seen by an observer at a specified location on the Earth. @@ -27,6 +14,23 @@ This is a more advanced example. It shows how to use coordinate transforms to find where the ecliptic intersects with an observer's horizon at a given date and time. +### [Lunar Eclipse](lunar_eclipse.c) +Calculates details about the first 10 partial/total lunar eclipses +after the given date and time. + +### [Moon Phase Calculator](moonphase.c) +This example shows how to determine the Moon's current phase, +and how to predict when the next few quarter phases will occur. + +### [Positions](positions.c) +Calculates equatorial and horizontal coordinates of the Sun, Moon, and planets. + +### [Rise/Set](riseset.c) +Shows how to calculate sunrise, sunset, moonrise, and moonset times. + +### [Seasons](seasons.c) +Calculates the equinoxes and solstices for a given calendar year. + --- # [API Reference](../../source/c/) diff --git a/demo/csharp/README.md b/demo/csharp/README.md index d7c4b652..90c83e14 100644 --- a/demo/csharp/README.md +++ b/demo/csharp/README.md @@ -2,19 +2,6 @@ --- -### [Moon Phase Calculator](moonphase/moonphase.cs) -This example shows how to determine the Moon's current phase, -and how to predict when the next few quarter phases will occur. - -### [Body Positions](positions/positions.cs) -An example of how to calculate equatorial and horizontal coordinates for all of the major solar system bodies. - -### [Rise/Set](riseset/riseset.cs) -Shows how to calculate sunrise, sunset, moonrise, and moonset times. - -### [Seasons](seasons/seasons.cs) -Calculates the equinoxes and solstices for a given calendar year. - ### [Culmination](culminate/culminate.cs) Finds when the Sun, Moon, and planets reach their highest position in the sky on a given date, as seen by an observer at a specified location on the Earth. @@ -27,6 +14,23 @@ This is a more advanced example. It shows how to use coordinate transforms to find where the ecliptic intersects with an observer's horizon at a given date and time. +### [Lunar Eclipse](lunar_eclipse/lunar_eclipse.js) +Calculates details about the first 10 partial/total lunar eclipses +after the given date and time. + +### [Moon Phase Calculator](moonphase/moonphase.cs) +This example shows how to determine the Moon's current phase, +and how to predict when the next few quarter phases will occur. + +### [Positions](positions/positions.cs) +Calculates equatorial and horizontal coordinates of the Sun, Moon, and planets. + +### [Rise/Set](riseset/riseset.cs) +Shows how to calculate sunrise, sunset, moonrise, and moonset times. + +### [Seasons](seasons/seasons.cs) +Calculates the equinoxes and solstices for a given calendar year. + --- # [API Reference](../../source/csharp/) diff --git a/demo/csharp/demo.sln b/demo/csharp/demo.sln index cf942cd1..cdbeea1f 100644 --- a/demo/csharp/demo.sln +++ b/demo/csharp/demo.sln @@ -19,6 +19,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "demo_helper", "demo_helper\ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "astronomy", "..\..\source\csharp\astronomy.csproj", "{B5681C91-3FEF-4455-AAA9-15070BDDB9C9}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "lunar_eclipse", "lunar_eclipse\lunar_eclipse.csproj", "{F65EC67F-7BC8-48D8-8D74-B58747B6BA7A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -128,5 +130,17 @@ Global {B5681C91-3FEF-4455-AAA9-15070BDDB9C9}.Release|x64.Build.0 = Release|Any CPU {B5681C91-3FEF-4455-AAA9-15070BDDB9C9}.Release|x86.ActiveCfg = Release|Any CPU {B5681C91-3FEF-4455-AAA9-15070BDDB9C9}.Release|x86.Build.0 = Release|Any CPU + {F65EC67F-7BC8-48D8-8D74-B58747B6BA7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F65EC67F-7BC8-48D8-8D74-B58747B6BA7A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F65EC67F-7BC8-48D8-8D74-B58747B6BA7A}.Debug|x64.ActiveCfg = Debug|Any CPU + {F65EC67F-7BC8-48D8-8D74-B58747B6BA7A}.Debug|x64.Build.0 = Debug|Any CPU + {F65EC67F-7BC8-48D8-8D74-B58747B6BA7A}.Debug|x86.ActiveCfg = Debug|Any CPU + {F65EC67F-7BC8-48D8-8D74-B58747B6BA7A}.Debug|x86.Build.0 = Debug|Any CPU + {F65EC67F-7BC8-48D8-8D74-B58747B6BA7A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F65EC67F-7BC8-48D8-8D74-B58747B6BA7A}.Release|Any CPU.Build.0 = Release|Any CPU + {F65EC67F-7BC8-48D8-8D74-B58747B6BA7A}.Release|x64.ActiveCfg = Release|Any CPU + {F65EC67F-7BC8-48D8-8D74-B58747B6BA7A}.Release|x64.Build.0 = Release|Any CPU + {F65EC67F-7BC8-48D8-8D74-B58747B6BA7A}.Release|x86.ActiveCfg = Release|Any CPU + {F65EC67F-7BC8-48D8-8D74-B58747B6BA7A}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/demo/csharp/lunar_eclipse/lunar_eclipse.cs b/demo/csharp/lunar_eclipse/lunar_eclipse.cs new file mode 100644 index 00000000..f7996f49 --- /dev/null +++ b/demo/csharp/lunar_eclipse/lunar_eclipse.cs @@ -0,0 +1,73 @@ +using System; +using demo_helper; +using CosineKitty; + +namespace lunar_eclipse +{ + class Program + { + static int Main(string[] args) + { + AstroTime time; + switch (args.Length) + { + case 0: + time = new AstroTime(DateTime.Now); + break; + + case 1: + time = DemoHelper.ParseTime("lunar_eclipse", args[0]); + break; + + default: + Console.WriteLine("USAGE: lunar_eclipse [date]"); + return 1; + } + + int count = 0; + LunarEclipseInfo eclipse = Astronomy.SearchLunarEclipse(time); + for(;;) + { + if (eclipse.kind != EclipseKind.Penumbral) + { + PrintEclipse(eclipse); + if (++count == 10) + break; + } + eclipse = Astronomy.NextLunarEclipse(eclipse.center); + } + + return 0; + } + + static void PrintEclipse(LunarEclipseInfo eclipse) + { + // Calculate beginning/ending of different phases + // of an eclipse by subtracting/adding the center time + // with the number of minutes indicated by the "semi-duration" + // fields sd_partial and sd_total. + const double MINUTES_PER_DAY = 24 * 60; + + AstroTime p1 = eclipse.center.AddDays(-eclipse.sd_partial / MINUTES_PER_DAY); + Console.WriteLine("{0} Partial eclipse begins.", p1); + + if (eclipse.sd_total > 0.0) + { + AstroTime t1 = eclipse.center.AddDays(-eclipse.sd_total / MINUTES_PER_DAY); + Console.WriteLine("{0} Total eclipse begins.", t1); + } + + Console.WriteLine("{0} Peak of {1} eclipse.", eclipse.center, eclipse.kind.ToString().ToLowerInvariant()); + + if (eclipse.sd_total > 0.0) + { + AstroTime t2 = eclipse.center.AddDays(+eclipse.sd_total / MINUTES_PER_DAY); + Console.WriteLine("{0} Total eclipse ends.", t2); + } + + AstroTime p2 = eclipse.center.AddDays(+eclipse.sd_partial / MINUTES_PER_DAY); + Console.WriteLine("{0} Partial eclipse ends.", p2); + Console.WriteLine(); + } + } +} diff --git a/demo/csharp/lunar_eclipse/lunar_eclipse.csproj b/demo/csharp/lunar_eclipse/lunar_eclipse.csproj new file mode 100644 index 00000000..40d78a9c --- /dev/null +++ b/demo/csharp/lunar_eclipse/lunar_eclipse.csproj @@ -0,0 +1,14 @@ + + + + + + + + + Exe + netcoreapp2.2 + true + + + diff --git a/demo/csharp/test/.gitignore b/demo/csharp/test/.gitignore index d84be8c9..73426264 100644 --- a/demo/csharp/test/.gitignore +++ b/demo/csharp/test/.gitignore @@ -4,3 +4,4 @@ riseset.txt seasons.txt culminate.txt horizon.txt +lunar_eclipse.txt diff --git a/demo/csharp/test/lunar_eclipse_correct.txt b/demo/csharp/test/lunar_eclipse_correct.txt new file mode 100644 index 00000000..aa3f5f1f --- /dev/null +++ b/demo/csharp/test/lunar_eclipse_correct.txt @@ -0,0 +1,50 @@ +1988-03-03T16:04:42.484Z Partial eclipse begins. +1988-03-03T16:13:29.227Z Peak of partial eclipse. +1988-03-03T16:22:15.970Z Partial eclipse ends. + +1988-08-27T10:07:57.338Z Partial eclipse begins. +1988-08-27T11:05:04.753Z Peak of partial eclipse. +1988-08-27T12:02:12.168Z Partial eclipse ends. + +1989-02-20T13:44:07.827Z Partial eclipse begins. +1989-02-20T14:56:15.430Z Total eclipse begins. +1989-02-20T15:36:04.478Z Peak of total eclipse. +1989-02-20T16:15:53.526Z Total eclipse ends. +1989-02-20T17:28:01.129Z Partial eclipse ends. + +1989-08-17T01:21:19.201Z Partial eclipse begins. +1989-08-17T02:20:31.653Z Total eclipse begins. +1989-08-17T03:08:46.679Z Peak of total eclipse. +1989-08-17T03:57:01.705Z Total eclipse ends. +1989-08-17T04:56:14.157Z Partial eclipse ends. + +1990-02-09T17:29:19.371Z Partial eclipse begins. +1990-02-09T18:50:02.143Z Total eclipse begins. +1990-02-09T19:11:46.639Z Peak of total eclipse. +1990-02-09T19:33:31.135Z Total eclipse ends. +1990-02-09T20:54:13.906Z Partial eclipse ends. + +1990-08-06T12:44:54.290Z Partial eclipse begins. +1990-08-06T14:13:00.287Z Peak of partial eclipse. +1990-08-06T15:41:06.284Z Partial eclipse ends. + +1991-12-21T10:00:27.419Z Partial eclipse begins. +1991-12-21T10:33:39.370Z Peak of partial eclipse. +1991-12-21T11:06:51.320Z Partial eclipse ends. + +1992-06-15T03:27:15.071Z Partial eclipse begins. +1992-06-15T04:57:38.272Z Peak of partial eclipse. +1992-06-15T06:28:01.474Z Partial eclipse ends. + +1992-12-09T21:59:59.280Z Partial eclipse begins. +1992-12-09T23:07:16.402Z Total eclipse begins. +1992-12-09T23:44:42.637Z Peak of total eclipse. +1992-12-10T00:22:08.873Z Total eclipse ends. +1992-12-10T01:29:25.994Z Partial eclipse ends. + +1993-06-04T11:11:48.333Z Partial eclipse begins. +1993-06-04T12:12:49.449Z Total eclipse begins. +1993-06-04T13:01:01.725Z Peak of total eclipse. +1993-06-04T13:49:14.001Z Total eclipse ends. +1993-06-04T14:50:15.117Z Partial eclipse ends. + diff --git a/demo/csharp/test/test b/demo/csharp/test/test index cb4f0234..1798b277 100755 --- a/demo/csharp/test/test +++ b/demo/csharp/test/test @@ -5,7 +5,7 @@ Fail() exit 1 } rm -rf exe -rm -f test/{moonphase,positions,riseset,seasons,culminate,horizon}.txt +rm -f test/{moonphase,positions,riseset,seasons,culminate,horizon,lunar_eclipse}.txt dotnet build --output ${PWD}/exe || Fail "Error building ${PWD}/demo.sln" echo "Testing example: moonphase.cs" @@ -32,5 +32,9 @@ echo "Testing example: horizon.cs" dotnet exe/horizon.dll +25.5 -85.3 2016-12-25T12:30:45Z > test/horizon.txt || Fail "Error testing horizon.cs" diff test/horizon.txt test/horizon_correct.txt || Fail "Error comparing horizon.cs output." +echo "Testing example: lunar_eclipse.cs" +dotnet exe/lunar_eclipse.dll 1988-01-01T00:00:00Z > test/lunar_eclipse.txt || Fail "Error running lunar_eclipse.cs." +diff test/lunar_eclipse.txt test/lunar_eclipse_correct.txt || Fail "Error comparing lunar_eclipse.cs output." + echo "PASS: C# examples" exit 0 diff --git a/demo/nodejs/README.md b/demo/nodejs/README.md index bae82bce..418eb36e 100644 --- a/demo/nodejs/README.md +++ b/demo/nodejs/README.md @@ -2,14 +2,14 @@ The source file [`astronomy.js`](../../source/js/astronomy.js) -works as a Node.js module. Download the file into your project directory. +works as a Node.js module. Download the file into your project directory. Then in your own source file, do this: ```javascript const Astronomy = require('astronomy.js'); ``` -![Vanilla JS](../vanillajs.png) There are no external dependencies! +![Vanilla JS](../vanillajs.png) There are no external dependencies! Astronomy Engine is completely self-contained, and it always will be. (By the way, you can use the same file `astronomy.js` for @@ -17,19 +17,6 @@ Astronomy Engine is completely self-contained, and it always will be. --- -### [Moon Phase Calculator](moonphase.js) -This example shows how to determine the Moon's current phase, -and how to predict when the next few quarter phases will occur. - -### [Planet Positions](positions.js) -Calculates equatorial and horizontal coordinates of the Sun, Moon, and planets. - -### [Rise/Set](riseset.js) -Shows how to calculate sunrise, sunset, moonrise, and moonset times. - -### [Seasons](seasons.js) -Calculates the equinoxes and solstices for a given calendar year. - ### [Culmination](culminate.js) Finds when the Sun, Moon, and planets reach their highest position in the sky on a given date, as seen by an observer at a specified location on the Earth. @@ -42,6 +29,23 @@ This is a more advanced example. It shows how to use coordinate transforms to find where the ecliptic intersects with an observer's horizon at a given date and time. +### [Lunar Eclipse](lunar_eclipse.js) +Calculates details about the first 10 partial/total lunar eclipses +after the given date and time. + +### [Moon Phase Calculator](moonphase.js) +This example shows how to determine the Moon's current phase, +and how to predict when the next few quarter phases will occur. + +### [Positions](positions.js) +Calculates equatorial and horizontal coordinates of the Sun, Moon, and planets. + +### [Rise/Set](riseset.js) +Shows how to calculate sunrise, sunset, moonrise, and moonset times. + +### [Seasons](seasons.js) +Calculates the equinoxes and solstices for a given calendar year. + --- # [API Reference](../../source/js/) diff --git a/demo/nodejs/culminate.js b/demo/nodejs/culminate.js index 23ab16a0..901b9d2e 100644 --- a/demo/nodejs/culminate.js +++ b/demo/nodejs/culminate.js @@ -11,9 +11,9 @@ each body's "hour angle" is 0. Having an hour angle of 0 is another way of saying that the body is - crossing the meridian, the imaginary semicircle in the sky that passes - from due north on the horizon, through the zenith (straight up), - toward due south on the horizon. At this moment the body appears to + crossing the meridian, the imaginary semicircle in the sky that passes + from due north on the horizon, through the zenith (straight up), + toward due south on the horizon. At this moment the body appears to have an azimuth of either 180 degrees (due south) or 0 (due north). To execute, run the command: diff --git a/demo/nodejs/lunar_eclipse.js b/demo/nodejs/lunar_eclipse.js new file mode 100644 index 00000000..0cae3de4 --- /dev/null +++ b/demo/nodejs/lunar_eclipse.js @@ -0,0 +1,79 @@ +/* + lunar_eclipse.js - by Don Cross - 2020-05-17 + + Example Node.js program for Astronomy Engine: + https://github.com/cosinekitty/astronomy + + Searches for the next 10 partial/total lunar eclipses after + the current date, or a date specified on the command line. + + To execute, run the command: + node lunar_eclipse [date] +*/ + +const Astronomy = require('../../source/js/astronomy.js'); + +function Pad(s, w) { + s = s.toFixed(0); + while (s.length < w) { + s = '0' + s; + } + return s; +} + +function FormatDate(t) { + const date = t.date; + var year = Pad(date.getUTCFullYear(), 4); + var month = Pad(1 + date.getUTCMonth(), 2); + var day = Pad(date.getUTCDate(), 2); + var hour = Pad(date.getUTCHours(), 2); + var minute = Pad(date.getUTCMinutes(), 2); + var svalue = date.getUTCSeconds() + (date.getUTCMilliseconds() / 1000); + var second = Pad(Math.round(svalue), 2); + return `${year}-${month}-${day} ${hour}:${minute}:${second} UTC`; +} + +function PrintEclipse(e) { + // Calculate beginning/ending of different phases + // of an eclipse by subtracting/adding the center time + // with the number of minutes indicated by the "semi-duration" + // fields sd_partial and sd_total. + const MINUTES_PER_DAY = 24 * 60; + + const p1 = e.center.AddDays(-e.sd_partial / MINUTES_PER_DAY); + console.log(`${FormatDate(p1)} - Partial eclipse begins.`); + + if (e.sd_total > 0) { + const t1 = e.center.AddDays(-e.sd_total / MINUTES_PER_DAY); + console.log(`${FormatDate(t1)} - Total eclipse begins.`); + } + + console.log(`${FormatDate(e.center)} - Peak of ${e.kind} eclipse.`); + + if (e.sd_total > 0) { + const t2 = e.center.AddDays(+e.sd_total / MINUTES_PER_DAY); + console.log(`${FormatDate(t2)} - Total eclipse ends.`); + } + + const p2 = e.center.AddDays(+e.sd_partial / MINUTES_PER_DAY); + console.log(`${FormatDate(p2)} - Partial eclipse ends.`); + console.log(''); +} + +function Demo() { + const date = (process.argv.length === 3) ? new Date(process.argv[2]) : new Date(); + let count = 0; + let eclipse = Astronomy.SearchLunarEclipse(date); + for(;;) { + if (eclipse.kind !== 'penumbral') { + PrintEclipse(eclipse); + if (++count === 10) { + break; + } + } + eclipse = Astronomy.NextLunarEclipse(eclipse.center); + } +} + +Demo(); +process.exit(0); diff --git a/demo/nodejs/moonphase.js b/demo/nodejs/moonphase.js index 13b7e577..d0626e07 100644 --- a/demo/nodejs/moonphase.js +++ b/demo/nodejs/moonphase.js @@ -36,14 +36,14 @@ function FormatDate(date) { function Demo() { const date = (process.argv.length === 3) ? new Date(process.argv[2]) : new Date(); - // Calculate the Moon's current phase angle, + // Calculate the Moon's current phase angle, // which ranges from 0 to 360 degrees. // 0 degrees = new moon, // 90 degrees = first quarter, // 180 degrees = full moon, // 270 degrees = third quarter. const phase = Astronomy.MoonPhase(date); - console.log(`${FormatDate(date)} : Moon's phase angle = ${phase.toFixed(6)} degrees.`); + console.log(`${FormatDate(date)} : Moon's phase angle = ${phase.toFixed(6)} degrees.`); console.log(''); // Now we predict when the next 10 lunar quarter phases will happen. diff --git a/demo/nodejs/positions.js b/demo/nodejs/positions.js index 223d6363..9509fca1 100644 --- a/demo/nodejs/positions.js +++ b/demo/nodejs/positions.js @@ -9,7 +9,7 @@ location on the Earth. To execute, run the command: - + node positions.js latitude longitude [date] where diff --git a/demo/nodejs/riseset.js b/demo/nodejs/riseset.js index b1514229..856ad32d 100644 --- a/demo/nodejs/riseset.js +++ b/demo/nodejs/riseset.js @@ -32,7 +32,7 @@ function Demo() { DisplayEvent('sunrise', sunrise); DisplayEvent('sunset', sunset); DisplayEvent('moonrise', moonrise); - DisplayEvent('moonset', moonset); + DisplayEvent('moonset', moonset); process.exit(0); } else { console.log('USAGE: node riseset.js latitude longitude [date]'); diff --git a/demo/nodejs/test/.gitignore b/demo/nodejs/test/.gitignore index d84be8c9..73426264 100644 --- a/demo/nodejs/test/.gitignore +++ b/demo/nodejs/test/.gitignore @@ -4,3 +4,4 @@ riseset.txt seasons.txt culminate.txt horizon.txt +lunar_eclipse.txt diff --git a/demo/nodejs/test/lunar_eclipse_correct.txt b/demo/nodejs/test/lunar_eclipse_correct.txt new file mode 100644 index 00000000..551f1a6b --- /dev/null +++ b/demo/nodejs/test/lunar_eclipse_correct.txt @@ -0,0 +1,50 @@ +1988-03-03 16:04:42 UTC - Partial eclipse begins. +1988-03-03 16:13:29 UTC - Peak of partial eclipse. +1988-03-03 16:22:16 UTC - Partial eclipse ends. + +1988-08-27 10:07:57 UTC - Partial eclipse begins. +1988-08-27 11:05:05 UTC - Peak of partial eclipse. +1988-08-27 12:02:12 UTC - Partial eclipse ends. + +1989-02-20 13:44:08 UTC - Partial eclipse begins. +1989-02-20 14:56:15 UTC - Total eclipse begins. +1989-02-20 15:36:04 UTC - Peak of total eclipse. +1989-02-20 16:15:54 UTC - Total eclipse ends. +1989-02-20 17:28:01 UTC - Partial eclipse ends. + +1989-08-17 01:21:19 UTC - Partial eclipse begins. +1989-08-17 02:20:32 UTC - Total eclipse begins. +1989-08-17 03:08:47 UTC - Peak of total eclipse. +1989-08-17 03:57:02 UTC - Total eclipse ends. +1989-08-17 04:56:14 UTC - Partial eclipse ends. + +1990-02-09 17:29:19 UTC - Partial eclipse begins. +1990-02-09 18:50:02 UTC - Total eclipse begins. +1990-02-09 19:11:47 UTC - Peak of total eclipse. +1990-02-09 19:33:31 UTC - Total eclipse ends. +1990-02-09 20:54:14 UTC - Partial eclipse ends. + +1990-08-06 12:44:54 UTC - Partial eclipse begins. +1990-08-06 14:13:00 UTC - Peak of partial eclipse. +1990-08-06 15:41:06 UTC - Partial eclipse ends. + +1991-12-21 10:00:27 UTC - Partial eclipse begins. +1991-12-21 10:33:39 UTC - Peak of partial eclipse. +1991-12-21 11:06:51 UTC - Partial eclipse ends. + +1992-06-15 03:27:15 UTC - Partial eclipse begins. +1992-06-15 04:57:38 UTC - Peak of partial eclipse. +1992-06-15 06:28:01 UTC - Partial eclipse ends. + +1992-12-09 21:59:59 UTC - Partial eclipse begins. +1992-12-09 23:07:16 UTC - Total eclipse begins. +1992-12-09 23:44:43 UTC - Peak of total eclipse. +1992-12-10 00:22:09 UTC - Total eclipse ends. +1992-12-10 01:29:26 UTC - Partial eclipse ends. + +1993-06-04 11:11:48 UTC - Partial eclipse begins. +1993-06-04 12:12:49 UTC - Total eclipse begins. +1993-06-04 13:01:02 UTC - Peak of total eclipse. +1993-06-04 13:49:14 UTC - Total eclipse ends. +1993-06-04 14:50:15 UTC - Partial eclipse ends. + diff --git a/demo/nodejs/test/test b/demo/nodejs/test/test index 20ba03b0..0f1f09de 100755 --- a/demo/nodejs/test/test +++ b/demo/nodejs/test/test @@ -29,5 +29,9 @@ echo "Testing example: horizon.js" node horizon +25.5 -85.3 2016-12-25T12:30:45Z > test/horizon.txt || Fail "Error running horizon.js." diff test/horizon.txt test/horizon_correct.txt || Fail "Error comparing horizon.js output." +echo "Testing example: lunar_eclipse.js" +node lunar_eclipse.js 1988-01-01 > test/lunar_eclipse.txt || Fail "Error running lunar_eclipse.js." +diff test/lunar_eclipse.txt test/lunar_eclipse_correct.txt || Fail "Error comparing lunar_eclipse.js output." + echo "PASS: nodejs examples" exit 0 diff --git a/demo/python/README.md b/demo/python/README.md index 0e885cf4..3d68b127 100644 --- a/demo/python/README.md +++ b/demo/python/README.md @@ -2,19 +2,6 @@ --- -### [Moon Phase Calculator](moonphase.py) -This example shows how to determine the Moon's current phase, -and how to predict when the next few quarter phases will occur. - -### [Body Positions](positions.py) -An example of how to calculate equatorial and horizontal coordinates for all of the major solar system bodies. - -### [Rise/Set](riseset.py) -Shows how to calculate sunrise, sunset, moonrise, and moonset times. - -### [Seasons](seasons.py) -Calculates the equinoxes and solstices for a given calendar year. - ### [Culmination](culminate.py) Finds when the Sun, Moon, and planets reach their highest position in the sky on a given date, as seen by an observer at a specified location on the Earth. @@ -27,6 +14,23 @@ This is a more advanced example. It shows how to use coordinate transforms to find where the ecliptic intersects with an observer's horizon at a given date and time. +### [Lunar Eclipse](lunar_eclipse.py) +Calculates details about the first 10 partial/total lunar eclipses +after the given date and time. + +### [Moon Phase Calculator](moonphase.py) +This example shows how to determine the Moon's current phase, +and how to predict when the next few quarter phases will occur. + +### [Positions](positions.py) +Calculates equatorial and horizontal coordinates of the Sun, Moon, and planets. + +### [Rise/Set](riseset.py) +Shows how to calculate sunrise, sunset, moonrise, and moonset times. + +### [Seasons](seasons.py) +Calculates the equinoxes and solstices for a given calendar year. + --- # [API Reference](../../source/python/)