Commit d3c8135b authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Renamed juldate_to_seconds() to julianDateToSeconds().

parent 6e8603ee
......@@ -2217,8 +2217,8 @@ get_branch_times(list_t *kvl, int calendar, char *time_units)
childstartdate = juldate_encode(calendar, childsdate, childstime);
/* If time unit is always "days since.." */
branch_time[0] = JulianDateo_seconds(julianDateSub(parentbranchdate, parentstartdate)) / 86400;
branch_time[1] = JulianDateo_seconds(julianDateSub(parentbranchdate, childstartdate)) / 86400;
branch_time[0] = julianDateToSeconds(julianDateSub(parentbranchdate, parentstartdate)) / 86400;
branch_time[1] = julianDateToSeconds(julianDateSub(parentbranchdate, childstartdate)) / 86400;
}
else if (numdates > 0)
cdoWarning("Attribute 'parent_dates' is not formatted as expected. Specify two comma separated integers.");
......@@ -4540,7 +4540,7 @@ static double *
get_time_bounds(list_t *kvl, int taxisID, int ifreq, JulianDate ref_date, JulianDate jtime_val, int calendar,
int tunitsec, double *time_bnds, int time_axis, int /*vlistID*/)
{
double time_val = JulianDateo_seconds(julianDateSub(jtime_val, ref_date)) / tunitsec;
double time_val = julianDateToSeconds(julianDateSub(jtime_val, ref_date)) / tunitsec;
int vtime0b, vtime1b, vtimecorr;
int64_t vdatecorr, vdate0b, vdate1b;
int year, month, day;
......@@ -4679,8 +4679,8 @@ get_time_bounds(list_t *kvl, int taxisID, int ifreq, JulianDate ref_date, Julian
JulianDate time_bnds1;
int halfhourinseconds = 60*30;
time_bnds1 = juldate_add_seconds(halfhourinseconds, jtime_val);
time_bnds[1] = JulianDateo_seconds(julianDateSub(time_bnds1, ref_date)) / tunitsec;
time_bnds[0] = ( JulianDateo_seconds(julianDateSub(time_bnds1, ref_date)) - 3600. ) / tunitsec;
time_bnds[1] = julianDateToSeconds(julianDateSub(time_bnds1, ref_date)) / tunitsec;
time_bnds[0] = ( julianDateToSeconds(julianDateSub(time_bnds1, ref_date)) - 3600. ) / tunitsec;
return time_bnds;
}
else if ( ifreq == 8)
......@@ -4695,10 +4695,10 @@ get_time_bounds(list_t *kvl, int taxisID, int ifreq, JulianDate ref_date, Julian
taxisInqVtimeBounds(taxisID, &vtime0b, &vtime1b);
}
JulianDate juldate = juldate_encode(calendar, vdate0b, vtime0b);
time_bnds[0] = JulianDateo_seconds(julianDateSub(juldate, ref_date)) / tunitsec;
time_bnds[0] = julianDateToSeconds(julianDateSub(juldate, ref_date)) / tunitsec;
juldate = juldate_encode(calendar, vdate1b, vtime1b);
time_bnds[1] = JulianDateo_seconds(julianDateSub(juldate, ref_date)) / tunitsec;
time_bnds[1] = julianDateToSeconds(julianDateSub(juldate, ref_date)) / tunitsec;
if (time_axis == 3) time_bnds[1] -= 1;
return time_bnds;
......@@ -4885,7 +4885,7 @@ check_append_and_size(list_t *kvl, int /*vlistID*/, char *testIn, int ifreq, int
}
/* Check temporal distance between last chunk date and first file date */
double append_distance = JulianDateo_seconds(julianDateSub(firstdate, juloend)) / 3600.0;
double append_distance = julianDateToSeconds(julianDateSub(firstdate, juloend)) / 3600.0;
if ( (ifreq == 6 && (append_distance > 2.0 || append_distance < 0))
|| (ifreq == 5 && (append_distance > 6.0 || append_distance < 0))
|| (ifreq == 4 && (append_distance > 12.0 || append_distance < 0))
......@@ -4921,7 +4921,7 @@ check_append_and_size(list_t *kvl, int /*vlistID*/, char *testIn, int ifreq, int
if (Options::cdoVerbose) cdoPrint("Successfully checked temporal gap.");
/* Check file size */
if (Options::cdoVerbose) cdoPrint("Start to check file size of chunk + working file.");
double old_interval_sec = JulianDateo_seconds(julianDateSub(juloend, julostart));
double old_interval_sec = julianDateToSeconds(julianDateSub(juloend, julostart));
double size_per_sec = (double) filesize / old_interval_sec;
int maxsizegb = atol(kv_get_a_val(kvl, "ms", "2"));
......@@ -5217,7 +5217,7 @@ write_variables(list_t *kvl, int *streamID, struct mapping vars[], int miptab_fr
if (time_axis != 4)
{
jtime_val = get_cmor_time_val(kvl, taxisID, ref_date, tunitsec, calendar, frequency, tsID);
time_val = JulianDateo_seconds(julianDateSub(jtime_val, ref_date)) / tunitsec;
time_val = julianDateToSeconds(julianDateSub(jtime_val, ref_date)) / tunitsec;
time_bndsp = (time_axis != 1) ? get_time_bounds(kvl, taxisID, ifreq, ref_date, jtime_val, calendar,
tunitsec, time_bnds, time_axis, vlistID)
: 0;
......
......@@ -81,7 +81,7 @@ Deltat(void *process)
while ((nrecs = cdoStreamInqTimestep(streamID1, tsID)))
{
const JulianDate juldate1 = juldate_encode(calendar, taxisInqVdate(taxisID1), taxisInqVtime(taxisID1));
const double idt_in_sec = ldivdt ? 1./JulianDateo_seconds(julianDateSub(juldate1, juldate0)) : 1;
const double idt_in_sec = ldivdt ? 1./julianDateToSeconds(julianDateSub(juldate1, juldate0)) : 1;
juldate0 = juldate1;
taxisCopyTimestep(taxisID2, taxisID1);
......
......@@ -666,7 +666,7 @@ Expr(void *process)
{
JulianDate juldate0 = juldate_encode(calendar, vdate0, vtime0);
JulianDate juldate = juldate_encode(calendar, vdate, vtime);
jdelta = JulianDateo_seconds(julianDateSub(juldate, juldate0));
jdelta = julianDateToSeconds(julianDateSub(juldate, juldate0));
}
vdate0 = vdate;
......
......@@ -216,7 +216,7 @@ Filter(void *process)
JulianDate juldate0 = juldate_encode(calendar, vdate0, vtime0);
JulianDate juldate = juldate_encode(calendar, vdate, vtime);
double jdelta = JulianDateo_seconds(julianDateSub(juldate, juldate0));
double jdelta = julianDateToSeconds(julianDateSub(juldate, juldate0));
if (tsID == 1)
{
......
......@@ -137,7 +137,7 @@ Intgridtraj(void *process)
}
int tsIDo = 0;
while (JulianDateo_seconds(juldate1) <= JulianDateo_seconds(juldate))
while (julianDateToSeconds(juldate1) <= julianDateToSeconds(juldate))
{
nrecs = cdoStreamInqTimestep(streamID1, tsID++);
if (nrecs == 0) break;
......@@ -158,10 +158,10 @@ Intgridtraj(void *process)
if (nmiss) cdoAbort("Missing values unsupported for this operator!");
}
while (JulianDateo_seconds(juldate) < JulianDateo_seconds(juldate2))
while (julianDateToSeconds(juldate) < julianDateToSeconds(juldate2))
{
if (JulianDateo_seconds(juldate) >= JulianDateo_seconds(juldate1)
&& JulianDateo_seconds(juldate) < JulianDateo_seconds(juldate2))
if (julianDateToSeconds(juldate) >= julianDateToSeconds(juldate1)
&& julianDateToSeconds(juldate) < julianDateToSeconds(juldate2))
{
if (streamID2 == CDI_UNDEFID)
{
......@@ -175,13 +175,13 @@ Intgridtraj(void *process)
pstreamDefTimestep(streamID2, tsIDo++);
const double fac1
= JulianDateo_seconds(julianDateSub(juldate2, juldate)) / JulianDateo_seconds(julianDateSub(juldate2, juldate1));
= julianDateToSeconds(julianDateSub(juldate2, juldate)) / julianDateToSeconds(julianDateSub(juldate2, juldate1));
const double fac2
= JulianDateo_seconds(julianDateSub(juldate, juldate1)) / JulianDateo_seconds(julianDateSub(juldate2, juldate1));
= julianDateToSeconds(julianDateSub(juldate, juldate1)) / julianDateToSeconds(julianDateSub(juldate2, juldate1));
/*
printf(" %f %f %f %f %f\n", JulianDateo_seconds(juldate),
JulianDateo_seconds(juldate1),
JulianDateo_seconds(juldate2),
printf(" %f %f %f %f %f\n", julianDateToSeconds(juldate),
julianDateToSeconds(juldate1),
julianDateToSeconds(juldate2),
fac1, fac2);
*/
for (int recID = 0; recID < nrecs; recID++)
......
......@@ -130,7 +130,7 @@ Intntime(void *process)
for (int it = 1; it < numts; it++)
{
const double seconds = it * JulianDateo_seconds(julianDateSub(juldate2, juldate1)) / numts;
const double seconds = it * julianDateToSeconds(julianDateSub(juldate2, juldate1)) / numts;
JulianDate juldate = juldate_add_seconds(lround(seconds), juldate1);
juldate_decode(calendar, juldate, &vdate, &vtime);
......@@ -139,9 +139,9 @@ Intntime(void *process)
{
char vdatestr[32], vtimestr[32];
/*
cdoPrint("juldate1 %f", JulianDateo_seconds(juldate1));
cdoPrint("juldate %f", JulianDateo_seconds(juldate));
cdoPrint("juldate2 %f", JulianDateo_seconds(juldate2));
cdoPrint("juldate1 %f", julianDateToSeconds(juldate1));
cdoPrint("juldate %f", julianDateToSeconds(juldate));
cdoPrint("juldate2 %f", julianDateToSeconds(juldate2));
*/
date2str(vdate, vdatestr, sizeof(vdatestr));
time2str(vtime, vtimestr, sizeof(vtimestr));
......@@ -152,8 +152,8 @@ Intntime(void *process)
taxisDefVtime(taxisID2, vtime);
pstreamDefTimestep(streamID2, tsIDo++);
const double fac1 = JulianDateo_seconds(julianDateSub(juldate2, juldate)) / JulianDateo_seconds(julianDateSub(juldate2, juldate1));
const double fac2 = JulianDateo_seconds(julianDateSub(juldate, juldate1)) / JulianDateo_seconds(julianDateSub(juldate2, juldate1));
const double fac1 = julianDateToSeconds(julianDateSub(juldate2, juldate)) / julianDateToSeconds(julianDateSub(juldate2, juldate1));
const double fac2 = julianDateToSeconds(julianDateSub(juldate, juldate1)) / julianDateToSeconds(julianDateSub(juldate2, juldate1));
for (int recID = 0; recID < nrecs; recID++)
{
......
......@@ -134,7 +134,7 @@ Inttime(void *process)
if (Options::cdoVerbose)
{
cdoPrint("date %ld time %d", vdate, vtime);
cdoPrint("juldate = %f", JulianDateo_seconds(juldate));
cdoPrint("juldate = %f", julianDateToSeconds(juldate));
cdoPrint("ijulinc = %lld", ijulinc);
}
......@@ -153,13 +153,13 @@ Inttime(void *process)
if (Options::cdoVerbose)
{
cdoPrint("date %ld time %d", taxisInqVdate(taxisID1), taxisInqVtime(taxisID1));
cdoPrint("juldate1 = %f", JulianDateo_seconds(juldate1));
cdoPrint("juldate1 = %f", julianDateToSeconds(juldate1));
}
if (JulianDateo_seconds(juldate1) > JulianDateo_seconds(juldate)) cdoWarning("start time %ld %d out of range!", vdate, vtime);
if (julianDateToSeconds(juldate1) > julianDateToSeconds(juldate)) cdoWarning("start time %ld %d out of range!", vdate, vtime);
int tsIDo = 0;
while (JulianDateo_seconds(juldate1) <= JulianDateo_seconds(juldate))
while (julianDateToSeconds(juldate1) <= julianDateToSeconds(juldate))
{
nrecs = cdoStreamInqTimestep(streamID1, tsID++);
if (nrecs == 0) break;
......@@ -168,7 +168,7 @@ Inttime(void *process)
if (Options::cdoVerbose)
{
cdoPrint("date %ld time %d", taxisInqVdate(taxisID1), taxisInqVtime(taxisID1));
cdoPrint("juldate2 = %f", JulianDateo_seconds(juldate2));
cdoPrint("juldate2 = %f", julianDateToSeconds(juldate2));
}
for (int recID = 0; recID < nrecs; recID++)
......@@ -185,10 +185,10 @@ Inttime(void *process)
pstreamReadRecord(streamID1, single2, &nmiss2[varID][levelID]);
}
while (JulianDateo_seconds(juldate) <= JulianDateo_seconds(juldate2))
while (julianDateToSeconds(juldate) <= julianDateToSeconds(juldate2))
{
if (JulianDateo_seconds(juldate) >= JulianDateo_seconds(juldate1)
&& JulianDateo_seconds(juldate) <= JulianDateo_seconds(juldate2))
if (julianDateToSeconds(juldate) >= julianDateToSeconds(juldate1)
&& julianDateToSeconds(juldate) <= julianDateToSeconds(juldate2))
{
juldate_decode(calendar, juldate, &vdate, &vtime);
......@@ -196,13 +196,13 @@ Inttime(void *process)
{
char vdatestr[32], vtimestr[32];
/*
cdoPrint("juldate1 %f", JulianDateo_seconds(juldate1));
cdoPrint("juldate %f", JulianDateo_seconds(juldate));
cdoPrint("juldate2 %f", JulianDateo_seconds(juldate2));
cdoPrint("juldate1 %f", julianDateToSeconds(juldate1));
cdoPrint("juldate %f", julianDateToSeconds(juldate));
cdoPrint("juldate2 %f", julianDateToSeconds(juldate2));
*/
date2str(vdate, vdatestr, sizeof(vdatestr));
time2str(vtime, vtimestr, sizeof(vtimestr));
cdoPrint("%s %s %f %d", vdatestr, vtimestr, JulianDateo_seconds(juldate), calendar);
cdoPrint("%s %s %f %d", vdatestr, vtimestr, julianDateToSeconds(juldate), calendar);
}
if (streamID2 == -1)
......@@ -216,9 +216,9 @@ Inttime(void *process)
pstreamDefTimestep(streamID2, tsIDo++);
const double fac1
= JulianDateo_seconds(julianDateSub(juldate2, juldate)) / JulianDateo_seconds(julianDateSub(juldate2, juldate1));
= julianDateToSeconds(julianDateSub(juldate2, juldate)) / julianDateToSeconds(julianDateSub(juldate2, juldate1));
const double fac2
= JulianDateo_seconds(julianDateSub(juldate, juldate1)) / JulianDateo_seconds(julianDateSub(juldate2, juldate1));
= julianDateToSeconds(julianDateSub(juldate, juldate1)) / julianDateToSeconds(julianDateSub(juldate2, juldate1));
for (int recID = 0; recID < nrecs; recID++)
{
......
......@@ -156,7 +156,7 @@ shifttime(int calendar, int tunit, int64_t ijulinc, int64_t *pdate, int *ptime)
*ptime = vtime;
if (Options::cdoVerbose)
cdoPrint("juldate, ijulinc, vdate, vtime: %g %lld %lld %d", JulianDateo_seconds(juldate), ijulinc, vdate, vtime);
cdoPrint("juldate, ijulinc, vdate, vtime: %g %lld %lld %d", julianDateToSeconds(juldate), ijulinc, vdate, vtime);
}
}
......@@ -563,7 +563,7 @@ Settime(void *process)
{
const JulianDate juldate1 = juldate_encode(calendar, vdateb[0], vtimeb[0]);
const JulianDate juldate2 = juldate_encode(calendar, vdateb[1], vtimeb[1]);
const double seconds = JulianDateo_seconds(julianDateSub(juldate2, juldate1)) / 2;
const double seconds = julianDateToSeconds(julianDateSub(juldate2, juldate1)) / 2;
const JulianDate juldatem = juldate_add_seconds(lround(seconds), juldate1);
juldate_decode(calendar, juldatem, &vdate, &vtime);
}
......
......@@ -134,7 +134,7 @@ printBounds(int taxisID, int calendar)
JulianDate juldate0 = juldate_encode(calendar, vdate0, vtime0);
JulianDate juldate1 = juldate_encode(calendar, vdate1, vtime1);
double jdelta = JulianDateo_seconds(julianDateSub(juldate1, juldate0));
double jdelta = julianDateToSeconds(julianDateSub(juldate1, juldate0));
int64_t incperiod = 0;
int incunit = 0;
......@@ -204,7 +204,7 @@ fill_gap(int ngaps, int ntsm[MAX_NTSM], int rangetsm[MAX_GAPS][2], int64_t vdate
{
its = 0;
juldate0 = juldate_add_seconds(ijulinc, juldate0);
while (JulianDateo_seconds(juldate0) < JulianDateo_seconds(juldate))
while (julianDateToSeconds(juldate0) < julianDateToSeconds(juldate))
{
juldate_decode(calendar, juldate0, &ndate, &ntime);
juldate0 = juldate_add_seconds(ijulinc, juldate0);
......@@ -340,7 +340,7 @@ Tinfo(void *process)
juldate0 = juldate_encode(calendar, vdate0, vtime0);
juldate = juldate_encode(calendar, vdate, vtime);
jdelta = JulianDateo_seconds(julianDateSub(juldate, juldate0));
jdelta = julianDateToSeconds(julianDateSub(juldate, juldate0));
getTimeInc(jdelta, vdate0, vdate, &incperiod, &incunit);
......
......@@ -148,7 +148,7 @@ DateTimeList::taxisInqTimestep(int taxisID, int tsID)
// int hour, minute, second;
// cdiDecodeTime(vtime, &hour, &minute, &second);
if (vtime == 0 && JulianDateo_seconds(juldate1) < JulianDateo_seconds(juldate2))
if (vtime == 0 && julianDateToSeconds(juldate1) < julianDateToSeconds(juldate2))
{
JulianDate juldate = juldate_add_seconds(-1, juldate2);
juldate_decode(calendar, juldate, &vdate, &vtime);
......@@ -205,7 +205,7 @@ DateTimeList::mean(int nsteps)
vtime = this->dtinfo[i].v.time;
juldate = juldate_encode(calendar, vdate, vtime);
seconds += JulianDateo_seconds(julianDateSub(juldate, juldate0));
seconds += julianDateToSeconds(julianDateSub(juldate, juldate0));
}
juldate = juldate_add_seconds(lround(seconds / nsteps), juldate0);
......@@ -219,7 +219,7 @@ DateTimeList::mean(int nsteps)
vtime = this->dtinfo[nsteps / 2].v.time;
JulianDate juldate2 = juldate_encode(calendar, vdate, vtime);
double seconds = JulianDateo_seconds(julianDateSub(juldate2, juldate1)) / 2;
double seconds = julianDateToSeconds(julianDateSub(juldate2, juldate1)) / 2;
JulianDate juldatem = juldate_add_seconds(lround(seconds), juldate1);
juldate_decode(calendar, juldatem, &vdate, &vtime);
#endif
......@@ -293,7 +293,7 @@ datetime_avg(int calendar, int ndates, CdoDateTime *datetime)
vtime = datetime[ndates / 2].time;
JulianDate juldate2 = juldate_encode(calendar, vdate, vtime);
double seconds = JulianDateo_seconds(julianDateSub(juldate2, juldate1)) / 2;
double seconds = julianDateToSeconds(julianDateSub(juldate2, juldate1)) / 2;
JulianDate juldatem = juldate_add_seconds(lround(seconds), juldate1);
juldate_decode(calendar, juldatem, &vdate, &vtime);
}
......
......@@ -104,7 +104,7 @@ JulianDate juldate_encode(int calendar, int64_t date, int time);
void juldate_decode(int calendar, JulianDate juldate, int64_t *date, int *time);
JulianDate julianDateSub(const JulianDate &juldate2, const JulianDate &juldate1);
JulianDate juldate_add_seconds(int64_t seconds, JulianDate juldate);
double JulianDateo_seconds(JulianDate juldate);
double julianDateToSeconds(JulianDate juldate);
void datetime_avg(int dpy, int ndates, CdoDateTime *datetime);
......
......@@ -64,7 +64,7 @@ juldate_add_seconds(int64_t seconds, JulianDate juldate)
}
double
JulianDateo_seconds(JulianDate juldate)
julianDateToSeconds(JulianDate juldate)
{
return juldate.julday * 86400. + juldate.secofday;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment