/*----------------------------------------------------------------------*/ /* wtrlvl.c is a program which returns the water level data from the */ /* Great Lakes Water Level Database data files for the date and time */ /* most closely matching the date and time indicated by the name of the */ /* input image file(s), which must be of the form created by the argus */ /* and voyeur series of Remote Video Monitoring stations. The database */ /* files location is set by the constant WTRLVL_LOC in rvmlib.h. */ /* */ /* NOTE: If the location of the water level data files is moved, */ /* WTRLVL_LOC must be modified. */ /*----------------------------------------------------------------------*/ #include "rvmlibv2.h" /*----------------------------*/ /* provides usage information */ /*----------------------------*/ void usage() { fprintf(stdout, "\nusage: wtrlvl [-h] filename...\n\ -h show help page\n\ filename: standard Remote Video Monitoring System composed filename\n\ Input filename(s) must be of the form\n\ eg. 751757722.Wed.Oct.27_21:35:22.GMT.1993.timex.2.ras\n\ Output goes to the standard out\n\n"); } /*---------------------------*/ /* provides help information */ /*---------------------------*/ void help() { fprintf(stdout, "\n\ NAME\n\ WTRLVL\n\ SYNOPSIS\n\ WTRLVL [-h] filename...\n\ DESCRIPTION\n\ wtrlvl returns a water level data value from a Great Lakes Water Level\n\ Database file for the date and time most closely matching the date and\n\ time of the input image filename(s). Input image filenames must be of\n\ the correct form eg. 751757722.Wed.Oct.27_21:35:22.GMT.1993.timex.2.ras\n\ OPTIONS\n\ -h shoe help page\n\ filename specifies a Remote Video Monitoring System composed filename\n\ OUTPUT\n\ wtrlvl determines the correct water value for the input filename(s) and\n\ prints that value to the standard output.\n\n"); exit(); } /*----------------------*/ /* wtrlvl main function */ /*----------------------*/ main(int argc, char *argv[]) { FILE *fp; float *retval; int file; if(argc < 2) usage(); /*------------------*/ /* initialize stuff */ /*------------------*/ file = 1; /*------------------------------*/ /* parse command line arguments */ /*------------------------------*/ while(*argv[file] == '-') { switch(*(argv[file] + 1)) { case 'h': help(); default: usage(); } } /*------------------*/ /* for each file... */ /*------------------*/ while(file < argc) { /*------------------------------------------*/ /* determine the relative water level value */ /*------------------------------------------*/ retval = (float *) wtrlvl_value(argv[file]); /*------------------------------------------*/ /* print the name of the input file and the */ /* relative water level value */ /*------------------------------------------*/ fprintf(stdout, "%s - %3.4f\n", argv[file], *retval); /*----------------------------*/ /* increment the file counter */ /*----------------------------*/ file++; } free(retval); exit(); }