39 #define RADIUS 6378.137
40 #define FL 1.0/298.257
46 #define MAXOCARR 10000
51 static int32_t msec_start;
54 static int16_t year,
day, nline,
npix, sline;
56 static int16_t maxday;
57 static float solz1, sola1, senz1, sena1;
58 static float *
lon, *
lat, *senz, *sena, *solz, *sola;
61 static int32_t scansPerScene;
62 static int32_t linesPerScan;
63 static int16_t *tilt_flag;
65 static float *inst_temp;
66 static int16_t *miss_qual;
67 static int16_t num_tab;
68 static int32_t extr_line_offset = 0;
69 static int16_t *start_scan;
70 static int16_t last_table = 0;
71 static int32_t samp_start[8];
72 static int32_t samp_edges[8];
73 static int16_t sample_table[3][8][2][400][2];
96 int32_t
recnum, int16_t npix, int32_t spix, int32_t tilt,
98 int16_t sample_table[3][8][2][400][2], int32_t scansPerScene,
107 static float time_dep [
NBND][
NSEG][3];
109 static float unit_conv = 1.0e-1;
110 static int firstCall = 1;
111 static double refjsec;
112 static int32_t refyear = 1996;
113 static int refday = 306;
116 int i,
j, idet, iscn, ign, itilt,
mside, igscnmod, rdet;
117 float eta, Lt, A, tcorr;
120 if (jsec >= 854769600.)
125 char name [H4_MAX_NC_NAME] =
"";
126 char sdsname[H4_MAX_NC_NAME] =
"";
131 int32_t dims[H4_MAX_VAR_DIMS];
133 int32_t
start[3] = {0, 0, 0};
139 "-E %s Line %d: No calibration file specified.\n",
145 printf(
"Loading caltable: %s\n",
file);
148 sd_id = SDstart(
file, DFACC_RDONLY);
150 fprintf(
stderr,
"-E- %s line %d: SDstart(%s, %d) failed.\n",
151 __FILE__, __LINE__,
file, DFACC_RDONLY);
155 strcpy(sdsname,
"basic_offset");
156 sds_id = SDselect(sd_id, SDnametoindex(sd_id, sdsname));
160 printf(
"-E- %s Line %d: Error reading SDS %s from %s.\n",
161 __FILE__, __LINE__, sdsname,
file);
164 status = SDendaccess(sds_id);
167 strcpy(sdsname,
"calib_coeff_gain");
168 sds_id = SDselect(sd_id, SDnametoindex(sd_id, sdsname));
170 status = SDreaddata(sds_id,
start,
NULL, dims, (VOIDP) calib_coeff_gain);
172 printf(
"-E- %s Line %d: Error reading SDS %s from %s.\n",
173 __FILE__, __LINE__, sdsname,
file);
176 status = SDendaccess(sds_id);
179 strcpy(sdsname,
"det_norm_slope");
180 sds_id = SDselect(sd_id, SDnametoindex(sd_id, sdsname));
182 status = SDreaddata(sds_id,
start,
NULL, dims, (VOIDP) det_norm_slope);
184 printf(
"-E- %s Line %d: Error reading SDS %s from %s.\n",
185 __FILE__, __LINE__, sdsname,
file);
188 status = SDendaccess(sds_id);
191 strcpy(sdsname,
"det_norm_offset");
192 sds_id = SDselect(sd_id, SDnametoindex(sd_id, sdsname));
194 status = SDreaddata(sds_id,
start,
NULL, dims, (VOIDP) det_norm_offset);
196 printf(
"-E- %s Line %d: Error reading SDS %s from %s.\n",
197 __FILE__, __LINE__, sdsname,
file);
200 status = SDendaccess(sds_id);
203 strcpy(sdsname,
"L_Border");
204 sds_id = SDselect(sd_id, SDnametoindex(sd_id, sdsname));
208 printf(
"-E- %s Line %d: Error reading SDS %s from %s.\n",
209 __FILE__, __LINE__, sdsname,
file);
212 status = SDendaccess(sds_id);
215 strcpy(sdsname,
"tilt_refl");
216 sds_id = SDselect(sd_id, SDnametoindex(sd_id, sdsname));
220 printf(
"-E- %s Line %d: Error reading SDS %s from %s.\n",
221 __FILE__, __LINE__, sdsname,
file);
224 status = SDendaccess(sds_id);
227 strcpy(sdsname,
"time_dep");
228 sds_id = SDselect(sd_id, SDnametoindex(sd_id, sdsname));
233 printf(
"-E- %s Line %d: Error reading SDS %s from %s.\n",
234 __FILE__, __LINE__, sdsname,
file);
237 status = SDendaccess(sds_id);
242 refjsec =
yds2unix(refyear, refday, (
double) 0.0);
251 if (
tilt < -10) itilt = 0;
252 if (
tilt > 10) itilt = 2;
261 rdet = sample_table[itilt][
i][
mside][subpix][1];
262 idet = (rdet + 200) % 10;
266 if (rdet < -9) igscnmod -= 2;
267 if (rdet >= -9 && rdet < 0) igscnmod -= 1;
268 if (rdet >= 10 && rdet < 20) igscnmod += 1;
269 if (rdet >= 20) igscnmod += 2;
271 if (idet < 0.) idet += 9;
272 if (idet < 0 || idet > 9) {
273 printf(
"-W- idet %d outside bounds [0,9]\n", idet);
276 if (iscn < 0 || iscn > scansPerScene - 1) {
277 printf(
"-W- iscn %d outside bounds [0,%d]\n", iscn, scansPerScene);
279 }
else if (l1acnts[
i][
j] == 0) {
281 }
else if (inst_temp[iscn] > 30) {
282 printf(
"inst_temp: %8.5f\n", inst_temp[iscn]);
284 }
else if (iscn + igscnmod < 0 || iscn + igscnmod > scansPerScene - 1) {
288 ign = gainset[iscn + igscnmod];
289 eta = tilt_refl[
i][itilt];
291 Lt = unit_conv * (l1acnts[
i][
j] - basic_offset[
i][idet][ign]) /
292 calib_coeff_gain[
i][4][ign];
294 if (Lt <= L_Border[
i][idet]) {
295 A = det_norm_slope[
i][idet] * Lt + det_norm_offset[
i][idet];
297 A = det_norm_slope[
i][idet] * L_Border[
i][idet] +
298 det_norm_offset[
i][idet];
302 tcorr = time_dep[
i][segment][1]*(jsec - refjsec) + time_dep[
i][segment][0];
303 l1brads[
j][
i] = (A * Lt / eta) * tcorr;
332 int32_t linesPerScene;
336 int32_t sds_index, sds_id;
337 int32_t dims[H4_MAX_VAR_DIMS];
356 printf(
"-E- %s: Error reading control-point column dimension.\n",
363 linesPerScene = scansPerScene * linesPerScan;
373 printf(
"File is Level-1A extract starting on line %d.\n", extr_line_offset + 1);
375 extr_line_offset = 0;
379 nline = linesPerScene;
385 printf(
"-E- %s: Number of scene lines: %d, greater than array allocation: %d.\n",
386 "openl1_read_octs_hdf", nline,
MAXOCLIN);
394 printf(
"-E- %s: Number of scan pixels: %d, greater than array allocation: %d.\n",
401 lon = (
float *) calloc(
npix*nline,
sizeof (
float));
402 lat = (
float *) calloc(
npix*nline,
sizeof (
float));
403 senz = (
float *) calloc(
npix*nline,
sizeof (
float));
404 sena = (
float *) calloc(
npix*nline,
sizeof (
float));
405 solz = (
float *) calloc(
npix*nline,
sizeof (
float));
406 sola = (
float *) calloc(
npix*nline,
sizeof (
float));
420 for (
i = 0;
i < scansPerScene;
i++) {
421 for (
j = 0;
j < linesPerScan;
j++) {
422 msec_temp2[
i * linesPerScan +
j] = msec_temp1[
i];
425 msec_start = msec_temp2[0];
427 for (
i = sline;
i < (sline + nline);
i++) {
462 tilt_flag = (int16_t *) calloc(scansPerScene,
sizeof (int16_t));
464 inst_temp = (
float *) calloc(4 * scansPerScene,
sizeof (
float));
466 gain = (int16_t *) calloc(8 * scansPerScene,
sizeof (int16_t));
468 miss_qual = (int16_t *) calloc(scansPerScene,
sizeof (int16_t));
473 start_scan = (int16_t *) calloc(num_tab,
sizeof (int16_t));
476 for (
i = 0;
i < num_tab;
i++) {
477 if ((extr_line_offset + sline) / linesPerScan < start_scan[
i]) {
483 samp_start[0] = last_table;
496 sds_index = SDnametoindex(
fileID,
"samp_table");
497 sds_id = SDselect(
fileID, sds_index);
499 status = SDreaddata(sds_id, samp_start,
NULL, samp_edges, (VOIDP) sample_table);
516 int32_t sds_index, sds_id;
520 int32_t nwave =
l1rec->l1file->nbands;
525 int32_t dims[H4_MAX_VAR_DIMS];
527 char name [H4_MAX_NC_NAME] =
"";
528 static int FirstCall = 1;
529 int current_scan =
recnum / linesPerScan;
536 static int dayIncrimented = 0;
538 if(!dayIncrimented) {
549 if(!dayIncrimented) {
572 sds_index = SDnametoindex(
fileID,
"l1a_data");
573 sds_id = SDselect(
fileID, sds_index);
585 scan = (
recnum + extr_line_offset) / linesPerScan;
590 if (tilt_flag[current_scan] == 1) tilt_deg = +20;
591 if (tilt_flag[current_scan] == 2) tilt_deg = 0;
592 if (tilt_flag[current_scan] == 4) tilt_deg = -20;
595 if (FirstCall == 1 &&
recnum > 0) {
596 for (
i = 0;
i < num_tab;
i++) {
597 if (
scan / linesPerScan < start_scan[
i]) {
606 if (
scan >= start_scan[last_table + 1]) {
608 samp_start[0] = last_table;
610 sds_index = SDnametoindex(
fileID,
"samp_table");
611 sds_id = SDselect(
fileID, sds_index);
613 status = SDreaddata(sds_id, samp_start,
NULL, samp_edges, (VOIDP) sample_table);
618 gain, inst_temp, sample_table, scansPerScene,
623 "-E- %s line %d: Error applying calibration table \"%s\".\n",
624 __FILE__, __LINE__, cal_path);
646 dataarr[
i][
j] = dataarr[
i][
j] & 8191;
651 scanarr[
i][0] = (
float) dataarr[0][
i] * m[0] +
b[0];
652 scanarr[
i][1] = (
float) dataarr[1][
i] * m[1] +
b[1];
653 scanarr[
i][2] = (
float) dataarr[2][
i] * m[2] +
b[2];
654 scanarr[
i][3] = (
float) dataarr[3][
i] * m[3] +
b[3];
655 scanarr[
i][4] = (
float) dataarr[4][
i] * m[4] +
b[4];
656 scanarr[
i][5] = (
float) dataarr[5][
i] * m[5] +
b[5];
657 scanarr[
i][6] = (
float) dataarr[6][
i] * m[6] +
b[6];
658 scanarr[
i][7] = (
float) dataarr[7][
i] * m[7] +
b[7];
662 for (ip = 0; ip <
npix; ip++) {
665 if (isnan(
l1rec->solz[ip]))
666 l1rec->navfail[ip] = 1;
668 for (iw = 0; iw < nwave; iw++) {
670 l1rec->Lt [ip * nwave + ib] = scanarr[ip][iw];
673 if (
gain[iw * scansPerScene + current_scan] > 0)
674 l1rec->navwarn[ip] = 1;
675 if (miss_qual[current_scan] > 0)
676 l1rec->navwarn[ip] = 1;
677 if (dataarr[iw][ip] > 1022)
679 if (scanarr[ip][iw] <= 0.0)
680 l1rec->navfail[ip] = 1;
701 float *inlon, *inlat;
702 float *insolz, *insola;
703 float *insenz, *insena;
710 float iusun[3], ipos[3];
713 int eline, nlon, nlat;
718 float *x_ctl_ll, *y_ctl_ll, *z_ctl_ll;
719 float *x_ctl_sol, *y_ctl_sol, *z_ctl_sol;
720 float *x_ctl_sen, *y_ctl_sen, *z_ctl_sen;
721 float * in_ptr[3][3], *out_ptr[3][2];
723 inlon = (
float *) calloc(ncol*scansPerScene,
sizeof (
float));
724 inlat = (
float *) calloc(ncol*scansPerScene,
sizeof (
float));
725 insolz = (
float *) calloc(ncol*scansPerScene,
sizeof (
float));
726 insola = (
float *) calloc(ncol*scansPerScene,
sizeof (
float));
727 insenz = (
float *) calloc(ncol*scansPerScene,
sizeof (
float));
728 insena = (
float *) calloc(ncol*scansPerScene,
sizeof (
float));
729 usun = (
float *) calloc(3 * scansPerScene,
sizeof (
float));
730 pos = (
float *) calloc(3 * scansPerScene,
sizeof (
float));
731 row = (
int *) calloc(scansPerScene,
sizeof (
int));
732 pxl = (int16_t *) calloc(ncol,
sizeof (int16_t));
733 xctl = (
float *) calloc(ncol,
sizeof (
float));
734 indx = (
int *) calloc(scansPerScene,
sizeof (
int));
735 yctl = (
float *) calloc(scansPerScene,
sizeof (
float));
736 in1 = (
float *) calloc(scansPerScene,
sizeof (
float));
737 in2 = (
float *) calloc(scansPerScene,
sizeof (
float));
744 rdSDS(
fileID,
"sun_ref", 0, 0, 0, 0, (VOIDP) usun);
748 for (
i = 0;
i < ncol;
i++) {
753 for (
i = 0;
i < scansPerScene;
i++) {
755 for (
j = 0;
j < 3;
j++) {
756 usun_sum = usun_sum + usun[3 *
i +
j] * usun[3 *
i +
j];
758 for (
j = 0;
j < 3;
j++) {
759 usun[3 *
i +
j] = usun[3 *
i +
j] / sqrt(usun_sum);
765 printf(
"scansPerScene,ncol = %d %d \n", scansPerScene, ncol);
766 for (
i = 0;
i < ncol;
i++) {
769 for (
i = 0;
i < scansPerScene;
i++) {
770 row[
i] =
i * linesPerScan + det;
774 eline = sline + nline - 1;
776 if (nline < linesPerScan * scansPerScene) {
778 }
else nlat = linesPerScan*scansPerScene;
780 for (
i = 0;
i < nlon;
i++) {
783 for (
i = 0;
i < nlat;
i++) {
789 for (
i = 0;
i < nlat;
i++) {
790 for (
j = 0;
j < scansPerScene;
j++) {
791 if (ilat[
i] == row[
j]) {
798 for (
i = 0;
i < nlat / linesPerScan;
i++) {
806 printf(
"Computing view angles at input control points\n");
807 for (
i = 0;
i < scansPerScene;
i++) {
808 for (
j = 0;
j < ncol;
j++) {
809 for (
k = 0;
k < 3;
k++) {
811 iusun[
k] = usun[3 *
i +
k];
814 insolz[
i * ncol +
j] = solz1;
815 insola[
i * ncol +
j] = sola1;
816 insenz[
i * ncol +
j] = senz1;
817 insena[
i * ncol +
j] = sena1;
823 x_ctl_ll = (
float *) calloc(ncol*scansPerScene,
sizeof (
float));
824 y_ctl_ll = (
float *) calloc(ncol*scansPerScene,
sizeof (
float));
825 z_ctl_ll = (
float *) calloc(ncol*scansPerScene,
sizeof (
float));
827 x_ctl_sol = (
float *) calloc(ncol*scansPerScene,
sizeof (
float));
828 y_ctl_sol = (
float *) calloc(ncol*scansPerScene,
sizeof (
float));
829 z_ctl_sol = (
float *) calloc(ncol*scansPerScene,
sizeof (
float));
831 x_ctl_sen = (
float *) calloc(ncol*scansPerScene,
sizeof (
float));
832 y_ctl_sen = (
float *) calloc(ncol*scansPerScene,
sizeof (
float));
833 z_ctl_sen = (
float *) calloc(ncol*scansPerScene,
sizeof (
float));
836 for (
i = 0;
i < scansPerScene;
i++) {
837 for (
j = 0;
j < ncol;
j++) {
838 inlon[
i * ncol +
j] = inlon[
i * ncol +
j] /
RADEG;
839 inlat[
i * ncol +
j] = inlat[
i * ncol +
j] /
RADEG;
841 x_ctl_ll[
i * ncol +
j] = cos(inlat[
i * ncol +
j]) * cos(inlon[
i * ncol +
j]);
842 y_ctl_ll[
i * ncol +
j] = cos(inlat[
i * ncol +
j]) * sin(inlon[
i * ncol +
j]);
843 z_ctl_ll[
i * ncol +
j] = sin(inlat[
i * ncol +
j]);
846 insola[
i * ncol +
j] = insola[
i * ncol +
j] /
RADEG;
847 insolz[
i * ncol +
j] = insolz[
i * ncol +
j] /
RADEG;
849 x_ctl_sol[
i * ncol +
j] = cos(insolz[
i * ncol +
j]) * cos(insola[
i * ncol +
j]);
850 y_ctl_sol[
i * ncol +
j] = cos(insolz[
i * ncol +
j]) * sin(insola[
i * ncol +
j]);
851 z_ctl_sol[
i * ncol +
j] = sin(insolz[
i * ncol +
j]);
854 insena[
i * ncol +
j] = insena[
i * ncol +
j] /
RADEG;
855 insenz[
i * ncol +
j] = insenz[
i * ncol +
j] /
RADEG;
857 x_ctl_sen[
i * ncol +
j] = cos(insenz[
i * ncol +
j]) * cos(insena[
i * ncol +
j]);
858 y_ctl_sen[
i * ncol +
j] = cos(insenz[
i * ncol +
j]) * sin(insena[
i * ncol +
j]);
859 z_ctl_sen[
i * ncol +
j] = sin(insenz[
i * ncol +
j]);
863 in_ptr[0][0] = x_ctl_ll;
864 in_ptr[0][1] = y_ctl_ll;
865 in_ptr[0][2] = z_ctl_ll;
866 in_ptr[1][0] = x_ctl_sol;
867 in_ptr[1][1] = y_ctl_sol;
868 in_ptr[1][2] = z_ctl_sol;
869 in_ptr[2][0] = x_ctl_sen;
870 in_ptr[2][1] = y_ctl_sen;
871 in_ptr[2][2] = z_ctl_sen;
875 out_ptr[1][0] = sola;
876 out_ptr[1][1] = solz;
877 out_ptr[2][0] = sena;
878 out_ptr[2][1] = senz;
885 printf(
"Interpolating rows for longitude/azimuth\n");
886 spl_aux = (
float *) calloc(ncol,
sizeof (
float));
888 for (
i = 0;
i < scansPerScene;
i++) {
889 jout = row[
i] - sline;
890 if ((row[
i] >= sline) && (row[
i] <= eline)) {
891 for (l = 0; l < 3; l++) {
892 spline(xctl, in_ptr[l][0] +
i*ncol, ncol, 1e30, 1e30, spl_aux);
893 for (
j = 0;
j < nlon;
j++)
894 splint(xctl, in_ptr[l][0] +
i * ncol, spl_aux, ncol,
895 (
float) ilon[
j], out_ptr[l][0] + jout *
npix +
j);
897 spline(xctl, in_ptr[l][1] +
i*ncol, ncol, 1e30, 1e30, spl_aux);
898 for (
j = 0;
j < nlon;
j++)
899 splint(xctl, in_ptr[l][1] +
i * ncol, spl_aux, ncol,
900 (
float) ilon[
j], out_ptr[l][1] + jout *
npix +
j);
909 printf(
"Interpolating columns for longitude/azimuth\n");
910 spl_aux = (
float *) calloc(nlat / linesPerScan,
sizeof (
float));
912 for (
i = 0;
i < nlon;
i++) {
913 for (l = 0; l < 3; l++) {
914 for (
k = 0;
k < nlat / linesPerScan;
k++) {
915 in1[
k] = *(out_ptr[l][0] + indx[
k] *
npix +
i);
916 in2[
k] = *(out_ptr[l][1] + indx[
k] *
npix +
i);
918 spline(yctl, in1, nlat / linesPerScan, 1e30, 1e30, spl_aux);
919 for (
j = 0;
j < nlat;
j++)
920 splint(yctl, in1, spl_aux, nlat / linesPerScan, (
float)
j, (
float *) &out1[
j]);
922 spline(yctl, in2, nlat / linesPerScan, 1e30, 1e30, spl_aux);
923 for (
j = 0;
j < nlat;
j++)
924 splint(yctl, in2, spl_aux, nlat / linesPerScan, (
float)
j, (
float *) &out2[
j]);
926 for (
j = 0;
j < nlat;
j++) {
927 *(out_ptr[l][0] +
j *
npix +
i) = atan2(out2[
j], out1[
j]) *
RADEG;
928 if (l >= 1 && *(out_ptr[l][0] +
j *
npix +
i) < 0) {
929 *(out_ptr[l][0] +
j *
npix +
i) += 360;
938 printf(
"Interpolating rows for latitude/zenith\n");
939 spl_aux = (
float *) calloc(ncol,
sizeof (
float));
941 for (
i = 0;
i < scansPerScene;
i++) {
942 jout = row[
i] - sline;
943 if ((row[
i] >= sline) && (row[
i] <= eline)) {
944 for (l = 0; l < 3; l++) {
945 spline(xctl, in_ptr[l][2] +
i*ncol, ncol, 1e30, 1e30, spl_aux);
946 for (
j = 0;
j < nlon;
j++)
947 splint(xctl, in_ptr[l][2] +
i * ncol, spl_aux, ncol,
948 (
float) ilon[
j], out_ptr[l][1] + jout *
npix +
j);
957 printf(
"Interpolating columns for latitude/zenith\n");
958 spl_aux = (
float *) calloc(nlat / linesPerScan,
sizeof (
float));
960 for (
i = 0;
i < nlon;
i++) {
961 for (l = 0; l < 3; l++) {
962 for (
k = 0;
k < nlat / linesPerScan;
k++) {
963 in1[
k] = *(out_ptr[l][1] + indx[
k] *
npix +
i);
965 spline(yctl, in1, nlat / linesPerScan, 1e30, 1e30, spl_aux);
966 for (
j = 0;
j < nlat;
j++)
967 splint(yctl, in1, spl_aux, nlat / linesPerScan, (
float)
j, (
float *) &out1[
j]);
969 for (
j = 0;
j < nlat;
j++) {
970 *(out_ptr[l][1] +
j *
npix +
i) = asin(out1[
j]) *
RADEG;
1036 float up[3], upxy, ea[3], no[3];
1038 float gvec[3], scvec[3], senl[3], sunl[3];
1041 rlon = lon1 *
PI / 180.0;
1042 rlat = lat1 *
PI / 180.0;
1048 up[0] = cos(rlat) * cos(rlon);
1049 up[1] = cos(rlat) * sin(rlon);
1051 upxy = sqrt(up[0] * up[0 ] + up[1] * up[1]);
1052 ea[0] = -up[1] / upxy;
1053 ea[1] = up[0] / upxy;
1056 no[0] = up[1] * ea[2] - ea[1] * up[2];
1057 no[1] = up[2] * ea[0] - ea[2] * up[0];
1058 no[2] = up[0] * ea[1] - ea[0] * up[1];
1065 phi = atan(tan(rlat)*(1 -
FL)*(1 -
FL));
1067 R =
RADIUS * (1 -
FL) / sqrt(1 - (2 -
FL) *
FL * (cos(phi) * cos(phi)));
1068 gvec[0] =
R * cos(phi) * cos(rlon);
1069 gvec[1] =
R * cos(phi) * sin(rlon);
1070 gvec[2] =
R * sin(phi);
1071 for (
i = 0;
i < 3;
i++) {
1072 scvec[
i] =
pos[
i] - gvec[
i];
1077 for (
i = 0;
i < 3;
i++) {
1082 for (
i = 0;
i < 3;
i++) {
1085 for (
j = 0;
j < 3;
j++) {
1086 senl[
i] = senl[
i] + rmat[
i][
j] * scvec[
j];
1087 sunl[
i] = sunl[
i] + rmat[
i][
j] * usun[
j];
1092 solz1 =
RADEG * atan(sqrt(sunl[0] * sunl[0] + sunl[1] * sunl[1]) / sunl[2]);
1093 if (solz1 < 0.0) solz1 += 180.0;
1096 sola1 =
RADEG * (atan2(sunl[0], sunl[1]));
1101 sola1 = sola1 + 360.0;
1105 senz1 =
RADEG * atan(sqrt(senl[0] * senl[0] + senl[1] * senl[1]) / senl[2]);
1106 if (senz1 < 0.0) senz1 += 180.0;
1108 sena1 =
RADEG * (atan2(senl[0], senl[1]));
1113 sena1 = sena1 + 360.0;
1130 if ((yr % 4) == 0) {
1133 if ((yr % 100) == 0) {
1136 if ((yr % 400) == 0) {
1168 int year, month,
day, hour,
min;
1171 sscanf(
time,
"%4d%2d%2d %2d:%2d:%lf", &year, &month, &
day, &hour, &
min, &sec);
1172 sec = sec + 60. *
min + 3600. * hour;