-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from observerly/feature/temporal/convertLocalS…
…iderealTimeToGreenwhichSiderealTime feat: Added convertLocalSiderealTimeToGreenwhichSiderealTime() to temporal module in @observerly/astrometry.
- Loading branch information
Showing
2 changed files
with
80 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/*****************************************************************************************************************/ | ||
|
||
// @author Michael Roberts <[email protected]> | ||
// @package @observerly/astrometry/temporal | ||
// @license Copyright © 2021-2023 observerly | ||
|
||
/*****************************************************************************************************************/ | ||
|
||
import { describe, expect, it } from 'vitest' | ||
|
||
/*****************************************************************************************************************/ | ||
|
||
import { | ||
getLocalSiderealTime, | ||
getGreenwhichSiderealTime, | ||
convertLocalSiderealTimeToGreenwhichSiderealTime | ||
} from '../src' | ||
|
||
/*****************************************************************************************************************/ | ||
|
||
// For testing we need to specify a date because most calculations are | ||
// differential w.r.t a time component. We set it to the author's birthday: | ||
export const datetime = new Date('2021-05-14T00:00:00.000+00:00') | ||
|
||
// For testing we will fix the latitude to be Manua Kea, Hawaii, US | ||
export const latitude = 19.820611 | ||
|
||
// For testing we will fix the longitude to be Manua Kea, Hawaii, US: | ||
export const longitude = -155.468094 | ||
|
||
/*****************************************************************************************************************/ | ||
|
||
describe('convertLocalSiderealTimeToGreenwhichSiderealTime', () => { | ||
it('should be defined', () => { | ||
expect(convertLocalSiderealTimeToGreenwhichSiderealTime).toBeDefined() | ||
}) | ||
|
||
it('should return the correct Local Sidereal Time for a given Greenwich Sidereal Time', () => { | ||
const LST = getLocalSiderealTime(datetime, longitude) | ||
const GST = getGreenwhichSiderealTime(datetime) | ||
expect( | ||
convertLocalSiderealTimeToGreenwhichSiderealTime(LST, { latitude, longitude }) | ||
).toBeCloseTo(GST) | ||
}) | ||
}) | ||
|
||
/*****************************************************************************************************************/ |