#include <stdio.h>#include <stdlib.h>#include <string.h>#include <time.h>#include <unistd.h>#include <netcdf.h>#include "nco_netcdf.h"#include "nco.h"#include "nco_mmr.h"Include dependency graph for nco_ctl.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Functions | |
| const char * | nco_cmp_get (void) |
| void | nco_exit (int rcd) |
| void | nco_exit_gracefully (void) |
| bool | nco_is_rth_opr (const int prg_id) |
| bool | nco_is_mlt_fl_opr (const int prg_id) |
| void | nco_lbr_vrs_prn (void) |
| const char * | nco_mpi_get (void) |
| char * | prg_prs (const char *const nm_in, int *const prg_lcl) |
| const char * | nco_nmn_get (void) |
| void | nco_usg_prn (void) |
|
|
Definition at line 12 of file nco_ctl.c. References dbg_lvl_get(), and prg_nm_get(). Referenced by main(). 00013 { 00014 /* Purpose: Return string containing compiler and version */ 00015 const char fnc_nm[]="nco_cmp_get()"; 00016 #ifdef _AIX 00017 static const char cmp_nm[]="xlc"; /* [sng] Compiler name */ 00018 static const char cmp_sng[]="Token _AIX_ defined in nco_cmp_get(), probably compiled with xlc"; /* [sng] Compiler string */ 00019 #endif /* !_AIX */ 00020 #if defined(__GNUC__) && !defined(__INTEL_COMPILER) 00021 static const char cmp_nm[]="gcc"; /* [sng] Compiler name */ 00022 static const char cmp_sng[]="Token __GNUC__ defined in nco_cmp_get(), probably compiled with gcc"; /* [sng] Compiler string */ 00023 #endif /* !__GNUC__ */ 00024 #ifdef __INTEL_COMPILER 00025 /* Some compilers, including icc, also define __GNUC__ by default */ 00026 static const char cmp_nm[]="icc"; 00027 static const char cmp_sng[]="Token __INTEL_COMPILER defined in nco_cmp_get(), probably compiled with icc"; /* [sng] Compiler string */ 00028 #endif /* !__INTEL_COMPILER */ 00029 /* In case none of the above tokens matched */ 00030 #if !defined(_AIX) && !defined(__GNUC__) && !defined(__INTEL_COMPILER) 00031 /* Unknown compiler */ 00032 static const char cmp_nm[]="unknown"; /* [sng] Compiler name */ 00033 static const char cmp_sng[]="Unknown compiler tokens in nco_cmp_get(), compiler is unknown"; /* [sng] Compiler string */ 00034 #endif /* !unknown */ 00035 if(dbg_lvl_get() > 4) (void)fprintf(stderr,"%s: INFO %s reports compiler name is %s, compiler string is %s\n",prg_nm_get(),fnc_nm,cmp_nm,cmp_sng); 00036 00037 return cmp_nm; 00038 } /* end nco_cmp_get() */
|
|
|
|
Definition at line 105 of file nco_ctl.c. References EXIT_SUCCESS, nco_exit(), nco_free(), and prg_nm_get(). Referenced by main(). 00106 { 00107 /* Purpose: Clean up timers, file descriptors, memory, then exit */ 00108 char *time_bfr_end; 00109 time_t time_crr_time_t; 00110 00111 /* End clock */ 00112 time_crr_time_t=time((time_t *)NULL); 00113 time_bfr_end=ctime(&time_crr_time_t); time_bfr_end=time_bfr_end; /* Avoid compiler warning until variable is used for something */ 00114 /* (void)fprintf(stderr,"\tend = %s\n",time_bfr_end);*/ 00115 00116 (void)fclose(stderr); 00117 (void)fclose(stdin); 00118 (void)fclose(stdout); 00119 00120 /* This should be penultimate command in program 00121 After program name is free'd, calls to prg_nm_get() will fail */ 00122 (void)nco_free(prg_nm_get()); 00123 00124 nco_exit(EXIT_SUCCESS); 00125 } /* end nco_exit_gracefully() */
|
|
|
Definition at line 129 of file nco_ctl.c. References False, ncap, ncatted, ncbo, ncea, ncecat, ncflint, ncks, nco_dfl_case_prg_id_err(), ncpdq, ncra, ncrcat, ncrename, ncwa, and True. Referenced by nco_fl_lst_mk(), and nco_usg_prn(). 00130 { 00131 /* Purpose: Is this a multi-file operator? 00132 Such operators attempt to read input filenames from stdin when input filenames are not positional arguments */ 00133 switch(prg_id){ 00134 case ncea: 00135 case ncecat: 00136 case ncra: 00137 case ncrcat: 00138 return True; 00139 break; 00140 case ncap: 00141 case ncatted: 00142 case ncbo: 00143 case ncflint: 00144 case ncks: 00145 case ncpdq: 00146 case ncrename: 00147 case ncwa: 00148 return False; 00149 break; 00150 default: nco_dfl_case_prg_id_err(); break; 00151 } /* end switch */ 00152 return False; 00153 } /* end nco_is_mlt_fl_opr() */
|
|
|
Definition at line 157 of file nco_ctl.c. References False, ncap, ncatted, ncbo, ncea, ncecat, ncflint, ncks, nco_dfl_case_prg_id_err(), ncpdq, ncra, ncrcat, ncrename, ncwa, and True. Referenced by nco_pck_dsk_inq(), nco_var_dfn(), nco_var_get(), and nco_var_mtd_refresh(). 00158 { 00159 /* Purpose: Is operator arithmetic? 00160 For purposes of this function, an arithmetic operator is one which changes values 00161 Concatenators (ncrcat, ncecat) are not arithmetic because they just glue data 00162 Permutor (ncpdq) is not arithmetic because it just re-arranges values 00163 Packer (ncpdq) is not arithmetic because it re-represents values 00164 Attributors (ncrename, ncatted) are not arithmetic because they change metadata, not data 00165 nco_is_rth_opr() flag help control packing behavior 00166 Clearly, arithmetic operators must operate on unpacked values 00167 Hence, one use of nco_is_rth_opr() is to tell arithmetic operators to 00168 automatically unpack variables when reading them 00169 Non-arithmetic operators do not need to unpack variables */ 00170 switch(prg_id){ 00171 case ncap: 00172 case ncbo: 00173 case ncea: 00174 case ncflint: 00175 case ncra: 00176 case ncwa: 00177 return True; 00178 break; 00179 case ncatted: 00180 case ncecat: 00181 case ncks: 00182 case ncpdq: 00183 case ncrcat: 00184 case ncrename: 00185 return False; 00186 break; 00187 default: nco_dfl_case_prg_id_err(); break; 00188 } /* end switch */ 00189 return False; 00190 } /* end nco_is_rth_opr() */
|
|
|
Definition at line 193 of file nco_ctl.c. References NC_64BIT_OFFSET, nc_inq_libvers, nco_free(), nco_malloc(), nco_nmn_get(), and prg_nm_get(). 00194 { 00195 /* Purpose: Print netCDF library version */ 00196 00197 char *cmp_dat_sng; 00198 char *dlr_ptr; 00199 char *lbr_sng; 00200 char *lbr_vrs_sng; 00201 char *of_ptr; 00202 00203 size_t cmp_dat_sng_lng; 00204 size_t lbr_vrs_sng_lng; 00205 00206 /* Behavior of nc_inq_libvers() depends on library versions. Return values are: 00207 netCDF 3.4--3.6.x: "3.4 of May 16 1998 14:06:16 $" 00208 netCDF 4.0-alpha1-4.0-alpha10: NULL 00209 netCDF 4.0-alpha11-present: "4.0-alpha11" */ 00210 lbr_sng=(char *)strdup(nc_inq_libvers()); 00211 /* (void)fprintf(stderr,"%s: nco_lbr_vrs_prn() returns %s\n",prg_nm_get(),lbr_sng);*/ 00212 of_ptr=strstr(lbr_sng," of "); 00213 if(of_ptr == NULL){ 00214 (void)fprintf(stderr,"%s: WARNING nco_lbr_vrs_prn() reports of_ptr == NULL\n",prg_nm_get()); 00215 lbr_vrs_sng_lng=(size_t)strlen(lbr_sng); 00216 }else{ 00217 lbr_vrs_sng_lng=(size_t)(of_ptr-lbr_sng); 00218 } /* endif */ 00219 lbr_vrs_sng=(char *)nco_malloc(lbr_vrs_sng_lng+1); 00220 strncpy(lbr_vrs_sng,lbr_sng,lbr_vrs_sng_lng); 00221 lbr_vrs_sng[lbr_vrs_sng_lng]='\0'; /* NUL-terminate */ 00222 00223 dlr_ptr=strstr(lbr_sng," $"); 00224 if(of_ptr != NULL && dlr_ptr != NULL){ 00225 cmp_dat_sng_lng=(size_t)(dlr_ptr-of_ptr-4); /* 4 is the length of " of " */ 00226 cmp_dat_sng=(char *)nco_malloc(cmp_dat_sng_lng+1ul); 00227 strncpy(cmp_dat_sng,of_ptr+4,cmp_dat_sng_lng); /* 4 is the length of " of " */ 00228 cmp_dat_sng[cmp_dat_sng_lng]='\0'; /* NUL-terminate */ 00229 }else{ 00230 cmp_dat_sng=(char *)strdup("Unknown"); 00231 } /* endif */ 00232 00233 (void)fprintf(stderr,"Linked to netCDF library version %s, compiled %s\n",lbr_vrs_sng,cmp_dat_sng); 00234 (void)fprintf(stdout,"Homepage URL: http://nco.sf.net\n"); 00235 (void)fprintf(stdout,"User's Guide: http://nco.sf.net/nco.html\n"); 00236 /* fxm: TKN2YESNO breaks when TKN is undefined 00237 Full macro language like M4 might be useful here, though probably too much trouble */ 00238 #define TKN2YESNO(x) ((x+0) ? ("No"):("Yes")) 00239 /* Configuration option tokens must be consistent among configure.in, bld/Makefile, and nco_ctl.c 00240 Arrange tokens alphabetically by first word in English text description */ 00241 (void)fprintf(stderr,"Configuration Option:\tActive?\tMeaning or Reference:\nDebugging: Custom\t%s\tPedantic, bounds checking (slowest execution)\nDebugging: Symbols\t%s\tProduce symbols for debuggers (e.g., dbx, gdb)\nInternationalization\t%s\thttp://nco.sf.net/nco.html#i18n (pre-alpha)\nMPI parallelization\t%s\thttp://nco.sf.net/nco.html#mpi (alpha)\nnetCDF3 64-bit files\t%s\thttp://nco.sf.net/nco.html#lfs\nnetCDF4/HDF\t\t%s\thttp://nco.sf.net/nco.html#netcdf4\nOPeNDAP/DODS clients\t%s\thttp://nco.sf.net/nco.html#dap\nOpenMP SMP threading\t%s\thttp://nco.sf.net/nco.html#omp\nOptimization: run-time\t%s\tFastest execution possible (slowest compilation)\nParallel netCDF3\t%s\thttp://nco.sf.net/nco.html#pnetcdf (pre-alpha)\nShared libraries built\t%s\tSmall, dynamically linked executables\nStatic libraries built\t%s\tLarge executables with private namespaces\nUDUnits conversions\t%s\thttp://nco.sf.net/nco.html#udunits\nWildcarding (regex)\t%s\thttp://nco.sf.net/nco.html#rx\n%s", 00242 #if defined(ENABLE_DEBUG_CUSTOM) && (ENABLE_DEBUG_CUSTOM) 00243 "Yes", 00244 #else /* !ENABLE_DEBUG_CUSTOM */ 00245 "No", 00246 #endif /* !ENABLE_DEBUG_CUSTOM */ 00247 #if defined(ENABLE_DEBUG_SYMBOLS) && (ENABLE_DEBUG_SYMBOLS) 00248 "Yes", 00249 #else /* !ENABLE_DEBUG_SYMBOLS */ 00250 "No", 00251 #endif /* !ENABLE_DEBUG_SYMBOLS */ 00252 #if defined(I18N) && (I18N) 00253 "Yes", 00254 #else /* !I18N */ 00255 "No", 00256 #endif /* !I18N */ 00257 #if defined(ENABLE_MPI) && (ENABLE_MPI) 00258 "Yes", 00259 #else /* !ENABLE_MPI */ 00260 "No", 00261 #endif /* !ENABLE_MPI */ 00262 #if defined(NC_64BIT_OFFSET) && (NC_64BIT_OFFSET) 00263 "Yes", 00264 #else /* !NC_64BIT_OFFSET */ 00265 "No", 00266 #endif /* !NC_64BIT_OFFSET */ 00267 #if defined(ENABLE_NETCDF4) && (ENABLE_NETCDF4) 00268 "Yes", 00269 #else /* !ENABLE_NETCDF4 */ 00270 "No", 00271 #endif /* !ENABLE_NETCDF4 */ 00272 #if defined(ENABLE_DAP) && (ENABLE_DAP) 00273 "Yes", 00274 #else /* !ENABLE_DAP */ 00275 "No", 00276 #endif /* !ENABLE_DAP */ 00277 #if defined(_OPENMP) && (_OPENMP) 00278 "Yes", 00279 #else /* !_OPENMP */ 00280 "No", 00281 #endif /* !_OPENMP */ 00282 #if defined(ENABLE_OPTIMIZE_CUSTOM) && (ENABLE_OPTIMIZE_CUSTOM) 00283 "Yes", 00284 #else /* !ENABLE_OPTIMIZE_CUSTOM */ 00285 "No", 00286 #endif /* !ENABLE_OPTIMIZE_CUSTOM */ 00287 #if defined(ENABLE_PNETCDF) && (ENABLE_PNETCDF) 00288 "Yes", 00289 #else /* !ENABLE_PNETCDF */ 00290 "No", 00291 #endif /* !ENABLE_PNETCDF */ 00292 #if defined(ENABLE_SHARED) && (ENABLE_SHARED) 00293 "Yes", 00294 #else /* !ENABLE_SHARED */ 00295 "No", 00296 #endif /* !ENABLE_SHARED */ 00297 #if defined(ENABLE_STATIC) && (ENABLE_STATIC) 00298 "Yes", 00299 #else /* !ENABLE_STATIC */ 00300 "No", 00301 #endif /* !ENABLE_STATIC */ 00302 #if defined(ENABLE_UDUNITS) && (ENABLE_UDUNITS) 00303 "Yes", 00304 #else /* !ENABLE_UDUNITS */ 00305 "No", 00306 #endif /* !ENABLE_UDUNITS */ 00307 #if defined(NCO_HAVE_REGEX_FUNCTIONALITY) && (NCO_HAVE_REGEX_FUNCTIONALITY) 00308 "Yes", 00309 #else /* !NCO_HAVE_REGEX_FUNCTIONALITY */ 00310 "No", 00311 #endif /* !NCO_HAVE_REGEX_FUNCTIONALITY */ 00312 ""); /* End of print statement marker */ 00313 (void)fprintf(stderr,"\n%s",nco_nmn_get()); 00314 00315 lbr_vrs_sng=(char *)nco_free(lbr_vrs_sng); 00316 lbr_sng=(char *)nco_free(lbr_sng); 00317 cmp_dat_sng=(char *)nco_free(cmp_dat_sng); 00318 } /* end nco_lbr_vrs_prn() */
|
|
|
Definition at line 41 of file nco_ctl.c. References dbg_lvl_get(), and prg_nm_get(). Referenced by main(). 00042 { 00043 /* Purpose: Return string containing MPI implementation information */ 00044 const char fnc_nm[]="nco_mpi_get()"; 00045 00046 #ifdef _H_MPI 00047 static const char mpi_nm[]="PPE"; /* [sng] MPI name */ 00048 static const char mpi_sng[]="Token _H_MPI defined in nco_mpi_get(), MPI environment is probably AIX PPE MPI"; /* [sng] MPI string */ 00049 #endif /* !_H_MPI */ 00050 #ifdef LAM_MPI 00051 static const char mpi_nm[]="LAM"; /* [sng] MPI name */ 00052 static const char mpi_sng[]="Token LAM_MPI defined in nco_mpi_get(), MPI environment is probably LAM-MPI"; /* [sng] MPI string */ 00053 #endif /* !LAM_MPI */ 00054 #if MPICH_NAME == '1' 00055 static const char mpi_nm[]="MPICH"; /* [sng] MPI name */ 00056 static const char mpi_sng[]="Token MPICH_NAME defined to 1 in nco_mpi_get(), MPI environment is probably MPICH version 1"; /* [sng] MPI string */ 00057 #endif /* !MPICH_NAME */ 00058 #ifdef MPICH2 00059 static const char mpi_nm[]="MPICH2"; /* [sng] MPI name */ 00060 static const char mpi_sng[]="Token MPICH2 defined in nco_mpi_get(), MPI environment is probably MPICH2, i.e., MPICH version 2"; /* [sng] MPI string */ 00061 #endif /* !MPICH2 */ 00062 00063 /* In case no token matched */ 00064 #if !defined(_H_MPI) && !defined(LAM_MPI) && (MPICH_NAME != '1') && !defined(MPICH2) 00065 #ifndef MPI_VERSION 00066 /* MPI is not installed */ 00067 static const char mpi_nm[]="none"; /* [sng] MPI name */ 00068 static const char mpi_sng[]="No MPI tokens found in nco_cmp_get(), MPI environment is not active"; /* [sng] MPI string */ 00069 #else /* MPI_VERSION */ 00070 /* Unknown MPI implementation */ 00071 static const char mpi_nm[]="unknown"; /* [sng] MPI name */ 00072 static const char mpi_sng[]="Unknown MPI tokens found in nco_cmp_get(), MPI environment is present but of unknown pedigree"; /* [sng] MPI string */ 00073 #endif /* MPI_VERSION */ 00074 #endif /* !unknown */ 00075 00076 if(dbg_lvl_get() > 4) (void)fprintf(stderr,"%s: INFO %s reports MPI implementation name is %s, MPI implementation string is %s\n",prg_nm_get(),fnc_nm,mpi_nm,mpi_sng); 00077 return mpi_nm; 00078 } /* end nco_mpi_get() */
|
|
|
Definition at line 321 of file nco_ctl.c. Referenced by nco_lbr_vrs_prn(). 00322 { 00323 /* Purpose: Return mnemonic describing current NCO version */ 00324 return "As a young teenager I prayed to ancient Greek gods, usually Apollo, for vengeance against three classmates who taunted me when I rode the school bus. Unfortunately Bret, Steve, and Randy were never punished (as far as I know). They could be the basis for J. K. Rowlings' Malfoy, Crabb, and Goyle. I'm now an atheist, and I hope they get justice in Harry Potter Book 7.\n"; 00325 } /* end nco_nmn_get() */
|
|
|
Definition at line 402 of file nco_ctl.c. References ncap, ncatted, ncbo, ncea, ncecat, ncflint, ncks, nco_dfl_case_prg_id_err(), nco_free(), nco_is_mlt_fl_opr(), ncpdq, ncra, ncrcat, ncrename, ncwa, NULL_CEWI, prg_get(), and prg_nm_get(). Referenced by main(), nco_fl_lst_mk(), nco_lmt_prs(), and nco_prs_rnm_lst(). 00403 { 00404 /* Purpose: Print correct command-line usage (currently to stdout) */ 00405 00406 char *opt_sng=NULL_CEWI; 00407 00408 int prg_lcl; 00409 00410 prg_lcl=prg_get(); 00411 00412 switch(prg_lcl){ 00413 case ncap: 00414 opt_sng=(char *)strdup("[-4] [-A] [-C] [-c] [-D dbg_lvl] [-d ...] [-F] [-f] [-h] [-l path] [-O] [-o out.nc] [-p path] [-R] [-r] [-s algebra] [-S fl.nco] [-v] [-Z] in.nc [out.nc]\n"); 00415 break; 00416 case ncatted: 00417 opt_sng=(char *)strdup("[-a ...] [-D dbg_lvl] [-h] [-l path] [-O] [-o out.nc] [-p path] [-R] [-r] [-Z] in.nc [[out.nc]]\n"); 00418 break; 00419 case ncbo: 00420 opt_sng=(char *)strdup("[-4] [-A] [-C] [-c] [-D dbg_lvl] [-d ...] [-F] [-h] [-l path] [-n ...] [-O] [-o out.nc] [-p path] [-R] [-r] [-t thr_nbr] [-v ...] [-x] [-y op_typ] in_1.nc in_2.nc [out.nc]\n"); 00421 break; 00422 case ncflint: 00423 opt_sng=(char *)strdup("[-4] [-A] [-C] [-c] [-D dbg_lvl] [-d ...] [-F] [-h] [-i var,val] [-l path] [-O] [-o out.nc] [-p path] [-R] [-r] [-t thr_nbr] [-v ...] [-x] [-w wgt_1[,wgt_2]] [-Z] in_1.nc in_2.nc [out.nc]\n"); 00424 break; 00425 case ncks: 00426 opt_sng=(char *)strdup("[-4] [-A] [-a] [-B] [-b fl_bnr] [-C] [-c] [-D dbg_lvl] [-d ...] [-F] [-H] [-h] [-l path] [-m] [-M] [-O] [-o out.nc] [-P] [-p path] [-Q] [-q] [-R] [-r] [-s format] [-u] [-v ...] [-x] [-Z] in.nc [[out.nc]]\n"); 00427 break; 00428 case ncpdq: 00429 opt_sng=(char *)strdup("[-4] [-A] [-a ...] [-C] [-c] [-D dbg_lvl] [-d ...] [-F] [-h] [-l path] [-M pck_map][-O] [-o out.nc] [-P pck_plc] [-p path] [-R] [-r] [-t thr_nbr] [-v ...] [-U] [-x] [-Z] in.nc [out.nc]\n"); 00430 break; 00431 case ncra: 00432 case ncea: 00433 opt_sng=(char *)strdup("[-4] [-A] [-C] [-c] [-D dbg_lvl] [-d ...] [-F] [-H] [-h] [-l path] [-n ...] [-O] [-o out.nc] [-p path] [-R] [-r] [-t thr_nbr] [-v ...] [-x] [-y op_typ] [-Z] in.nc [...] [out.nc]\n"); 00434 break; 00435 case ncrcat: 00436 case ncecat: 00437 opt_sng=(char *)strdup("[-4] [-A] [-C] [-c] [-D dbg_lvl] [-d ...] [-F] [-H] [-h] [-l path] [-n ...] [-O] [-o out.nc] [-p path] [-R] [-r] [-t thr_nbr] [-v ...] [-x] [-Z] in.nc [...] [out.nc]\n"); 00438 break; 00439 case ncrename: 00440 opt_sng=(char *)strdup("[-a ...] [-D dbg_lvl] [-d ...] [-h] [-l path] [-O] [-o out.nc] [-p path] [-R] [-r] [-v ...] [-Z] in.nc [[out.nc]]\n"); 00441 break; 00442 case ncwa: 00443 opt_sng=(char *)strdup("[-4] [-A] [-a ...] [-C] [-c] [-D dbg_lvl] [-d ...] [-F] [-h] [-I] [-l path] [-m mask] [-M val] [-N] [-O] [-o out.nc] [-p path] [-R] [-r] [-T condition] [-t thr_nbr] [-v ...] [-w wgt] [-x] [-y op_typ] [-Z] in.nc [out.nc]\n"); 00444 break; 00445 default: nco_dfl_case_prg_id_err(); break; 00446 } /* end switch */ 00447 00448 /* We now have command-specific command line option string */ 00449 (void)fprintf(stdout,"%s command line options cheat-sheet:\n",prg_nm_get()); 00450 (void)fprintf(stdout,"%s %s\n",prg_nm_get(),opt_sng); 00451 00452 if(strstr(opt_sng,"-4")) (void)fprintf(stdout,"-4, --4, --netcdf4\tOutput file in netCDF4 storage format (HDF5)\n"); 00453 if(strstr(opt_sng,"--64bit")) (void)fprintf(stdout,"\tOutput file in netCDF3 64-bit offset storage format\n"); 00454 if(strstr(opt_sng,"-A")) (void)fprintf(stdout,"-A, --apn, --append\tAppend to existing output file, if any\n"); 00455 if(strstr(opt_sng,"-a")){ 00456 if(prg_lcl == ncatted) (void)fprintf(stdout,"-a, --attribute att_nm,var_nm,mode,att_typ,att_val Attribute specification:\n\t\t\tmode = a,c,d,m,o and att_typ = f,d,l,s,c,b\n"); 00457 if(prg_lcl == ncks) (void)fprintf(stdout,"-a, --abc, --alphabetize\tDisable alphabetization of extracted variables\n"); 00458 if(prg_lcl == ncpdq) (void)fprintf(stdout,"-a, --arrange, --permute, --reorder, --rdr [-]rdr_dim1[,[-]rdr_dim2[...]] Re-order dimensions\n"); 00459 if(prg_lcl == ncrename) (void)fprintf(stdout,"-a, --attribute old_att,new_att Attribute's old and new names\n"); 00460 if(prg_lcl == ncwa) (void)fprintf(stdout,"-a, --avg, --average avg_dim1[,avg_dim2[...]] Averaging dimensions\n"); 00461 } /* end if */ 00462 if(strstr(opt_sng,"-B")) (void)fprintf(stdout,"-B, --bnr, --binary\tWrite data to unformatted binary file\n"); 00463 if(strstr(opt_sng,"-b")) (void)fprintf(stdout,"-b, --fl_bnr, --binary-file fl_bnr\tUnformatted binary file to write\n"); 00464 if(strstr(opt_sng,"-c")) (void)fprintf(stdout,"-c, --crd, --coords\tCoordinate variables will all be processed\n"); 00465 if(strstr(opt_sng,"-C")) (void)fprintf(stdout,"-C, --nocoords\t\tAssociated coordinate variables should not be processed\n"); 00466 if(strstr(opt_sng,"-D")) (void)fprintf(stdout,"-D, --dbg_lvl, --debug-level dbg_lvl\tDebugging level\n"); 00467 if(strstr(opt_sng,"-d")){ 00468 if(prg_lcl == ncrename) (void)fprintf(stdout,"-d, --dmn, --dimension old_dim,new_dim Dimension's old and new names\n"); 00469 else if(prg_lcl == ncks) (void)fprintf(stdout,"-d, --dmn, --dimension dim,[min][,[max]][,[stride]] Dimension's limits and stride in hyperslab\n"); 00470 else if(prg_lcl == ncra || prg_lcl == ncrcat) (void)fprintf(stdout,"-d, --dmn, --dimension dim,[min][,[max]][,[stride]] Dimension's limits (any dimension) and stride (record dimension only) in hyperslab\n"); 00471 else (void)fprintf(stdout,"-d, --dmn, --dimension dim,[min][,[max]] Dimension's limits in hyperslab\n"); 00472 } /* end if -d */ 00473 if(strstr(opt_sng,"-F")) (void)fprintf(stdout,"-F, --ftn, --fortran\tFortran indexing conventions (1-based) for I/O\n"); 00474 if(strstr(opt_sng,"[-f]")) (void)fprintf(stdout,"-f, --fnc_tbl, --prn_fnc_tbl\tPrint function table\n"); 00475 if(strstr(opt_sng,"--fl_fmt")) (void)fprintf(stdout,"--fl_fmt, --file_format format\tFile format [classic,64bit,netcdf4,netcdf4_classic]\n"); 00476 if(strstr(opt_sng,"-H")){ 00477 if(prg_lcl == ncks) (void)fprintf(stdout,"-H, --huh, --hmm\tToggle printing data\n"); 00478 if(nco_is_mlt_fl_opr(prg_lcl)) (void)fprintf(stdout,"-H, --fl_lst_in, --file_list\tDo not create \"input_file_list\" global attribute\n"); 00479 } /* end if -H */ 00480 if(strstr(opt_sng,"-h")) (void)fprintf(stdout,"-h, --hst, --history\tDo not append to \"history\" global attribute\n"); 00481 if(strstr(opt_sng,"-i")) (void)fprintf(stdout,"-i, --ntp, --interpolate var,val\tInterpolant and value\n"); 00482 if(strstr(opt_sng,"-I")) (void)fprintf(stdout,"-I, --wgt_msk_crd_var \tDo not weight or mask coordinate variables\n"); 00483 if(strstr(opt_sng,"-l")) (void)fprintf(stdout,"-l, --lcl, --local path\tLocal storage path for remotely-retrieved files\n"); 00484 if(strstr(opt_sng,"-M")){ 00485 if(prg_lcl == ncwa) (void)fprintf(stdout,"-M, --msk_val, --mask-value, --mask_value mask_val\tMasking value (default is 1.0)\n"); 00486 if(prg_lcl == ncks) (void)fprintf(stdout,"-M, --Mtd, --Metadata\tToggle printing global metadata\n"); 00487 if(prg_lcl == ncpdq) (void)fprintf(stdout,"-M, --pck_map, --map pck_map\tPack map [flt_sht,flt_byt,hgh_sht,hgh_byt,nxt_lsr]\n"); 00488 } /* end if */ 00489 if(strstr(opt_sng,"-m")){ 00490 if(prg_lcl == ncwa) (void)fprintf(stdout,"-m, --msk_nm, --msk_var, --mask-variable, --mask_variable mask_var\tMasking variable name\n"); 00491 if(prg_lcl == ncks) (void)fprintf(stdout,"-m, --mtd, --metadata\tToggle printing variable metadata\n"); 00492 } /* end if */ 00493 if(strstr(opt_sng,"-N")) (void)fprintf(stdout,"-N, --nmr, --numerator\tNo normalization\n"); 00494 if(strstr(opt_sng,"-n")){ 00495 /* if(prg_lcl == ncwa) (void)fprintf(stdout,"-n\t\tNormalize by tally but not weight\n");*/ 00496 if(prg_lcl != ncwa) (void)fprintf(stdout,"-n, --nintap nbr_files,[nbr_numeric_chars[,increment]] NINTAP-style abbreviation of file list\n"); 00497 } /* end if -n */ 00498 if(strstr(opt_sng,"-o")) (void)fprintf(stdout,"-o, --output, --fl_out fl_out\tOutput file name (or use last positional argument)\n"); 00499 if(strstr(opt_sng,"-O")) (void)fprintf(stdout,"-O, --ovr, --overwrite\tOverwrite existing output file, if any\n"); 00500 if(strstr(opt_sng,"-P")){ 00501 if(prg_lcl == ncks) (void)fprintf(stdout,"-P, --prn, --print\tPrint data, metadata, and units. Abbreviation for -C -H -M -m -u.\n"); 00502 if(prg_lcl == ncpdq) (void)fprintf(stdout,"-P, --pck_plc, --pack_policy pck_plc\tPacking policy [all_new,all_xst,xst_new,upk]\n"); 00503 } /* end if -P */ 00504 if(strstr(opt_sng,"-p")) (void)fprintf(stdout,"-p, --pth, --path path\tPath prefix for all input filenames\n"); 00505 if(strstr(opt_sng,"-Q")) (void)fprintf(stdout,"-Q, \t\t\tToggle printing of dimension indices and coordinate values\n"); 00506 if(strstr(opt_sng,"-q")) (void)fprintf(stdout,"-q, --quiet\t\tTurn off all printing to screen\n"); 00507 if(strstr(opt_sng,"-R")) (void)fprintf(stdout,"-R, --rtn, --retain\tRetain remotely-retrieved files after use\n"); 00508 if(strstr(opt_sng,"-r")) (void)fprintf(stdout,"-r, --revision, --vrs, --version\tProgram version and copyright notice\n"); 00509 if(strstr(opt_sng,"-s")){ 00510 if(prg_lcl != ncap) (void)fprintf(stdout,"-s, --sng_fmt, --string format\tString format for text output\n"); 00511 if(prg_lcl == ncap) (void)fprintf(stdout,"-s, --spt, --script algebra\tAlgebraic command defining single output variable\n"); 00512 } /* end if */ 00513 if(strstr(opt_sng,"-S")) (void)fprintf(stdout,"-S, --fl_spt, --script-file fl.nco\tScript file containing multiple algebraic commands\n"); 00514 if(strstr(opt_sng,"-T")) (void)fprintf(stdout,"-T, --truth_condition, --msk_cmp_typ, --op_rlt condition\tTruth condition for masking: eq,ne,ge,le,gt,lt\n"); 00515 if(strstr(opt_sng,"-t")) (void)fprintf(stdout,"-t, --thr_nbr, --threads, --omp_num_threads thr_nbr\tThread number for OpenMP\n"); 00516 if(strstr(opt_sng,"-u")) (void)fprintf(stdout,"-u, --units\t\tToggle printing units of variables, if any\n"); 00517 if(strstr(opt_sng,"-U")) (void)fprintf(stdout,"-U, --upk, --unpack\tUnpack input file\n"); 00518 if(strstr(opt_sng,"-v")){ 00519 if(prg_lcl == ncrename) (void)fprintf(stdout,"-v, --variable old_var,new_var Variable's old and new names\n"); 00520 if(prg_lcl == ncap) (void)fprintf(stdout,"-v, --variable \t\tOutput file includes ONLY user-defined variables\n"); 00521 if(prg_lcl != ncrename && prg_lcl != ncap) (void)fprintf(stdout,"-v, --variable var1[,var2[...]] Variable(s) to process (regular expressions supported)\n"); 00522 } /* end if */ 00523 /* if(strstr(opt_sng,"-W")) (void)fprintf(stdout,"-W\t\tNormalize by weight but not tally\n");*/ 00524 if(strstr(opt_sng,"-w")){ 00525 if(prg_lcl == ncwa) (void)fprintf(stdout,"-w, --wgt_var, --weight wgt\tWeighting variable name\n"); 00526 if(prg_lcl == ncflint) (void)fprintf(stdout,"-w, --wgt_var, --weight wgt_1[,wgt_2] Weight(s) of file(s)\n"); 00527 } /* end if */ 00528 if(strstr(opt_sng,"-x")) (void)fprintf(stdout,"-x, --xcl, --exclude\tExtract all variables EXCEPT those specified with -v\n"); 00529 if(strstr(opt_sng,"-y")){ 00530 if(prg_lcl == ncbo)(void)fprintf(stdout,"-y, --op_typ, --operation op_typ\tBinary arithmetic operation: add,sbt,mlt,dvd (+,-,*,/)\n"); 00531 if(prg_lcl == ncra || prg_lcl == ncea || prg_lcl == ncwa)(void)fprintf(stdout,"-y, --op_typ, --operation op_typ\tArithmetic operation: avg,min,max,ttl,sqravg,avgsqr,sqrt,rms,rmssdn\n"); 00532 } 00533 if(strstr(opt_sng,"in.nc")) (void)fprintf(stdout,"in.nc\t\t\tInput file name(s)\n"); 00534 if(strstr(opt_sng,"[out.nc]")) (void)fprintf(stdout,"[out.nc]\t\tOutput file name (or use -o switch)\n"); 00535 /* if(strstr(opt_sng,"-")) (void)fprintf(stdout,"-\n");*/ 00536 00537 /* Free the space holding option string */ 00538 opt_sng=(char *)nco_free(opt_sng); 00539 00540 /* Public service announcements */ 00541 (void)fprintf(stdout,"Where to find more help on %s and/or NCO:\n",prg_nm_get()); 00542 (void)fprintf(stdout,"1. User's Guide/Reference Manual: http://nco.sf.net#RTFM\n"); 00543 (void)fprintf(stdout,"2. On-line reference manual for %s: http://nco.sf.net/nco.html#%s\n",prg_nm_get(),prg_nm_get()); 00544 (void)fprintf(stdout,"3. UNIX man page: \'man %s\'\n",prg_nm_get()); 00545 (void)fprintf(stdout,"4. Known problems: http://nco.sf.net#Bugs\n"); 00546 (void)fprintf(stdout,"5. Help Forum: http://sourceforge.net/forum/forum.php?forum_id=9830\n"); 00547 (void)fprintf(stdout,"Post questions, suggestions, patches at http://sf.net/projects/nco\n"); 00548 00549 } /* end nco_usg_prn() */
|
|
||||||||||||
|
Definition at line 329 of file nco_ctl.c. References EXIT_FAILURE, ncap, ncatted, ncbo, ncea, ncecat, ncflint, ncks, nco_exit(), nco_free(), ncpdq, ncra, ncrcat, ncrename, and ncwa. Referenced by main(). 00331 { 00332 /* Purpose: Set program name and enum */ 00333 char *nm_out; 00334 char *nm_out_tmp; 00335 char *nm_out_orig; 00336 00337 /* Get program name (use strrchr() first in case nm_in contains a path) */ 00338 nm_out_orig=nm_out_tmp=(char *)strdup(nm_in); 00339 if(strrchr(nm_out_tmp,'/') != NULL) nm_out_tmp=strrchr(nm_out_tmp,'/')+1; 00340 00341 /* Skip possible libtool prefix */ 00342 if(!strncmp(nm_out_tmp,"lt-",3)){nm_out_tmp+=3;} 00343 00344 /* Classify calling program */ 00345 /* ncap and acceptable synonyms (symbolic links): */ 00346 if(!strcmp(nm_out_tmp,"ncap")){*prg_lcl=ncap;} 00347 else if(!strcmp(nm_out_tmp,"ncap2")){*prg_lcl=ncap;} 00348 /* ncatted and acceptable synonyms (symbolic links): */ 00349 else if(!strcmp(nm_out_tmp,"ncatted")){*prg_lcl=ncatted;} 00350 /* ncbo and acceptable synonyms (symbolic links): */ 00351 else if(!strcmp(nm_out_tmp,"mpncbo")){*prg_lcl=ncbo;} 00352 else if(!strcmp(nm_out_tmp,"mpncdiff")){*prg_lcl=ncbo;} 00353 else if(!strcmp(nm_out_tmp,"ncadd")){*prg_lcl=ncbo;} 00354 else if(!strcmp(nm_out_tmp,"ncbo")){*prg_lcl=ncbo;} 00355 else if(!strcmp(nm_out_tmp,"ncdiff")){*prg_lcl=ncbo;} 00356 else if(!strcmp(nm_out_tmp,"ncdivide")){*prg_lcl=ncbo;} 00357 else if(!strcmp(nm_out_tmp,"ncmult")){*prg_lcl=ncbo;} 00358 else if(!strcmp(nm_out_tmp,"ncmultiply")){*prg_lcl=ncbo;} 00359 else if(!strcmp(nm_out_tmp,"ncsub")){*prg_lcl=ncbo;} 00360 else if(!strcmp(nm_out_tmp,"ncsubtract")){*prg_lcl=ncbo;} 00361 /* ncea and acceptable synonyms (symbolic links): */ 00362 else if(!strcmp(nm_out_tmp,"ncea")){*prg_lcl=ncea;} 00363 else if(!strcmp(nm_out_tmp,"mpncea")){*prg_lcl=ncea;} 00364 /* ncecat and acceptable synonyms (symbolic links): */ 00365 else if(!strcmp(nm_out_tmp,"ncecat")){*prg_lcl=ncecat;} 00366 else if(!strcmp(nm_out_tmp,"mpncecat")){*prg_lcl=ncecat;} 00367 /* ncflint and acceptable synonyms (symbolic links): */ 00368 else if(!strcmp(nm_out_tmp,"ncflint")){*prg_lcl=ncflint;} 00369 else if(!strcmp(nm_out_tmp,"mpncflint")){*prg_lcl=ncflint;} 00370 /* ncks and acceptable synonyms (symbolic links): */ 00371 else if(!strcmp(nm_out_tmp,"ncks")){*prg_lcl=ncks;} 00372 /* ncpdq and acceptable synonyms (symbolic links): */ 00373 else if(!strcmp(nm_out_tmp,"ncpdq")){*prg_lcl=ncpdq;} 00374 else if(!strcmp(nm_out_tmp,"mpncpdq")){*prg_lcl=ncpdq;} 00375 else if(!strcmp(nm_out_tmp,"ncpack")){*prg_lcl=ncpdq;} 00376 else if(!strcmp(nm_out_tmp,"ncunpack")){*prg_lcl=ncpdq;} 00377 /* ncra and acceptable synonyms (symbolic links): */ 00378 else if(!strcmp(nm_out_tmp,"ncra")){*prg_lcl=ncra;} 00379 else if(!strcmp(nm_out_tmp,"mpncra")){*prg_lcl=ncra;} 00380 /* ncrcat and acceptable synonyms (symbolic links): */ 00381 else if(!strcmp(nm_out_tmp,"ncrcat")){*prg_lcl=ncrcat;} 00382 else if(!strcmp(nm_out_tmp,"mpncrcat")){*prg_lcl=ncrcat;} 00383 /* ncrename and acceptable synonyms (symbolic links): */ 00384 else if(!strcmp(nm_out_tmp,"ncrename")){*prg_lcl=ncrename;} 00385 /* ncwa and acceptable synonyms (symbolic links): */ 00386 else if(!strcmp(nm_out_tmp,"ncwa")){*prg_lcl=ncwa;} 00387 else if(!strcmp(nm_out_tmp,"mpncwa")){*prg_lcl=ncwa;} 00388 else{ 00389 (void)fprintf(stdout,"%s: ERROR executable name %s not registered in prg_prs()\n",nm_out_tmp,nm_out_tmp); 00390 nco_exit(EXIT_FAILURE); 00391 } /* end else */ 00392 00393 /* Duplicate stub for returning */ 00394 nm_out=(char *)strdup(nm_out_tmp); 00395 /* Free copy of argv[0] */ 00396 nm_out_orig=(char *)nco_free(nm_out_orig); 00397 return nm_out; 00398 00399 } /* end prg_prs() */
|
1.4.4