Skip to content

Commit 16d1264

Browse files
committed
More fixes, more tweaks
1 parent 4c2d0dc commit 16d1264

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+2345
-985
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@
1111
**/apidoc/**
1212
**/test/data/**
1313
**/*~
14+
README-pruned.md
1415

Doxyfile

+5-4
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ PROJECT_NUMBER = v0.9
5454
# for a project that appears at the top of each page and should give viewer a
5555
# quick idea about the purpose of the project. Keep the description short.
5656

57-
PROJECT_BRIEF = "The Naval Obseervatory NOVAS library made more usable"
57+
PROJECT_BRIEF = "The Naval Obseervatory NOVAS library, made better"
5858

5959
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
6060
# in the documentation. The maximum height of the logo should not exceed 55
@@ -1013,7 +1013,6 @@ FILE_PATTERNS = *.c \
10131013
*.inc \
10141014
*.m \
10151015
*.markdown \
1016-
*.md \
10171016
*.mm \
10181017
*.dox \
10191018
*.doc \
@@ -1031,7 +1030,9 @@ FILE_PATTERNS = *.c \
10311030
*.vhdl \
10321031
*.ucf \
10331032
*.qsf \
1034-
*.ice
1033+
*.ice \
1034+
*.mm \
1035+
README-pruned.md
10351036

10361037
# The RECURSIVE tag can be used to specify whether or not subdirectories should
10371038
# be searched for input files as well.
@@ -1164,7 +1165,7 @@ FILTER_SOURCE_PATTERNS =
11641165
# (index.html). This can be useful if you have a project on for instance GitHub
11651166
# and want to reuse the introduction page also for the doxygen output.
11661167

1167-
USE_MDFILE_AS_MAINPAGE = README.md
1168+
USE_MDFILE_AS_MAINPAGE = README-pruned.md
11681169

11691170
# The Fortran standard specifies that for fixed formatted Fortran code all
11701171
# characters from position 72 are to be considered as comment. A common

Makefile

+18-12
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
include config.mk
88

99

10-
11-
1210
# ===============================================================================
1311
# Specific build targets and recipes below...
1412
# ===============================================================================
@@ -17,9 +15,6 @@ include config.mk
1715
.PHONY: api
1816
api: static shared cio_file dox
1917

20-
.PHONY: all
21-
all: api solsys tools test coverage check
22-
2318
.PHONY: static
2419
static: lib/novas.a
2520

@@ -41,6 +36,21 @@ test: tools
4136
coverage: test
4237
make -C test coverage
4338

39+
.PHONY: all
40+
all: api solsys tools test coverage check
41+
42+
.PHONY: clean
43+
clean:
44+
rm -f README-pruned.md
45+
@make -C tools clean
46+
@make -C test clean
47+
48+
.PHONY: distclean
49+
distclean:
50+
@make -C tools clean
51+
@make -C test clean
52+
53+
4454
# Static library: novas.a
4555
lib/novas.a: $(OBJECTS) | lib
4656
ar -rc $@ $^
@@ -58,14 +68,10 @@ cio_file: lib/novas.a
5868
obj/jplint.o: $(SRC)/jplint.f
5969
gfortran -c -o $@ $<
6070

71+
README-pruned.md: README.md
72+
tail -n +`sed -n '/\# /{=;q;}' $<` $< > $@
6173

62-
clean:
63-
@make -C tools clean
64-
@make -C test clean
65-
66-
distclean:
67-
@make -C tools clean
68-
@make -C test clean
74+
dox: README-pruned.md
6975

7076

7177
# ===============================================================================

README.md

+5-9
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,9 @@
33
![Static Analysis](https://github.com/Smithsonian/SuperNOVAS/actions/workflows/check.yml/badge.svg)
44
![API documentation](https://github.com/Smithsonian/SuperNOVAS/actions/workflows/dox.yml/badge.svg)
55

6-
7-
<img ><br clear="all">
8-
96
<picture>
10-
<!-- User prefers dark mode: -->
117
<source srcset="resources/CfA-logo-dark.png" alt="CfA logo" media="(prefers-color-scheme: dark)"/>
12-
13-
<!-- User prefers light mode: -->
148
<source srcset="resources/CfA-logo.png" alt="CfA logo" media="(prefers-color-scheme: light)"/>
15-
16-
<!-- default: -->
179
<img src="resources/CfA-logo.png" alt="CfA logo" width="400" height="66" align="right"/>
1810
</picture>
1911
<br clear="all">
@@ -196,12 +188,16 @@ code:
196188
resulting in incorrect observed radial velocities being reported for spectroscopic observations.
197189

198190
- Fixes bug in `ira_equinox()` which may return the result for the wrong type of equinox if the the `equinox`
199-
argument was changing from 1 to 0, and back to 1 again with the date being held the same.
191+
argument was changing from 1 to 0, and back to 1 again with the date being held the same. This affected routines
192+
downstream also, such as `sidereal_time()`.
200193

201194
- Fixes accuracy bug in `ecl2equ_vec()`, `equ2ecl_vec()`, `geo_posvel()`, `place()`, and `sidereal_time()`, which
202195
could return a cached value for the other accuracy if the other input parameters are the same as a prior call,
203196
except the accuracy.
204197

198+
- The use of `fmod()` in NOVAS C 3.1 led to the wrong results when the numerator was negative, since `fmod()` is
199+
not the mathematical definition of a modulus. This affected `solsys3.c` for dates prior to J2000. Fixed by using
200+
`remainder()` instead of `fmod()` (throughout the library).
205201

206202
-----------------------------------------------------------------------------
207203

build.mk

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11

2-
# ===============================================================================
3-
# Generic build targets and recipes.
4-
# You can include this in your Makefile
5-
# ===============================================================================
2+
# ============================================================================
3+
# Generic build targets and recipes for SuperNOVAS.
4+
#
5+
# You can include this in your Makefile also.
6+
# ============================================================================
67

78

89
# Regular object files
@@ -18,7 +19,8 @@ dep obj lib bin apidoc:
1819
clean-local:
1920
rm -rf obj dep
2021

21-
# Remove all locally built files, effectively restoring the repo to its pristine state
22+
# Remove all locally built files, effectively restoring the repo to its
23+
# pristine state
2224
.PHONY: distclean-local
2325
distclean-local: clean-local
2426
rm -rf bin lib apidoc

config.mk

+46-24
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
# ===============================================================================
2-
# Generic configuration options for
3-
# You can include this in your Makefile
4-
# ===============================================================================
1+
# ============================================================================
2+
# Generic configuration options for building the SuperNOVAS libraries (both
3+
# static and shared).
4+
#
5+
# You can include this snipplet in your Makefile also.
6+
# ============================================================================
57

68
PROJECT_ROOT = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
79

@@ -15,42 +17,52 @@ CFLAGS = -Os -Wall -Wextra -I$(INC)
1517
# For maximum compatibility with NOVAS C 3.1, uncomment the line below
1618
#CFLAGS += -DCOMPAT=1
1719

18-
# You can set the default CIO locator file to use depending on where you installed it.
19-
# By default, the library will assume '/usr/share/novas/cio_ra.bin', or simply 'cio_ra.bin'
20-
# if the COMPAT flag is set to a nonzero value (above). Some other good locations
21-
# for this file may be in '/usr/local/share/novas', or '/opt/share/novas' for system-wide
22-
# availability, or in '$(HOME)/.local/share/novas' for user-specific installation.
20+
# You can set the default CIO locator file to use depending on where you
21+
# installed it. By default, the library will assume
22+
# '/usr/share/novas/cio_ra.bin', or else 'cio_ra.bin' if the COMPAT flag is
23+
# set to a nonzero value (above). Some other good locations for this file may
24+
# be in '/usr/local/share/novas', or '/opt/share/novas' for system-wide
25+
# availability, or in '$(HOME)/.local/share/novas' for user-specific
26+
# installation.
2327
#
2428
#CFLAGS += -DDEFAULT_CIO_LOCATOR_FILE="/user/share/novas/cio_ra.bin"
2529

26-
# Whether to build into the library specific versions of solarsystem()
30+
# Whether to build into the library planet_eph_manager() routines provided in
31+
# solsys1.c
2732
BUILTIN_SOLSYS1 = 1
33+
34+
# Whether to build into the library planet_jplint() routines provided in
35+
# solsys2.c.
2836
#BUILTIN_SOLSYS2 = 1
37+
38+
# Whether to build into the library earth_sun_calc() routines provided in
39+
# solsys3.c
2940
BUILTIN_SOLSYS3 = 1
3041

31-
# Compile library with a default solarsystem() implementation, which will be used
32-
# only if the application does not define another implementation via calls to the
33-
# to set_solarsystem() type functions.
42+
# Whether to build into the library planet_ephem_reader() routines provided in
43+
# solsys3.c
44+
BUILTIN_SOLSYS_EPHEM = 1
45+
46+
# Compile library with a default solarsystem() implementation. If you want to
47+
# use your library with your own solarsystem() implementation, you should
48+
# not set this option. In that case you must always provide a solarsystem()
49+
# implementation when linking your application against this library.
3450
DEFAULT_SOLSYS = 3
3551

3652
# Compile library with a default readeph() implementation, which will be used
37-
# only if the application does not define another implementation via calls to the
38-
# to set_ephem_reader() function.
53+
# only if the application does not define another implementation via calls to
54+
# the to set_ephem_reader() function.
3955
DEFAULT_READEPH = readeph0
4056

41-
# Compiler and linker options etc.
42-
ifeq ($(BUILD_MODE),debug)
43-
CFLAGS += -g
44-
endif
45-
4657
# cppcheck options
47-
CHECKOPTS = --enable=performance,warning,portability,style --language=c --error-exitcode=1
58+
CHECKOPTS = --enable=performance,warning,portability,style --language=c \
59+
--error-exitcode=1
4860

49-
# ===============================================================================
61+
# ============================================================================
5062
# END of user config section.
5163
#
5264
# Below are some generated constants based on the one that were set above
53-
# ===============================================================================
65+
# ============================================================================
5466

5567
ifeq ($(DEFAULT_SOLSYS), 1)
5668
BUILTIN_SOLSYS1 = 1
@@ -84,12 +96,22 @@ ifeq ($(BUILTIN_SOLSYS3), 1)
8496
CFLAGS += -DBUILTIN_SOLSYS3=1
8597
endif
8698

99+
ifeq ($(BUILTIN_SOLSYS_EPHEM), 1)
100+
SOURCES += $(SRC)/solsys-ephem.c
101+
endif
102+
87103
ifdef (DEFAULT_READEPH)
88104
SOURCES += $(SRC)/$(DEFAULT_READEPH).c
89105
CFLAGS += -DDEFAULT_READEPH=1
90106
endif
91107

108+
109+
# Compiler and linker options etc.
110+
ifeq ($(BUILD_MODE),debug)
111+
CFLAGS += -g
112+
endif
113+
114+
# Generate a list of object (obj/*.o) files from the input sources
92115
OBJECTS := $(subst $(SRC),obj,$(SOURCES))
93116
OBJECTS := $(subst .c,.o,$(OBJECTS))
94117

95-

include/novas.h

+21-11
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ enum novas_observer_place {
227227
*/
228228
enum novas_reference_system {
229229
NOVAS_GCRS = 0, ///< Geocentric Celestial Reference system. Essentially the same as ICRS, but with velocities referenced to Earth's orbiting frame.
230-
NOVAS_TOD, ///< True equinox Of Date: dynamical system of the true equator, with its origin at the true equinox (pre IAU 2006 system).
231-
NOVAS_CIRS, ///< Celestial Intermediate Reference System: dynamical system of the true equator, with its origin at the CIO (preferred since IAU 2006)
230+
NOVAS_TOD, ///< True equinox Of Date: dynamical system of the true equator, with its origin at the true equinox (pre IAU 2006 system).
231+
NOVAS_CIRS, ///< Celestial Intermediate Reference System: dynamical system of the true equator, with its origin at the CIO (preferred since IAU 2006)
232232
NOVAS_ICRS ///< International Celestiual Reference system. The equatorial system fixed to the frame of distant quasars.
233233
};
234234

@@ -358,8 +358,12 @@ enum novas_cio_location_type {
358358
* @sa WOBBLE_ITRS_TO_TIRS
359359
*/
360360
enum novas_wobble_direction {
361-
WOBBLE_ITRS_TO_TIRS = 0, ///< use for wobble() to change from ITRS to TIRS.
362-
WOBBLE_TIRS_TO_ITRS ///< to use for wobble() to change from TIRS to ITRS. (You can use any non-zero value as well.)
361+
WOBBLE_ITRS_TO_PEF = 0, ///< use for wobble() to change from ITRS (actual rotating Earth) to Pseudo Earth Fixed (PEF).
362+
/**
363+
* use for wobble() to change from Pseudo Earth Fixed (PEF) to ITRS (actual rotating Earth).
364+
* (You can use any non-zero value as well.)
365+
*/
366+
WOBBLE_PEF_TO_ITRS
363367
};
364368

365369
/**
@@ -726,24 +730,30 @@ int make_on_surface(double latitude, double longitude, double height, double tem
726730
int make_in_space(const double *sc_pos, const double *sc_vel, in_space *obs_space);
727731

728732
// Added API in SuperNOVAS
729-
int calc_pos(const object *source, const observer *obs, double jd_tt, double ut1_to_tt, enum novas_reference_system system,
730-
enum novas_accuracy accuracy, sky_pos *pos);
731733

732-
int calc_frame_pos(const object *source, const astro_frame *frame, enum novas_accuracy accuracy, sky_pos *pos);
734+
int place_in_frame(const object *source, const astro_frame *frame, enum novas_accuracy accuracy, sky_pos *pos);
733735

734-
int calc_star_pos(const cat_entry *star, const observer *obs, double jd_tt, double ut1_to_tt, enum novas_reference_system system,
736+
int place_star(const cat_entry *star, const observer *obs, double jd_tt, double ut1_to_tt, enum novas_reference_system system,
735737
enum novas_accuracy accuracy, sky_pos *pos);
736738

737-
int calc_icrs_pos(const object *source, double jd_tt, enum novas_accuracy accuracy, sky_pos *pos);
739+
int place_icrs(const object *source, double jd_tt, enum novas_accuracy accuracy, sky_pos *pos);
740+
741+
int place_gcrs(const object *source, double jd_tt, enum novas_accuracy accuracy, sky_pos *pos);
742+
743+
int place_cirs(const object *source, double jd_tt, enum novas_accuracy accuracy, sky_pos *pos);
738744

739-
int calc_gcrs_pos(const object *source, double jd_tt, enum novas_accuracy accuracy, sky_pos *pos);
745+
int place_tod(const object *source, double jd_tt, enum novas_accuracy accuracy, sky_pos *pos);
740746

741-
int calc_dynamical_pos(const object *source, double jd_tt, enum novas_accuracy accuracy, sky_pos *pos);
742747

743748
int cio_set_locator_file(const char *filename);
744749

745750
int nutation_set_lp(novas_nutate_func f);
746751

747752
#include "solarsystem.h"
748753

754+
755+
756+
757+
758+
749759
#endif /* _NOVAS_ */

0 commit comments

Comments
 (0)