Skip to content

Commit 7a7cd0c

Browse files
MartinHerrencbassa
authored andcommitted
[rfplot] Add -T and -E option to specify range to display given date/time strings
Using the new get_subs_from_datestrings() function in rfio. Signed-off-by: Martin Herren (HB9FXX) <[email protected]>
1 parent affe4fe commit 7a7cd0c

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

rfplot.c

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ int main(int argc,char *argv[])
8282
double foff=0.0,mjdgrid=0.0;
8383
int jj0,jj1;
8484
int show_names = 0;
85+
char * start_time = NULL;
86+
char * end_time = NULL;
8587

8688
// Get site
8789
env=getenv("ST_COSPAR");
@@ -106,7 +108,7 @@ int main(int argc,char *argv[])
106108

107109
// Read arguments
108110
if (argc>1) {
109-
while ((arg=getopt(argc,argv,"p:f:w:s:l:b:z:hc:C:gm:o:S:W:F:n"))!=-1) {
111+
while ((arg=getopt(argc,argv,"p:f:w:s:l:b:z:hc:C:gm:o:S:W:F:nT:E:"))!=-1) {
110112
switch (arg) {
111113

112114
case 'p':
@@ -180,6 +182,14 @@ int main(int argc,char *argv[])
180182
show_names = 1;
181183
break;
182184

185+
case 'T':
186+
start_time = optarg;
187+
break;
188+
189+
case 'E':
190+
end_time = optarg;
191+
break;
192+
183193
default:
184194
usage();
185195
return 0;
@@ -190,6 +200,16 @@ int main(int argc,char *argv[])
190200
return 0;
191201
}
192202

203+
if (start_time || end_time) {
204+
status = get_subs_from_datestrings(path, start_time, end_time, &isub, &nsub);
205+
206+
if (status != 0) {
207+
printf("Failed to read files or requested period out of bin range\n");
208+
209+
return -1;
210+
}
211+
}
212+
193213
// Read data
194214
s=read_spectrogram(path,isub,nsub,f0,df0,nbin,foff);
195215

@@ -1043,6 +1063,10 @@ void usage(void)
10431063
printf("-C <site> Site ID\n");
10441064
printf("-c <catalog> TLE catalog\n");
10451065
printf("-F <freqlist> List with frequencies [$ST_DATADIR/data/frequencies.txt]\n");
1066+
printf("-T <time> Start time to plot, in the format YYYY-MM-DDTHH.mm.ss\n");
1067+
printf(" This setting overrides the -s setting\n");
1068+
printf("-E <time> End time to plot, in the format YYYY-MM-DDTHH.mm.ss\n");
1069+
printf(" This setting overrides the -l setting\n");
10461070
printf("-g GRAVES data\n");
10471071
printf("-n Display satellite names\n");
10481072
printf("-h This help\n");

0 commit comments

Comments
 (0)