tle2文件转czml文件
This commit is contained in:
18
node_modules/julian/.npmignore
generated
vendored
Normal file
18
node_modules/julian/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
# Created by http://gitignore.io
|
||||
|
||||
### Node ###
|
||||
lib-cov
|
||||
*.seed
|
||||
*.log
|
||||
*.csv
|
||||
*.dat
|
||||
*.out
|
||||
*.pid
|
||||
*.gz
|
||||
|
||||
pids
|
||||
logs
|
||||
results
|
||||
|
||||
npm-debug.log
|
||||
node_modules
|
||||
76
node_modules/julian/README.md
generated
vendored
Normal file
76
node_modules/julian/README.md
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
# julian
|
||||
|
||||
Convert between JavaScript's [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) object and [Julian dates](http://en.wikipedia.org/wiki/Julian_day) used in astronomy and history.
|
||||
|
||||
## usage
|
||||
|
||||
```javascript
|
||||
var julian = require('julian');
|
||||
|
||||
var now = new Date(); // Let's say it's Thu, 21 Nov 2013 10:47:02 GMT
|
||||
var jd = '';
|
||||
|
||||
console.log(jd = julian(now)); // -> '2456617.949335'
|
||||
console.log(julian.toDate(jd)); // -> Timestamp above in local TZ
|
||||
```
|
||||
|
||||
## api
|
||||
|
||||
### julian(date)
|
||||
|
||||
Convert a `Date` into a string representing Julian Date.
|
||||
|
||||
### julian.toDate(jd)
|
||||
|
||||
Convert a Julian Date to a javascript `Date`.
|
||||
|
||||
### julian.toJulianDay(date)
|
||||
|
||||
return a javascript `Date` or `timestamp` to the julian day.
|
||||
An integer day is returned.
|
||||
|
||||
### julian.toMillisecondsInJulianDay (date)
|
||||
|
||||
returns the number of milliseconds since the start of
|
||||
the julian day. Note, the julian day starts at noon,
|
||||
not at midnight. This seems strange, if you don't have
|
||||
an accurate clock, then finding noon accurately is easy
|
||||
(from the sun) but finding midnight is not easy. Julian
|
||||
days have been used by astronomers since before accurate clocks.
|
||||
|
||||
### julian.fromJulianDayAndMilliseconds(day, ms)
|
||||
|
||||
Converts a julian day and ms back to a javascript timestamp.
|
||||
Also, note that this is reversable with out floating point errors.
|
||||
|
||||
``` js
|
||||
var date = Date.now()
|
||||
|
||||
assert.equal(
|
||||
julian.fromJulianDayAndMilliseconds(
|
||||
julian.toJulianDay(date),
|
||||
julian.toMillisecondsInJulianDay(date)
|
||||
),
|
||||
date
|
||||
)
|
||||
```
|
||||
|
||||
## notice
|
||||
|
||||
Date systems are a mess. Leap years, leap seconds, epochs, different calendars using the same nomenclature, different countries using different calendars at the same time, etc.
|
||||
|
||||
This library doesn't even try to cope with all that shit.
|
||||
|
||||
If you want to display calendar dates in format appropriate for a given culture at a given time in history - well, first of all, good luck to you. For example, the [*October* Revolution](http://en.wikipedia.org/wiki/October_Revolution) took place in what most of us now call *November*. That's because in Tsar's Russia they still used obsolete Julian calendar until bolsheviks finally adopted Gregorian. Hey thanks, Lenin!
|
||||
|
||||
Luckily for historians and astronomers, they can just say the revolution began on 2421540 Julian Day, and that's the whole point. You don't mess with naming days, you just count them. Day 0 would be *1 January 4713 BC*. Or is that *27 Nov 4714 BC*? Fuck.
|
||||
|
||||
## license
|
||||
|
||||
MIT
|
||||
|
||||
## author
|
||||
|
||||
Stepan Stolyarov <stepan.stolyarov@gmail.com>
|
||||
|
||||
|
||||
31
node_modules/julian/index.js
generated
vendored
Normal file
31
node_modules/julian/index.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
module.exports = convert;
|
||||
module.exports.toDate = convertToDate;
|
||||
|
||||
module.exports.toJulianDay = toJulianDay;
|
||||
module.exports.toMillisecondsInJulianDay = toMillisecondsInJulianDay;
|
||||
module.exports.fromJulianDayAndMilliseconds = fromJulianDayAndMilliseconds;
|
||||
|
||||
var DAY = 86400000;
|
||||
var HALF_DAY = DAY / 2;
|
||||
var UNIX_EPOCH_JULIAN_DATE = 2440587.5;
|
||||
var UNIX_EPOCH_JULIAN_DAY = 2440587;
|
||||
|
||||
function convert(date) {
|
||||
return (toJulianDay(date) + (toMillisecondsInJulianDay(date) / DAY)).toFixed(6);
|
||||
};
|
||||
|
||||
function convertToDate(julian) {
|
||||
return new Date((Number(julian) - UNIX_EPOCH_JULIAN_DATE) * DAY);
|
||||
};
|
||||
|
||||
function toJulianDay(date) {
|
||||
return ~~((+date + HALF_DAY) / DAY) + UNIX_EPOCH_JULIAN_DAY;
|
||||
};
|
||||
|
||||
function toMillisecondsInJulianDay(date) {
|
||||
return (+date + HALF_DAY) % DAY;
|
||||
};
|
||||
|
||||
function fromJulianDayAndMilliseconds(day, ms) {
|
||||
return (day - UNIX_EPOCH_JULIAN_DATE) * DAY + ms;
|
||||
};
|
||||
30
node_modules/julian/package.json
generated
vendored
Normal file
30
node_modules/julian/package.json
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "julian",
|
||||
"version": "0.2.0",
|
||||
"description": "Convert between Date object and Julian dates used in astronomy and history",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "tap test"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/stevebest/julian.git"
|
||||
},
|
||||
"keywords": [
|
||||
"julian",
|
||||
"date",
|
||||
"conversion",
|
||||
"epoch",
|
||||
"time",
|
||||
"calendar",
|
||||
"astronomy"
|
||||
],
|
||||
"author": "Stepan Stolyarov <stepan.stolyarov@gmail.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/stevebest/julian-date/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tap": "^10.3.0"
|
||||
}
|
||||
}
|
||||
73
node_modules/julian/test/test.js
generated
vendored
Normal file
73
node_modules/julian/test/test.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
var test = require('tap').test;
|
||||
|
||||
var julian = require('..');
|
||||
|
||||
test('from Date to JD', function (t) {
|
||||
t.equal(julian(new Date(0)), '2440587.500000', 'unix epoch');
|
||||
t.equal(julian(new Date('2000-01-01T12:00:00.000Z')), '2451545.000000', 'noon of Jan 1, 2000');
|
||||
|
||||
t.equal(julian(new Date('2013-01-01T00:30:00.000Z')), '2456293.520833');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('from JD to Date', function (t) {
|
||||
t.equal(+julian.toDate('2440587.500000'), +new Date(0), 'unix epoch');
|
||||
t.equal(+julian.toDate('2451545.000000'), +new Date('2000-01-01T12:00:00.000Z'), 'noon of Jan 1, 2000');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('convert back and forth without floating point errors', function (t) {
|
||||
var now = new Date();
|
||||
|
||||
t.equal(+
|
||||
julian.fromJulianDayAndMilliseconds(
|
||||
julian.toJulianDay(now),
|
||||
julian.toMillisecondsInJulianDay(now)
|
||||
),
|
||||
+now,
|
||||
'now is converted to julian and back safely'
|
||||
);
|
||||
|
||||
t.equal(
|
||||
julian.toMillisecondsInJulianDay(new Date('2000-01-01T12:00:00.000Z')),
|
||||
0,
|
||||
'the day starts at noon, so noon is zero milliseconds'
|
||||
);
|
||||
|
||||
t.equal(
|
||||
julian.toJulianDay(new Date('1970-01-01T00:00:00.000Z')),
|
||||
2440587,
|
||||
'unix epoch starts on julian day 2440587'
|
||||
);
|
||||
|
||||
t.equal(
|
||||
julian.toMillisecondsInJulianDay(new Date('1970-01-01T00:00:00.000Z')),
|
||||
43200000,
|
||||
'unix epoch starts with half a julian day'
|
||||
);
|
||||
|
||||
t.equal(
|
||||
julian.toJulianDay(new Date('1970-01-01T12:00:00.000Z')),
|
||||
2440588,
|
||||
'first noon in unix epoch starts julian day 2440588'
|
||||
);
|
||||
|
||||
t.equal(
|
||||
julian.toMillisecondsInJulianDay(new Date('1970-01-01T12:00:00.000Z')),
|
||||
0,
|
||||
'unix epoch starts with half a julian day'
|
||||
);
|
||||
|
||||
//the instance in time known as j2000, aka terriestial time
|
||||
t.equal(
|
||||
julian.toJulianDay(new Date('2000-01-01T12:00:00.000Z')),
|
||||
2451545,
|
||||
'toJulianDay is give correct julian day for j2000 epoch'
|
||||
);
|
||||
// test data taken from https://en.wikipedia.org/wiki/Epoch_(astronomy)#Julian_years_and_J2000
|
||||
|
||||
t.end();
|
||||
|
||||
});
|
||||
1746
node_modules/julian/yarn.lock
generated
vendored
Normal file
1746
node_modules/julian/yarn.lock
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user