mirror of
https://github.com/nasa/trick.git
synced 2025-01-31 00:24:03 +00:00
In Calendar_Date_to_JD and JD_to_Calendar_Date changed float params to double. Refs: #201
This commit is contained in:
parent
26dfb3a000
commit
793530250e
@ -12,11 +12,11 @@ REALTIME = True
|
||||
if REALTIME:
|
||||
execfile("Modified_data/realtime.py")
|
||||
|
||||
JAPANESE = True
|
||||
JAPANESE = False
|
||||
if JAPANESE:
|
||||
execfile("Modified_data/Japanese_labels_alt.py")
|
||||
|
||||
STRIPCHART = True
|
||||
STRIPCHART = False
|
||||
if STRIPCHART:
|
||||
trickView = trick.TrickView()
|
||||
trickView.set_auto_open_file("sun.tv")
|
||||
@ -60,10 +60,10 @@ sun_predictor.sun.observer_offset_from_UTC = -6
|
||||
""" Set local time here. """
|
||||
""" ======================================== """
|
||||
sun_predictor.sun.local_time.year = 2016
|
||||
sun_predictor.sun.local_time.month = 2
|
||||
sun_predictor.sun.local_time.day = 26
|
||||
sun_predictor.sun.local_time.hour = 16
|
||||
sun_predictor.sun.local_time.min = 0
|
||||
sun_predictor.sun.local_time.month = 3
|
||||
sun_predictor.sun.local_time.day = 11
|
||||
sun_predictor.sun.local_time.hour = 17
|
||||
sun_predictor.sun.local_time.min = 10
|
||||
sun_predictor.sun.local_time.sec = 0.0
|
||||
|
||||
trick.stop(86400.0)
|
||||
|
@ -37,8 +37,8 @@ int is_julian_date (int Y, int M, double D);
|
||||
* @param D (IN) Day
|
||||
* @param JD (OUT) Julian date
|
||||
*/
|
||||
int Calendar_Date_to_JD (int Y, int M, float D, double * JD);
|
||||
void JD_to_Calendar_Date (double JD, int *year, int *month, float *day) ;
|
||||
int Calendar_Date_to_JD (int Y, int M, double D, double * JD);
|
||||
void JD_to_Calendar_Date (double JD, int *year, int *month, double *day) ;
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -21,17 +21,27 @@ int is_julian_date (int Y, int M, double D) {
|
||||
}
|
||||
|
||||
/* The algorithm for this function is described on page 60 of ref(1). */
|
||||
int Calendar_Date_to_JD (int Y, int M, float D, double * JD) {
|
||||
int Calendar_Date_to_JD (int Y, int M, double D, double * JD) {
|
||||
|
||||
int A, B;
|
||||
|
||||
/* Is the day valid? */
|
||||
if ((D < 1.0) || (M >= 32.0)) return -1;
|
||||
if ((D < 1.0) || (M >= 32.0)) {
|
||||
printf("%s: Day Invalid.", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Is the month valid? */
|
||||
if ((M < 1) || (M > 12)) return -1;
|
||||
if ((M < 1) || (M > 12)) {
|
||||
printf("%s: Month Invalid.", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Is the year valid? */
|
||||
if ((Y < -4712) || ((Y == -4712) && (D < 1.5))) return -1;
|
||||
if ((Y < -4712) || ((Y == -4712) && (D < 1.5))) {
|
||||
printf("%s: Year Invalid.", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (M <= 2) {
|
||||
Y = Y - 1;
|
||||
@ -54,12 +64,12 @@ int Calendar_Date_to_JD (int Y, int M, float D, double * JD) {
|
||||
}
|
||||
|
||||
/* The algorithm for this function is described on page 63 of ref(1). */
|
||||
void JD_to_Calendar_Date (double JD, int *Year, int *Month, float *Day) {
|
||||
void JD_to_Calendar_Date (double JD, int *Year, int *Month, double *Day) {
|
||||
|
||||
int Z,A,B,C,D,E;
|
||||
int alpha, year, month;
|
||||
float day;
|
||||
float F;
|
||||
double day;
|
||||
double F;
|
||||
|
||||
Z = (int)(JD + 0.5);
|
||||
F = (JD + 0.5) - Z;
|
||||
|
@ -18,11 +18,10 @@ PROGRAMMERS:
|
||||
#define MINUTES_PER_DAY 1440.0
|
||||
#define SECONDS_PER_DAY 86400.0
|
||||
|
||||
int sun_pred_cyclic(
|
||||
SUN_PRED* S,
|
||||
double current_sim_time )
|
||||
{
|
||||
float dday;
|
||||
int sun_pred_cyclic( SUN_PRED* S,
|
||||
double current_sim_time ) {
|
||||
|
||||
double dday;
|
||||
double JDL;
|
||||
double tsec;
|
||||
|
||||
|
@ -6,19 +6,16 @@ PROGRAMMERS:
|
||||
*******************************************************************************/
|
||||
#include "sun_pred.h"
|
||||
|
||||
int sun_pred_default_data(
|
||||
SUN_PRED* S )
|
||||
{
|
||||
int sun_pred_default_data( SUN_PRED* S ) {
|
||||
|
||||
/* (helios/include/sun_pred.d) */
|
||||
S->observer_latitude = 29.55298;
|
||||
S->observer_longitude = 95.09379;
|
||||
S->observer_offset_from_UTC = -6;
|
||||
S->local_time.year = 2006;
|
||||
S->local_time.month = 8;
|
||||
S->local_time.day = 8;
|
||||
S->local_time.hour = 12;
|
||||
S->local_time.min = 0;
|
||||
S->local_time.year = 2016;
|
||||
S->local_time.month = 3;
|
||||
S->local_time.day = 11;
|
||||
S->local_time.hour = 13;
|
||||
S->local_time.min = 25;
|
||||
S->local_time.sec = 0.0;
|
||||
/* Wide characters must use the prefix L when defined in quotes. */
|
||||
S->label_UTC = L"UTC" ;
|
||||
|
@ -13,10 +13,9 @@ PROGRAMMERS:
|
||||
#define MINUTES_PER_DAY 1440.0
|
||||
#define SECONDS_PER_DAY 86400.0
|
||||
|
||||
int sun_pred_init(
|
||||
SUN_PRED* S )
|
||||
{
|
||||
float dday;
|
||||
int sun_pred_init( SUN_PRED* S ) {
|
||||
|
||||
double dday;
|
||||
double JDL;
|
||||
double tsec;
|
||||
|
||||
@ -29,6 +28,7 @@ int sun_pred_init(
|
||||
Calendar_Date_to_JD (S->local_time.year, S->local_time.month, dday, &JDL);
|
||||
|
||||
/* Subtract the local offset from UTC from the JD. */
|
||||
|
||||
S->JD_start = JDL - ( S->observer_offset_from_UTC / HOURS_PER_DAY ) ;
|
||||
S->JD = S->JD_start;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user