NASA Logo
Ocean Color Science Software

ocssw V2022
gha2000.c
Go to the documentation of this file.
1 #include "sun2000.h"
2 #include "nav.h"
3 extern double dpsi, eps;
4 extern int nutime;
5 void gha2000(int iyr, double day, double* gha) {
6  const static int imon = 1;
7  // Compute days since J2000
8  int iday = (int)day;
9  double fday = day - iday;
10  int jday = jd(iyr, imon, iday);
11  double t = jday - 2451545.5e0 + fday;
12  // Compute Greenwich Mean Sidereal Time (degrees)
13  double gmst = 100.4606184e0 + 0.9856473663e0 * t + 2.908e-13 * t * t;
14  // Check if need to compute nutation correction for this day
15  int nt = (int)t;
16  if (nt != nutime) {
17  nutime = nt;
18  double xls, gs, xlm, omega;
19  ephparms(t, &xls, &gs, &xlm, &omega);
20  nutate(t, xls, gs, xlm, omega, &dpsi, &eps);
21  }
22  // Include apparent time correction and time-of-day
23  *gha = gmst + dpsi * cos(eps / radeg) + fday * 360.e0;
24  *gha = dmod(*gha, 360.e0);
25  if (*gha < 0.e0)
26  *gha = *gha + 360.e0;
27 }
data_t t[NROOTS+1]
Definition: decode_rs.h:77
int nutime
Definition: sun2000.c:7
int32_t day
int32_t jday(int16_t i, int16_t j, int16_t k)
Converts a calendar date to the corresponding Julian day starting at noon on the calendar date....
Definition: jday.c:14
double dpsi
Definition: sun2000.c:6
double eps
Definition: gha2000.c:3
data_t omega[NROOTS+1]
Definition: decode_rs.h:77
short int nutate(double tjd, short int fn1, double *pos, double *pos2)
void gha2000(int iyr, double day, double *gha)
This subroutine computes the Greenwich hour angle in degrees for the input time. It uses the model re...
Definition: gha2000.c:5
double dmod(double a, double p)
Description:
Definition: nav.c:23
def jd(i, j, k)
Definition: jd.py:1
int32_t iyr
Definition: atrem_corl1.h:161
int ephparms(double t, double &xls, double &gs, double &xlm, double &omega)