Compare commits

..

1 Commits

Author SHA1 Message Date
316e6884f4 Add starting point for Arabic lots 2016-09-21 14:10:29 +02:00
122 changed files with 457725 additions and 69 deletions

1
.gitignore vendored
View File

@ -98,7 +98,6 @@ test-suite.log
/data/*.gschema.xml
# Documentation related files
/docs/reference/*/*.actions
/docs/reference/*/*.args
/docs/reference/*/*.hierarchy
/docs/reference/*/*.interfaces

View File

@ -1,7 +1,7 @@
include $(top_srcdir)/swe-glib.mk
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = src po data tests
SUBDIRS = swe swe/src swe/doc src po data tests
if ENABLE_GTK_DOC
SUBDIRS += docs/reference/swe-glib

View File

@ -102,7 +102,7 @@ AS_IF([ test "x$use_gcov" = "xyes"], [
AC_MSG_ERROR([ccache must be disabled when --enable-coverage option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
fi
ltp_version_list="1.6 1.7 1.8 1.9 1.10 1.14"
ltp_version_list="1.6 1.7 1.8 1.9 1.10"
AC_CHECK_PROG(LTP, lcov, lcov)
AC_CHECK_PROG(LTP_GENHTML, genhtml, genhtml)
@ -160,11 +160,17 @@ PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26])
GLIB_GSETTINGS
AC_CONFIG_MACRO_DIR([m4])
LIBSWE_LIBS='$(top_builddir)/swe/src/libswe-$(SWE_VERSION).la'
AC_SUBST(LIBSWE_LIBS)
LIBSWE_GLIB_LIBS='$(top_builddir)/src/libswe-glib-$(SWE_GLIB_API_VERSION).la'
AC_SUBST(LIBSWE_GLIB_LIBS)
AC_CONFIG_FILES([
Makefile
swe/Makefile
swe/src/Makefile
swe/doc/Makefile
src/Makefile
data/Makefile
po/Makefile.in

View File

@ -9,7 +9,79 @@ gsettings_SCHEMAS = eu.polonkai.gergely.swe-glib.gschema.xml
@GSETTINGS_RULES@
swephdir = $(pkgdatadir)
sweph_DATA = \
sweph-data/seas_00.se1 \
sweph-data/seas_06.se1 \
sweph-data/seas_12.se1 \
sweph-data/seas_18.se1 \
sweph-data/seas_24.se1 \
sweph-data/seas_30.se1 \
sweph-data/seas_36.se1 \
sweph-data/seas_42.se1 \
sweph-data/seas_48.se1 \
sweph-data/seasm06.se1 \
sweph-data/seasm12.se1 \
sweph-data/seasm18.se1 \
sweph-data/seasm24.se1 \
sweph-data/seasm30.se1 \
sweph-data/seasm36.se1 \
sweph-data/seasm42.se1 \
sweph-data/seasm48.se1 \
sweph-data/seasm54.se1 \
sweph-data/semo_00.se1 \
sweph-data/semo_06.se1 \
sweph-data/semo_12.se1 \
sweph-data/semo_18.se1 \
sweph-data/semo_24.se1 \
sweph-data/semo_30.se1 \
sweph-data/semo_36.se1 \
sweph-data/semo_42.se1 \
sweph-data/semo_48.se1 \
sweph-data/semom06.se1 \
sweph-data/semom12.se1 \
sweph-data/semom18.se1 \
sweph-data/semom24.se1 \
sweph-data/semom30.se1 \
sweph-data/semom36.se1 \
sweph-data/semom42.se1 \
sweph-data/semom48.se1 \
sweph-data/semom54.se1 \
sweph-data/sepl_00.se1 \
sweph-data/sepl_06.se1 \
sweph-data/sepl_12.se1 \
sweph-data/sepl_18.se1 \
sweph-data/sepl_24.se1 \
sweph-data/sepl_30.se1 \
sweph-data/sepl_36.se1 \
sweph-data/sepl_42.se1 \
sweph-data/sepl_48.se1 \
sweph-data/seplm06.se1 \
sweph-data/seplm12.se1 \
sweph-data/seplm18.se1 \
sweph-data/seplm24.se1 \
sweph-data/seplm30.se1 \
sweph-data/seplm36.se1 \
sweph-data/seplm42.se1 \
sweph-data/seplm48.se1 \
sweph-data/seplm54.se1 \
sweph-data/seleapsec.txt \
sweph-data/s136199.se1 \
sweph-data/s136199s.se1 \
sweph-data/se00010s.se1 \
sweph-data/se00034s.se1 \
sweph-data/se00157s.se1 \
sweph-data/se07066s.se1 \
sweph-data/se08405s.se1 \
sweph-data/se10199s.se1 \
sweph-data/se90377.se1 \
sweph-data/se90377s.se1 \
sweph-data/se90482.se1 \
sweph-data/se90482s.se1 \
$(NULL)
EXTRA_DIST = \
$(sweph_DATA) \
swe-glib.spec \
gschema.template

312
data/lots.py Normal file
View File

@ -0,0 +1,312 @@
# -*- coding: utf8
import re
import logging
from collections import OrderedDict
def get_planet_name(planet):
if planet == 'ASC':
return 'ASCENDANT'
if planet == 'S. Node':
return 'MOON_SOUTH_NODE'
if planet.upper() in known_planets:
return planet.upper()
return None
def get_planet_def(planet):
PLANET_NAME = 0
CUSP = 1
RULER = 2
SIGN = 3
SIGN_DEGREE = 4
SIGN_MINUTE = 5
HOUSE_RULER = 6
ARABIC_LOT = 7
PLANET_HOUSE_RULER = 8
planet_def = [
get_planet_name(planet), # 0, PLANET_NAME
0, # 1, CUSP
None, # 2, RULER
None, # 3, SIGN
0, # 4, SIGN_DEGREE
0, # 5, SIGN_MINUTE
0, # 6, HOUSE_RULER
None, # 7, ARABIC_LOT
None, # 8, PLANET_HOUSE_RULER
]
sign_match = re.match(r'^(\d{2})([A-Z]{2})(\d{2})$', planet)
if planet_def[PLANET_NAME] is None:
if planet.startswith('Ruler of ') and \
get_planet_name(planet[9:]) is not None:
planet_def[RULER] = get_planet_name(planet[9:])
elif planet.startswith('Ruler '):
m1 = re.match(r'Ruler (\d+)(st|nd|rd|th)', planet)
m2 = re.match(r"Ruler (\w+)'s house", planet)
if m1 is not None:
planet_def[HOUSE_RULER] = int(m1.groups()[0])
elif m2 is not None:
planet_def[PLANET_HOUSE_RULER] = get_planet_name(
m2.groups()[0])
if planet_def[PLANET_HOUSE_RULER] is None:
logging.error(
"Error: planet house ruler definition error: {}"
.format(planet))
return None
else:
logging.error(
"Error: House ruler definition problem: {}"
.format(planet))
return None
elif planet.startswith('Cusp '):
m = re.match(r'^Cusp (\d+)(st|nd|rd|th)', planet)
if m is None:
logging.error("Cusp definition problem: {}"
.format(planet))
return None
planet_def[CUSP] = int(m.groups()[0])
elif sign_match is not None:
degree, sign, minute = sign_match.groups()
planet_def[SIGN] = next(s for s in signs if s.startswith(sign))
planet_def[SIGN_DEGREE] = int(degree)
planet_def[SIGN_MINUTE] = int(minute)
elif planet.startswith('PO '):
p_lot = planet[3:]
if not any(x['c_name'] for y, x in lots.items()
if p_lot.upper() == x['c_name']):
logging.error("Error: Unknown lot: {}".format(planet))
return None
planet_def[ARABIC_LOT] = p_lot.upper()
else:
logging.error("Unknown planet definition: {}".format(planet))
return None
planet_def = map(lambda x: 'NONE' if x is None else x, planet_def)
return """
{{
GSWE_PLANET_{name},
{cusp},
GSWE_PLANET_{ruler},
GSWE_SIGN_{sign}, {sign_degree}, {sign_minute},
{house_ruler},
GSWE_ARABIC_LOT_{arabic_lot},
GSWE_PLANET_{planet_house_ruler}
}}""".format(
name=planet_def[PLANET_NAME],
cusp=planet_def[CUSP],
ruler=planet_def[RULER],
sign=planet_def[SIGN],
sign_degree=planet_def[SIGN_DEGREE],
sign_minute=planet_def[SIGN_MINUTE],
house_ruler=planet_def[HOUSE_RULER],
arabic_lot=planet_def[ARABIC_LOT],
planet_house_ruler=planet_def[PLANET_HOUSE_RULER],
)
with open('lots.txt', 'r') as f:
content = map(lambda line: line.strip(), f.readlines())
lots = OrderedDict()
c_names = set()
known_planets = [
'MC',
'VERTEX',
'MOON_NODE',
'MOON_APOGEE',
'SUN',
'MOON',
'MERCURY',
'VENUS',
'EARTH',
'MARS',
'JUPITER',
'SATURN',
'URANUS',
'NEPTUNE',
'PLUTO',
'CHIRON',
'CERES',
'PALLAS',
'JUNO',
'VESTA',
'PHOLUS',
'NESSUS',
'CHARIKLO',
'SEDNA',
'ERIS',
'DEJANIRA',
'CIRCE',
'ORCUS',
'ASBOLUS',
'HYGIEA',
]
signs = [
'ARIES',
'TAURUS',
'GEMINI',
'CANCER',
'LEO',
'VIRGO',
'LIBRA',
'SCORPIO',
'SAGITTARIUS',
'CAPRICORN',
'AQUARIUS',
'PISCES',
]
while content:
line = content.pop(0)
m = re.match('^([^=]+) = (.*)$', line)
if not m:
print("Error in line (no lot name): {}".format(line))
continue
lot_name, line = m.groups()
line = line.strip()
am_pm_rule = False
if re.search('AM.*::.*PM', line):
am_pm_rule = True
line = line.split(' :: ')[0]
s = re.search(' \([AP]M\)$', line)
if s is None:
print("Error in AM/PM line: {}".format(line))
continue
line = line[:-5]
m = re.match('^([^-+]+) ([+-]) ([^-+]+) ([+-]) ([^-+]+)$', line)
if not m:
print("Error in line (doesn't match): {}".format(line))
continue
m = m.groups()
if m[1] != '+' and m[3] != '-':
print("Error in line: {}".format(line))
continue
if lot_name in lots and not am_pm_rule:
print("Lot {} already exists!".format(lot_name))
continue
lot_name_def = re.sub(r'[^A-Z0-9_]', '',
re.sub(r'[ ,]+', '_', lot_name.upper()))
if lot_name_def in c_names:
print("Lot {} already exists in enum!".format(lot_name_def))
lots[lot_name] = {
"c_name": lot_name_def,
"planets": (m[0], m[2], m[4]),
"am_pm": am_pm_rule,
}
enum = '''typedef enum _GsweArabicLot {
GSWE_ARABIC_LOT_NONE,\n'''
defs = '''typedef struct _GsweArabicLotPart {
GswePlanet planet;
guint8 cusp;
GswePlanet ruler;
GsweZodiac fixed_sign;
guint8 fixed_degree;
guint8 fixed_minute;
guint8 house_ruler;
GsweArabicLot arabic_lot;
GswePlanet planet_house_ruler;
} GsweArabicLotPart;
typedef struct _GsweArabicLotRecord {
gchar *name;
gboolean am_pm_rule;
GsweArabicLotPart parts[3];
} GsweArabicLotRecord;
static const GsweArabicLotRecord known_lots[] = {
'''
for idx, (lot_name, lot) in enumerate(lots.items()):
if idx != 0:
enum += ',\n'
defs += '\n'
enum += ' GSWE_ARABIC_LOT_' + lot['c_name']
defs += ' // Record for enum value ' + lot['c_name'] + '''
{
"''' + lot_name + '''",
''' + ("TRUE" if lot['am_pm'] else "FALSE") + ''',
{'''
for pidx, planet in enumerate(lot['planets']):
defs += get_planet_def(planet)
if pidx != 2:
defs += ','
defs += '''\n }
},\n'''
defs += ''' {NULL}
};'''
enum += '\n} GsweArabicLot;'
print("""/* gswe-lots.h - Arabic lot definitions for SWE-GLib
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GSWE_LOTS_H__
#define __GSWE_LOTS_H__
#include "gswe-types.h"
""" + enum + """
""" + defs + """
#endif /* __GSWE_LOTS_H__ */""")

109
data/lots.txt Normal file
View File

@ -0,0 +1,109 @@
Fortune = ASC + Moon - Sun (AM) :: ASC + Sun - Moon (PM)
Ability = ASC + Mars - Ruler of ASC
Abundance = ASC + Sun - Moon
Accident = ASC + Saturn - Mars
Accomplishment = ASC + Sun - Jupiter
Action/Reasoning = ASC + Mars - Mercury
Addiction = ASC + S. Node - Neptune
Administrators = ASC + Mars - Mercury
Agriculture = ASC + Saturn - Venus
Allegiance = ASC + Saturn - Sun
Ancestors/Relations = ASC + Mars - Saturn (AM) :: ASC + Saturn - Mars (PM)
Ancestral Heritage = ASC + Moon - Cusp 8th
Armies = ASC + Saturn - Mars
Art = ASC + Venus - Mercury
Assassination (1) = ASC + Ruler 12th - Neptune
Assassination (2) = Mars + Neptune - Uranus
Assurance = ASC + Jupiter - Mercury
Astrology = ASC + Uranus - Mercury
Bad Luck = ASC + PO Fortune - PO Spirit
Bankruptcy (1) = Jupiter + Neptune - Uranus
Bankruptcy (2) = Jupiter + Jupiter - Uranus
Beauty = ASC + Venus - Sun
Benific Change = ASC + Pluto - Jupiter
Benevolence = ASC + Jupiter - Pluto
Business Partnerships = ASC + Cusp 7th - Ruler 10th
Cancer = ASC + Neptune - Jupiter
Catastrophe (1) = ASC + Uranus - Sun
Catastrophe (2) = ASC + Uranus - Saturn
Caution = ASC + Neptune - Saturn
Children = ASC + Saturn - Jupiter (AM) :: ASC + Jupiter - Saturn (PM)
Commerce (1) = ASC + Mercury - Sun
Commerce (2) = ASC + Mars - Sun
Controversy = ASC + Jupiter - Mars
Corruptness = ASC + Neptune - Venus
Curiosity = ASC + Moon - Mercury
Damage = ASC + Neptune - Venus
Danger, Violence, Debt = ASC + Mercury - Saturn (AM) :: ASC + Saturn - Mercury (PM)
Daughters = ASC + Venus - Moon
Death = ASC + Cusp 8th - Moon
Death (Parents) = ASC + Jupiter - Saturn (AM) :: ASC + Saturn - Jupiter (PM)
Debt = ASC + Mercury - Saturn (AM) :: ASC + Saturn - Mercury (PM)
Desire, Sexual Attraction = ASC + Cusp 5th + Ruler 5th
Destiny = MC + Sun - Moon (AM) :: MC + Mooon - Sun (PM)
Destruction = ASC + Mars - Sun
Disease = ASC + Mars - Mercury
Divorce (1) = ASC + Venus - Cusp 7th
Divorce (2) = ASC + Cusp 7th - Saturn
Eccentricity = ASC + Mercury - Uranus
Energy, Sex Drive = ASC + Pluto - Venus
Expected Birth (1) = ASC + Ruler Moon's house - Moon
Expected Birth (2) = ASC + Venus - Moon
Fame = ASC + Jupiter - Sun (AM) :: ASC + Sun - Jupiter (PM)
Famous Friends = ASC + PO Fortune - Sun
Fascination = ASC + Venus - Uranus
Fate (Karma) = ASC + Saturn - Sun
Father = ASC + Sun - Saturn (AM) :: ASC + Saturn - Sun (PM)
Fraud = ASC + Neptune - Sun
Friends (1) = ASC + Moon - Venus
Friends (2) = ASC + Mercury - Moon
Friends (3) = ASC + Moon - Uranus
Genius = ASC + Sun - Neptune
Grandparents (1) = ASC + Jupiter - Cusp 2nd (AM) :: ASC + Cusp 2nd - Jupiter (PM)
Grandparents (2) = ASC + Saturn - Cusp 2nd (AM) :: ASC + Cusp 2nd - Saturn (PM)
Guidance = ASC + Neptune - Uranus
Happiness = ASC + Uranus - Jupiter
Homosexuality = ASC + Mars - Uranus
Horsemanship = ASC + Moon - Saturn
Identity = ASC + Saturn - Moon
Imprisonment = ASC + Sun - Neptune
Increase = ASC + Jupiter - Sun
Inheritance (1) = ASC + Moon - Saturn
Inheritance (2) = ASC + Jupiter - Venus
Journeys (Air) = ASC + Uranus - Cusp 9th
Journeys (Land) = ASC + Cusp 9th - Ruler 9th
Journeys (Water) = ASC + 15CA00 + Saturn (AM) :: ASC + Saturn - 15CA00 (PM)
Kings, Rulers = ASC + Moon - Mercury
Knowledge = ASC + Moon - Mercury (AM) :: ASC + Mercury - Moon (PM)
Life, Reincarnation = ASC + Saturn - Jupiter (AM) :: ASC + Jupiter - Saturn (PM)
Love = ASC + Venus - Sun
Lovers = Mars + Venus - Cusp 5th
Luck = ASC + Moon - Jupiter
Marriage = ASC + Cusp 7th - Venus
Marriage of Woman (1) = ASC + Saturn - Venus
Marriage of Woman (2) = ASC + Mars - Moon
Marriage of Man (1) = ASC + Venus - Saturn
Marriage of Man (2) = ASC + Venus - Sun
Mother = ASC + Moon - Saturn
Partners = ASC + Cusp 7th - Venus
Peril = ASC + Cusp 8th - Saturn (AM) :: ASC + Saturn - Cusp 8th (PM)
Possessions = ASC + Cusp 2nd - Ruler 2nd
Real Estate (Land) = ASC + Moon - Saturn (AM) :: ASC + Saturn - Moon (PM)
Real Estate (Investment) = ASC + Jupiter - Mercury (AM) :: ASC + Mercury - Jupiter (PM)
Secret Enemies = ASC + Moon - Saturn
Short Journeys = ASC + Cusp 3rd - Ruler 3rd
Siblings = ASC + Saturn - Jupiter
Sickness = ASC + Mars - Saturn
Son-in-Laws = ASC + Venus - Saturn (AM) :: ASC + Saturn - Venus (PM)
Sons = Cusp 4th + Moon - Sun
Spirit = ASC + Sun - Moon (AM) :: ASC + Moon - Sun (PM)
Success = ASC + Jupiter - PO Fortune (AM) :: ASC + PO Fortune - Jupiter (PM)
Success (Investment) = ASC + Venus - Saturn
Suicide (1) = ASC + Cusp 8th - Neptune
Suicide (2) = ASC + Jupiter - Neptune
Surgery = ASC + Saturn - Mars (AM) :: ASC + Mars - Saturn (PM)
Tragedy = ASC + Saturn - Sun
Unusual Events = ASC + Uranus - Moon
Victory = ASC + Jupiter - PO Spirit (AM) :: ASC + PO Spirit - Jupiter (PM)
Weddings, Legal Contracts = Cusp 9th + Cusp 3rd - Venus
Widowhood = ASC + 08LI50 - Neptune

BIN
data/sweph-data/s136199.se1 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
data/sweph-data/se90377.se1 Normal file

Binary file not shown.

Binary file not shown.

BIN
data/sweph-data/se90482.se1 Normal file

Binary file not shown.

Binary file not shown.

BIN
data/sweph-data/seas_00.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seas_06.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seas_12.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seas_18.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seas_24.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seas_30.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seas_36.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seas_42.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seas_48.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seasm06.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seasm12.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seasm18.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seasm24.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seasm30.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seasm36.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seasm42.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seasm48.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seasm54.se1 Normal file

Binary file not shown.

393347
data/sweph-data/seasnam.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,31 @@
# This file contains the dates of leap seconds to be taken into account
# by the Swiss Ephemeris.
# For each new leap second add the date of its insertion in the format
# yyyymmdd, e.g. "20081231" for 21 december 2008
19720630
19721231
19731231
19741231
19751231
19761231
19771231
19781231
19791231
19810630
19820630
19830630
19850630
19871231
19891231
19901231
19920630
19930630
19949630
19951231
19970630
19981231
20051231
20081231
20120630
20150630
20161231

BIN
data/sweph-data/semo_00.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semo_06.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semo_12.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semo_18.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semo_24.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semo_30.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semo_36.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semo_42.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semo_48.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semom06.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semom12.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semom18.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semom24.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semom30.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semom36.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semom42.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semom48.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semom54.se1 Normal file

Binary file not shown.

View File

@ -0,0 +1,76 @@
# Orbital elements of ficticious planets
# 27 Jan. 2000
#
# This file is part of the Swiss Ephemeris, from Version 1.52 on.
#
# Warning! These planets do not exist!
#
# The user can add his or her own elements.
# 960 is the maximum number of ficticious planets.
#
# The elements order is as follows:
# 1. epoch of elements (Julian day)
# 2. equinox (Julian day or "J1900" or "B1950" or "J2000")
# 3. mean anomaly at epoch
# 4. semi-axis
# 5. eccentricity
# 6. argument of perihelion (ang. distance of perihelion from node)
# 7. ascending node
# 8. inclination
# 9. name of planet
#
# use '#' for comments
# to compute a body with swe_calc(), use planet number
# ipl = SE_FICT_OFFSET_1 + number_of_elements_set,
# e.g. number of Kronos is ipl = 39 + 4 = 43
#
# Witte/Sieggruen planets, refined by James Neely
J1900, J1900, 163.7409, 40.99837, 0.00460, 171.4333, 129.8325, 1.0833, Cupido # 1
J1900, J1900, 27.6496, 50.66744, 0.00245, 148.1796, 161.3339, 1.0500, Hades # 2
J1900, J1900, 165.1232, 59.21436, 0.00120, 299.0440, 0.0000, 0.0000, Zeus # 3
J1900, J1900, 169.0193, 64.81690, 0.00305, 208.8801, 0.0000, 0.0000, Kronos # 4
J1900, J1900, 138.0533, 70.29949, 0.00000, 0.0000, 0.0000, 0.0000, Apollon # 5
J1900, J1900, 351.3350, 73.62765, 0.00000, 0.0000, 0.0000, 0.0000, Admetos # 6
J1900, J1900, 55.8983, 77.25568, 0.00000, 0.0000, 0.0000, 0.0000, Vulcanus # 7
J1900, J1900, 165.5163, 83.66907, 0.00000, 0.0000, 0.0000, 0.0000, Poseidon # 8
#
# Isis-Transpluto; elements from "Die Sterne" 3/1952, p. 70ff.
# Strubell does not give an equinox. 1945 is taken in order to
# reproduce the as best as ASTRON ephemeris. (This is a strange
# choice, though.)
# The epoch according to Strubell is 1772.76.
# 1772 is a leap year!
# The fraction is counted from 1 Jan. 1772
2368547.66, 2431456.5, 0.0, 77.775, 0.3, 0.7, 0, 0, Isis-Transpluto # 9
# Nibiru, elements from Christian Woeltge, Hannover
1856113.380954, 1856113.380954, 0.0, 234.8921, 0.981092, 103.966, -44.567, 158.708, Nibiru # 10
# Harrington, elements from Astronomical Journal 96(4), Oct. 1988
2374696.5, J2000, 0.0, 101.2, 0.411, 208.5, 275.4, 32.4, Harrington # 11
# according to W.G. Hoyt, "Planets X and Pluto", Tucson 1980, p. 63
2395662.5, 2395662.5, 34.05, 36.15, 0.10761, 284.75, 0, 0, Leverrier (Neptune) # 12
2395662.5, 2395662.5, 24.28, 37.25, 0.12062, 299.11, 0, 0, Adams (Neptune) # 13
2425977.5, 2425977.5, 281, 43.0, 0.202, 204.9, 0, 0, Lowell (Pluto) # 14
2425977.5, 2425977.5, 48.95, 55.1, 0.31, 280.1, 100, 15, Pickering (Pluto) # 15
# intramercurian hypothetical Vulcan acc. to L.H. Weston
J1900,JDATE, 252.8987988 + 707550.7341 * T, 0.13744, 0.019, 322.212069+1670.056*T, 47.787931-1670.056*T, 7.5, Vulcan # 16
# Selena/White Moon
J2000,JDATE, 242.2205555 + 5143.5418158 * T, 0.05280098949, 0.0, 0.0, 0.0, 0.0, Selena/White Moon, geo # 17
# Hypothetical planet Proserpina, according to http://www.geocities.com/Hollywood/Academy/7519/proserpina.html
# J1900, 170.73 + 51.05 * T
J1900,JDATE, 170.73, 79.225630, 0, 0, 0, 0, Proserpina #18
# Waldemath's Second Earth Moon
# Elements were derived by D.Koch from Waldemaths original elements as given in
# David Walters' book on Vulcan. They differ from Solar Fire (Graham Dawsons)
# elements, which are based on the assumption that the "mean longitude" given
# by Waldemath is an observation (a true longitude)
# Neither Swisseph nor Solar fire elements agree with Delphine Jay's ephemeris,
# which is obviously wrong.
2414290.95827875,2414290.95827875, 70.3407215 + 109023.2634989 * T, 0.0068400705250028, 0.1587, 8.14049594 + 2393.47417444 * T, 136.24878256 - 1131.71719709 * T, 2.5, Waldemath, geo # 19
#
# The following elements are for test only
# (Selena without T)
J2000,JDATE, 242.2205555, 0.05279142865925, 0.0, 0.0, 0.0, 0.0, Selena/White Moon, geo # 17
# (Selena with T, gives exactly the same position)
J2000,JDATE, 242.2205555 + 5143.5418158 * T, 0.05279142865925, 0.0, 0.0, 0.0, 0.0, Selena/White Moon with T Terms, geo # 17
J2000, JDATE, 174.794787 + 149472.5157715 * T, 0.38709831, 0.20563175 + 0.000020406 * T, 29.125226 + 0.3702885 * T, 48.330893 + 1.186189 * T, 7.004986 + 0.0018215 * T, Mercury elem. for equ. of date # 18
J2000, J2000, 174.794787 + 149472.5157715 * T, 0.38709831, 0.20563175 + 0.000020406 * T, 29.125226 + 0.2842872 * T, 48.330893 - 0.1254229 * T, 7.004986 - 0.0059516 * T, Mercury Test J2000 Elements# 18

BIN
data/sweph-data/sepl_00.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/sepl_06.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/sepl_12.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/sepl_18.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/sepl_24.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/sepl_30.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/sepl_36.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/sepl_42.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/sepl_48.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seplm06.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seplm12.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seplm18.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seplm24.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seplm30.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seplm36.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seplm42.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seplm48.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seplm54.se1 Normal file

Binary file not shown.

View File

@ -92,7 +92,7 @@ expand_content_files=
# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
GTKDOC_CFLAGS=
GTKDOC_LIBS=$(LIBSWE_GLIB_LIBS) -lswe -ldl $(NULL)
GTKDOC_LIBS=$(LIBSWE_GLIB_LIBS) $(NULL)
# This includes the standard gtk-doc make rules, copied by gtkdocize.
include $(top_srcdir)/gtk-doc.make

View File

@ -25,6 +25,7 @@ INST_H_SRC_FILES = \
INST_H_BUILT_FILES = \
gswe-enumtypes.h \
gswe-lots.h \
gswe-version.h \
$(NULL)
@ -61,10 +62,11 @@ libswe_glib_2_0_la_SOURCES = \
gswe-timestamp.c \
gswe-enumtypes.c \
gswe-version.c \
gswe-lots.c \
$(NULL)
libswe_glib_2_0_la_CFLAGS = $(GLIB_CFLAGS) $(GOBJECT_CFLAGS) -Wall
libswe_glib_2_0_la_LIBADD = $(GLIB_LIBS) $(GOBJECT_LIBS) -lswe
libswe_glib_2_0_la_LIBADD = $(GLIB_LIBS) $(GOBJECT_LIBS) $(LIBSWE_LIBS)
libswe_glib_2_0_la_DEPENDENCIES = \
$(NULL)
@ -94,7 +96,6 @@ SweGlib_@SWE_GLIB_API_VERSION_U@_gir_LIBS = libswe-glib-2.0.la
SweGlib_@SWE_GLIB_API_VERSION_U@_gir_SCANNERFLAGS = --identifier-prefix=Gswe --symbol-prefix=gswe --warn-all
SweGlib_@SWE_GLIB_API_VERSION_U@_gir_INCLUDES = GLib-2.0 GObject-2.0
SweGlib_@SWE_GLIB_API_VERSION_U@_gir_CFLAGS = -D__SWE_GLIB_BUILDING__ -I$(top_srcdir) -I$(srcdir) -I$(builddir)
SweGlib_@SWE_GLIB_API_VERSION_U@_gir_LDFLAGS = $(GLIB_LIBS) $(GOBJECT_LIBS) -lswe
SweGlib_@SWE_GLIB_API_VERSION_U@_gir_EXPORT_PACKAGES = swe-glib
INTROSPECTION_GIRS = SweGlib-$(SWE_GLIB_API_VERSION).gir

View File

@ -18,11 +18,11 @@
*/
#include "swe-glib.h"
#include "gswe-enumtypes.h"
#include "@filename@"
/*** END file-header ***/
/*** BEGIN file-production ***/
#include "@filename@"
/* enumerations from "@filename@" */
/*** END file-production ***/

3862
src/gswe-lots.c Normal file

File diff suppressed because it is too large Load Diff

136
src/gswe-lots.h Normal file
View File

@ -0,0 +1,136 @@
/* gswe-lots.h - Arabic lot definitions for SWE-GLib
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GSWE_LOTS_H__
#define __GSWE_LOTS_H__
#include "gswe-types.h"
typedef enum _GsweArabicLot {
GSWE_ARABIC_LOT_NONE,
GSWE_ARABIC_LOT_FORTUNE,
GSWE_ARABIC_LOT_ABILITY,
GSWE_ARABIC_LOT_ABUNDANCE,
GSWE_ARABIC_LOT_ACCIDENT,
GSWE_ARABIC_LOT_ACCOMPLISHMENT,
GSWE_ARABIC_LOT_ACTIONREASONING,
GSWE_ARABIC_LOT_ADDICTION,
GSWE_ARABIC_LOT_ADMINISTRATORS,
GSWE_ARABIC_LOT_AGRICULTURE,
GSWE_ARABIC_LOT_ALLEGIANCE,
GSWE_ARABIC_LOT_ANCESTORSRELATIONS,
GSWE_ARABIC_LOT_ANCESTRAL_HERITAGE,
GSWE_ARABIC_LOT_ARMIES,
GSWE_ARABIC_LOT_ART,
GSWE_ARABIC_LOT_ASSASSINATION_1,
GSWE_ARABIC_LOT_ASSASSINATION_2,
GSWE_ARABIC_LOT_ASSURANCE,
GSWE_ARABIC_LOT_ASTROLOGY,
GSWE_ARABIC_LOT_BAD_LUCK,
GSWE_ARABIC_LOT_BANKRUPTCY_1,
GSWE_ARABIC_LOT_BANKRUPTCY_2,
GSWE_ARABIC_LOT_BEAUTY,
GSWE_ARABIC_LOT_BENIFIC_CHANGE,
GSWE_ARABIC_LOT_BENEVOLENCE,
GSWE_ARABIC_LOT_BUSINESS_PARTNERSHIPS,
GSWE_ARABIC_LOT_CANCER,
GSWE_ARABIC_LOT_CATASTROPHE_1,
GSWE_ARABIC_LOT_CATASTROPHE_2,
GSWE_ARABIC_LOT_CAUTION,
GSWE_ARABIC_LOT_CHILDREN,
GSWE_ARABIC_LOT_COMMERCE_1,
GSWE_ARABIC_LOT_COMMERCE_2,
GSWE_ARABIC_LOT_CONTROVERSY,
GSWE_ARABIC_LOT_CORRUPTNESS,
GSWE_ARABIC_LOT_CURIOSITY,
GSWE_ARABIC_LOT_DAMAGE,
GSWE_ARABIC_LOT_DANGER_VIOLENCE_DEBT,
GSWE_ARABIC_LOT_DAUGHTERS,
GSWE_ARABIC_LOT_DEATH,
GSWE_ARABIC_LOT_DEATH_PARENTS,
GSWE_ARABIC_LOT_DEBT,
GSWE_ARABIC_LOT_DESIRE_SEXUAL_ATTRACTION,
GSWE_ARABIC_LOT_DESTINY,
GSWE_ARABIC_LOT_DESTRUCTION,
GSWE_ARABIC_LOT_DISEASE,
GSWE_ARABIC_LOT_DIVORCE_1,
GSWE_ARABIC_LOT_DIVORCE_2,
GSWE_ARABIC_LOT_ECCENTRICITY,
GSWE_ARABIC_LOT_ENERGY_SEX_DRIVE,
GSWE_ARABIC_LOT_EXPECTED_BIRTH_1,
GSWE_ARABIC_LOT_EXPECTED_BIRTH_2,
GSWE_ARABIC_LOT_FAME,
GSWE_ARABIC_LOT_FAMOUS_FRIENDS,
GSWE_ARABIC_LOT_FASCINATION,
GSWE_ARABIC_LOT_FATE_KARMA,
GSWE_ARABIC_LOT_FATHER,
GSWE_ARABIC_LOT_FRAUD,
GSWE_ARABIC_LOT_FRIENDS_1,
GSWE_ARABIC_LOT_FRIENDS_2,
GSWE_ARABIC_LOT_FRIENDS_3,
GSWE_ARABIC_LOT_GENIUS,
GSWE_ARABIC_LOT_GRANDPARENTS_1,
GSWE_ARABIC_LOT_GRANDPARENTS_2,
GSWE_ARABIC_LOT_GUIDANCE,
GSWE_ARABIC_LOT_HAPPINESS,
GSWE_ARABIC_LOT_HOMOSEXUALITY,
GSWE_ARABIC_LOT_HORSEMANSHIP,
GSWE_ARABIC_LOT_IDENTITY,
GSWE_ARABIC_LOT_IMPRISONMENT,
GSWE_ARABIC_LOT_INCREASE,
GSWE_ARABIC_LOT_INHERITANCE_1,
GSWE_ARABIC_LOT_INHERITANCE_2,
GSWE_ARABIC_LOT_JOURNEYS_AIR,
GSWE_ARABIC_LOT_JOURNEYS_LAND,
GSWE_ARABIC_LOT_JOURNEYS_WATER,
GSWE_ARABIC_LOT_KINGS_RULERS,
GSWE_ARABIC_LOT_KNOWLEDGE,
GSWE_ARABIC_LOT_LIFE_REINCARNATION,
GSWE_ARABIC_LOT_LOVE,
GSWE_ARABIC_LOT_LOVERS,
GSWE_ARABIC_LOT_LUCK,
GSWE_ARABIC_LOT_MARRIAGE,
GSWE_ARABIC_LOT_MARRIAGE_OF_WOMAN_1,
GSWE_ARABIC_LOT_MARRIAGE_OF_WOMAN_2,
GSWE_ARABIC_LOT_MARRIAGE_OF_MAN_1,
GSWE_ARABIC_LOT_MARRIAGE_OF_MAN_2,
GSWE_ARABIC_LOT_MOTHER,
GSWE_ARABIC_LOT_PARTNERS,
GSWE_ARABIC_LOT_PERIL,
GSWE_ARABIC_LOT_POSSESSIONS,
GSWE_ARABIC_LOT_REAL_ESTATE_LAND,
GSWE_ARABIC_LOT_REAL_ESTATE_INVESTMENT,
GSWE_ARABIC_LOT_SECRET_ENEMIES,
GSWE_ARABIC_LOT_SHORT_JOURNEYS,
GSWE_ARABIC_LOT_SIBLINGS,
GSWE_ARABIC_LOT_SICKNESS,
GSWE_ARABIC_LOT_SONINLAWS,
GSWE_ARABIC_LOT_SONS,
GSWE_ARABIC_LOT_SPIRIT,
GSWE_ARABIC_LOT_SUCCESS,
GSWE_ARABIC_LOT_SUCCESS_INVESTMENT,
GSWE_ARABIC_LOT_SUICIDE_1,
GSWE_ARABIC_LOT_SUICIDE_2,
GSWE_ARABIC_LOT_SURGERY,
GSWE_ARABIC_LOT_TRAGEDY,
GSWE_ARABIC_LOT_UNUSUAL_EVENTS,
GSWE_ARABIC_LOT_VICTORY,
GSWE_ARABIC_LOT_WEDDINGS_LEGAL_CONTRACTS,
GSWE_ARABIC_LOT_WIDOWHOOD
} GsweArabicLot;
#endif /* __GSWE_LOTS_H__ */

View File

@ -15,11 +15,11 @@
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include <swephexp.h>
#include "swe-glib.h"
#include "swe-glib-private.h"
#include "../swe/src/swephexp.h"
#define glforeach(a, b) for ((a) = (b); (a); (a) = g_list_next((a)))
/**
@ -805,39 +805,14 @@ gswe_moment_calculate_house_positions(GsweMoment *moment, GError **err)
err
);
}
if (gswe_moment_has_planet(moment, GSWE_PLANET_DESCENDANT)) {
calculate_data_by_position(
moment,
GSWE_PLANET_DESCENDANT,
fmod(ascmc[0] + 180.0, 180.0),
err
);
}
if (gswe_moment_has_planet(moment, GSWE_PLANET_MC)) {
calculate_data_by_position(moment, GSWE_PLANET_MC, ascmc[1], err);
}
if (gswe_moment_has_planet(moment, GSWE_PLANET_IC)) {
calculate_data_by_position(
moment,
GSWE_PLANET_IC,
fmod(ascmc[2] + 180.0, 180.0),
err
);
}
if (gswe_moment_has_planet(moment, GSWE_PLANET_VERTEX)) {
calculate_data_by_position(moment, GSWE_PLANET_VERTEX, ascmc[3], err);
}
if (gswe_moment_has_planet(moment, GSWE_PLANET_ANTIVERTEX)) {
calculate_data_by_position(
moment,
GSWE_PLANET_ANTIVERTEX,
fmod(ascmc[3] + 180.0, 180.0),
err
);
}
}
/**

View File

@ -18,8 +18,8 @@
*/
#include <math.h>
#include <glib.h>
#include <swephexp.h>
#include "../swe/src/swephexp.h"
#include "swe-glib-private.h"
#include "swe-glib.h"
#include "gswe-timestamp.h"

View File

@ -35,12 +35,9 @@
* GswePlanet:
* @GSWE_PLANET_NONE: no planet
* @GSWE_PLANET_ASCENDANT: the ascendant
* @GSWE_PLANET_DESCENDANT: the descendant
* @GSWE_PLANET_MC: midheaven (Medium Coeli)
* @GSWE_PLANET_IC: Immum Coeli
* @GSWE_PLANET_VERTEX: the Vertex (the point where the ecliptic meats the
* primal vertical)
* @GSWE_PLANET_ANTIVERTEX: the Antivertex (the point opposing the Vertex)
* @GSWE_PLANET_MOON_NODE: the mean ascending (north) Moon node
* @GSWE_PLANET_MOON_SOUTH_NODE: the mean descending (south) Moon node
* @GSWE_PLANET_MOON_APOGEE: the mean Moon apogee (sometimes called Dark Moon,
@ -83,9 +80,6 @@ typedef enum {
GSWE_PLANET_MOON_NODE,
GSWE_PLANET_MOON_APOGEE,
GSWE_PLANET_MOON_SOUTH_NODE,
GSWE_PLANET_DESCENDANT,
GSWE_PLANET_IC,
GSWE_PLANET_ANTIVERTEX,
/* Actual astrological planets */
GSWE_PLANET_SUN = 11,

View File

@ -18,8 +18,8 @@
#include <glib.h>
#define GETTEXT_PACKAGE "swe-glib"
#include <glib/gi18n-lib.h>
#include <swephexp.h>
#include "../swe/src/swephexp.h"
#include "swe-glib.h"
#include "swe-glib-private.h"
@ -178,14 +178,6 @@ void gswe_init_with_dir(gchar *directory)
9.0,
2
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_DESCENDANT,
-1,
FALSE,
_("Descendant"),
0.0,
0
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_MC,
-1,
@ -194,14 +186,6 @@ void gswe_init_with_dir(gchar *directory)
5.0,
1
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_IC,
-1,
FALSE,
_("Immum Coeli"),
0.0,
0
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_VERTEX,
-1,
@ -210,14 +194,6 @@ void gswe_init_with_dir(gchar *directory)
2.0,
0
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_ANTIVERTEX,
-1,
FALSE,
_("Anti-vertex"),
0.0,
0
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_MOON_NODE,
SE_MEAN_NODE,
@ -228,9 +204,6 @@ void gswe_init_with_dir(gchar *directory)
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_MOON_SOUTH_NODE,
// As this is just the opposing point of the mean node,
// we actually calculate that, and simply add 180
// degrees when queried.
SE_MEAN_NODE,
TRUE,
_("Descending Moon Node"),

View File

@ -33,6 +33,7 @@
#include "gswe-timestamp.h"
#include "gswe-moment.h"
#include "gswe-enumtypes.h"
#include "gswe-lots.h"
typedef enum {
GSWE_ERROR_SUCCESS,

1
swe/Makefile.am Normal file
View File

@ -0,0 +1 @@
EXTRA_DIST = README

5
swe/README Normal file
View File

@ -0,0 +1,5 @@
This directory contains version 2.0 of the Swiss Ephemeris programming library
in a reduced form, so it can be used in an Autotools project like Astrognome.
If you need the full version, you can download it from
ftp://ftp.astro.com/pub/swisseph/ (as of July, 2013)

1
swe/doc/Makefile.am Normal file
View File

@ -0,0 +1 @@
EXTRA_DIST = swephprg.pdf swisseph.pdf

BIN
swe/doc/swephprg.pdf Normal file

Binary file not shown.

BIN
swe/doc/swisseph.pdf Normal file

Binary file not shown.

54
swe/src/LICENSE Normal file
View File

@ -0,0 +1,54 @@
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions
------------------
This file is part of Swiss Ephemeris.
Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author
or distributor accepts any responsibility for the consequences of using it,
or for whether it serves any particular purpose or works at all, unless he
or she says so in writing.
Swiss Ephemeris is made available by its authors under a dual licensing
system. The software developer, who uses any part of Swiss Ephemeris
in his or her software, must choose between one of the two license models,
which are
a) GNU public license version 2 or later
b) Swiss Ephemeris Professional License
The choice must be made before the software developer distributes software
containing parts of Swiss Ephemeris to others, and before any public
service using the developed software is activated.
If the developer choses the GNU GPL software license, he or she must fulfill
the conditions of that license, which includes the obligation to place his
or her whole software project under the GNU GPL or a compatible license.
See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
If the developer choses the Swiss Ephemeris Professional license,
he must follow the instructions as found in http://www.astro.com/swisseph/
and purchase the Swiss Ephemeris Professional Edition from Astrodienst
and sign the corresponding license contract.
The License grants you the right to use, copy, modify and redistribute
Swiss Ephemeris, but only under certain conditions described in the License.
Among other things, the License requires that the copyright notices and
this notice be preserved on all copies.
Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl
The authors of Swiss Ephemeris have no control or influence over any of
the derived works, i.e. over software or services created by other
programmers which use Swiss Ephemeris functions.
The names of the authors or of the copyright holder (Astrodienst) must not
be used for promoting any software, product or service which uses or contains
the Swiss Ephemeris. This copyright notice is the ONLY place where the
names of the authors can legally appear, except in cases where they have
given special permission in writing.
The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used
for promoting such software, products or services.
*/

25
swe/src/Makefile.am Normal file
View File

@ -0,0 +1,25 @@
lib_LTLIBRARIES = libswe-2.0.la
libswe_2_0_la_SOURCES = swedate.c swehouse.c swejpl.c swemmoon.c swemplan.c swepcalc.c sweph.c swepdate.c swephlib.c swecl.c swehel.c
libswe_2_0_la_CFLAGS = $(CFLAGS) -Wall
libswe_2_0_la_LIBADD = $(LIBS)
EXTRA_DIST = \
LICENSE \
README \
swemptab.c \
swemptab.h \
swedate.h \
swedll.h \
swehouse.h \
swejpl.h \
swenut2000a.h \
sweodef.h \
swepcalc.h \
swephexp.h \
sweph.h \
swephlib.h \
fixstars.cat \
sedeltat.txt.inactive \
sefstars.txt \
seorbel.txt \
$(NULL)

6
swe/src/README Normal file
View File

@ -0,0 +1,6 @@
This directory holds the Swiss Ephemeris library. It can be downloaded from
http://www.astro.com/swisseph/ and used via the GPL licence.
The original directory is stripped down, and the unneded files are deleted (like
the swetest source and such. In the future, even the library may be optimised
further.

1258
swe/src/fixstars.cat Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,13 @@
# This file allows to make new Delta T known to the Swiss Ephemeris.
# Note, these values override the values given in the internal Delta T
# table of the Swiss Ephemeris.
#
# If you want to use this file, change its file name and remove the
# the extension '.inactive'. As soon as you do so, the values below
# will be used, i.e. they will override the internal Delta T values
# of the Swiss Ephemeris.
#
# Format: year and seconds (decimal)
2007 65.15
2008 65.46
2009 65.78

1290
swe/src/sefstars.txt Normal file

File diff suppressed because it is too large Load Diff

76
swe/src/seorbel.txt Normal file
View File

@ -0,0 +1,76 @@
# Orbital elements of ficticious planets
# 27 Jan. 2000
#
# This file is part of the Swiss Ephemeris, from Version 1.52 on.
#
# Warning! These planets do not exist!
#
# The user can add his or her own elements.
# 960 is the maximum number of ficticious planets.
#
# The elements order is as follows:
# 1. epoch of elements (Julian day)
# 2. equinox (Julian day or "J1900" or "B1950" or "J2000")
# 3. mean anomaly at epoch
# 4. semi-axis
# 5. eccentricity
# 6. argument of perihelion (ang. distance of perihelion from node)
# 7. ascending node
# 8. inclination
# 9. name of planet
#
# use '#' for comments
# to compute a body with swe_calc(), use planet number
# ipl = SE_FICT_OFFSET_1 + number_of_elements_set,
# e.g. number of Kronos is ipl = 39 + 4 = 43
#
# Witte/Sieggruen planets, refined by James Neely
J1900, J1900, 163.7409, 40.99837, 0.00460, 171.4333, 129.8325, 1.0833, Cupido # 1
J1900, J1900, 27.6496, 50.66744, 0.00245, 148.1796, 161.3339, 1.0500, Hades # 2
J1900, J1900, 165.1232, 59.21436, 0.00120, 299.0440, 0.0000, 0.0000, Zeus # 3
J1900, J1900, 169.0193, 64.81690, 0.00305, 208.8801, 0.0000, 0.0000, Kronos # 4
J1900, J1900, 138.0533, 70.29949, 0.00000, 0.0000, 0.0000, 0.0000, Apollon # 5
J1900, J1900, 351.3350, 73.62765, 0.00000, 0.0000, 0.0000, 0.0000, Admetos # 6
J1900, J1900, 55.8983, 77.25568, 0.00000, 0.0000, 0.0000, 0.0000, Vulcanus # 7
J1900, J1900, 165.5163, 83.66907, 0.00000, 0.0000, 0.0000, 0.0000, Poseidon # 8
#
# Isis-Transpluto; elements from "Die Sterne" 3/1952, p. 70ff.
# Strubell does not give an equinox. 1945 is taken in order to
# reproduce the as best as ASTRON ephemeris. (This is a strange
# choice, though.)
# The epoch according to Strubell is 1772.76.
# 1772 is a leap year!
# The fraction is counted from 1 Jan. 1772
2368547.66, 2431456.5, 0.0, 77.775, 0.3, 0.7, 0, 0, Isis-Transpluto # 9
# Nibiru, elements from Christian Woeltge, Hannover
1856113.380954, 1856113.380954, 0.0, 234.8921, 0.981092, 103.966, -44.567, 158.708, Nibiru # 10
# Harrington, elements from Astronomical Journal 96(4), Oct. 1988
2374696.5, J2000, 0.0, 101.2, 0.411, 208.5, 275.4, 32.4, Harrington # 11
# according to W.G. Hoyt, "Planets X and Pluto", Tucson 1980, p. 63
2395662.5, 2395662.5, 34.05, 36.15, 0.10761, 284.75, 0, 0, Leverrier (Neptune) # 12
2395662.5, 2395662.5, 24.28, 37.25, 0.12062, 299.11, 0, 0, Adams (Neptune) # 13
2425977.5, 2425977.5, 281, 43.0, 0.202, 204.9, 0, 0, Lowell (Pluto) # 14
2425977.5, 2425977.5, 48.95, 55.1, 0.31, 280.1, 100, 15, Pickering (Pluto) # 15
# intramercurian hypothetical Vulcan acc. to L.H. Weston
J1900,JDATE, 252.8987988 + 707550.7341 * T, 0.13744, 0.019, 322.212069+1670.056*T, 47.787931-1670.056*T, 7.5, Vulcan # 16
# Selena/White Moon
J2000,JDATE, 242.2205555 + 5143.5418158 * T, 0.05280098949, 0.0, 0.0, 0.0, 0.0, Selena/White Moon, geo # 17
# Hypothetical planet Proserpina, according to http://www.geocities.com/Hollywood/Academy/7519/proserpina.html
# J1900, 170.73 + 51.05 * T
J1900,JDATE, 170.73, 79.225630, 0, 0, 0, 0, Proserpina #18
# Waldemath's Second Earth Moon
# Elements were derived by D.Koch from Waldemaths original elements as given in
# David Walters' book on Vulcan. They differ from Solar Fire (Graham Dawsons)
# elements, which are based on the assumption that the "mean longitude" given
# by Waldemath is an observation (a true longitude)
# Neither Swisseph nor Solar fire elements agree with Delphine Jay's ephemeris,
# which is obviously wrong.
2414290.95827875,2414290.95827875, 70.3407215 + 109023.2634989 * T, 0.0068400705250028, 0.1587, 8.14049594 + 2393.47417444 * T, 136.24878256 - 1131.71719709 * T, 2.5, Waldemath, geo # 19
#
# The following elements are for test only
# (Selena without T)
J2000,JDATE, 242.2205555, 0.05279142865925, 0.0, 0.0, 0.0, 0.0, Selena/White Moon, geo # 17
# (Selena with T, gives exactly the same position)
J2000,JDATE, 242.2205555 + 5143.5418158 * T, 0.05279142865925, 0.0, 0.0, 0.0, 0.0, Selena/White Moon with T Terms, geo # 17
J2000, JDATE, 174.794787 + 149472.5157715 * T, 0.38709831, 0.20563175 + 0.000020406 * T, 29.125226 + 0.3702885 * T, 48.330893 + 1.186189 * T, 7.004986 + 0.0018215 * T, Mercury elem. for equ. of date # 18
J2000, J2000, 174.794787 + 149472.5157715 * T, 0.38709831, 0.20563175 + 0.000020406 * T, 29.125226 + 0.2842872 * T, 48.330893 - 0.1254229 * T, 7.004986 - 0.0059516 * T, Mercury Test J2000 Elements# 18

5410
swe/src/swecl.c Normal file

File diff suppressed because it is too large Load Diff

592
swe/src/swedate.c Normal file
View File

@ -0,0 +1,592 @@
/*********************************************************
$Header: /home/dieter/sweph/RCS/swedate.c,v 1.75 2009/04/08 07:17:29 dieter Exp $
version 15-feb-89 16:30
swe_date_conversion()
swe_revjul()
swe_julday()
************************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions
------------------
This file is part of Swiss Ephemeris.
Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author
or distributor accepts any responsibility for the consequences of using it,
or for whether it serves any particular purpose or works at all, unless he
or she says so in writing.
Swiss Ephemeris is made available by its authors under a dual licensing
system. The software developer, who uses any part of Swiss Ephemeris
in his or her software, must choose between one of the two license models,
which are
a) GNU public license version 2 or later
b) Swiss Ephemeris Professional License
The choice must be made before the software developer distributes software
containing parts of Swiss Ephemeris to others, and before any public
service using the developed software is activated.
If the developer choses the GNU GPL software license, he or she must fulfill
the conditions of that license, which includes the obligation to place his
or her whole software project under the GNU GPL or a compatible license.
See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
If the developer choses the Swiss Ephemeris Professional license,
he must follow the instructions as found in http://www.astro.com/swisseph/
and purchase the Swiss Ephemeris Professional Edition from Astrodienst
and sign the corresponding license contract.
The License grants you the right to use, copy, modify and redistribute
Swiss Ephemeris, but only under certain conditions described in the License.
Among other things, the License requires that the copyright notices and
this notice be preserved on all copies.
Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl
The authors of Swiss Ephemeris have no control or influence over any of
the derived works, i.e. over software or services created by other
programmers which use Swiss Ephemeris functions.
The names of the authors or of the copyright holder (Astrodienst) must not
be used for promoting any software, product or service which uses or contains
the Swiss Ephemeris. This copyright notice is the ONLY place where the
names of the authors can legally appear, except in cases where they have
given special permission in writing.
The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used
for promoting such software, products or services.
*/
/*
swe_date_conversion():
This function converts some date+time input {d,m,y,uttime}
into the Julian day number tjd.
The function checks that the input is a legal combination
of dates; for illegal dates like 32 January 1993 it returns ERR
but still converts the date correctly, i.e. like 1 Feb 1993.
The function is usually used to convert user input of birth data
into the Julian day number. Illegal dates should be notified to the user.
Be aware that we always use astronomical year numbering for the years
before Christ, not the historical year numbering.
Astronomical years are done with negative numbers, historical
years with indicators BC or BCE (before common era).
Year 0 (astronomical) = 1 BC historical.
year -1 (astronomical) = 2 BC
etc.
Many users of Astro programs do not know about this difference.
Return: OK or ERR (for illegal date)
*********************************************************/
# include "swephexp.h"
# include "sweph.h"
static TLS AS_BOOL init_leapseconds_done = FALSE;
int CALL_CONV swe_date_conversion(int y,
int m,
int d, /* day, month, year */
double uttime, /* UT in hours (decimal) */
char c, /* calendar g[regorian]|j[ulian] */
double *tjd)
{
int rday, rmon, ryear;
double rut, jd;
int gregflag = SE_JUL_CAL;
if (c == 'g')
gregflag = SE_GREG_CAL;
rut = uttime; /* hours UT */
jd = swe_julday(y, m, d, rut, gregflag);
swe_revjul(jd, gregflag, &ryear, &rmon, &rday, &rut);
*tjd = jd;
if (rmon == m && rday == d && ryear == y) {
return OK;
} else {
return ERR;
}
} /* end date_conversion */
/*************** swe_julday ********************************************
* This function returns the absolute Julian day number (JD)
* for a given calendar date.
* The arguments are a calendar date: day, month, year as integers,
* hour as double with decimal fraction.
* If gregflag = SE_GREG_CAL (1), Gregorian calendar is assumed,
* if gregflag = SE_JUL_CAL (0),Julian calendar is assumed.
The Julian day number is a system of numbering all days continously
within the time range of known human history. It should be familiar
to every astrological or astronomical programmer. The time variable
in astronomical theories is usually expressed in Julian days or
Julian centuries (36525 days per century) relative to some start day;
the start day is called 'the epoch'.
The Julian day number is a double representing the number of
days since JD = 0.0 on 1 Jan -4712, 12:00 noon (in the Julian calendar).
Midnight has always a JD with fraction .5, because traditionally
the astronomical day started at noon. This was practical because
then there was no change of date during a night at the telescope.
From this comes also the fact the noon ephemerides were printed
before midnight ephemerides were introduced early in the 20th century.
NOTE: The Julian day number must not be confused with the Julian
calendar system.
Be aware the we always use astronomical year numbering for the years
before Christ, not the historical year numbering.
Astronomical years are done with negative numbers, historical
years with indicators BC or BCE (before common era).
Year 0 (astronomical) = 1 BC
year -1 (astronomical) = 2 BC
etc.
Original author: Marc Pottenger, Los Angeles.
with bug fix for year < -4711 15-aug-88 by Alois Treindl
(The parameter sequence m,d,y still indicates the US origin,
be careful because the similar function date_conversion() uses
other parameter sequence and also Astrodienst relative juldate.)
References: Oliver Montenbruck, Grundlagen der Ephemeridenrechnung,
Verlag Sterne und Weltraum (1987), p.49 ff
related functions: swe_revjul() reverse Julian day number: compute the
calendar date from a given JD
date_conversion() includes test for legal date values
and notifies errors like 32 January.
****************************************************************/
double CALL_CONV swe_julday(int year, int month, int day, double hour, int gregflag)
{
double jd;
double u,u0,u1,u2;
u = year;
if (month < 3) u -=1;
u0 = u + 4712.0;
u1 = month + 1.0;
if (u1 < 4) u1 += 12.0;
jd = floor(u0*365.25)
+ floor(30.6*u1+0.000001)
+ day + hour/24.0 - 63.5;
if (gregflag == SE_GREG_CAL) {
u2 = floor(fabs(u) / 100) - floor(fabs(u) / 400);
if (u < 0.0) u2 = -u2;
jd = jd - u2 + 2;
if ((u < 0.0) && (u/100 == floor(u/100)) && (u/400 != floor(u/400)))
jd -=1;
}
return jd;
}
/*** swe_revjul ******************************************************
swe_revjul() is the inverse function to swe_julday(), see the description
there.
Arguments are julian day number, calendar flag (0=julian, 1=gregorian)
return values are the calendar day, month, year and the hour of
the day with decimal fraction (0 .. 23.999999).
Be aware the we use astronomical year numbering for the years
before Christ, not the historical year numbering.
Astronomical years are done with negative numbers, historical
years with indicators BC or BCE (before common era).
Year 0 (astronomical) = 1 BC historical year
year -1 (astronomical) = 2 BC historical year
year -234 (astronomical) = 235 BC historical year
etc.
Original author Mark Pottenger, Los Angeles.
with bug fix for year < -4711 16-aug-88 Alois Treindl
*************************************************************************/
void CALL_CONV swe_revjul (double jd, int gregflag,
int *jyear, int *jmon, int *jday, double *jut)
{
double u0,u1,u2,u3,u4;
u0 = jd + 32082.5;
if (gregflag == SE_GREG_CAL) {
u1 = u0 + floor (u0/36525.0) - floor (u0/146100.0) - 38.0;
if (jd >= 1830691.5) u1 +=1;
u0 = u0 + floor (u1/36525.0) - floor (u1/146100.0) - 38.0;
}
u2 = floor (u0 + 123.0);
u3 = floor ( (u2 - 122.2) / 365.25);
u4 = floor ( (u2 - floor (365.25 * u3) ) / 30.6001);
*jmon = (int) (u4 - 1.0);
if (*jmon > 12) *jmon -= 12;
*jday = (int) (u2 - floor (365.25 * u3) - floor (30.6001 * u4));
*jyear = (int) (u3 + floor ( (u4 - 2.0) / 12.0) - 4800);
*jut = (jd - floor (jd + 0.5) + 0.5) * 24.0;
}
/* transform local time to UTC or UTC to local time
*
* input
* iyear ... dsec date and time
* d_timezone timezone offset
* output
* iyear_out ... dsec_out
*
* For time zones east of Greenwich, d_timezone is positive.
* For time zones west of Greenwich, d_timezone is negative.
*
* For conversion from local time to utc, use +d_timezone.
* For conversion from utc to local time, use -d_timezone.
*/
void CALL_CONV swe_utc_time_zone(
int32 iyear, int32 imonth, int32 iday,
int32 ihour, int32 imin, double dsec,
double d_timezone,
int32 *iyear_out, int32 *imonth_out, int32 *iday_out,
int32 *ihour_out, int32 *imin_out, double *dsec_out
)
{
double tjd, d;
AS_BOOL have_leapsec = FALSE;
double dhour;
if (dsec >= 60.0) {
have_leapsec = TRUE;
dsec -= 1.0;
}
dhour = ((double) ihour) + ((double) imin) / 60.0 + dsec / 3600.0;
tjd = swe_julday(iyear, imonth, iday, 0, SE_GREG_CAL);
dhour -= d_timezone;
if (dhour < 0.0) {
tjd -= 1.0;
dhour += 24.0;
}
if (dhour >= 24.0) {
tjd += 1.0;
dhour -= 24.0;
}
swe_revjul(tjd + 0.001, SE_GREG_CAL, iyear_out, imonth_out, iday_out, &d);
*ihour_out = (int) dhour;
d = (dhour - (double) *ihour_out) * 60;
*imin_out = (int) d;
*dsec_out = (d - (double) *imin_out) * 60;
if (have_leapsec)
*dsec_out += 1.0;
}
/*
* functions for the handling of UTC
*/
/* Leap seconds were inserted at the end of the following days:*/
#define NLEAP_SECONDS 26
#define NLEAP_SECONDS_SPACE 100
static TLS int leap_seconds[NLEAP_SECONDS_SPACE] = {
19720630,
19721231,
19731231,
19741231,
19751231,
19761231,
19771231,
19781231,
19791231,
19810630,
19820630,
19830630,
19850630,
19871231,
19891231,
19901231,
19920630,
19930630,
19940630,
19951231,
19970630,
19981231,
20051231,
20081231,
20120630,
20150630,
0 /* keep this 0 as end mark */
};
#define J1972 2441317.5
#define NLEAP_INIT 10
/* Read additional leap second dates from external file, if given.
*/
static int init_leapsec(void)
{
FILE *fp;
int ndat, ndat_last;
int tabsiz = 0;
int i;
char s[AS_MAXCH];
char *sp;
if (!init_leapseconds_done) {
init_leapseconds_done = TRUE;
tabsiz = NLEAP_SECONDS;
ndat_last = leap_seconds[NLEAP_SECONDS - 1];
/* no error message if file is missing */
if ((fp = swi_fopen(-1, "seleapsec.txt", swed.ephepath, NULL)) == NULL)
return NLEAP_SECONDS;
while(fgets(s, AS_MAXCH, fp) != NULL) {
sp = s;
while (*sp == ' ' || *sp == '\t') sp++;
sp++;
if (*sp == '#' || *sp == '\n')
continue;
ndat = atoi(s);
if (ndat <= ndat_last)
continue;
/* table space is limited. no error msg, if exceeded */
if (tabsiz >= NLEAP_SECONDS_SPACE)
return tabsiz;
leap_seconds[tabsiz] = ndat;
tabsiz++;
}
if (tabsiz > NLEAP_SECONDS) leap_seconds[tabsiz] = 0; /* end mark */
fclose(fp);
return tabsiz;
}
/* find table size */
tabsiz = 0;
for (i = 0; i < NLEAP_SECONDS_SPACE; i++) {
if (leap_seconds[i] == 0)
break;
else
tabsiz++;
}
return tabsiz;
}
/*
* Input: Clock time UTC, year, month, day, hour, minute, second (decimal).
* gregflag Calendar flag
* serr error string
* Output: An array of doubles:
* dret[0] = Julian day number TT (ET)
* dret[1] = Julian day number UT1
*
* Function returns OK or Error.
*
* - Before 1972, swe_utc_to_jd() treats its input time as UT1.
* Note: UTC was introduced in 1961. From 1961 - 1971, the length of the
* UTC second was regularly changed, so that UTC remained very close to UT1.
* - From 1972 on, input time is treated as UTC.
* - If delta_t - nleap - 32.184 > 1, the input time is treated as UT1.
* Note: Like this we avoid errors greater than 1 second in case that
* the leap seconds table (or the Swiss Ephemeris version) is not updated
* for a long time.
*/
int32 CALL_CONV swe_utc_to_jd(int32 iyear, int32 imonth, int32 iday, int32 ihour, int32 imin, double dsec, int32 gregflag, double *dret, char *serr)
{
double tjd_ut1, tjd_et, tjd_et_1972, dhour, d;
int iyear2, imonth2, iday2;
int i, j, ndat, nleap, tabsiz_nleap;
/*
* error handling: invalid iyear etc.
*/
tjd_ut1 = swe_julday(iyear, imonth, iday, 0, gregflag);
swe_revjul(tjd_ut1, gregflag, &iyear2, &imonth2, &iday2, &d);
if (iyear != iyear2 || imonth != imonth2 || iday != iday2) {
if (serr != NULL)
sprintf(serr, "invalid date: year = %d, month = %d, day = %d", iyear, imonth, iday);
return ERR;
}
if (ihour < 0 || ihour > 23
|| imin < 0 || imin > 59
|| dsec < 0 || dsec >= 61
|| (dsec >= 60 && (imin < 59 || ihour < 23 || tjd_ut1 < J1972))) {
if (serr != NULL)
sprintf(serr, "invalid time: %d:%d:%.2f", ihour, imin, dsec);
return ERR;
}
dhour = (double) ihour + ((double) imin) / 60.0 + dsec / 3600.0;
/*
* before 1972, we treat input date as UT1
*/
if (tjd_ut1 < J1972) {
dret[1] = swe_julday(iyear, imonth, iday, dhour, gregflag);
dret[0] = dret[1] + swe_deltat_ex(dret[1], -1, NULL);
return OK;
}
/*
* if gregflag = Julian calendar, convert to gregorian calendar
*/
if (gregflag == SE_JUL_CAL) {
gregflag = SE_GREG_CAL;
swe_revjul(tjd_ut1, gregflag, &iyear, &imonth, &iday, &d);
}
/*
* number of leap seconds since 1972:
*/
tabsiz_nleap = init_leapsec();
nleap = NLEAP_INIT; /* initial difference between UTC and TAI in 1972 */
ndat = iyear * 10000 + imonth * 100 + iday;
for (i = 0; i < tabsiz_nleap; i++) {
if (ndat <= leap_seconds[i])
break;
nleap++;
}
/*
* For input dates > today:
* If leap seconds table is not up to date, we'd better interpret the
* input time as UT1, not as UTC. How do we find out?
* Check, if delta_t - nleap - 32.184 > 0.9
*/
d = swe_deltat_ex(tjd_ut1, -1, NULL) * 86400.0;
if (d - (double) nleap - 32.184 >= 1.0) {
dret[1] = tjd_ut1 + dhour / 24.0;
dret[0] = dret[1] + swe_deltat_ex(dret[1], -1, NULL);
return OK;
}
/*
* if input second is 60: is it a valid leap second ?
*/
if (dsec >= 60) {
j = 0;
for (i = 0; i < tabsiz_nleap; i++) {
if (ndat == leap_seconds[i]) {
j = 1;
break;
}
}
if (j != 1) {
if (serr != NULL)
sprintf(serr, "invalid time (no leap second!): %d:%d:%.2f", ihour, imin, dsec);
return ERR;
}
}
/*
* convert UTC to ET and UT1
*/
/* the number of days between input date and 1 jan 1972: */
d = tjd_ut1 - J1972;
/* SI time since 1972, ignoring leap seconds: */
d += (double) ihour / 24.0 + (double) imin / 1440.0 + dsec / 86400.0;
/* ET (TT) */
tjd_et_1972 = J1972 + (32.184 + NLEAP_INIT) / 86400.0;
tjd_et = tjd_et_1972 + d + ((double) (nleap - NLEAP_INIT)) / 86400.0;
d = swe_deltat_ex(tjd_et, -1, NULL);
tjd_ut1 = tjd_et - swe_deltat_ex(tjd_et - d, -1, NULL);
tjd_ut1 = tjd_et - swe_deltat_ex(tjd_ut1, -1, NULL);
dret[0] = tjd_et;
dret[1] = tjd_ut1;
return OK;
}
/*
* Input: tjd_et Julian day number, terrestrial time (ephemeris time).
* gregfalg Calendar flag
* Output: UTC year, month, day, hour, minute, second (decimal).
*
* - Before 1 jan 1972 UTC, output UT1.
* Note: UTC was introduced in 1961. From 1961 - 1971, the length of the
* UTC second was regularly changed, so that UTC remained very close to UT1.
* - From 1972 on, output is UTC.
* - If delta_t - nleap - 32.184 > 1, the output is UT1.
* Note: Like this we avoid errors greater than 1 second in case that
* the leap seconds table (or the Swiss Ephemeris version) has not been
* updated for a long time.
*/
void CALL_CONV swe_jdet_to_utc(double tjd_et, int32 gregflag, int32 *iyear, int32 *imonth, int32 *iday, int32 *ihour, int32 *imin, double *dsec)
{
int i;
int second_60 = 0;
int iyear2, imonth2, iday2, nleap, ndat, tabsiz_nleap;
double d, tjd, tjd_et_1972, tjd_ut, dret[10];
/*
* if tjd_et is before 1 jan 1972 UTC, return UT1
*/
tjd_et_1972 = J1972 + (32.184 + NLEAP_INIT) / 86400.0;
d = swe_deltat_ex(tjd_et, -1, NULL);
tjd_ut = tjd_et - swe_deltat_ex(tjd_et - d, -1, NULL);
tjd_ut = tjd_et - swe_deltat_ex(tjd_ut, -1, NULL);
if (tjd_et < tjd_et_1972) {
swe_revjul(tjd_ut, gregflag, iyear, imonth, iday, &d);
*ihour = (int32) d;
d -= (double) *ihour;
d *= 60;
*imin = (int32) d;
*dsec = (d - (double) *imin) * 60.0;
return;
}
/*
* minimum number of leap seconds since 1972; we may be missing one leap
* second
*/
tabsiz_nleap = init_leapsec();
swe_revjul(tjd_ut-1, SE_GREG_CAL, &iyear2, &imonth2, &iday2, &d);
ndat = iyear2 * 10000 + imonth2 * 100 + iday2;
nleap = 0;
for (i = 0; i < tabsiz_nleap; i++) {
if (ndat <= leap_seconds[i])
break;
nleap++;
}
/* date of potentially missing leapsecond */
if (nleap < tabsiz_nleap) {
i = leap_seconds[nleap];
iyear2 = i / 10000;
imonth2 = (i % 10000) / 100;;
iday2 = i % 100;
tjd = swe_julday(iyear2, imonth2, iday2, 0, SE_GREG_CAL);
swe_revjul(tjd+1, SE_GREG_CAL, &iyear2, &imonth2, &iday2, &d);
swe_utc_to_jd(iyear2,imonth2,iday2, 0, 0, 0, SE_GREG_CAL, dret, NULL);
d = tjd_et - dret[0];
if (d >= 0) {
nleap++;
} else if (d < 0 && d > -1.0/86400.0) {
second_60 = 1;
}
}
/*
* UTC, still unsure about one leap second
*/
tjd = J1972 + (tjd_et - tjd_et_1972) - ((double) nleap + second_60) / 86400.0;
swe_revjul(tjd, SE_GREG_CAL, iyear, imonth, iday, &d);
*ihour = (int32) d;
d -= (double) *ihour;
d *= 60;
*imin = (int32) d;
*dsec = (d - (double) *imin) * 60.0 + second_60;
/*
* For input dates > today:
* If leap seconds table is not up to date, we'd better interpret the
* input time as UT1, not as UTC. How do we find out?
* Check, if delta_t - nleap - 32.184 > 0.9
*/
d = swe_deltat_ex(tjd_et, -1, NULL);
d = swe_deltat_ex(tjd_et - d, -1, NULL);
if (d * 86400.0 - (double) (nleap + NLEAP_INIT) - 32.184 >= 1.0) {
swe_revjul(tjd_et - d, SE_GREG_CAL, iyear, imonth, iday, &d);
*ihour = (int32) d;
d -= (double) *ihour;
d *= 60;
*imin = (int32) d;
*dsec = (d - (double) *imin) * 60.0;
}
if (gregflag == SE_JUL_CAL) {
tjd = swe_julday(*iyear, *imonth, *iday, 0, SE_GREG_CAL);
swe_revjul(tjd, gregflag, iyear, imonth, iday, &d);
}
}
/*
* Input: tjd_ut Julian day number, universal time (UT1).
* gregfalg Calendar flag
* Output: UTC year, month, day, hour, minute, second (decimal).
*
* - Before 1 jan 1972 UTC, output UT1.
* Note: UTC was introduced in 1961. From 1961 - 1971, the length of the
* UTC second was regularly changed, so that UTC remained very close to UT1.
* - From 1972 on, output is UTC.
* - If delta_t - nleap - 32.184 > 1, the output is UT1.
* Note: Like this we avoid errors greater than 1 second in case that
* the leap seconds table (or the Swiss Ephemeris version) has not been
* updated for a long time.
*/
void CALL_CONV swe_jdut1_to_utc(double tjd_ut, int32 gregflag, int32 *iyear, int32 *imonth, int32 *iday, int32 *ihour, int32 *imin, double *dsec)
{
double tjd_et = tjd_ut + swe_deltat_ex(tjd_ut, -1, NULL);
swe_jdet_to_utc(tjd_et, gregflag, iyear, imonth, iday, ihour, imin, dsec);
}

82
swe/src/swedate.h Normal file
View File

@ -0,0 +1,82 @@
/*********************************************************
$Header: /home/dieter/sweph/RCS/swedate.h,v 1.74 2008/06/16 10:07:20 dieter Exp $
version 15-feb-89 16:30
*********************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions
------------------
This file is part of Swiss Ephemeris.
Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author
or distributor accepts any responsibility for the consequences of using it,
or for whether it serves any particular purpose or works at all, unless he
or she says so in writing.
Swiss Ephemeris is made available by its authors under a dual licensing
system. The software developer, who uses any part of Swiss Ephemeris
in his or her software, must choose between one of the two license models,
which are
a) GNU public license version 2 or later
b) Swiss Ephemeris Professional License
The choice must be made before the software developer distributes software
containing parts of Swiss Ephemeris to others, and before any public
service using the developed software is activated.
If the developer choses the GNU GPL software license, he or she must fulfill
the conditions of that license, which includes the obligation to place his
or her whole software project under the GNU GPL or a compatible license.
See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
If the developer choses the Swiss Ephemeris Professional license,
he must follow the instructions as found in http://www.astro.com/swisseph/
and purchase the Swiss Ephemeris Professional Edition from Astrodienst
and sign the corresponding license contract.
The License grants you the right to use, copy, modify and redistribute
Swiss Ephemeris, but only under certain conditions described in the License.
Among other things, the License requires that the copyright notices and
this notice be preserved on all copies.
Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl
The authors of Swiss Ephemeris have no control or influence over any of
the derived works, i.e. over software or services created by other
programmers which use Swiss Ephemeris functions.
The names of the authors or of the copyright holder (Astrodienst) must not
be used for promoting any software, product or service which uses or contains
the Swiss Ephemeris. This copyright notice is the ONLY place where the
names of the authors can legally appear, except in cases where they have
given special permission in writing.
The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used
for promoting such software, products or services.
*/
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _SWEDLL_H
extern EXP32 int swe_date_conversion (
int y , int m , int d , /* year, month, day */
double utime, /* universal time in hours (decimal) */
char c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */
double *tgmt);
extern EXP32 double *swe_julday(
int year, int month, int day, double hour,
int gregflag);
extern EXP32 void swe_revjul (
double jd,
int gregflag,
int *jyear, int *jmon, int *jday, double *jut);
#endif
#ifdef __cplusplus
} /* extern C */
#endif

Some files were not shown because too many files have changed in this diff Show More