Commit 14a5c10c authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Renamed juldate_encode() to julianDateEncode().

parent a45fd6f1
......@@ -2209,12 +2209,12 @@ get_branch_times(list_t *kvl, int calendar, char *time_units)
sprintf(ptu, "days since %d-%d-%d 00:00:00", parentyears[0], parentmonths[0], parentdays[0]);
kv_insert_a_val(kvl, "parent_time_units", ptu, 0);
parentstartdate = juldate_encode(calendar, parentvdates[0], parentvtimes[0]);
parentbranchdate = juldate_encode(calendar, parentvdates[1], parentvtimes[1]);
parentstartdate = julianDateEncode(calendar, parentvdates[0], parentvtimes[0]);
parentbranchdate = julianDateEncode(calendar, parentvdates[1], parentvtimes[1]);
int childsdate, childstime, childtimeunit;
get_taxis(time_units, &childsdate, &childstime, &childtimeunit);
childstartdate = juldate_encode(calendar, childsdate, childstime);
childstartdate = julianDateEncode(calendar, childsdate, childstime);
/* If time unit is always "days since.." */
branch_time[0] = julianDateToSeconds(julianDateSub(parentbranchdate, parentstartdate)) / 86400;
......@@ -4444,7 +4444,7 @@ get_cmor_time_val(list_t *kvl, int taxisID, JulianDate ref_date, int /*tunitsec*
{
int year, month, day;
cdiDecodeDate(taxisInqVdate(taxisID), &year, &month, &day);
JulianDate juldate = juldate_encode(calendar, taxisInqVdate(taxisID), taxisInqVtime(taxisID));
JulianDate juldate = julianDateEncode(calendar, taxisInqVdate(taxisID), taxisInqVtime(taxisID));
if (month == 0 || day == 0)
{
......@@ -4487,7 +4487,7 @@ get_cmor_time_val(list_t *kvl, int taxisID, JulianDate ref_date, int /*tunitsec*
timeoffset = 0;
}
}
ref_date = juldate_encode(calendar, cdiEncodeDate(ryear, rmonth, rday), rtime);
ref_date = julianDateEncode(calendar, cdiEncodeDate(ryear, rmonth, rday), rtime);
/**/
/* Add time index * frequency on correfdate */
/**/
......@@ -4528,7 +4528,7 @@ get_cmor_time_val(list_t *kvl, int taxisID, JulianDate ref_date, int /*tunitsec*
{
int64_t vdate = cdiEncodeDate(year, month, 1);
int vtime = 0;
juldate = juldate_encode(calendar, vdate, vtime);
juldate = julianDateEncode(calendar, vdate, vtime);
}
}
}
......@@ -4694,10 +4694,10 @@ get_time_bounds(list_t *kvl, int taxisID, int ifreq, JulianDate ref_date, Julian
taxisInqVdateBounds(taxisID, &vdate0b, &vdate1b);
taxisInqVtimeBounds(taxisID, &vtime0b, &vtime1b);
}
JulianDate juldate = juldate_encode(calendar, vdate0b, vtime0b);
JulianDate juldate = julianDateEncode(calendar, vdate0b, vtime0b);
time_bnds[0] = julianDateToSeconds(julianDateSub(juldate, ref_date)) / tunitsec;
juldate = juldate_encode(calendar, vdate1b, vtime1b);
juldate = julianDateEncode(calendar, vdate1b, vtime1b);
time_bnds[1] = julianDateToSeconds(julianDateSub(juldate, ref_date)) / tunitsec;
if (time_axis == 3) time_bnds[1] -= 1;
......@@ -4856,8 +4856,8 @@ check_append_and_size(list_t *kvl, int /*vlistID*/, char *testIn, int ifreq, int
int cdi_starttime = cdiEncodeTime(old_start_hr, old_start_min, 0);
int cdi_endtime = cdiEncodeTime(old_end_hr, old_end_min, 0);
JulianDate julostart = juldate_encode(calendar, cdi_startdate, cdi_starttime);
JulianDate juloend = juldate_encode(calendar, cdi_enddate, cdi_endtime);
JulianDate julostart = julianDateEncode(calendar, cdi_startdate, cdi_starttime);
JulianDate juloend = julianDateEncode(calendar, cdi_enddate, cdi_endtime);
if (Options::cdoVerbose) cdoPrint("Successfully calculated juldates.");
/* Read in first vdate in case not piped */
......@@ -4872,7 +4872,7 @@ check_append_and_size(list_t *kvl, int /*vlistID*/, char *testIn, int ifreq, int
int streamID2 = streamOpenRead(cdoGetStreamName(0));
int vlistID2 = streamInqVlist(streamID2);
int taxisID2 = vlistInqTaxis(vlistID2);
JulianDate firstdate = juldate_encode(calendar, taxisInqVdate(taxisID2), taxisInqVtime(taxisID2));
JulianDate firstdate = julianDateEncode(calendar, taxisInqVdate(taxisID2), taxisInqVtime(taxisID2));
int fyear, fmonth, dummy;
cdiDecodeDate(taxisInqVdate(taxisID2), &fyear, &fmonth, &dummy);
......@@ -5144,7 +5144,7 @@ write_variables(list_t *kvl, int *streamID, struct mapping vars[], int miptab_fr
int sdate, stime, time_unit;
get_taxis(kv_get_a_val(kvl, "rtu", nullptr), &sdate, &stime, &time_unit);
int tunitsec = get_tunitsec(time_unit);
JulianDate ref_date = juldate_encode(calendar, sdate, stime);
JulianDate ref_date = julianDateEncode(calendar, sdate, stime);
char *frequency = nullptr;
if (time_axis != 4)
{
......
......@@ -67,7 +67,7 @@ Deltat(void *process)
int tsID = 0;
int nrecs = cdoStreamInqTimestep(streamID1, tsID);
JulianDate juldate0 = juldate_encode(calendar, taxisInqVdate(taxisID1), taxisInqVtime(taxisID1));
JulianDate juldate0 = julianDateEncode(calendar, taxisInqVdate(taxisID1), taxisInqVtime(taxisID1));
for (int recID = 0; recID < nrecs; ++recID)
{
......@@ -80,7 +80,7 @@ Deltat(void *process)
int tsID2 = 0;
while ((nrecs = cdoStreamInqTimestep(streamID1, tsID)))
{
const JulianDate juldate1 = juldate_encode(calendar, taxisInqVdate(taxisID1), taxisInqVtime(taxisID1));
const JulianDate juldate1 = julianDateEncode(calendar, taxisInqVdate(taxisID1), taxisInqVtime(taxisID1));
const double idt_in_sec = ldivdt ? 1./julianDateToSeconds(julianDateSub(juldate1, juldate0)) : 1;
juldate0 = juldate1;
......
......@@ -461,7 +461,7 @@ EOFs(void *process)
int64_t vdate = 10101;
int vtime = 0;
JulianDate juldate = juldate_encode(calendar, vdate, vtime);
JulianDate juldate = julianDateEncode(calendar, vdate, vtime);
double *out = in;
double *eig_val = nullptr;
......@@ -471,8 +471,8 @@ EOFs(void *process)
for (tsID = 0; tsID < nts_out; tsID++)
{
juldate = juldate_add_seconds(60, juldate);
juldate_decode(calendar, juldate, &vdate, &vtime);
juldate = julianDateAddSeconds(60, juldate);
julianDateDecode(calendar, juldate, &vdate, &vtime);
taxisDefVdate(taxisID2, vdate);
taxisDefVtime(taxisID2, vtime);
......
......@@ -431,11 +431,11 @@ EOF3d(void *process)
int64_t vdate = 10101;
int vtime = 0;
JulianDate juldate = juldate_encode(calendar, vdate, vtime);
JulianDate juldate = julianDateEncode(calendar, vdate, vtime);
for (tsID = 0; tsID < n; tsID++)
{
juldate = juldate_add_seconds(60, juldate);
juldate_decode(calendar, juldate, &vdate, &vtime);
juldate = julianDateAddSeconds(60, juldate);
julianDateDecode(calendar, juldate, &vdate, &vtime);
taxisDefVdate(taxisID2, vdate);
taxisDefVtime(taxisID2, vtime);
......
......@@ -664,8 +664,8 @@ Expr(void *process)
if (tsID)
{
JulianDate juldate0 = juldate_encode(calendar, vdate0, vtime0);
JulianDate juldate = juldate_encode(calendar, vdate, vtime);
JulianDate juldate0 = julianDateEncode(calendar, vdate0, vtime0);
JulianDate juldate = julianDateEncode(calendar, vdate, vtime);
jdelta = julianDateToSeconds(julianDateSub(juldate, juldate0));
}
......
......@@ -214,8 +214,8 @@ Filter(void *process)
cdiDecodeDate(vdate0, &year0, &month0, &day0);
cdiDecodeDate(vdate, &year, &month, &day);
JulianDate juldate0 = juldate_encode(calendar, vdate0, vtime0);
JulianDate juldate = juldate_encode(calendar, vdate, vtime);
JulianDate juldate0 = julianDateEncode(calendar, vdate0, vtime0);
JulianDate juldate = julianDateEncode(calendar, vdate, vtime);
double jdelta = julianDateToSeconds(julianDateSub(juldate, juldate0));
if (tsID == 1)
......
......@@ -42,7 +42,7 @@ readnextpos(FILE *fp, int calendar, JulianDate *juldate, double *xpos, double *y
{
int date = cdiEncodeDate(year, month, day);
int time = cdiEncodeTime(hour, minute, second);
*juldate = juldate_encode(calendar, date, time);
*juldate = julianDateEncode(calendar, date, time);
}
return stat;
......@@ -125,7 +125,7 @@ Intgridtraj(void *process)
int tsID = 0;
int nrecs = cdoStreamInqTimestep(streamID1, tsID++);
JulianDate juldate1 = juldate_encode(calendar, taxisInqVdate(taxisID1), taxisInqVtime(taxisID1));
JulianDate juldate1 = julianDateEncode(calendar, taxisInqVdate(taxisID1), taxisInqVtime(taxisID1));
for (int recID = 0; recID < nrecs; recID++)
{
pstreamInqRecord(streamID1, &varID, &levelID);
......@@ -141,7 +141,7 @@ Intgridtraj(void *process)
{
nrecs = cdoStreamInqTimestep(streamID1, tsID++);
if (nrecs == 0) break;
JulianDate juldate2 = juldate_encode(calendar, taxisInqVdate(taxisID1), taxisInqVtime(taxisID1));
JulianDate juldate2 = julianDateEncode(calendar, taxisInqVdate(taxisID1), taxisInqVtime(taxisID1));
for (int recID = 0; recID < nrecs; recID++)
{
......
......@@ -93,7 +93,7 @@ Intntime(void *process)
int nrecs = cdoStreamInqTimestep(streamID1, tsID++);
const int64_t vdate1 = taxisInqVdate(taxisID1);
const int vtime1 = taxisInqVtime(taxisID1);
JulianDate juldate1 = juldate_encode(calendar, vdate1, vtime1);
JulianDate juldate1 = julianDateEncode(calendar, vdate1, vtime1);
taxisCopyTimestep(taxisID2, taxisID1);
pstreamDefTimestep(streamID2, tsIDo++);
......@@ -113,7 +113,7 @@ Intntime(void *process)
{
int64_t vdate2 = taxisInqVdate(taxisID1);
int vtime2 = taxisInqVtime(taxisID1);
JulianDate juldate2 = juldate_encode(calendar, vdate2, vtime2);
JulianDate juldate2 = julianDateEncode(calendar, vdate2, vtime2);
for (int recID = 0; recID < nrecs; recID++)
{
......
......@@ -129,7 +129,7 @@ Inttime(void *process)
const int calendar = taxisInqCalendar(taxisID1);
JulianDate juldate = juldate_encode(calendar, vdate, vtime);
JulianDate juldate = julianDateEncode(calendar, vdate, vtime);
if (Options::cdoVerbose)
{
......@@ -140,7 +140,7 @@ Inttime(void *process)
int tsID = 0;
int nrecs = cdoStreamInqTimestep(streamID1, tsID++);
JulianDate juldate1 = juldate_encode(calendar, taxisInqVdate(taxisID1), taxisInqVtime(taxisID1));
JulianDate juldate1 = julianDateEncode(calendar, taxisInqVdate(taxisID1), taxisInqVtime(taxisID1));
for (int recID = 0; recID < nrecs; recID++)
{
pstreamInqRecord(streamID1, &varID, &levelID);
......@@ -164,7 +164,7 @@ Inttime(void *process)
nrecs = cdoStreamInqTimestep(streamID1, tsID++);
if (nrecs == 0) break;
JulianDate juldate2 = juldate_encode(calendar, taxisInqVdate(taxisID1), taxisInqVtime(taxisID1));
JulianDate juldate2 = julianDateEncode(calendar, taxisInqVdate(taxisID1), taxisInqVtime(taxisID1));
if (Options::cdoVerbose)
{
cdoPrint("date %ld time %d", taxisInqVdate(taxisID1), taxisInqVtime(taxisID1));
......@@ -284,7 +284,7 @@ Inttime(void *process)
vdate = cdiEncodeDate(year, month, day);
juldate = juldate_encode(calendar, vdate, vtime);
juldate = julianDateEncode(calendar, vdate, vtime);
}
else
{
......
......@@ -148,7 +148,7 @@ shifttime(int calendar, int tunit, int64_t ijulinc, int64_t *pdate, int *ptime)
else
{
JulianDate juldate;
juldate = juldate_encode(calendar, vdate, vtime);
juldate = julianDateEncode(calendar, vdate, vtime);
juldate = julianDateAddSeconds(ijulinc, juldate);
julianDateDecode(calendar, juldate, &vdate, &vtime);
......@@ -192,7 +192,7 @@ time_gen_bounds(int calendar, int tunit, int incperiod, int64_t vdate, int vtime
else if (tunit == TUNIT_DAY)
{
vdateb[0] = vdate;
juldate = juldate_encode(calendar, vdateb[0], vtimeb[0]);
juldate = julianDateEncode(calendar, vdateb[0], vtimeb[0]);
juldate = julianDateAddSeconds(86400, juldate);
julianDateDecode(calendar, juldate, &vdateb[1], &vtimeb[1]);
}
......@@ -216,7 +216,7 @@ time_gen_bounds(int calendar, int tunit, int incperiod, int64_t vdate, int vtime
if (h1 >= 24)
{
vdateb[1] = cdiEncodeDate(year, month, day + 1);
juldate = juldate_encode(calendar, vdateb[0], vtimeb[0]);
juldate = julianDateEncode(calendar, vdateb[0], vtimeb[0]);
juldate = julianDateAddSeconds(incperiod * 3600, juldate);
julianDateDecode(calendar, juldate, &vdateb[1], &vtimeb[1]);
}
......@@ -482,7 +482,7 @@ Settime(void *process)
taxisDefTunit(taxisID2, tunit);
taxisDefRdate(taxisID2, sdate);
taxisDefRtime(taxisID2, stime);
juldate = juldate_encode(calendar, sdate, stime);
juldate = julianDateEncode(calendar, sdate, stime);
}
else if (operatorID == SETTUNITS)
{
......@@ -561,8 +561,8 @@ Settime(void *process)
if (Options::CMOR_Mode)
{
const JulianDate juldate1 = juldate_encode(calendar, vdateb[0], vtimeb[0]);
const JulianDate juldate2 = juldate_encode(calendar, vdateb[1], vtimeb[1]);
const JulianDate juldate1 = julianDateEncode(calendar, vdateb[0], vtimeb[0]);
const JulianDate juldate2 = julianDateEncode(calendar, vdateb[1], vtimeb[1]);
const double seconds = julianDateToSeconds(julianDateSub(juldate2, juldate1)) / 2;
const JulianDate juldatem = julianDateAddSeconds(lround(seconds), juldate1);
julianDateDecode(calendar, juldatem, &vdate, &vtime);
......
......@@ -132,8 +132,8 @@ printBounds(int taxisID, int calendar)
time2str(vtime1, vtimestr, sizeof(vtimestr));
fprintf(stdout, " %s %s", vdatestr, vtimestr);
JulianDate juldate0 = juldate_encode(calendar, vdate0, vtime0);
JulianDate juldate1 = juldate_encode(calendar, vdate1, vtime1);
JulianDate juldate0 = julianDateEncode(calendar, vdate0, vtime0);
JulianDate juldate1 = julianDateEncode(calendar, vdate1, vtime1);
double jdelta = julianDateToSeconds(julianDateSub(juldate1, juldate0));
int64_t incperiod = 0;
......@@ -338,8 +338,8 @@ Tinfo(void *process)
{
cdiDecodeDate(vdate0, &year0, &month0, &day0);
juldate0 = juldate_encode(calendar, vdate0, vtime0);
juldate = juldate_encode(calendar, vdate, vtime);
juldate0 = julianDateEncode(calendar, vdate0, vtime0);
juldate = julianDateEncode(calendar, vdate, vtime);
jdelta = julianDateToSeconds(julianDateSub(juldate, juldate0));
getTimeInc(jdelta, vdate0, vdate, &incperiod, &incunit);
......@@ -380,7 +380,7 @@ Tinfo(void *process)
incunit0 = incunit;
its = fill_gap(ngaps, ntsm, rangetsm, vdatem, vtimem, 1, incperiod0, incunit0, vdate_first, vdate, vtime,
calendar, day, juldate0, juldate_encode(calendar, vdate_first, vtime_first));
calendar, day, juldate0, julianDateEncode(calendar, vdate_first, vtime_first));
arrow = '^';
}
......
......@@ -139,11 +139,11 @@ DateTimeList::taxisInqTimestep(int taxisID, int tsID)
int64_t vdate = this->dtinfo[tsID].b[0].date;
int vtime = this->dtinfo[tsID].b[0].time;
JulianDate juldate1 = juldate_encode(calendar, vdate, vtime);
JulianDate juldate1 = julianDateEncode(calendar, vdate, vtime);
vdate = this->dtinfo[tsID].b[1].date;
vtime = this->dtinfo[tsID].b[1].time;
JulianDate juldate2 = juldate_encode(calendar, vdate, vtime);
JulianDate juldate2 = julianDateEncode(calendar, vdate, vtime);
// int hour, minute, second;
// cdiDecodeTime(vtime, &hour, &minute, &second);
......@@ -195,7 +195,7 @@ DateTimeList::mean(int nsteps)
#ifdef TEST_DTLIST_MEAN
vdate = this->dtinfo[0].v.date;
vtime = this->dtinfo[0].v.time;
JulianDate juldate0 = juldate_encode(calendar, vdate, vtime);
JulianDate juldate0 = julianDateEncode(calendar, vdate, vtime);
JulianDate juldate;
double seconds = 0;
......@@ -203,7 +203,7 @@ DateTimeList::mean(int nsteps)
{
vdate = this->dtinfo[i].v.date;
vtime = this->dtinfo[i].v.time;
juldate = juldate_encode(calendar, vdate, vtime);
juldate = julianDateEncode(calendar, vdate, vtime);
seconds += julianDateToSeconds(julianDateSub(juldate, juldate0));
}
......@@ -213,11 +213,11 @@ DateTimeList::mean(int nsteps)
#else
vdate = this->dtinfo[nsteps / 2 - 1].v.date;
vtime = this->dtinfo[nsteps / 2 - 1].v.time;
JulianDate juldate1 = juldate_encode(calendar, vdate, vtime);
JulianDate juldate1 = julianDateEncode(calendar, vdate, vtime);
vdate = this->dtinfo[nsteps / 2].v.date;
vtime = this->dtinfo[nsteps / 2].v.time;
JulianDate juldate2 = juldate_encode(calendar, vdate, vtime);
JulianDate juldate2 = julianDateEncode(calendar, vdate, vtime);
double seconds = julianDateToSeconds(julianDateSub(juldate2, juldate1)) / 2;
JulianDate juldatem = julianDateAddSeconds(lround(seconds), juldate1);
......@@ -287,11 +287,11 @@ datetime_avg(int calendar, int ndates, CdoDateTime *datetime)
{
vdate = datetime[ndates / 2 - 1].date;
vtime = datetime[ndates / 2 - 1].time;
JulianDate juldate1 = juldate_encode(calendar, vdate, vtime);
JulianDate juldate1 = julianDateEncode(calendar, vdate, vtime);
vdate = datetime[ndates / 2].date;
vtime = datetime[ndates / 2].time;
JulianDate juldate2 = juldate_encode(calendar, vdate, vtime);
JulianDate juldate2 = julianDateEncode(calendar, vdate, vtime);
double seconds = julianDateToSeconds(julianDateSub(juldate2, juldate1)) / 2;
JulianDate juldatem = julianDateAddSeconds(lround(seconds), juldate1);
......
......@@ -100,7 +100,7 @@ private:
void midhigh(int nsteps);
};
JulianDate juldate_encode(int calendar, int64_t date, int time);
JulianDate julianDateEncode(int calendar, int64_t date, int time);
void julianDateDecode(int calendar, const JulianDate &juldate, int64_t *date, int *time);
JulianDate julianDateSub(const JulianDate &juldate2, const JulianDate &juldate1);
JulianDate julianDateAddSeconds(int64_t seconds, const JulianDate &juldate);
......
......@@ -21,7 +21,7 @@
#include "timebase.h"
JulianDate
juldate_encode(int calendar, int64_t date, int time)
julianDateEncode(int calendar, int64_t date, int time)
{
int year, month, day, hour, minute, second;
cdiDecodeDate(date, &year, &month, &day);
......
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