#include <stdio.h>#include <netcdf.h>#include "nco_netcdf.h"#include "nco.h"Include dependency graph for nco_rec_var.h:

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

Go to the source code of this file.
Functions | |
| void | rec_var_dbg (const int nc_id, const char *const dbg_sng) |
| void | rec_crd_chk (const var_sct *const var, const char *const fl_in, const char *const fl_out, const long idx_rec, const long idx_rec_out) |
|
||||||||||||||||||||||||
|
Definition at line 36 of file nco_rec_var.c. References ptr_unn::bp, ptr_unn::cp, ptr_unn::dp, ptr_unn::fp, ptr_unn::lp, NC_BYTE, NC_CHAR, NC_DOUBLE, NC_FLOAT, NC_INT, NC_SHORT, nco_dfl_case_nc_type_err(), var_sct_tag::nm, prg_nm_get(), ptr_unn::sp, var_sct_tag::type, and var_sct_tag::val. Referenced by main(). 00041 { 00042 /* Threads: Routine is thread safe and calls no unsafe routines */ 00043 /* Purpose: Check for monotonicity of coordinate values */ 00044 00045 enum monotonic_direction{ 00046 decreasing, /* 0 */ 00047 increasing}; /* 1 */ 00048 00049 static double rec_crd_val_lst; 00050 static double rec_crd_val_crr; 00051 00052 static int monotonic_direction; 00053 00054 /* Use implicit type conversion */ 00055 switch(var->type){ 00056 case NC_FLOAT: rec_crd_val_crr=var->val.fp[0]; break; 00057 case NC_DOUBLE: rec_crd_val_crr=var->val.dp[0]; break; 00058 case NC_INT: rec_crd_val_crr=var->val.lp[0]; break; 00059 case NC_SHORT: rec_crd_val_crr=var->val.sp[0]; break; 00060 case NC_CHAR: rec_crd_val_crr=var->val.cp[0]; break; 00061 case NC_BYTE: rec_crd_val_crr=var->val.bp[0]; break; 00062 default: nco_dfl_case_nc_type_err(); break; 00063 } /* end switch */ 00064 00065 if(idx_rec_out > 1){ 00066 if(((rec_crd_val_crr > rec_crd_val_lst) && monotonic_direction == decreasing) || 00067 ((rec_crd_val_crr < rec_crd_val_lst) && monotonic_direction == increasing)){ 00068 if(idx_rec-1 == -1){ 00069 /* Inter-file non-monotonicity */ 00070 (void)fprintf(stderr,"%s: WARNING Inter-file non-monotonicity. Record coordinate \"%s\" does not monotonically %s between last specified record of previous input file (whose name is not cached locally) and first specified record (i.e., record index = %ld) of current input file (%s). Output file %s will contain these non-monotonic record coordinate values (%f, %f) at record indices %ld, %ld.\n",prg_nm_get(),var->nm,(monotonic_direction == decreasing ? "decrease" : "increase"),idx_rec,fl_in,fl_out,rec_crd_val_lst,rec_crd_val_crr,idx_rec_out-1,idx_rec_out); 00071 }else{ 00072 /* Intra-file non-monotonicity */ 00073 (void)fprintf(stderr,"%s: WARNING Intra-file non-monotonicity. Record coordinate \"%s\" does not monotonically %s between (input file %s record indices: %ld, %ld) (output file %s record indices %ld, %ld) record coordinate values %f, %f\n",prg_nm_get(),var->nm,(monotonic_direction == decreasing ? "decrease" : "increase"),fl_in,idx_rec-1,idx_rec,fl_out,idx_rec_out-1,idx_rec_out,rec_crd_val_lst,rec_crd_val_crr); 00074 } /* end if Intra-file non-monotonicity */ 00075 } /* end if not monotonic */ 00076 }else if(idx_rec_out == 1){ 00077 if(rec_crd_val_crr > rec_crd_val_lst) monotonic_direction=increasing; else monotonic_direction=decreasing; 00078 } /* end if */ 00079 00080 rec_crd_val_lst=rec_crd_val_crr; 00081 00082 } /* end rec_crd_chk() */
|
|
||||||||||||
|
Definition at line 13 of file nco_rec_var.c. References nco_inq(), nco_inq_dimlen(), NCO_REC_DMN_UNDEFINED, and prg_nm_get(). 00015 { 00016 /* Purpose: Aid in debugging problems with record dimension */ 00017 /* Usage: if(dbg_lvl == 73) rec_var_dbg(out_id,"After ncvarput()"); */ 00018 int nbr_dmn_fl; 00019 int nbr_var_fl; 00020 int rec_dmn_id=NCO_REC_DMN_UNDEFINED; 00021 long dmn_sz; 00022 00023 (void)fprintf(stderr,"%s: DBG %s\n",prg_nm_get(),dbg_sng); 00024 (void)nco_inq(nc_id,&nbr_dmn_fl,&nbr_var_fl,(int *)NULL,&rec_dmn_id); 00025 if(rec_dmn_id == NCO_REC_DMN_UNDEFINED){ 00026 (void)fprintf(stderr,"%s: DBG %d dimensions, %d variables, no record dimension\n",prg_nm_get(),nbr_dmn_fl,nbr_var_fl); 00027 }else{ 00028 (void)nco_inq_dimlen(nc_id,rec_dmn_id,&dmn_sz); 00029 (void)fprintf(stderr,"%s: DBG %d dimensions, %d variables, record dimension size is %li\n",prg_nm_get(),nbr_dmn_fl,nbr_var_fl,dmn_sz); 00030 } /* end else */ 00031 (void)fflush(stderr); 00032 } /* end rec_var_dbg() */
|
1.4.4