Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test reference mismatch #786

Merged
merged 12 commits into from
Dec 19, 2023
7 changes: 6 additions & 1 deletion utils/obsproc/IcecAmsr2Ioda.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include <cstdio>
#include <ctime>
#include <iostream>
#include <map>
Expand Down Expand Up @@ -65,6 +66,10 @@ namespace gdasapp {
ncFile.getVar("Scan_Time").getVar(oneTmpdateTimeVal.data());
iodaVars.referenceDate_ = "seconds since 1970-01-01T00:00:00Z";

// Set the time zone (UTC)
putenv("TZ=UTC");
tzset();

size_t index = 0;
std::tm timeinfo = {};
for (int i = 0; i < ntimes; i += dimTimeSize) {
Expand All @@ -73,7 +78,7 @@ namespace gdasapp {
timeinfo.tm_mday = oneTmpdateTimeVal[i + 2];
timeinfo.tm_hour = oneTmpdateTimeVal[i + 3];
timeinfo.tm_min = oneTmpdateTimeVal[i + 4];
timeinfo.tm_sec = oneTmpdateTimeVal[i + 5];
timeinfo.tm_sec = static_cast<int64_t>(oneTmpdateTimeVal[i + 5]);

// Calculate and store the seconds since the Unix epoch
time_t epochtime = std::mktime(&timeinfo);
Expand Down
6 changes: 6 additions & 0 deletions utils/obsproc/Smap2Ioda.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include <cstdio>
#include <ctime>
#include <iostream>
#include <netcdf> // NOLINT (using C API)
#include <string>
Expand Down Expand Up @@ -70,6 +72,10 @@ namespace gdasapp {

iodaVars.referenceDate_ = "seconds since 1970-01-01T00:00:00Z";

// Set the time zone (UTC)
putenv("TZ=UTC");
tzset();

// calculate the seconds of Jan 1 of startyear since unix epoch
std::tm tm{};
// defaults are zero, Jan is zero
Expand Down
6 changes: 3 additions & 3 deletions utils/test/testref/icecamsr2ioda.test
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ latitude:
Max: 86.8975
Sum: 1346.66
datetime:
Min: 1625066557
Max: 1625126209
Sum: 27626797699
Min: 1625048557
Max: 1625108209
Sum: 27626462899
2 changes: 1 addition & 1 deletion utils/test/testref/rads2ioda.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
iReading: [rads_adt_3a_2021181.nc4,rads_adt_3b_2021181.nc4]
Reading: [rads_adt_3a_2021181.nc4,rads_adt_3b_2021181.nc4]
seconds since 1858-11-17T00:00:00Z
obsVal:
Min: 0.1671
Expand Down
6 changes: 3 additions & 3 deletions utils/test/testref/smap2ioda.test
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ latitude:
Max: 40.8618
Sum: -370.853
datetime:
Min: 1625197568
Max: 1625204736
Sum: 48756048640
Min: 1625175936
Max: 1625183104
Sum: 48755399680