Skip to content

Commit 8b6c9cc

Browse files
authored
Merge pull request #2 from gkjohnson/v2-rework
Version 2.0 Rework
2 parents c9118b3 + d3fb0af commit 8b6c9cc

24 files changed

+10902
-2314
lines changed

.editorconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
charset = utf-8
6+
trim_trailing_whitespace = true
7+
insert_final_newline = true
8+
indent_style = space
9+
indent_size = 4
10+
insert_final_newline = true

.gitignore

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
9+
# Diagnostic reports (https://nodejs.org/api/report.html)
10+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11+
12+
# Runtime data
13+
pids
14+
*.pid
15+
*.seed
16+
*.pid.lock
17+
18+
# Directory for instrumented libs generated by jscoverage/JSCover
19+
lib-cov
20+
21+
# Coverage directory used by tools like istanbul
22+
coverage
23+
*.lcov
24+
25+
# nyc test coverage
26+
.nyc_output
27+
28+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29+
.grunt
30+
31+
# Bower dependency directory (https://bower.io/)
32+
bower_components
33+
34+
# node-waf configuration
35+
.lock-wscript
36+
37+
# Compiled binary addons (https://nodejs.org/api/addons.html)
38+
build/Release
39+
40+
# Dependency directories
41+
node_modules/
42+
jspm_packages/
43+
44+
# Snowpack dependency directory (https://snowpack.dev/)
45+
web_modules/
46+
47+
# TypeScript cache
48+
*.tsbuildinfo
49+
50+
# Optional npm cache directory
51+
.npm
52+
53+
# Optional eslint cache
54+
.eslintcache
55+
56+
# Microbundle cache
57+
.rpt2_cache/
58+
.rts2_cache_cjs/
59+
.rts2_cache_es/
60+
.rts2_cache_umd/
61+
62+
# Optional REPL history
63+
.node_repl_history
64+
65+
# Output of 'npm pack'
66+
*.tgz
67+
68+
# Yarn Integrity file
69+
.yarn-integrity
70+
71+
# dotenv environment variables file
72+
.env
73+
.env.test
74+
75+
# parcel-bundler cache (https://parceljs.org/)
76+
.cache
77+
.parcel-cache
78+
79+
# Next.js build output
80+
.next
81+
out
82+
83+
# Nuxt.js build / generate output
84+
.nuxt
85+
dist
86+
87+
# Gatsby files
88+
.cache/
89+
# Comment in the public line in if your project uses Gatsby and not Next.js
90+
# https://nextjs.org/blog/next-9-1#public-directory-support
91+
# public
92+
93+
# vuepress build output
94+
.vuepress/dist
95+
96+
# Serverless directories
97+
.serverless/
98+
99+
# FuseBox cache
100+
.fusebox/
101+
102+
# DynamoDB Local files
103+
.dynamodb/
104+
105+
# TernJS port file
106+
.tern-port
107+
108+
# Stores VSCode versions used for testing VSCode extensions
109+
.vscode-test
110+
111+
# yarn v2
112+
.yarn/cache
113+
.yarn/unplugged
114+
.yarn/build-state.yml
115+
.yarn/install-state.gz
116+
.pnp.*
117+
118+
example/bundle

example-timecraftjs.html

Lines changed: 0 additions & 18 deletions
This file was deleted.

example/index.html

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<html>
2+
<head>
3+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
4+
<meta charset="utf-8"/>
5+
6+
<title>Timecraft Time Conversion</title>
7+
8+
<style>
9+
html, body {
10+
box-sizing: border-box;
11+
margin: 0;
12+
padding: 0;
13+
}
14+
15+
body {
16+
display: flex;
17+
flex-direction: column;
18+
height: 100vh;
19+
background: #ECEFF1;
20+
}
21+
22+
.flex-padding {
23+
flex: 1;
24+
}
25+
26+
#output {
27+
font-family: 'Roboto', 'Helvetica', Arial, sans-serif;
28+
font-weight: 300;
29+
width: 500px;
30+
margin: auto;
31+
font-size: 30px;
32+
color: #37474F;
33+
padding: 15px;
34+
}
35+
36+
#output > div {
37+
margin: 20px 0;
38+
}
39+
40+
#output > div::before {
41+
content: attr(name);
42+
/* font-weight: 400; */
43+
display: block;
44+
font-size: 20px;
45+
/* opacity: 0.4; */
46+
color: #E57373;
47+
}
48+
</style>
49+
</head>
50+
<body>
51+
<div class="flex-padding"></div>
52+
<div id="output">
53+
<div name="utc">--</div>
54+
<div name="et">--</div>
55+
<div name="mars lst">--</div>
56+
<div name="msl lmst">--</div>
57+
<div name="msl sclk">--</div>
58+
<div name="msl sun direction">--</div>
59+
</div>
60+
<div class="flex-padding"></div>
61+
62+
<script src="./index.js" type="module"></script>
63+
</body>
64+
</html>

example/index.js

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import * as Timecraft from '../src/index.js';
2+
window.Timecraft = Timecraft;
3+
4+
( async function() {
5+
6+
const buffers = await Promise.all([
7+
// kernels from
8+
// https://naif.jpl.nasa.gov/pub/naif/pds/data/msl-m-spice-6-v1.0/mslsp_1000/extras/mk/msl_chronos_v07.tm
9+
'../kernels/lsk/naif0012.tls',
10+
'../kernels/spk/de425s.bsp',
11+
12+
// '../kernels/sclk/msl_76_sclkscet_00016.tsc',
13+
'../kernels/sclk/msl_lmst_ops120808_v1.tsc',
14+
15+
'../kernels/pck/pck00008.tpc',
16+
17+
// '../kernels/spk/msl_cruise_v1.bsp',
18+
// '../kernels/spk/msl_edl_v01.bsp',
19+
'../kernels/spk/msl_ls_ops120808_iau2000_v1.bsp',
20+
'../kernels/spk/msl_atls_ops120808_v1.bsp',
21+
22+
'../kernels/fk/msl_v08.tf',
23+
].map( p => fetch( p ).then( res => res.arrayBuffer() ) ) );
24+
25+
buffers.forEach( buffer => {
26+
27+
Timecraft.loadKernelFromBuffer( buffer );
28+
29+
} );
30+
31+
const utcEl = document.querySelector('[name="utc"]');
32+
const etEl = document.querySelector('[name="et"]');
33+
const lstEl = document.querySelector('[name="mars lst"]');
34+
const lmstEl = document.querySelector('[name="msl lmst"]');
35+
const sclkEl = document.querySelector('[name="msl sclk"]');
36+
const sunEl = document.querySelector('[name="msl sun direction"]');
37+
38+
setInterval(() => {
39+
40+
let utc = new Date().toISOString();
41+
utc = utc.slice(0, utc.length - 1);
42+
43+
const et = Timecraft.Spice.utc2et(utc);
44+
45+
const lst = Timecraft.Spice.et2lst(et, 499, 0, 'planetocentric');
46+
47+
const lmst = Timecraft.Spice.sce2s(-76900, et);
48+
49+
const sclk = Timecraft.Spice.sce2c(-76900, et);
50+
51+
const sunPos = Timecraft.Spice.spkpos('SUN', et, 'MSL_TOPO', 'LT+S', '-76').ptarg;
52+
let sunDir = sunPos.map(e => e / sunPos[0]);
53+
let sunLen = Math.sqrt(sunDir[0]**2 + sunDir[1]**2 + sunDir[2]**2);
54+
sunDir[0] /= sunLen;
55+
sunDir[1] /= sunLen;
56+
sunDir[2] /= sunLen;
57+
58+
utcEl.childNodes[0].textContent = utc;
59+
etEl.childNodes[0].textContent = et;
60+
lstEl.childNodes[0].textContent = lst.time;
61+
lmstEl.childNodes[0].textContent = lmst;
62+
sclkEl.childNodes[0].textContent = sclk;
63+
sunEl.childNodes[0].textContent = `${sunDir[0].toFixed(4)}, ${sunDir[1].toFixed(4)}, ${sunDir[2].toFixed(4)}`;
64+
65+
}, 100);
66+
67+
} )();

example_kernel_list.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

gulpfile.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

kernel_setup.py

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)