diff --git a/src/DATA/TOOLS/GetGranules.c b/src/DATA/TOOLS/GetGranules.c index c5459fc..ba2ec42 100644 --- a/src/DATA/TOOLS/GetGranules.c +++ b/src/DATA/TOOLS/GetGranules.c @@ -3,7 +3,8 @@ * @brief Stand-alone executable
Returns granules for given VI in DDBase
* * @details GetGranules(string *)
-* @arg \c argv[1] Full name of *_times.nc +* @arg \c argv[1] Path to VI +* @arg \c argv[2] Prefix * */ @@ -13,6 +14,7 @@ #include #include #include +#include #include #include @@ -29,14 +31,21 @@ int main(int argc, char *argv[]) { int status; - if (argc < 2){ - fprintf(stderr,"Usage: GetGranules *_times.nc\n"); + if (argc < 3){ + fprintf(stderr,"Usage: GetGranules path_to_vi prefix\n"); exit(1); } + char timesPath[512]; + memset(timesPath, 0, 512*sizeof(char)); + strcat(timesPath, argv[1]); + strcat(timesPath, "/"); + strcat(timesPath, argv[2]); + strcat(timesPath, "_times.nc"); + // Open VI_times.nc int DataID; - if ((status = nc_open(argv[1], NC_NOWRITE, &DataID)) != NC_NOERR) + if ((status = nc_open(timesPath, NC_NOWRITE, &DataID)) != NC_NOERR) nc_handle_error(status); int StartID; @@ -81,6 +90,8 @@ int main(int argc, char *argv[]) double StopTimestamp; size_t count[2] = {1L,TIMELENGTH}; size_t start[2] = {0L,0L}; + char filePath[512]; + struct stat attrib; for (i = 0; i < nb_records; ++i) { count[1] = TIMELENGTH; @@ -94,7 +105,14 @@ int main(int argc, char *argv[]) count[1] = 32; if ((status = nc_get_vara_text(DataID, FileID, start, count, FileName)) != NC_NOERR) nc_handle_error(status); - printf("%f %f\n", StartTimestamp, StopTimestamp); + memset(filePath, 0, 512*sizeof(char)); + strcat(filePath, argv[1]); + strcat(filePath, "/"); + strcat(filePath, FileName); + strcat(filePath, ".gz"); + stat(filePath, &attrib); + + printf("%f %f %s %d\n", StartTimestamp, StopTimestamp, FileName, attrib.st_mtime); } if ((status = nc_close(DataID)) != NC_NOERR) nc_handle_error(status); -- libgit2 0.21.2