summaryrefslogtreecommitdiffstats
path: root/org/madore/ephem/Smart97.java
diff options
context:
space:
mode:
Diffstat (limited to 'org/madore/ephem/Smart97.java')
-rw-r--r--org/madore/ephem/Smart97.java65
1 files changed, 65 insertions, 0 deletions
diff --git a/org/madore/ephem/Smart97.java b/org/madore/ephem/Smart97.java
new file mode 100644
index 0000000..21345bf
--- /dev/null
+++ b/org/madore/ephem/Smart97.java
@@ -0,0 +1,65 @@
+package org.madore.ephem;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.EnumMap;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.BufferedReader;
+
+public final class Smart97 {
+
+ public static enum Variable {
+ PSI("psi"), OMEGA("omega"), PHI("phi"),
+ P("p"), EPSILON("epsilon"), CHI("chi"), SIDTIME("sidtime");
+ final String name;
+ Variable(String name) { this.name = name; }
+ }
+
+ // The argument is in Julian millennia (value is in radians).
+ public static Comput.Polynomial[] lambdas = new Comput.Polynomial[] {
+ new Comput.Polynomial(4.40260867435, 26088.1469432237), // Mercury
+ new Comput.Polynomial(3.17614652884, 10213.5293478605), // Venus
+ new Comput.Polynomial(1.75347029148, 6283.3196527950), // Earth
+ new Comput.Polynomial(6.20347594486, 3340.8562283493), // Mars
+ new Comput.Polynomial(0.59954632934, 529.9347667441), // Jupiter
+ new Comput.Polynomial(0.87401658845, 213.5428970875), // Saturn
+ new Comput.Polynomial(5.48129370354, 75.0254002168), // Uranus
+ new Comput.Polynomial(5.31188611871, 38.3768372873), // Neptune
+ new Comput.Polynomial(5.19846640063, 77713.7714481804), // Delaunay D
+ new Comput.Polynomial(1.62790513602, 84334.6615717837), // Delaunay F
+ new Comput.Polynomial(2.35555563875, 83286.9142477147), // Delaunay l
+ new Comput.Polynomial(4.89496121282, 2301216.7536515365), // phi
+ };
+
+ private static EnumMap<Variable, Comput.SumPoisson2Terms> data = new EnumMap<Variable, Comput.SumPoisson2Terms>(Variable.class);
+
+ public static Comput.SumPoisson2Terms getFunc(Variable v) {
+ if ( ! data.containsKey(v) ) {
+ List<Comput.Poisson2Term> series = new ArrayList<Comput.Poisson2Term>();
+ try {
+ InputStream str = Smart97.class.getResourceAsStream("smart97.dat");
+ BufferedReader in = new BufferedReader(new InputStreamReader(str, "utf-8"));
+ String s;
+ while ( ( s = in.readLine() ) != null ) {
+ String[] fields = s.split("\t");
+ if ( ! fields[1].equals(v.name) )
+ continue;
+ int deg = Integer.parseInt(fields[2]);
+ String[] subfields = fields[3].split(",");
+ double[] om = new double[12];
+ for ( int j=0 ; j<12 ; j++ )
+ om[j] = Double.parseDouble(subfields[j]);
+ double b = Double.parseDouble(fields[4]);
+ double a = Double.parseDouble(fields[5]);
+ series.add(Comput.Poisson2Term.ab(deg, a, b, om, lambdas));
+ }
+ } catch ( Exception e ) {
+ throw new RuntimeException(e);
+ }
+ data.put(v, new Comput.SumPoisson2Terms(series));
+ }
+ return data.get(v);
+ }
+
+}