mirror of https://github.com/ecmwf/eccodes.git
Merge branch 'develop' into feature/Docker
This commit is contained in:
commit
407c8d92f8
|
@ -82,7 +82,7 @@ int grib_datetime_to_julian_d(
|
||||||
long year, long month, long day, long hour, long minute,
|
long year, long month, long day, long hour, long minute,
|
||||||
double second, double* jd)
|
double second, double* jd)
|
||||||
{
|
{
|
||||||
double a, b, dday;
|
double a, b = 0, dday;
|
||||||
long y, m;
|
long y, m;
|
||||||
|
|
||||||
dday = (double)(hour * 3600 + minute * 60 + second) / 86400.0 + day;
|
dday = (double)(hour * 3600 + minute * 60 + second) / 86400.0 + day;
|
||||||
|
@ -97,22 +97,10 @@ int grib_datetime_to_julian_d(
|
||||||
}
|
}
|
||||||
a = (long)(((double)y) / 100);
|
a = (long)(((double)y) / 100);
|
||||||
|
|
||||||
if (y > 1582)
|
if (y > 1582 ||
|
||||||
|
(y == 1582 && ((m > 10) || (m == 10 && day > 14)))) {
|
||||||
b = 2 - a + (long)(a / 4);
|
b = 2 - a + (long)(a / 4);
|
||||||
else if (y == 1582) {
|
|
||||||
if (m > 10)
|
|
||||||
b = 2 - a + (long)(a / 4);
|
|
||||||
else if (m == 10) {
|
|
||||||
if (day > 14)
|
|
||||||
b = 2 - a + (long)(a / 4);
|
|
||||||
else
|
|
||||||
b = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
b = 0;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
b = 0;
|
|
||||||
|
|
||||||
*jd = (long)(365.25 * (y + 4716)) + (long)(30.6001 * (m + 1)) + dday + b - 1524.5;
|
*jd = (long)(365.25 * (y + 4716)) + (long)(30.6001 * (m + 1)) + dday + b - 1524.5;
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ static grib_handle* try_template(grib_context* c, const char* dir, const char* n
|
||||||
|
|
||||||
sprintf(path, "%s/%s.tmpl", dir, name);
|
sprintf(path, "%s/%s.tmpl", dir, name);
|
||||||
|
|
||||||
if (c->debug == -1) {
|
if (c->debug) {
|
||||||
fprintf(stderr, "ECCODES DEBUG: try_template path='%s'\n", path);
|
fprintf(stderr, "ECCODES DEBUG: try_template path='%s'\n", path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ static grib_handle* try_bufr_template(grib_context* c, const char* dir, const ch
|
||||||
|
|
||||||
sprintf(path, "%s/%s.tmpl", dir, name);
|
sprintf(path, "%s/%s.tmpl", dir, name);
|
||||||
|
|
||||||
if (c->debug == -1) {
|
if (c->debug) {
|
||||||
fprintf(stderr, "ECCODES DEBUG: try_template path='%s'\n", path);
|
fprintf(stderr, "ECCODES DEBUG: try_template path='%s'\n", path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,12 +181,47 @@ static void Test3()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void Test4()
|
||||||
|
{
|
||||||
|
const long iyear = 1582;
|
||||||
|
|
||||||
|
TestDateTime(iyear, 9, 1, 1, 0, 0);
|
||||||
|
TestDateTime(iyear, 9, 2, 1, 0, 0);
|
||||||
|
TestDateTime(iyear, 9, 3, 1, 0, 0);
|
||||||
|
TestDateTime(iyear, 9, 4, 1, 0, 0);
|
||||||
|
TestDateTime(iyear, 9, 4, 16, 0, 0);
|
||||||
|
|
||||||
|
/* TODO */
|
||||||
|
/* TestDateTime(iyear, 10, 5, 1, 0, 0); */
|
||||||
|
TestDateTime(iyear, 10, 1, 1, 0, 0);
|
||||||
|
TestDateTime(iyear, 10, 2, 1, 0, 0);
|
||||||
|
TestDateTime(iyear, 10, 3, 1, 0, 0);
|
||||||
|
TestDateTime(iyear, 10, 4, 1, 0, 0);
|
||||||
|
TestDateTime(iyear, 10, 15, 1, 0, 0);
|
||||||
|
|
||||||
|
TestDateTime(iyear, 11, 1, 1, 0, 0);
|
||||||
|
TestDateTime(iyear, 11, 2, 1, 0, 0);
|
||||||
|
TestDateTime(iyear, 11, 3, 1, 0, 0);
|
||||||
|
TestDateTime(iyear, 11, 4, 1, 0, 0);
|
||||||
|
TestDateTime(iyear, 11, 5, 1, 0, 0);
|
||||||
|
TestDateTime(iyear, 11, 5, 15, 0, 0);
|
||||||
|
|
||||||
|
/* TODO
|
||||||
|
* for (imnth = 1; imnth <= 12; imnth += 1) {
|
||||||
|
* for (iday = 1; iday <= 28; iday += 1) {
|
||||||
|
* TestDateTime(iyear, imnth, iday, 1, 0, 0);
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
Test0();
|
Test0();
|
||||||
Test1();
|
Test1();
|
||||||
Test2();
|
Test2();
|
||||||
Test3();
|
Test3();
|
||||||
|
Test4();
|
||||||
printf("All OK\n");
|
printf("All OK\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue