|
ocssw
1.0
|
00001 #include "hdf5_Aquarius.h" 00002 //#include <gsl/gsl_interp.h> 00003 00004 #define PRODSTRLEN 2048 /* String length limit for product spec */ 00005 00006 #define MAXNFILES 525 00007 00008 //#define TRUE 1 00009 00010 #define RFI 0 00011 #define RAIN 2 00012 #define LAND 3 00013 #define ICE 4 00014 #define WIND 5 00015 #define TEMP 6 00016 #define FLUXD 7 00017 #define FLUXR 8 00018 #define SUNGLINT 9 00019 #define MOON 10 00020 #define GALACTIC 11 00021 #define NAV 12 00022 #define SAOVERFLOW 13 00023 #define ROUGH 14 00024 #define FLARE 15 00025 00026 typedef struct input_struct { 00027 char infile[FILENAME_MAX]; 00028 char ofile[FILENAME_MAX]; 00029 char pfile[FILENAME_MAX]; 00030 00031 char flaguse[1024]; 00032 char l3bprod[PRODSTRLEN]; 00033 // int64_t l3bprodword; 00034 00035 char resolve[16]; 00036 int32_t beam; 00037 00038 char fit[16]; 00039 float filter_width; 00040 int32_t fill; 00041 00042 char pversion[64]; 00043 00044 char orbit_type[4]; 00045 00046 bool require; 00047 } instr; 00048 00049 int parseInput( int argc, char* argv[], instr *l2binInput, string *procControl); 00050 00051 inline 00052 int extParmWordValue( string sLine, string *sParmWord, string *sValue) { 00053 00054 string::size_type posBeginIdx, posEndIdx; 00055 string::size_type ipos=0; 00056 const string sDelim( "=" ); 00057 00058 // Extract parameter word 00059 posEndIdx = sLine.find_first_of( sDelim ); 00060 *sParmWord = sLine.substr( ipos, posEndIdx ); 00061 posBeginIdx = posEndIdx + 1; // Beginning of next word (after '=') 00062 00063 // Convert to uppercase 00064 for (size_t j=0; j<(*sParmWord).length(); j++) 00065 (*sParmWord)[j] = toupper((*sParmWord)[j]); 00066 00067 // Extract parameter value 00068 *sValue = sLine.substr( posBeginIdx); 00069 00070 return 0; 00071 } 00072 00073 00074 inline 00075 int expandEnvVar( string *sValue) { 00076 if ( (*sValue).find_first_of( "$" ) == string::npos) return 0; 00077 string::size_type posEndIdx = (*sValue).find_first_of( "/" ); 00078 if ( posEndIdx == string::npos) return 0; 00079 char *envVar_str = getenv((*sValue).substr( 1, posEndIdx-1 ).c_str()); 00080 if (envVar_str == 0x0) { 00081 printf("Environment variable: %s not defined.\n", envVar_str); 00082 exit(1); 00083 } 00084 *sValue = envVar_str + (*sValue).substr( posEndIdx); 00085 00086 return 0; 00087 } 00088 00089
1.7.6.1