Skip to content

Commit

Permalink
Changing field info h_date and v_date from UTIMstruct to DateTime class
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-dixon committed Oct 5, 2024
1 parent c451ec8 commit 3a61cd8
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 34 deletions.
4 changes: 2 additions & 2 deletions codebase/apps/radar/src/Lucid/CartManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3339,7 +3339,7 @@ void CartManager::_checkForDataUpdates(time_t tm)
// See if any data matches
if(strstr(info.dir,dir_buf) != NULL) {
// Note unix_time is signed (time_t) and info.end_time is unsigned int
if (gd.mrec[i]->h_date.unix_time < (int) info.end_time) {
if (gd.mrec[i]->h_date.utime() < (time_t) info.end_time) {
gd.mrec[i]->h_data_valid = 0;
gd.mrec[i]->v_data_valid = 0;
}
Expand Down Expand Up @@ -3371,7 +3371,7 @@ void CartManager::_checkForDataUpdates(time_t tm)
// See if any data matches
if(strstr(info.dir,dir_buf) != NULL) {
// Check if that data is more current
if (gd.layers.wind[i].wind_u->h_date.unix_time < (int) info.end_time) {
if (gd.layers.wind[i].wind_u->h_date.utime() < (time_t) info.end_time) {
gd.layers.wind[i].wind_u->h_data_valid = 0;
gd.layers.wind[i].wind_u->v_data_valid = 0;
gd.layers.wind[i].wind_v->h_data_valid = 0;
Expand Down
5 changes: 3 additions & 2 deletions codebase/apps/radar/src/Lucid/DataHandling.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1369,7 +1369,8 @@ static void _checkForHorizData(met_record_t *mr)
mr->h_mdvx->vertTypeZUnits(mr->h_vhdr.type[0]),LABEL_LENGTH);

// Record the date
UTIMunix_to_date(mr->h_mhdr.time_centroid,&mr->h_date);
mr->h_date.set(mr->h_mhdr.time_centroid);
// UTIMunix_to_date(mr->h_mhdr.time_centroid,&mr->h_date);

mr->h_data_valid = 1;
mr->last_collected = time(0);
Expand Down Expand Up @@ -1533,7 +1534,7 @@ static void _checkForVertData(met_record_t *mr)
}

// Record the date
UTIMunix_to_date(mr->v_mhdr.time_centroid,&mr->v_date);
mr->v_date.set(mr->v_mhdr.time_centroid);

// Record the actual way points returned, if it's the key field .
if (gd.mrec[gd.h_win.page] == mr) {
Expand Down
6 changes: 2 additions & 4 deletions codebase/apps/radar/src/Lucid/Makefile.qmake
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,6 @@ moc_VertWidget.cpp: VertWidget.hh \
cidd_structs.h \
cidd_colorscales.h \
cidd_field_data.h \
$(HOME)/lrose/include/toolsa/utim.h \
$(HOME)/lrose/include/toolsa/mem.h \
$(HOME)/lrose/include/toolsa/membuf.h \
moc_predefs.h \
Expand Down Expand Up @@ -1358,7 +1357,6 @@ moc_VertWindow.cpp: VertWindow.hh \
cidd_structs.h \
cidd_colorscales.h \
cidd_field_data.h \
$(HOME)/lrose/include/toolsa/utim.h \
$(HOME)/lrose/include/toolsa/mem.h \
$(HOME)/lrose/include/toolsa/membuf.h \
moc_predefs.h \
Expand Down Expand Up @@ -3642,7 +3640,6 @@ VertWidget.o: VertWidget.cc $(HOME)/lrose/include/toolsa/toolsa_macros.h \
cidd_structs.h \
cidd_colorscales.h \
cidd_field_data.h \
$(HOME)/lrose/include/toolsa/utim.h \
$(HOME)/lrose/include/toolsa/mem.h \
$(HOME)/lrose/include/toolsa/membuf.h \
VertWindow.hh \
Expand All @@ -3662,6 +3659,7 @@ VertWidget.o: VertWidget.cc $(HOME)/lrose/include/toolsa/toolsa_macros.h \
$(HOME)/lrose/include/toolsa/Path.hh \
$(HOME)/lrose/include/toolsa/sockutil.h \
$(HOME)/lrose/include/toolsa/servmap.h \
$(HOME)/lrose/include/toolsa/utim.h \
$(HOME)/lrose/include/toolsa/umisc.h \
$(HOME)/lrose/include/toolsa/port.h \
$(HOME)/lrose/include/toolsa/ushmem.h \
Expand Down Expand Up @@ -3799,7 +3797,6 @@ VertWindow.o: VertWindow.cc CartManager.hh \
cidd_structs.h \
cidd_colorscales.h \
cidd_field_data.h \
$(HOME)/lrose/include/toolsa/utim.h \
$(HOME)/lrose/include/toolsa/mem.h \
$(HOME)/lrose/include/toolsa/membuf.h \
cidd.h \
Expand All @@ -3818,6 +3815,7 @@ VertWindow.o: VertWindow.cc CartManager.hh \
$(HOME)/lrose/include/toolsa/Path.hh \
$(HOME)/lrose/include/toolsa/sockutil.h \
$(HOME)/lrose/include/toolsa/servmap.h \
$(HOME)/lrose/include/toolsa/utim.h \
$(HOME)/lrose/include/toolsa/umisc.h \
$(HOME)/lrose/include/toolsa/port.h \
$(HOME)/lrose/include/toolsa/ushmem.h \
Expand Down
2 changes: 1 addition & 1 deletion codebase/apps/radar/src/Lucid/ProductMgr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ int ProductMgr::getData(time_t start_time, time_t end_time)
(time_t) gd.epoch_end,
(time_t) start_time,
(time_t) end_time,
gd.mrec[gd.h_win.page]->h_date.unix_time);
gd.mrec[gd.h_win.page]->h_date.utime());

// get the data

Expand Down
12 changes: 5 additions & 7 deletions codebase/apps/radar/src/Lucid/cidd_field_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#ifndef CIDD_FIELD_DATA_H
#define CIDD_FIELD_DATA_H

#include <toolsa/utim.h>
#include <toolsa/DateTime.hh>
#include <toolsa/mem.h>

class ColorMap;
Expand Down Expand Up @@ -107,10 +107,8 @@ class met_record_t { /* METEROLOGICAL DATA record info - for each data field
h_fl32_data = NULL;
v_fl32_data = NULL;

// MEM_zero(time_list);

MEM_zero(h_date);
MEM_zero(v_date);
h_date.setToNever();
v_date.setToNever();

proj = NULL;

Expand Down Expand Up @@ -215,8 +213,8 @@ class met_record_t { /* METEROLOGICAL DATA record info - for each data field
Valcolormap_t h_vcm; /* Data value to X color info */
Valcolormap_t v_vcm; /* Data value to X color info */

UTIMstruct h_date; /* date and time stamp of latest data - Horiz */
UTIMstruct v_date; /* date and time stamp of latest data - Vert */
DateTime h_date; /* date and time stamp of latest data - Horiz */
DateTime v_date; /* date and time stamp of latest data - Vert */

MdvxProj *proj; /* Pointer to projection class */

Expand Down
32 changes: 16 additions & 16 deletions codebase/apps/radar/src/Lucid/graphic_reset.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,20 @@ void reset_terrain_valid_flags(int hflag,int vflag)
if(hflag) {
if(gd.layers.earth.terrain_active) {
gd.layers.earth.terr->h_data_valid = 0;
gd.layers.earth.terr->h_date.unix_time = 0;
gd.layers.earth.terr->h_date.setToZero();
}

if(gd.layers.earth.landuse_active) {
gd.layers.earth.land_use->h_data_valid = 0;
gd.layers.earth.land_use->h_date.unix_time = 0;
gd.layers.earth.land_use->h_date.setToZero();
}
}

if(vflag) {

if(gd.layers.earth.terrain_active) {
gd.layers.earth.terr->v_data_valid = 0;
gd.layers.earth.terr->v_date.unix_time = 0;
gd.layers.earth.terr->v_date.setToZero();
}

}
Expand Down Expand Up @@ -153,18 +153,18 @@ void reset_data_valid_flags(int hflag,int vflag)
gd.mrec[i]->h_data_valid = 1;
} else {
gd.mrec[i]->h_data_valid = 0;
gd.mrec[i]->h_date.unix_time = 0;
gd.mrec[i]->h_date.setToZero();
}
}

for(i=0; i < gd.layers.num_wind_sets; i++) {
gd.layers.wind[i].wind_u->h_data_valid = 0;
gd.layers.wind[i].wind_u->h_date.unix_time = 0;
gd.layers.wind[i].wind_u->h_date.setToZero();
gd.layers.wind[i].wind_v->h_data_valid = 0;
gd.layers.wind[i].wind_v->h_date.unix_time = 0;
gd.layers.wind[i].wind_v->h_date.setToZero();
if(gd.layers.wind[i].wind_w != NULL) {
gd.layers.wind[i].wind_w->h_data_valid = 0;
gd.layers.wind[i].wind_w->h_date.unix_time = 0;
gd.layers.wind[i].wind_w->h_date.setToZero();
}
}

Expand All @@ -176,49 +176,49 @@ void reset_data_valid_flags(int hflag,int vflag)
gd.mrec[i]->v_data_valid = 1;
} else {
gd.mrec[i]->v_data_valid = 0;
gd.mrec[i]->v_date.unix_time = 0;
gd.mrec[i]->v_date.setToZero();
}
}

if(gd.layers.earth.terrain_active) {
gd.layers.earth.terr->v_data_valid = 0;
gd.layers.earth.terr->v_date.unix_time = 0;
gd.layers.earth.terr->v_date.setToZero();
}

if(gd.layers.route_wind.u_wind != NULL) {
gd.layers.route_wind.u_wind->v_data_valid = 0;
gd.layers.route_wind.u_wind->v_date.unix_time = 0;
gd.layers.route_wind.u_wind->v_date.setToZero();
}

if(gd.layers.route_wind.v_wind != NULL) {
gd.layers.route_wind.v_wind->v_data_valid = 0;
gd.layers.route_wind.v_wind->v_date.unix_time = 0;
gd.layers.route_wind.v_wind->v_date.setToZero();
}

if(gd.layers.route_wind.turb != NULL) {
gd.layers.route_wind.turb->v_data_valid = 0;
gd.layers.route_wind.turb->v_date.unix_time = 0;
gd.layers.route_wind.turb->v_date.setToZero();
}

if(gd.layers.route_wind.icing != NULL) {
gd.layers.route_wind.icing->v_data_valid = 0;
gd.layers.route_wind.icing->v_date.unix_time = 0;
gd.layers.route_wind.icing->v_date.setToZero();
}

for(i=0; i < gd.layers.num_wind_sets; i++) {
if(gd.layers.wind[i].wind_u != NULL) {
gd.layers.wind[i].wind_u->v_data_valid = 0;
gd.layers.wind[i].wind_u->v_date.unix_time = 0;
gd.layers.wind[i].wind_u->v_date.setToZero();
}

if(gd.layers.wind[i].wind_v != NULL) {
gd.layers.wind[i].wind_v->v_data_valid = 0;
gd.layers.wind[i].wind_v->v_date.unix_time = 0;
gd.layers.wind[i].wind_v->v_date.setToZero();
}

if(gd.layers.wind[i].wind_w != NULL) {
gd.layers.wind[i].wind_w->v_data_valid = 0;
gd.layers.wind[i].wind_w->v_date.unix_time = 0;
gd.layers.wind[i].wind_w->v_date.setToZero();
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions codebase/apps/radar/src/Lucid/render_legends.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ const char * field_label( met_record_t *mr)
static char label[2048];

/* Convert to a string */
time_t utime = mr->h_date.utime();
if(_params.use_local_timestamps) {
strftime(tlabel,256,_params.label_time_format,localtime_r(&mr->h_date.unix_time,&tms));
strftime(tlabel,256,_params.label_time_format,localtime_r(&utime,&tms));
} else {
strftime(tlabel,256,_params.label_time_format,gmtime_r(&mr->h_date.unix_time,&tms));
strftime(tlabel,256,_params.label_time_format,gmtime_r(&utime,&tms));
}

// now = time(NULL);
Expand Down

0 comments on commit 3a61cd8

Please sign in to comment.