Go to the documentation of this file.
18 char softwareVersion[200];
25 sprintf(tmpStr,
"Usage: l3bindump argument-list\n\n");
26 strcat(tmpStr,
" The argument-list is a set of keyword=value pairs. The arguments can\n");
27 strcat(tmpStr,
" be specified on the command line, or put into a parameter file, or the\n");
28 strcat(tmpStr,
" two methods can be used together, with command line overriding.\n\n");
29 strcat(tmpStr,
" return value: 0=OK, 1=error, 110=requested bin(s) not found\n");
30 strcat(tmpStr,
" file data.\n\n");
31 strcat(tmpStr,
" There are 3 use cases:\n");
32 strcat(tmpStr,
" 1) dump the bin requested by bin number\n");
33 strcat(tmpStr,
" use: bin_number=<the number>\n");
34 strcat(tmpStr,
" 2) region defined by lat, lon, and radius (in km)\n");
35 strcat(tmpStr,
" use: lat=<latitude> lon=<longitude> radius=<radius in km>\n");
36 strcat(tmpStr,
" 3) region defined by north, south, east, west\n");
37 strcat(tmpStr,
" use: north=<N> south=<S> east=<E> west=<W>\n");
39 strcat(tmpStr,
"The list of valid keywords follows:\n");
45 strcpy(tmpStr,
"output file format\n");
46 strcat(tmpStr,
" txt: plain text columnar format\n");
47 strcat(tmpStr,
" seabass: SeaBASS format");
66 char tmp_file[FILENAME_MAX];
71 char keyword[FILENAME_MAX];
76 for (optionId = 0; optionId < numOptions; optionId++) {
87 while (*strVal !=
'\0') {
88 *strVal = tolower(*strVal);
92 if (strcmp(keyword,
"help") == 0)
94 else if (strcmp(keyword,
"version") == 0)
96 else if (strncmp(keyword,
"dump_options", 12) == 0)
98 else if (strcmp(keyword,
"par") == 0)
100 else if (strcmp(keyword,
"ifile") == 0) {
105 }
else if (strcmp(keyword,
"ofile") == 0) {
111 }
else if (strcmp(keyword,
"oformat") == 0) {
114 if (tmpStr ==
NULL) {
115 printf(
"-E- l2gen_load_input: oformat=%s is not a recognized file format\n",
121 }
else if (strcmp(keyword,
"l3bprod") == 0) {
123 input->l3bprod[0] =
'\0';
126 strcat(
input->l3bprod,
" ");
127 strcat(
input->l3bprod, strArray[
i]);
129 }
else if (strcmp(keyword,
"west") == 0) {
131 }
else if (strcmp(keyword,
"east") == 0) {
133 }
else if (strcmp(keyword,
"north") == 0) {
135 }
else if (strcmp(keyword,
"south") == 0) {
137 }
else if (strcmp(keyword,
"lat") == 0) {
139 }
else if (strcmp(keyword,
"lon") == 0) {
141 }
else if (strcmp(keyword,
"bin_number") == 0) {
143 }
else if (strcmp(keyword,
"radius") == 0) {
145 }
else if (strcmp(keyword,
"verbose") == 0) {
148 printf(
"-E- Invalid argument \"%s\"\n", keyword);
158 if (
input->bin_number >= 0 && (
input->radius != -999 ||
160 input->north != -999 ||
input->south != -999 ||
161 input->west != -999 ||
input->east != -999)) {
162 printf(
"-E- Invalid argument set: bin_number cannot be provided if lon/lat/radius or NSWE are provided \n");
166 if (
input->radius != -999 && (
input->lat == -999 ||
input->lon == -999)) {
167 printf(
"-E- Invalid argument set: radius reqiures lon/lat to be provided\n");
171 if (
input->lat != -999 &&
input->lon == -999) {
172 printf(
"-E- Invalid argument set: if lat is set, lon must be provided\n");
176 if (
input->lat == -999 &&
input->lon != -999) {
177 printf(
"-E- Invalid argument set: if lon is set, lat must be provided\n");
181 if ((
input->radius != -999 ||
input->lat != -999 ||
input->lon != -999) &&
182 (
input->north != -999 ||
input->south != -999 ||
183 input->west != -999 ||
input->east != -999)) {
184 printf(
"-E- Choose either lon/lat/radius or NSWE\n");
207 char tmpStr[FILENAME_MAX];
208 char progName[] =
"l3bindump";
212 if ((dataRoot = getenv(
"OCDATAROOT")) ==
NULL) {
213 printf(
"-E- OCDATAROOT environment variable is not defined.\n");
222 sprintf(tmpStr,
"%s/common/%s_defaults.par", dataRoot, progName);
224 printf(
"Loading default parameters from %s\n", tmpStr);
229 printf(
"Loading command line parameters\n\n");
242 input->ifile[0] =
'\0';
243 input->ofile [0] =
'\0';
244 input->oformat[0] =
'\0';
245 input->l3bprod[0] =
'\0';
253 input->bin_number = -1;
254 input->radius = -999;
clo_option_t * clo_addOption(clo_optionList_t *list, const char *key, enum clo_dataType_t dataType, const char *defaultVal, const char *desc)
float clo_getOptionFloat(clo_option_t *option)
void clo_readArgs(clo_optionList_t *list, int argc, char *argv[])
char ** clo_getOptionStrings(clo_option_t *option, int *count)
int clo_isOptionSet(clo_option_t *option)
void clo_setVersion2(const char *programName, const char *versionStr)
void clo_setSelectOptionKeys(char **keys)
int64_t clo_getOptionInt64(clo_option_t *option)
void clo_setEnableDumpOptions(int val)
clo_optionList_t * clo_createList()
list(APPEND LIBS ${NETCDF_LIBRARIES}) find_package(GSL REQUIRED) include_directories($
void clo_setHelpStr(const char *str)
char * clo_getOptionString(clo_option_t *option)
void clo_printUsage(clo_optionList_t *list)
clo_option_t * clo_getOption(clo_optionList_t *list, int i)
void clo_readFile(clo_optionList_t *list, const char *fileName)
int clo_getNumOptions(clo_optionList_t *list)
void parse_file_name(const char *inpath, char *outpath)
void clo_dumpOption(clo_option_t *option)
enum clo_dataType_t dataType
How many dimensions is the output array Default is Not sure if anything above will work correctly strcpy(l2prod->title, "no title yet")
int clo_getOptionBool(clo_option_t *option)