s2-tools
Version:
A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.
110 lines • 4.16 kB
TypeScript
/** Time object to track month-day-hour-minute-second */
export interface TimeStamp {
mon: number;
day: number;
hr: number;
minute: number;
sec: number;
}
/**
* -----------------------------------------------------------------------------
*
* procedure days2mdhms
*
* this procedure converts the day of the year, days, to the equivalent month
* day, hour, minute and second.
*
* algorithm : set up array for the number of days per month
* find leap year - use 1900 because 2000 is a leap year
* loop through a temp value while the value is < the days
* perform int conversions to the correct day and month
* convert remainder into h m s using type conversions
*
* author : david vallado 719-573-2600 1 mar 2001
*
* inputs description range / units
* year - year 1900 .. 2100
* days - julian day of the year 0.0 .. 366.0
*
* outputs :
* mon - month 1 .. 12
* day - day 1 .. 28,29,30,31
* hr - hour 0 .. 23
* min - minute 0 .. 59
* sec - second 0.0 .. 59.999
*
* locals :
* dayofyr - day of year
* temp - temporary extended values
* inttemp - temporary int value
* i - index
* lmonth[12] - int array containing the number of days per month
*
* coupling :
* none.
* @param year - year to date
* @param days - day of year
* @returns - Decomposed information into year, month, day, hour, minute and second
*/
export declare function days2mdhms(year: number, days: number): TimeStamp;
/**
* Builds a julian date from the given parameters
* @param year - year
* @param mon - month
* @param day - day
* @param hr - hour
* @param min - minute
* @param sec - seconds
* @param msec - milliseconds
* @returns - Julian date
*/
export declare function jday(year: number | Date, mon?: number, day?: number, hr?: number, min?: number, sec?: number, msec?: number): number;
/**
* procedure invjday
*
* this procedure finds the year, month, day, hour, minute and second
* given the julian date. tu can be ut1, tdt, tdb, etc.
*
* algorithm : set up starting values
* find leap year - use 1900 because 2000 is a leap year
* find the elapsed days through the year in a loop
* call routine to find each individual value
*
* author : david vallado 719-573-2600 1 mar 2001
*
* inputs description range / units
* jd - julian date days from 4713 bc
*
* outputs :
* year - year 1900 .. 2100
* mon - month 1 .. 12
* day - day 1 .. 28,29,30,31
* hr - hour 0 .. 23
* min - minute 0 .. 59
* sec - second 0.0 .. 59.999
*
* locals :
* days - day of year plus fractional
* portion of a day days
* tu - julian centuries from 0 h
* jan 0, 1900
* temp - temporary double values
* leapyrs - number of leap years from 1900
*
* coupling :
* days2mdhms - finds month, day, hour, minute and second given days and year
*
* references :
* vallado 2007, 208, alg 22, ex 3-13
* @param jd - julian date
* @param asArray - if true, return an array, otherwise return a Date
* @returns - Date or [year, month, day, hour, minute, seconds]
*/
export declare function invjday(jd: number, asArray: boolean): Date | [number, number, number, number, number, number];
/**
* find greenwich sidereal time
* @param time - julian date
* @returns - greenwich sidereal time
*/
export declare function gstime(time: Date | number): number;
//# sourceMappingURL=time.d.ts.map