Everglades Landscape Model (ELM) Home Page
Main Page | Data Structures | Directories | File List | Data Fields | Globals

BudgStats.c File Reference

Budget and statistical summaries of model variables. More...

#include "budgstats.h"
#include "unitmod_vars.h"
#include "budgstats_birvars.h"
#include "budgstats_statvars.h"

Include dependency graph for BudgStats.c:

Include dependency graph

Go to the source code of this file.

Functions

void stats (int step)
 Calling function for budget and summary stats.
void BIRstats_sum (void)
 Generate variable sums/means for Basins/Indicator-Regions (non-budget) stats.
void BIRbudg_sum (void)
 Generate (every time step) budget summations for Basins/Indicator-Regions.
void BIRstats_sumFinal (void)
 Assemble the final sums for end-of-period summary statistics.
void BIRbudg_sumFinal (void)
 Assemble the final sums for end-of-period budget.
void BIRstats_print (int ibas)
 Print out values of BIRavg Performance Measure data.
void BIRbudg_print (int ibas)
 Calculate the mass balance errors and the in/out averages, then print out values of BIR budget data.
void BIRstats_date (void)
 Print date stamp on current BIRavg output record.
void BIRbudg_date (void)
 Print date stamp on current BIR budget output record.
void BIRstats_reset (void)
 Reset BIR (non-budget) statistics summations to zero.
void BIRbudg_reset (void)
 Reset BIR budget summations to zero.
void BIRinit (void)
 Set up the Basin & Indicator Region (BIR) linkages/inheritances.
void BIRoutfiles (void)
 Open files and create headers for BIR output.
void CellAvg (void)
 Generate sums, means (avgs), on cell-by-cell basis (not by Basin/IRegion here).
void Cell_reset_hydper (void)
 Zero the array holding hydroperiod data in cells (after printing).
void Cell_reset_avg (void)
 Zero the arrays holding selected variable averages in cells (after printing)/.
void alloc_mem_stats (void)
 Allocate memory for the BIR-based and cell-based stats variables.


Detailed Description

Budget and statistical summaries of model variables.

This source file calculates:

There are no calculations in this source code that affect the model results; the code here only summarizes the model results.

Mass balances of water and phosphorus are verified at high levels of precision in all budget files.
The water budgets are output in units of height per BIR and in units of volume per BIR.
The phosphorus budgets are output in units of:

The mean values of principal Performance Measure variables are ouput for each BIR.
The mean values of selected model variables are calculated (for output in gen_output function).

Note: documented with Doxygen, which expects specific syntax within special comments.

The Everglades Landscape Model (ELM).
last updated: Jan 2005

Remarks:
TODO: Yes, there is way too much replicated code here - its a pretty quick fix, but in a hurry as usual (Jan 2005)

Definition in file BudgStats.c.


Function Documentation

void stats int  step  ) 
 

Calling function for budget and summary stats.

Called every time step, this calls functions to summarize variables across time At the time interval for output, this calls functions to make the final summaries, and then resets the data for new interval.

Definition at line 51 of file BudgStats.c.

References BIRbudg_date(), BIRbudg_reset(), BIRbudg_sum(), BIRbudg_sumFinal(), BIRstats_date(), BIRstats_reset(), BIRstats_sum(), BIRstats_sumFinal(), CellAvg(), simTime::IsBIRavgEnd, simTime::IsBudgEnd, simTime::IsBudgFirst, simTime::IsDay0, and SimTime.

Referenced by call_cell_dyn().

00052 {
00053     CellAvg();  /* Generate sums, means (avgs), on cell-by-cell basis (not by Basin/IRegion here) */
00054         
00055     BIRstats_sum();  
00056     BIRbudg_sum();  
00057 
00058     if ( (SimTime.IsBIRavgEnd) )  {
00059         if (!SimTime.IsDay0) BIRstats_date(); /* skip TIME 0 of simulation */
00060                 BIRstats_sumFinal();
00061         BIRstats_reset();
00062     } 
00063     if ( (SimTime.IsBudgEnd) )  {
00064         if (!SimTime.IsBudgFirst) BIRbudg_date(); /* skip first budget interval to accumulate info for mass-balance budget check */
00065                 BIRbudg_sumFinal();
00066         BIRbudg_reset();
00067     } 
00068 } 

Here is the call graph for this function:

void BIRstats_sum void   ) 
 

Generate variable sums/means for Basins/Indicator-Regions (non-budget) stats.

Definition at line 75 of file BudgStats.c.

References basn, C_ALG, CELL_SIZE, Cperi_avg, Elev_avg, Mac_avg, MAC_TOT_BIOM, NC_ALG, NCperi_avg, ON_MAP, SED_ELEV, Sfwat_avg, SURFACE_WAT, T, TP_SEDWT_CONCACTMG, TP_SFWT_CONC_MG, TPpore_avg, TPsf_avg, TPsoil_avg, TPtoSOIL_rep, Unsat_avg, and UNSAT_DEPTH.

Referenced by stats().

00076 {
00077     int ix, iy, cellLoc;
00078     float cellSiz_DT = CELL_SIZE * DT;
00079    
00080     for(ix=1; ix<=s0; ix++) 
00081         for(iy=1; iy<=s1; iy++) 
00082 
00083             if(ON_MAP[cellLoc= T(ix,iy)])  {
00084 /* get the (non-budget) Performance Measure summary values for cells within basins/indicator regions */
00085                     Sfwat_avg[basn[cellLoc]] +=  SURFACE_WAT[cellLoc];
00086                     Sfwat_avg[0]             +=  SURFACE_WAT[cellLoc];
00087                     Unsat_avg[basn[cellLoc]] +=  UNSAT_DEPTH[cellLoc];
00088                     Unsat_avg[0]             +=  UNSAT_DEPTH[cellLoc];
00089                     TPsf_avg[basn[cellLoc]] +=  TP_SFWT_CONC_MG[cellLoc];
00090                     TPsf_avg[0]             +=  TP_SFWT_CONC_MG[cellLoc];
00091                     TPpore_avg[basn[cellLoc]] +=  TP_SEDWT_CONCACTMG[cellLoc];
00092                     TPpore_avg[0]             +=  TP_SEDWT_CONCACTMG[cellLoc];
00093                     TPsoil_avg[basn[cellLoc]] +=  TPtoSOIL_rep[cellLoc];
00094                     TPsoil_avg[0]             +=  TPtoSOIL_rep[cellLoc];
00095                     NCperi_avg[basn[cellLoc]] +=  NC_ALG[cellLoc];
00096                     NCperi_avg[0]             +=  NC_ALG[cellLoc];
00097                     Cperi_avg[basn[cellLoc]] +=  C_ALG[cellLoc];
00098                     Cperi_avg[0]             +=  C_ALG[cellLoc];
00099                     Mac_avg[basn[cellLoc]] +=  MAC_TOT_BIOM[cellLoc];
00100                     Mac_avg[0]             +=  MAC_TOT_BIOM[cellLoc];
00101                     Elev_avg[basn[cellLoc]] +=  SED_ELEV[cellLoc];
00102                     Elev_avg[0]             +=  SED_ELEV[cellLoc];
00103             } /* end spatial loop for summations across domain*/
00104 } 

void BIRbudg_sum void   ) 
 

Generate (every time step) budget summations for Basins/Indicator-Regions.

Definition at line 111 of file BudgStats.c.

References basn, C_ALG_GPP_P, C_ALG_MORT_P, C_ALG_P, Calg_GPP, Calg_mort, CELL_SIZE, conv_gTOkg, DOP, DOP_DECOMP, dop_decomp, dop_desorb, dop_macIn, DOP_nphBio, dop_sorbIn, EVAP, floc_decomp, floc_In, FlocP, FlocP_DECOMP, FlocP_FR_ALGAE, FlocP_PhBio, simTime::IsBudgEnd, mac_mort, mac_nph_P, mac_NPP, mac_ph_P, NC_ALG_GPP_P, NC_ALG_MORT_P, NC_ALG_P, NCalg_GPP, NCalg_mort, nphbio_mort_P, ON_MAP, P_Calg, P_CELL, P_DEAD_CELL, P_LIVE_CELL, P_MAC, P_NCalg, P_RAIN, P_settl, P_WAT_CELL, phbio_mort_P, phbio_npp_P, RAIN, RCHG, SALT_SED_WT, SALT_SURF_WT, SAT_WATER, SAT_WT_RECHG, SAT_WT_TRANSP, SF_WT_EVAP, SF_WT_FROM_RAIN, SimTime, SUMGW, SUMSF, SUMUW, SURFACE_WAT, T, TOT_S_CELL, TP_FR_RAIN, TP_SED_MINER, TP_SED_WT, TP_SEDWT_UPTAKE, TP_settl, TP_SF_WT, TP_SFWT_MINER, TP_SFWT_UPTAK, TP_SORB, TP_SORBTION, TRANSP, UNSAT_TRANSP, UNSAT_WATER, wat_sedMiner, wat_sedUpt, wat_sfMiner, and wat_sfUpt.

Referenced by stats().

00112 {
00113     int ix, iy, cellLoc;
00114     float cellSiz_DT = CELL_SIZE * DT;
00115    
00116     for(ix=1; ix<=s0; ix++) 
00117         for(iy=1; iy<=s1; iy++) 
00118 
00119             if(ON_MAP[cellLoc= T(ix,iy)])  {
00120 
00121 /* calculate sums of inputs/outputs, then sum the storages */
00122 /* the summations here are ONLY relating to vertical flows in this source file */
00123 /* horizontal cell<->cell, cell<->canal, and cell<->external_system flows in WatMgmt.c and Fluxes.c source files */
00124 /****/
00125 /*  sums of water inflow/outflow (m) */
00126                     /*  vertical system inputs to cells: rain  */
00127                 RAIN[basn[cellLoc]] += (double) SF_WT_FROM_RAIN[cellLoc]*cellSiz_DT ; 
00128                 RAIN[0]             += (double) SF_WT_FROM_RAIN[cellLoc]*cellSiz_DT; 
00129 
00130                     /*  vertical system outputs from cells: evap, transp, recharge */
00131                 EVAP[basn[cellLoc]] += (double) (SF_WT_EVAP[cellLoc])*cellSiz_DT; 
00132                 EVAP[0]             += (double) (SF_WT_EVAP[cellLoc])*cellSiz_DT; 
00133                 TRANSP[basn[cellLoc]] += (double) (SAT_WT_TRANSP[cellLoc] 
00134                                                    + UNSAT_TRANSP[cellLoc])*cellSiz_DT; 
00135                 TRANSP[0]             += (double) (SAT_WT_TRANSP[cellLoc] 
00136                                                    + UNSAT_TRANSP[cellLoc])*cellSiz_DT; 
00137 
00138                     /* Important NOTE: recharge is 0 in elm, not now linked to solute fluxes */
00139                 RCHG[basn[cellLoc]] += (double) (SAT_WT_RECHG[cellLoc])*cellSiz_DT; 
00140                 RCHG[0]             += (double) (SAT_WT_RECHG[cellLoc])*cellSiz_DT; 
00141 
00142 
00143                     /* mass (kg P) sums of P inflow/outflow */
00144                         
00145                 P_RAIN[basn[cellLoc]] += (double) (TP_FR_RAIN[cellLoc]* DT); 
00146                 P_RAIN[0]             += (double) (TP_FR_RAIN[cellLoc]* DT); 
00147                 P_settl[basn[cellLoc]] += (double) TP_settl[cellLoc]*DT;  /* kgP */
00148                 P_settl[0]             += (double) TP_settl[cellLoc]*DT;  /* kgP */
00149                         
00150                 if (!ESPmodeON) { /* not calc'd if running in ESP (Everglades Settling-of Phosphorus, i.e., EWQModel emulation) mode */
00151 
00152 
00153                     Calg_GPP[basn[cellLoc]] += (double) ( (C_ALG_GPP_P[cellLoc]  ) 
00154                                                           * conv_gTOkg * cellSiz_DT);/* gP/m2 => kgP */
00155                     NCalg_GPP[basn[cellLoc]] += (double) ( (NC_ALG_GPP_P[cellLoc] ) 
00156                                                            * conv_gTOkg * cellSiz_DT);/* gP/m2 => kgP */
00157                     Calg_mort[basn[cellLoc]] += (double) ( (C_ALG_MORT_P[cellLoc]) 
00158                                                            * conv_gTOkg * cellSiz_DT);/* gP/m2 => kgP */
00159                     NCalg_mort[basn[cellLoc]] += (double) ( (NC_ALG_MORT_P[cellLoc]) 
00160                                                             * conv_gTOkg * cellSiz_DT);/* gP/m2 => kgP */
00161                     dop_macIn[basn[cellLoc]] += (double) DOP_nphBio[cellLoc] 
00162                         * cellSiz_DT;  /* kgP/m2 => kgP */
00163                     dop_sorbIn[basn[cellLoc]] += (double) (TP_SORBTION[cellLoc]>0.0) ? (TP_SORBTION[cellLoc] * DT) : (0.0); /* kgP */
00164                     dop_decomp[basn[cellLoc]] += (double)  DOP_DECOMP[cellLoc] 
00165                         * cellSiz_DT;  /* kgP/m2 => kgP */
00166                     dop_desorb[basn[cellLoc]] += (double)  (TP_SORBTION[cellLoc]<=0.0) ? (-TP_SORBTION[cellLoc] * DT) : (0.0) ; /* kgP */
00167                     
00168                     floc_decomp[basn[cellLoc]] += (double)  FlocP_DECOMP[cellLoc]
00169                         * cellSiz_DT;  /* kgP/m2 => kgP */
00170                     floc_In[basn[cellLoc]] += (double)  (FlocP_FR_ALGAE[cellLoc] + FlocP_PhBio[cellLoc])
00171                         * cellSiz_DT;  /* kgP/m2 => kgP */
00172 
00173                     mac_NPP[basn[cellLoc]] += (double) phbio_npp_P[cellLoc] 
00174                         * cellSiz_DT;  /* kgP/m2 => kgP */
00175                     mac_mort[basn[cellLoc]] += (double) ( phbio_mort_P[cellLoc]+ nphbio_mort_P[cellLoc]) 
00176                         * cellSiz_DT;  /* kgP/m2 => kgP */
00177                     wat_sfMiner[basn[cellLoc]] += (double) TP_SFWT_MINER[cellLoc]*DT;  /* kgP */
00178                     wat_sedMiner[basn[cellLoc]] += (double) TP_SED_MINER[cellLoc]*DT;  /* kgP */
00179                     wat_sfUpt[basn[cellLoc]] += (double) TP_SFWT_UPTAK[cellLoc] * DT;  /* kgP */
00180                     wat_sedUpt[basn[cellLoc]] += (double) TP_SEDWT_UPTAKE[cellLoc]*DT;  /* kgP */
00181                         
00182                         
00183                     Calg_GPP[0] += (double) ( (C_ALG_GPP_P[cellLoc]  ) 
00184                                               * conv_gTOkg * cellSiz_DT);/* gP/m2 => kgP */
00185                     NCalg_GPP[0] += (double) ( (NC_ALG_GPP_P[cellLoc] ) 
00186                                                * conv_gTOkg * cellSiz_DT);/* gP/m2 => kgP */
00187                     Calg_mort[0] += (double) ( (C_ALG_MORT_P[cellLoc]) 
00188                                                * conv_gTOkg * cellSiz_DT);/* gP/m2 => kgP */
00189                     NCalg_mort[0] += (double) ( (NC_ALG_MORT_P[cellLoc]) 
00190                                                 * conv_gTOkg * cellSiz_DT);/* gP/m2 => kgP */
00191                     dop_macIn[0] += (double) DOP_nphBio[cellLoc] 
00192                         * cellSiz_DT;/* kgP/m2 => kgP */
00193                     dop_sorbIn[0] += (double) (TP_SORBTION[cellLoc]>0.0) ? (TP_SORBTION[cellLoc] * DT) : (0.0); /* kgP */
00194                     dop_decomp[0] += (double) DOP_DECOMP[cellLoc] 
00195                         * cellSiz_DT;/* kgP/m2 => kgP */
00196                     dop_desorb[0] += (double)  (TP_SORBTION[cellLoc]<=0.0) ? (-TP_SORBTION[cellLoc] * DT) : (0.0) ; /* kgP */
00197                     floc_decomp[0] += (double)  FlocP_DECOMP[cellLoc]
00198                         * cellSiz_DT;/* kgP/m2 => kgP */
00199                     floc_In[0] += (double)  (FlocP_FR_ALGAE[cellLoc] + FlocP_PhBio[cellLoc])
00200                         * cellSiz_DT;/* kgP/m2 => kgP */
00201                     mac_NPP[0] += (double) phbio_npp_P[cellLoc] 
00202                         * cellSiz_DT;/* kgP/m2 => kgP */
00203                     mac_mort[0] += (double) ( phbio_mort_P[cellLoc]+ nphbio_mort_P[cellLoc]) 
00204                         * cellSiz_DT;/* kgP/m2 => kgP */
00205                     wat_sfMiner[0] += (double) TP_SFWT_MINER[cellLoc]*DT;  /* kgP */
00206                     wat_sedMiner[0] += (double) TP_SED_MINER[cellLoc]*DT;  /* kgP */
00207                     wat_sfUpt[0] += (double) TP_SFWT_UPTAK[cellLoc] * DT;  /* kgP */
00208                     wat_sedUpt[0] += (double) TP_SEDWT_UPTAKE[cellLoc]*DT;  /* kgP */
00209                 }
00210                         
00211                     /* no salt inflow/outflow to/from system in vertical direction */
00212 
00213                     /* sum the storages (budgets) in IndRegions at the desired interval  */
00214                 if ( (SimTime.IsBudgEnd ) ) { 
00215                                 /* water (m * m2) */
00216                     SUMSF[basn[cellLoc]] += (double) SURFACE_WAT[cellLoc]*CELL_SIZE;
00217                     SUMSF[0]             += (double) SURFACE_WAT[cellLoc]*CELL_SIZE; 
00218                     SUMUW[basn[cellLoc]] += (double) UNSAT_WATER[cellLoc]*CELL_SIZE;
00219                     SUMUW[0]             += (double) UNSAT_WATER[cellLoc]*CELL_SIZE; 
00220                     SUMGW[basn[cellLoc]] += (double) SAT_WATER[cellLoc]*CELL_SIZE;
00221                     SUMGW[0]             += (double) SAT_WATER[cellLoc]*CELL_SIZE;  
00222 
00223                       /* most of this not needed when only running in ESP mode (ESPmodeOn), not bothering to clean up now */
00224                                 /* phosphorus (units converted to kg P)*/
00225                         P_Calg[basn[cellLoc]] += (double) (C_ALG_P[cellLoc] ) 
00226                             * conv_gTOkg * CELL_SIZE; /* gP/m2 => kgP */
00227                         P_Calg[0] += (double) (C_ALG_P[cellLoc] ) 
00228                             * conv_gTOkg * CELL_SIZE; /* gP/m2 => kgP */
00229                         P_NCalg[basn[cellLoc]] += (double) (NC_ALG_P[cellLoc]) 
00230                             * conv_gTOkg * CELL_SIZE; /* gP/m2 => kgP */
00231                         P_NCalg[0] += (double) (NC_ALG_P[cellLoc]) 
00232                             * conv_gTOkg * CELL_SIZE; /* gP/m2 => kgP */
00233                         P_MAC[basn[cellLoc]] += (double) (mac_nph_P[cellLoc] + mac_ph_P[cellLoc] )  
00234                             * CELL_SIZE; /* kgP/m2 => kgP */
00235                         P_MAC[0] += (double) (mac_nph_P[cellLoc] + mac_ph_P[cellLoc] )  
00236                             * CELL_SIZE; /* kgP/m2 => kgP */
00237 
00238                         P_LIVE_CELL[basn[cellLoc]] = (P_Calg[basn[cellLoc]] + P_NCalg[basn[cellLoc]] + P_MAC[basn[cellLoc]]);
00239                         P_LIVE_CELL[0]         = (P_Calg[0] + P_NCalg[0] + P_MAC[0]);
00240 
00241                         P_DEAD_CELL[basn[cellLoc]] += (double) ( TP_SORB[cellLoc] +
00242                                                                 ( FlocP[cellLoc] + DOP[cellLoc]  ) /* kgP/m2 */ * CELL_SIZE );
00243                         P_DEAD_CELL[0]         += (double) ( TP_SORB[cellLoc] +
00244                                                                 ( FlocP[cellLoc] + DOP[cellLoc] ) /* kgP/m2 */ * CELL_SIZE );
00245 
00246                         P_WAT_CELL[basn[cellLoc]] += (double) (TP_SED_WT[cellLoc] + TP_SF_WT[cellLoc] ); /*kgP*/
00247                         P_WAT_CELL[0]           += (double) (TP_SED_WT[cellLoc] + TP_SF_WT[cellLoc] ); /*kgP*/
00248                                 
00249                         P_CELL[basn[cellLoc]] = (double) (P_LIVE_CELL[basn[cellLoc]] + P_DEAD_CELL[basn[cellLoc]] + P_WAT_CELL[basn[cellLoc]]);
00250                         P_CELL[0]                 = (double) (P_LIVE_CELL[0] + P_DEAD_CELL[0] + P_WAT_CELL[0]);
00251                     
00252                     
00253                     
00254                                 /* salt (kgS) */
00255                     TOT_S_CELL[basn[cellLoc]] += (double) (SALT_SED_WT[cellLoc] + SALT_SURF_WT[cellLoc] ); 
00256                     TOT_S_CELL[0] +=             (double) (SALT_SED_WT[cellLoc] + SALT_SURF_WT[cellLoc] ); 
00257                 }
00258             } /* end spatial loop for summations across domain*/
00259 
00260 } /* end BIRbudg_sum() */

void BIRstats_sumFinal void   ) 
 

Assemble the final sums for end-of-period summary statistics.

Assemble the sums for parent hydrologic Basins from their children Indicator Regions.

Note:
Please remember that the struct "basins" is generic to include hydrologic Basins and Indicator Regions.

Definition at line 270 of file BudgStats.c.

References basins, basn_list, BIRstats_print(), Cperi_avg, Elev_avg, basndef::IR, simTime::IsDay0, Mac_avg, NCperi_avg, basndef::numIR, Sfwat_avg, SimTime, TPpore_avg, TPsf_avg, TPsoil_avg, and Unsat_avg.

Referenced by stats().

00271 {
00272     int ibas, ii; 
00273         
00274         for (ibas = numBasn; ibas >= 0; ibas--) {
00275             basins = basn_list[ibas];
00276 
00277             for (ii=0; ii<basins->numIR; ii++) { 
00278 /* to a parent basin, add the (non-budget) Performance Measure summation values within any child- Indicator Regions */
00279                                 Sfwat_avg[ibas] +=  Sfwat_avg[basins->IR[ii]];
00280                 Unsat_avg[ibas] +=  Unsat_avg[basins->IR[ii]];
00281                 TPsf_avg[ibas] +=  TPsf_avg[basins->IR[ii]];
00282                 TPpore_avg[ibas] +=  TPpore_avg[basins->IR[ii]];
00283                 TPsoil_avg[ibas] +=  TPsoil_avg[basins->IR[ii]];
00284                 NCperi_avg[ibas] +=  NCperi_avg[basins->IR[ii]];
00285                 Cperi_avg[ibas] +=  Cperi_avg[basins->IR[ii]];
00286                 Mac_avg[ibas] +=  Mac_avg[basins->IR[ii]];
00287                 Elev_avg[ibas] +=  Elev_avg[basins->IR[ii]];
00288             }
00289 
00290         /* now time for output of data */
00291             if (!SimTime.IsDay0) BIRstats_print(ibas); /* skip TIME 0 of simulation */
00292         }
00293 }

Here is the call graph for this function:

void BIRbudg_sumFinal void   ) 
 

Assemble the final sums for end-of-period budget.

Assemble the sums for parent hydrologic Basins from their children Indicator Regions, and assemble the grand sums of inflow/outflow to/from all Basins/Indicator Regions.

Note:
Please remember that the struct "basins" is generic to include hydrologic Basins and Indicator Regions.

Definition at line 304 of file BudgStats.c.

References basins, basn_list, BIRbudg_print(), Calg_GPP, Calg_mort, dop_decomp, dop_desorb, dop_macIn, dop_sorbIn, EVAP, floc_decomp, floc_In, basndef::IR, simTime::IsBudgFirst, mac_mort, mac_NPP, NCalg_GPP, NCalg_mort, basndef::numIR, P, P_CELL, P_DEAD, P_DEAD_CELL, P_DEAD_IN, P_DEAD_IN_SUM, P_DEAD_OUT, P_DEAD_OUT_SUM, P_IN, P_IN_GW, P_IN_OVL, P_IN_SPG, P_IN_STR, P_IN_SUM, P_LIVE, P_LIVE_CELL, P_LIVE_IN, P_LIVE_IN_SUM, P_LIVE_OUT, P_LIVE_OUT_SUM, P_OUT, P_OUT_GW, P_OUT_OVL, P_OUT_SPG, P_OUT_STR, P_OUT_SUM, P_RAIN, P_settl, P_WAT, P_WAT_CELL, P_WAT_IN, P_WAT_IN_SUM, P_WAT_OUT, P_WAT_OUT_SUM, RAIN, RCHG, S_IN, S_IN_GW, S_IN_OVL, S_IN_SPG, S_IN_STR, S_IN_SUM, S_OUT, S_OUT_GW, S_OUT_OVL, S_OUT_SPG, S_OUT_STR, S_OUT_SUM, SimTime, SUMGW, SUMSF, SUMUW, TOT_P_CAN, TOT_S, TOT_S_CAN, TOT_S_CELL, TOT_VOL, TOT_VOL_CAN, TRANSP, VOL_IN, VOL_IN_GW, VOL_IN_OVL, VOL_IN_SPG, VOL_IN_STR, VOL_IN_SUM, VOL_OUT, VOL_OUT_GW, VOL_OUT_OVL, VOL_OUT_SPG, VOL_OUT_STR, VOL_OUT_SUM, wat_sedMiner, wat_sedUpt, wat_sfMiner, and wat_sfUpt.

Referenced by stats().

00305 {
00306     int ibas, ii; 
00307         
00308         for (ibas = numBasn; ibas >= 0; ibas--) {
00309             basins = basn_list[ibas];
00310 
00311             for (ii=0; ii<basins->numIR; ii++) { 
00312                     /* sum up all the I/O to child- Indicator Regions within a parent hydrologic basin,
00313                        adding that to the parent (the horizontal flows are treated within the flow calcs) */
00314 
00315                     /* flows */
00316                 RAIN[ibas]+=RAIN[basins->IR[ii]];  
00317                 EVAP[ibas]+=EVAP[basins->IR[ii]];
00318                 TRANSP[ibas]+=TRANSP[basins->IR[ii]]; 
00319                 RCHG[ibas]+=RCHG[basins->IR[ii]];
00320 
00321                 VOL_IN_STR[ibas]+=VOL_IN_STR[basins->IR[ii]]; 
00322                 VOL_OUT_STR[ibas]+=VOL_OUT_STR[basins->IR[ii]];
00323                 S_IN_STR[ibas]+=S_IN_STR[basins->IR[ii]]; 
00324                 S_OUT_STR[ibas]+=S_OUT_STR[basins->IR[ii]];
00325                 P_IN_STR[ibas]+=P_IN_STR[basins->IR[ii]];
00326                 P_OUT_STR[ibas]+=P_OUT_STR[basins->IR[ii]];
00327 
00328                 P_RAIN[ibas]+=P_RAIN[basins->IR[ii]];
00329                 Calg_GPP[ibas]+=Calg_GPP[basins->IR[ii]];  
00330                 NCalg_GPP[ibas]+=NCalg_GPP[basins->IR[ii]];
00331                 Calg_mort[ibas]+=Calg_mort[basins->IR[ii]]; 
00332                 NCalg_mort[ibas]+=NCalg_mort[basins->IR[ii]];
00333                 mac_NPP[ibas]+=mac_NPP[basins->IR[ii]]; 
00334                 mac_mort[ibas]+=mac_mort[basins->IR[ii]]; 
00335                 dop_macIn[ibas]+=dop_macIn[basins->IR[ii]]; 
00336                 dop_sorbIn[ibas]+=dop_sorbIn[basins->IR[ii]];
00337                 floc_decomp[ibas]+=floc_decomp[basins->IR[ii]]; 
00338                 floc_In[ibas]+=floc_In[basins->IR[ii]];
00339                  P_settl[ibas]+=P_settl[basins->IR[ii]]; 
00340                 dop_decomp[ibas]+=dop_decomp[basins->IR[ii]]; 
00341                 dop_desorb[ibas]+=dop_desorb[basins->IR[ii]]; 
00342                 wat_sfMiner[ibas]+=wat_sfMiner[basins->IR[ii]]; 
00343                 wat_sedMiner[ibas]+=wat_sedMiner[basins->IR[ii]];
00344                 wat_sfUpt[ibas]+=wat_sfUpt[basins->IR[ii]];  
00345                 wat_sedUpt[ibas]+=wat_sedUpt[basins->IR[ii]];
00346 
00347                     /* stocks */
00348                 SUMSF[ibas]+=SUMSF[basins->IR[ii]];  
00349                 SUMUW[ibas]+=SUMUW[basins->IR[ii]];
00350                 SUMGW[ibas]+=SUMGW[basins->IR[ii]];  
00351                 TOT_VOL_CAN[ibas]+=TOT_VOL_CAN[basins->IR[ii]];
00352 
00353                 TOT_S_CELL[ibas]+=TOT_S_CELL[basins->IR[ii]];  
00354                 TOT_S_CAN[ibas]+=TOT_S_CAN[basins->IR[ii]];
00355                 
00356                 P_CELL[ibas]+=P_CELL[basins->IR[ii]];  
00357                 TOT_P_CAN[ibas]+=TOT_P_CAN[basins->IR[ii]];
00358                 P_LIVE_CELL[ibas]+=P_LIVE_CELL[basins->IR[ii]];  
00359                 P_DEAD_CELL[ibas]+=P_DEAD_CELL[basins->IR[ii]];  
00360                 P_WAT_CELL[ibas]+=P_WAT_CELL[basins->IR[ii]];  
00361 
00362             } /* end of IR summation */
00363             
00364                 /*  inputs  */
00365             VOL_IN[ibas] = RAIN[ibas] + VOL_IN_STR[ibas] + VOL_IN_OVL[ibas] + VOL_IN_SPG[ibas] + VOL_IN_GW[ibas]; 
00366             VOL_IN_SUM[ibas] += VOL_IN[ibas];
00367             S_IN[ibas] = S_IN_STR[ibas] + S_IN_OVL[ibas] + S_IN_SPG[ibas] + S_IN_GW[ibas]; 
00368             S_IN_SUM[ibas] += S_IN[ibas];
00369             P_IN[ibas] = P_RAIN[ibas] + P_IN_STR[ibas] + P_IN_OVL[ibas] + P_IN_SPG[ibas] + P_IN_GW[ibas]; 
00370             P_IN_SUM[ibas] += P_IN[ibas];
00371             
00372 
00373                 /*  outputs */
00374             VOL_OUT[ibas] = EVAP[ibas] + TRANSP[ibas] + RCHG[ibas] + VOL_OUT_STR[ibas] + VOL_OUT_OVL[ibas] + VOL_OUT_SPG[ibas] + VOL_OUT_GW[ibas]; 
00375             VOL_OUT_SUM[ibas] += VOL_OUT[ibas];
00376             S_OUT[ibas] = S_OUT_STR[ibas] + S_OUT_OVL[ibas] + S_OUT_SPG[ibas] + S_OUT_GW[ibas]; 
00377             S_OUT_SUM[ibas] += S_OUT[ibas];
00378             P_OUT[ibas] = P_OUT_STR[ibas] + P_OUT_OVL[ibas] + P_OUT_SPG[ibas] + P_OUT_GW[ibas]; 
00379             if (ESPmodeON) P_OUT[ibas] += P_settl[ibas]; /* only if running ESP (Everglades Settling-of Phosphorus, i.e., EWQModel emulation) with settling losses from system */
00380             P_OUT_SUM[ibas] += P_OUT[ibas];
00381             
00382 
00383                 /* actual new volume/mass = sum of the current storages */
00384             TOT_VOL[ibas] = SUMSF[ibas] + SUMUW[ibas] + SUMGW[ibas] + TOT_VOL_CAN[ibas]; 
00385             TOT_S[ibas] = TOT_S_CELL[ibas] + TOT_S_CAN[ibas]; 
00386             P[ibas] = P_CELL[ibas] + TOT_P_CAN[ibas]; 
00387             
00388             if (!ESPmodeON) { /* do same for diff P fractions when running full model */
00389                     /*  inputs  */
00390                 P_LIVE_IN[ibas] = Calg_GPP[ibas] + NCalg_GPP[ibas] + mac_NPP[ibas];
00391                 P_LIVE_IN_SUM[ibas] += P_LIVE_IN[ibas];
00392                 P_DEAD_IN[ibas] = dop_macIn[ibas]  + dop_sorbIn[ibas] + P_settl[ibas] + floc_In[ibas];
00393                 P_DEAD_IN_SUM[ibas] += P_DEAD_IN[ibas];
00394                 P_WAT_IN[ibas] =  P_RAIN[ibas] + dop_decomp[ibas] + floc_decomp[ibas] + dop_desorb[ibas] 
00395                     + P_IN_STR[ibas] + P_IN_OVL[ibas] + P_IN_SPG[ibas] + P_IN_GW[ibas] ;
00396                 P_WAT_IN_SUM[ibas] += P_WAT_IN[ibas] ;
00397                     /*  outputs */
00398                 P_LIVE_OUT[ibas] =  Calg_mort[ibas] + NCalg_mort[ibas] + mac_mort[ibas];
00399                 P_LIVE_OUT_SUM[ibas] += P_LIVE_OUT[ibas];
00400                 P_DEAD_OUT[ibas] = dop_decomp[ibas] + dop_desorb[ibas] + floc_decomp[ibas];
00401                 P_DEAD_OUT_SUM[ibas] += P_DEAD_OUT[ibas];
00402                 P_WAT_OUT[ibas] = Calg_GPP[ibas] + NCalg_GPP[ibas] + mac_NPP[ibas] + dop_sorbIn[ibas] + P_settl[ibas]
00403                     + P_OUT_STR[ibas] + P_OUT_OVL[ibas] + P_OUT_SPG[ibas] + P_OUT_GW[ibas] ;
00404                 P_WAT_OUT_SUM[ibas] += P_WAT_OUT[ibas];
00405                     /* actual new volume/mass = sum of the current storages */
00406                 P_LIVE[ibas] = P_LIVE_CELL[ibas]; 
00407                 P_DEAD[ibas] = P_DEAD_CELL[ibas]; 
00408                 P_WAT[ibas] = P_WAT_CELL[ibas] + TOT_P_CAN[ibas]; 
00409             } /* end of specific P-fraction summations */
00410            
00411         /* now time for output of data */
00412             if (!SimTime.IsBudgFirst) BIRbudg_print(ibas); /* skip first budget interval to accumulate info for mass-balance budget check */
00413         }
00414 }

Here is the call graph for this function:

void BIRstats_print int  ibas  ) 
 

Print out values of BIRavg Performance Measure data.

Parameters:
ibas Basin number

Definition at line 422 of file BudgStats.c.

References basins, basn_list, BIRavg1, BIRavg2, BIRavg3, BIRavg4, BIRavg5, BIRavg_Intvl, Cperi_avg, Elev_avg, Mac_avg, NCperi_avg, numCells, Sfwat_avg, TPpore_avg, TPsf_avg, TPsoil_avg, and Unsat_avg.

Referenced by BIRstats_sumFinal().

00423 {
00424     int Fnum;
00425     float BIRavgStep = BIRavg_Intvl / DT;
00426             
00427     basins = basn_list[ibas];
00428 
00429     Fnum = ((ibas>=52)?(5):
00430             ((ibas>=39)?(4):
00431              ((ibas>=26)?(3):
00432               ((ibas>=13)?(2):
00433                (1) ) )) );
00434     
00435 /* non-budget, Basin/Indicator-Region mean values are printed */
00436     fprintf(   ((Fnum==5)?(BIRavg5):
00437                 ((Fnum==4)?(BIRavg4):
00438                    ((Fnum==3)?(BIRavg3):
00439                     ((Fnum==2)?(BIRavg2):
00440                      (BIRavg1) ) ) ) ),
00441                "%9.3f\t%9.3f\t%9.3f\t%9.3f\t%9.3f\t%9.3f\t%9.3f\t%9.3f\t%9.3f\t",
00442                Sfwat_avg[ibas]/numCells[ibas]/BIRavgStep, 
00443                Unsat_avg[ibas]/numCells[ibas]/BIRavgStep,
00444                TPsf_avg[ibas]/numCells[ibas]/BIRavgStep, 
00445                TPpore_avg[ibas]/numCells[ibas]/BIRavgStep, 
00446                TPsoil_avg[ibas]/numCells[ibas]/BIRavgStep,
00447                NCperi_avg[ibas]/numCells[ibas]/BIRavgStep, 
00448                Cperi_avg[ibas]/numCells[ibas]/BIRavgStep, 
00449                Mac_avg[ibas]/numCells[ibas]/BIRavgStep, 
00450                Elev_avg[ibas]/numCells[ibas]/BIRavgStep);
00451 
00452 }

void BIRbudg_print int  ibas  ) 
 

Calculate the mass balance errors and the in/out averages, then print out values of BIR budget data.

Parameters:
ibas Basin number

Definition at line 459 of file BudgStats.c.

References basins, basn_list, budg_Intvl, budget_P1, budget_P2, budget_P3, budget_P4, budget_P5, budget_Par1, budget_Par2, budget_Par3, budget_Par4, budget_Par5, budget_Pdead1, budget_Pdead2, budget_Pdead3, budget_Pdead4, budget_Pdead5, budget_Plive1, budget_Plive2, budget_Plive3, budget_Plive4, budget_Plive5, budget_Pwat1, budget_Pwat2, budget_Pwat3, budget_Pwat4, budget_Pwat5, budget_S1, budget_S2, budget_S3, budget_S4, budget_S5, budget_Wacr1, budget_Wacr2, budget_Wacr3, budget_Wacr4, budget_Wacr5, budget_Wcm1, budget_Wcm2, budget_Wcm3, budget_Wcm4, budget_Wcm5, Calg_GPP, Calg_mort, conv_cmTOmm, conv_kgTO_Mg, basndef::conv_kgTOmgm2, basndef::conv_m3TOcm, conv_m3TOthousacrft, conv_mgTOug, dop_decomp, dop_desorb, dop_macIn, dop_sorbIn, EVAP, floc_decomp, floc_In, mac_mort, mac_NPP, NCalg_GPP, NCalg_mort, P, P_Calg, P_DEAD, P_DEAD_ERR, P_DEAD_ERR_CUM, P_DEAD_IN, P_DEAD_IN_AVG, P_DEAD_IN_SUM, P_DEAD_OLD, P_DEAD_OUT, P_DEAD_OUT_AVG, P_DEAD_OUT_SUM, P_ERR, P_ERR_CUM, P_IN, P_IN_AVG, P_IN_GW, P_IN_OVL, P_IN_SPG, P_IN_STR, P_IN_SUM, P_LIVE, P_LIVE_ERR, P_LIVE_ERR_CUM, P_LIVE_IN, P_LIVE_IN_AVG, P_LIVE_IN_SUM, P_LIVE_OLD, P_LIVE_OUT, P_LIVE_OUT_AVG, P_LIVE_OUT_SUM, P_MAC, P_NCalg, P_OLD, P_OUT, P_OUT_AVG, P_OUT_GW, P_OUT_OVL, P_OUT_SPG, P_OUT_STR, P_OUT_SUM, P_RAIN, P_settl, P_WAT, P_WAT_ERR, P_WAT_ERR_CUM, P_WAT_IN, P_WAT_IN_AVG, P_WAT_IN_SUM, P_WAT_OLD, P_WAT_OUT, P_WAT_OUT_AVG, P_WAT_OUT_SUM, RAIN, RCHG, S_ERR_CUM, S_IN, S_IN_AVG, S_IN_GW, S_IN_OVL, S_IN_SPG, S_IN_STR, S_IN_SUM, S_OUT, S_OUT_AVG, S_OUT_GW, S_OUT_OVL, S_OUT_SPG, S_OUT_STR, S_OUT_SUM, SimTime, simTime::TIME, TOT_S, TOT_S_ERR, TOT_S_OLD, TOT_VOL, TOT_VOL_CUM_ERR, TOT_VOL_ERR, TOT_VOL_OLD, TRANSP, VOL_IN, VOL_IN_AVG, VOL_IN_GW, VOL_IN_OVL, VOL_IN_SPG, VOL_IN_STR, VOL_IN_SUM, VOL_OUT, VOL_OUT_AVG, VOL_OUT_GW, VOL_OUT_OVL, VOL_OUT_SPG, VOL_OUT_STR, VOL_OUT_SUM, wat_sedMiner, wat_sedUpt, wat_sfMiner, and wat_sfUpt.

Referenced by BIRbudg_sumFinal().

00460 {
00461     int Fnum;
00462     float budgStep = budg_Intvl / DT;
00463             
00464     basins = basn_list[ibas];
00465 
00466     Fnum = ((ibas>=52)?(5):
00467             ((ibas>=39)?(4):
00468              ((ibas>=26)?(3):
00469               ((ibas>=13)?(2):
00470                (1) ) )) );
00471     
00472         /* error  = newVol - (oldVol+inputs-outputs) */
00473     TOT_VOL_ERR[ibas] = TOT_VOL[ibas] - (TOT_VOL_OLD[ibas]+VOL_IN[ibas]-VOL_OUT[ibas] ); 
00474     TOT_S_ERR[ibas] = TOT_S[ibas] - (TOT_S_OLD[ibas]+S_IN[ibas]-S_OUT[ibas] ); 
00475     P_ERR[ibas] = P[ibas] - (P_OLD[ibas]+P_IN[ibas]-P_OUT[ibas] ); 
00476                 
00477         /* cumulative error  */
00478     TOT_VOL_CUM_ERR[ibas] += TOT_VOL_ERR[ibas]; /* cumulative net error */
00479     S_ERR_CUM[ibas] += TOT_S_ERR[ibas];
00480     P_ERR_CUM[ibas] += P_ERR[ibas]; 
00481                 
00482         /* average inputs and outputs */
00483     VOL_IN_AVG[ibas] = VOL_IN_SUM[ibas]/(SimTime.TIME/budg_Intvl);
00484     VOL_OUT_AVG[ibas] = VOL_OUT_SUM[ibas]/(SimTime.TIME/budg_Intvl); 
00485     S_IN_AVG[ibas] = S_IN_SUM[ibas]/(SimTime.TIME/budg_Intvl);
00486     S_OUT_AVG[ibas] = S_OUT_SUM[ibas]/(SimTime.TIME/budg_Intvl); 
00487     P_IN_AVG[ibas] = P_IN_SUM[ibas]/(SimTime.TIME/budg_Intvl);
00488     P_OUT_AVG[ibas] = P_OUT_SUM[ibas]/(SimTime.TIME/budg_Intvl); 
00489 
00490         /* do same for diff P fractions when running full model */
00491     if (!ESPmodeON) { 
00492         P_LIVE_ERR[ibas] = P_LIVE[ibas] - (P_LIVE_OLD[ibas]+P_LIVE_IN[ibas]-P_LIVE_OUT[ibas] ); 
00493         P_DEAD_ERR[ibas] = P_DEAD[ibas] - (P_DEAD_OLD[ibas]+P_DEAD_IN[ibas]-P_DEAD_OUT[ibas] ); 
00494         P_WAT_ERR[ibas] = P_WAT[ibas] - (P_WAT_OLD[ibas]+P_WAT_IN[ibas]-P_WAT_OUT[ibas] ); 
00495         P_LIVE_ERR_CUM[ibas] += P_LIVE_ERR[ibas];  
00496         P_DEAD_ERR_CUM[ibas] += P_DEAD_ERR[ibas]; 
00497         P_WAT_ERR_CUM[ibas] += P_WAT_ERR[ibas]; 
00498         P_LIVE_IN_AVG[ibas] = P_LIVE_IN_SUM[ibas]/(SimTime.TIME/budg_Intvl);
00499         P_LIVE_OUT_AVG[ibas] = P_LIVE_OUT_SUM[ibas]/(SimTime.TIME/budg_Intvl); 
00500         P_DEAD_IN_AVG[ibas] = P_DEAD_IN_SUM[ibas]/(SimTime.TIME/budg_Intvl);
00501         P_DEAD_OUT_AVG[ibas] = P_DEAD_OUT_SUM[ibas]/(SimTime.TIME/budg_Intvl); 
00502         P_WAT_IN_AVG[ibas] = P_WAT_IN_SUM[ibas]/(SimTime.TIME/budg_Intvl);
00503         P_WAT_OUT_AVG[ibas] = P_WAT_OUT_SUM[ibas]/(SimTime.TIME/budg_Intvl); 
00504     }
00505                 
00506 
00507 /********** PRINTING DATA 
00508  **********/
00509 
00510 /* now all the various budget files are printed */
00511 
00512 /* hydrology */
00513         /* print two files, one with volumes and inputs/outputs in units of thousands acre-feet, the other in units of cm across basin */
00514         /* HYDRO: units used in calcs =  m^3, */
00515         /* OUTPUT of flows, storages are in thousands of acre-ft and in cm across basin (for SFWMM comp) */
00516         /* OUTPUT of error analyses use mm height across the basin */
00517 /* hydrology - volume units */
00518     fprintf(  ((Fnum==5)?(budget_Wacr5):
00519                ((Fnum==4)?(budget_Wacr4):
00520                    ((Fnum==3)?(budget_Wacr3):
00521                     ((Fnum==2)?(budget_Wacr2):
00522                      (budget_Wacr1) ) ) ) ),
00523                "%9.2f\t%9.3f\t%9.3f\t%9.3f\t%9.3f\t%9.3f\t%9.3f\t%9.3f\t%9.3f\t%9.3f\t%9.3f\t%9.3f\t%9.3f\t%9.2f\t", 
00524                TOT_VOL_OLD[ibas]*conv_m3TOthousacrft, 
00525                RAIN[ibas]*conv_m3TOthousacrft, 
00526                EVAP[ibas]*conv_m3TOthousacrft, 
00527                TRANSP[ibas]*conv_m3TOthousacrft,
00528                RCHG[ibas]*conv_m3TOthousacrft, 
00529                VOL_IN_STR[ibas]*conv_m3TOthousacrft, 
00530                VOL_OUT_STR[ibas]*conv_m3TOthousacrft, 
00531                VOL_IN_OVL[ibas]*conv_m3TOthousacrft, 
00532                VOL_OUT_OVL[ibas]*conv_m3TOthousacrft, 
00533                VOL_IN_SPG[ibas]*conv_m3TOthousacrft, 
00534                VOL_OUT_SPG[ibas]*conv_m3TOthousacrft, 
00535                VOL_IN_GW[ibas]*conv_m3TOthousacrft,  
00536                VOL_OUT_GW[ibas]*conv_m3TOthousacrft,
00537                (TOT_VOL_OLD[ibas]+VOL_IN[ibas]-VOL_OUT[ibas])*conv_m3TOthousacrft );
00538         /* the new volume, error (mm in basin),  error/inflow, avg Total vol In and Out */
00539     fprintf(   ((Fnum==5)?(budget_Wacr5):
00540                 ((Fnum==4)?(budget_Wacr4):
00541                    ((Fnum==3)?(budget_Wacr3):
00542                     ((Fnum==2)?(budget_Wacr2):
00543                      (budget_Wacr1) ) ) ) ),
00544                "%9.2f\t%9.4f\t%9.3f\t%9.3f\t%9.3f\t", 
00545                TOT_VOL[ibas]*conv_m3TOthousacrft, 
00546                TOT_VOL_ERR[ibas]*conv_cmTOmm*basins->conv_m3TOcm, 
00547                TOT_VOL_CUM_ERR[ibas]*conv_cmTOmm*basins->conv_m3TOcm, 
00548                VOL_IN_AVG[ibas]*conv_m3TOthousacrft, 
00549                VOL_OUT_AVG[ibas]*conv_m3TOthousacrft );  
00550     
00551 /* hydrology - height units */
00552     fprintf(   ((Fnum==5)?(budget_Wcm5):
00553                 ((Fnum==4)?(budget_Wcm4):
00554                    ((Fnum==3)?(budget_Wcm3):
00555                     ((Fnum==2)?(budget_Wcm2):
00556                      (budget_Wcm1) ) ) ) ),
00557                "%9.2f\t%9.3f\t%9.3f\t%9.3f\t%9.3f\t%9.3f\t%9.3f\t%9.3f\t%9.3f\t%9.3f\t%9.3f\t%9.3f\t%9.3f\t%9.2f\t", 
00558                TOT_VOL_OLD[ibas]*basins->conv_m3TOcm, 
00559                RAIN[ibas]*basins->conv_m3TOcm, 
00560                EVAP[ibas]*basins->conv_m3TOcm, 
00561                TRANSP[ibas]*basins->conv_m3TOcm, 
00562                RCHG[ibas]*basins->conv_m3TOcm, 
00563                VOL_IN_STR[ibas]*basins->conv_m3TOcm, 
00564                VOL_OUT_STR[ibas]*basins->conv_m3TOcm, 
00565                VOL_IN_OVL[ibas]*basins->conv_m3TOcm, 
00566                VOL_OUT_OVL[ibas]*basins->conv_m3TOcm, 
00567                VOL_IN_SPG[ibas]*basins->conv_m3TOcm, 
00568                VOL_OUT_SPG[ibas]*basins->conv_m3TOcm, 
00569                VOL_IN_GW[ibas]*basins->conv_m3TOcm,  
00570                VOL_OUT_GW[ibas]*basins->conv_m3TOcm,
00571                (TOT_VOL_OLD[ibas]+VOL_IN[ibas]-VOL_OUT[ibas])*basins->conv_m3TOcm );
00572         /* the new volume, error (mm in basin),  error/inflow, avg Total vol In and Out */
00573     fprintf(   ((Fnum==5)?(budget_Wcm5):
00574                 ((Fnum==4)?(budget_Wcm4):
00575                    ((Fnum==3)?(budget_Wcm3):
00576                     ((Fnum==2)?(budget_Wcm2):
00577                      (budget_Wcm1) ) ) ) ),
00578                "%9.2f\t%9.4f\t%9.3f\t%9.3f\t%9.3f\t", 
00579                TOT_VOL[ibas]*basins->conv_m3TOcm, 
00580                TOT_VOL_ERR[ibas]*conv_cmTOmm*basins->conv_m3TOcm, 
00581                TOT_VOL_CUM_ERR[ibas]*conv_cmTOmm*basins->conv_m3TOcm, 
00582                VOL_IN_AVG[ibas]*basins->conv_m3TOcm, 
00583                VOL_OUT_AVG[ibas]*basins->conv_m3TOcm );  
00584 
00585 /* salt/tracer - mass units */
00586         /* mass and inputs/outputs in metric tons (Mg) */
00587     fprintf(  ((Fnum==5)?(budget_S5):
00588                ((Fnum==4)?(budget_S4):
00589                    ((Fnum==3)?(budget_S3):
00590                     ((Fnum==2)?(budget_S2):
00591                      (budget_S1) ) ) ) ),
00592                "%9.3f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t%9.3f\t", 
00593                TOT_S_OLD[ibas]*conv_kgTO_Mg, 
00594                S_IN_STR[ibas]*conv_kgTO_Mg, 
00595                S_OUT_STR[ibas]*conv_kgTO_Mg, 
00596                S_IN_OVL[ibas]*conv_kgTO_Mg, 
00597                S_OUT_OVL[ibas]*conv_kgTO_Mg, 
00598                S_IN_SPG[ibas]*conv_kgTO_Mg, 
00599                S_OUT_SPG[ibas]*conv_kgTO_Mg, 
00600                S_IN_GW[ibas]*conv_kgTO_Mg,  
00601                S_OUT_GW[ibas]*conv_kgTO_Mg,
00602                (TOT_S_OLD[ibas]+S_IN[ibas]-S_OUT[ibas])*conv_kgTO_Mg );
00603         /* the new mass (Mg), error & cumulative error (ug/m2 of basin), cumulative avg Total mass In and Out */
00604     fprintf(   ((Fnum==5)?(budget_S5):
00605                 ((Fnum==4)?(budget_S4):
00606                    ((Fnum==3)?(budget_S3):
00607                     ((Fnum==2)?(budget_S2):
00608                      (budget_S1) ) ) ) ),
00609                "%9.3f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t", 
00610                TOT_S[ibas]*conv_kgTO_Mg, 
00611                TOT_S_ERR[ibas]*conv_mgTOug*basins->conv_kgTOmgm2, 
00612                S_ERR_CUM[ibas]*conv_mgTOug*basins->conv_kgTOmgm2, 
00613                S_IN_AVG[ibas]*conv_kgTO_Mg, 
00614                S_OUT_AVG[ibas]*conv_kgTO_Mg );  
00615                 
00616 /* phosphorus */
00617 /* phosphorus: total, all fractions of P */
00618         /* we print to two files, one with units of Mg per basin, the other in mg/m2 per basin */
00619     if (ESPmodeON) {
00620         fprintf(   ((Fnum==5)?(budget_P5):
00621                     ((Fnum==4)?(budget_P4):
00622                    ((Fnum==3)?(budget_P3):
00623                     ((Fnum==2)?(budget_P2):
00624                      (budget_P1) ) ) ) ),
00625                    "%9.3f\t%9.4f\t%9.4f\t", 
00626                    P_OLD[ibas]*conv_kgTO_Mg,
00627                    P_RAIN[ibas]*conv_kgTO_Mg, 
00628                    P_settl[ibas]*conv_kgTO_Mg);
00629                    
00630         fprintf(  ((Fnum==5)?(budget_Par5):
00631                    ((Fnum==4)?(budget_Par4):
00632                    ((Fnum==3)?(budget_Par3):
00633                     ((Fnum==2)?(budget_Par2):
00634                      (budget_Par1) ) ) ) ),
00635                    "%9.3f\t%9.4f\t%9.4f\t", 
00636                    P_OLD[ibas]*basins->conv_kgTOmgm2,
00637                    P_RAIN[ibas]*basins->conv_kgTOmgm2, 
00638                    P_settl[ibas]*basins->conv_kgTOmgm2);
00639     }
00640     
00641     else {
00642         fprintf(  ((Fnum==5)?(budget_P5):
00643                    ((Fnum==4)?(budget_P4):
00644                    ((Fnum==3)?(budget_P3):
00645                     ((Fnum==2)?(budget_P2):
00646                      (budget_P1) ) ) ) ),
00647                    "%9.3f\t%9.4f\t", 
00648                    P_OLD[ibas]*conv_kgTO_Mg,
00649                    P_RAIN[ibas]*conv_kgTO_Mg);
00650                    
00651         fprintf(   ((Fnum==5)?(budget_Par5):
00652                     ((Fnum==4)?(budget_Par4):
00653                      ((Fnum==3)?(budget_Par3):
00654                       ((Fnum==2)?(budget_Par2):
00655                        (budget_Par1) ) ) ) ),
00656                    "%9.3f\t%9.4f\t", 
00657                    P_OLD[ibas]*basins->conv_kgTOmgm2,
00658                    P_RAIN[ibas]*basins->conv_kgTOmgm2);
00659     }
00660     
00661     fprintf(   ((Fnum==5)?(budget_P5):
00662                 ((Fnum==4)?(budget_P4):
00663                    ((Fnum==3)?(budget_P3):
00664                     ((Fnum==2)?(budget_P2):
00665                      (budget_P1) ) ) ) ),
00666                "%9.4f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t%9.3f\t", 
00667                P_IN_STR[ibas]*conv_kgTO_Mg, 
00668                P_OUT_STR[ibas]*conv_kgTO_Mg, 
00669                P_IN_OVL[ibas]*conv_kgTO_Mg, 
00670                P_OUT_OVL[ibas]*conv_kgTO_Mg, 
00671                P_IN_SPG[ibas]*conv_kgTO_Mg, 
00672                P_OUT_SPG[ibas]*conv_kgTO_Mg, 
00673                P_IN_GW[ibas]*conv_kgTO_Mg,  
00674                P_OUT_GW[ibas]*conv_kgTO_Mg,
00675                (P_OLD[ibas]+P_IN[ibas]-P_OUT[ibas])*conv_kgTO_Mg );
00676         /* the new mass (Mg), error & cumulative error (ug/m2 of basin), cumulative avg Total mass In and Out */
00677     fprintf(   ((Fnum==5)?(budget_P5):
00678                 ((Fnum==4)?(budget_P4):
00679                    ((Fnum==3)?(budget_P3):
00680                     ((Fnum==2)?(budget_P2):
00681                      (budget_P1) ) ) ) ),
00682                "%9.3f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t", 
00683                P[ibas]*conv_kgTO_Mg, 
00684                P_ERR[ibas]*conv_mgTOug*basins->conv_kgTOmgm2, 
00685                P_ERR_CUM[ibas]*conv_mgTOug*basins->conv_kgTOmgm2, 
00686                P_IN_AVG[ibas]*conv_kgTO_Mg, 
00687                P_OUT_AVG[ibas]*conv_kgTO_Mg );  
00688     
00689     fprintf(   ((Fnum==5)?(budget_Par5):
00690                 ((Fnum==4)?(budget_Par4):
00691                    ((Fnum==3)?(budget_Par3):
00692                     ((Fnum==2)?(budget_Par2):
00693                      (budget_Par1) ) ) ) ),
00694                "%9.4f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t%9.3f\t", 
00695                P_IN_STR[ibas]*basins->conv_kgTOmgm2, 
00696                P_OUT_STR[ibas]*basins->conv_kgTOmgm2, 
00697                P_IN_OVL[ibas]*basins->conv_kgTOmgm2, 
00698                P_OUT_OVL[ibas]*basins->conv_kgTOmgm2, 
00699                P_IN_SPG[ibas]*basins->conv_kgTOmgm2, 
00700                P_OUT_SPG[ibas]*basins->conv_kgTOmgm2, 
00701                P_IN_GW[ibas]*basins->conv_kgTOmgm2,  
00702                P_OUT_GW[ibas]*basins->conv_kgTOmgm2,
00703                (P_OLD[ibas]+P_IN[ibas]-P_OUT[ibas])*basins->conv_kgTOmgm2 );
00704         /* the new mass (mg/m^2), error & cumulative error (ug/m2 of basin), cumulative avg Total mass In and Out */
00705     fprintf(   ((Fnum==5)?(budget_Par5):
00706                 ((Fnum==4)?(budget_Par4):
00707                    ((Fnum==3)?(budget_Par3):
00708                     ((Fnum==2)?(budget_Par2):
00709                      (budget_Par1) ) ) ) ),
00710                "%9.3f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t", 
00711                P[ibas]*basins->conv_kgTOmgm2, 
00712                P_ERR[ibas]*conv_mgTOug*basins->conv_kgTOmgm2, 
00713                P_ERR_CUM[ibas]*conv_mgTOug*basins->conv_kgTOmgm2, 
00714                P_IN_AVG[ibas]*basins->conv_kgTOmgm2, 
00715                P_OUT_AVG[ibas]*basins->conv_kgTOmgm2 );
00716     
00717 /* phosphorus: separate (live, dead, water-borne) fractions of P */
00718 /* don't print for ESPmodeON, which does not include live, dead, water-borne fractions */
00719     if (!ESPmodeON) { 
00720 /* phosphorus: live P fraction */
00721             /* mass and inputs/outputs in mg/m2 */
00722         fprintf(   ((Fnum==5)?(budget_Plive5):
00723                     ((Fnum==4)?(budget_Plive4):
00724                        ((Fnum==3)?(budget_Plive3):
00725                         ((Fnum==2)?(budget_Plive2):
00726                          (budget_Plive1) ) ) ) ),
00727                    "%9.3f\t%9.3f\t%9.3f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t%9.3f\t", 
00728                    P_MAC[ibas]*basins->conv_kgTOmgm2, 
00729                    P_Calg[ibas]*basins->conv_kgTOmgm2, 
00730                    P_NCalg[ibas]*basins->conv_kgTOmgm2,
00731                    mac_NPP[ibas]*basins->conv_kgTOmgm2, 
00732                    Calg_GPP[ibas]*basins->conv_kgTOmgm2, 
00733                    NCalg_GPP[ibas]*basins->conv_kgTOmgm2,
00734                    mac_mort[ibas]*basins->conv_kgTOmgm2, 
00735                    Calg_mort[ibas]*basins->conv_kgTOmgm2, 
00736                    NCalg_mort[ibas]*basins->conv_kgTOmgm2,
00737                    (P_LIVE_OLD[ibas]+P_LIVE_IN[ibas]-P_LIVE_OUT[ibas])*basins->conv_kgTOmgm2 );
00738             /* the new mass (mg/m2), error & cumulative error (ug/m2 of basin), cumulative avg Total mass In and Out */
00739         fprintf(   ((Fnum==5)?(budget_Plive5):
00740                     ((Fnum==4)?(budget_Plive4):
00741                        ((Fnum==3)?(budget_Plive3):
00742                         ((Fnum==2)?(budget_Plive2):
00743                          (budget_Plive1) ) ) ) ),
00744                    "%9.3f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t", 
00745                    P_LIVE[ibas]*basins->conv_kgTOmgm2, 
00746                    P_LIVE_ERR[ibas]*conv_mgTOug*basins->conv_kgTOmgm2, 
00747                    P_LIVE_ERR_CUM[ibas]*conv_mgTOug*basins->conv_kgTOmgm2, 
00748                    P_LIVE_IN_AVG[ibas]*basins->conv_kgTOmgm2, 
00749                    P_LIVE_OUT_AVG[ibas]*basins->conv_kgTOmgm2 );  
00750         
00751 /* phosphorus: dead P fraction */
00752             /* mass and inputs/outputs in mg/m2 */
00753         fprintf( ((Fnum==5)?(budget_Pdead5):
00754                   ((Fnum==4)?(budget_Pdead4):
00755                        ((Fnum==3)?(budget_Pdead3):
00756                         ((Fnum==2)?(budget_Pdead2):
00757                          (budget_Pdead1) ) ) ) ),
00758                  "%9.3f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t%9.3f\t", 
00759                  P_DEAD_OLD[ibas]*basins->conv_kgTOmgm2, 
00760                  dop_macIn[ibas]*basins->conv_kgTOmgm2, 
00761                  floc_In[ibas]*basins->conv_kgTOmgm2, 
00762                  (dop_decomp[ibas]+floc_decomp[ibas])*basins->conv_kgTOmgm2, 
00763                  P_settl[ibas]*basins->conv_kgTOmgm2, 
00764                  dop_sorbIn[ibas]*basins->conv_kgTOmgm2, 
00765                  dop_desorb[ibas]*basins->conv_kgTOmgm2, 
00766                  (P_DEAD_OLD[ibas]+P_DEAD_IN[ibas]-P_DEAD_OUT[ibas])*basins->conv_kgTOmgm2 );
00767             /* the new mass (mg/m2), error & cumulative error (ug/m2 of basin), cumulative avg Total mass In and Out */
00768         fprintf(  ((Fnum==5)?(budget_Pdead5):
00769                    ((Fnum==4)?(budget_Pdead4):
00770                        ((Fnum==3)?(budget_Pdead3):
00771                         ((Fnum==2)?(budget_Pdead2):
00772                          (budget_Pdead1) ) ) ) ),
00773                  "%9.3f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t", 
00774                  P_DEAD[ibas]*basins->conv_kgTOmgm2, 
00775                  P_DEAD_ERR[ibas]*conv_mgTOug*basins->conv_kgTOmgm2, 
00776                  P_DEAD_ERR_CUM[ibas]*conv_mgTOug*basins->conv_kgTOmgm2, 
00777                  P_DEAD_IN_AVG[ibas]*basins->conv_kgTOmgm2, 
00778                  P_DEAD_OUT_AVG[ibas]*basins->conv_kgTOmgm2 );  
00779 
00780 /* phosphorus: water-borne P fraction */
00781             /* mass and inputs/outputs in mg/m2 */ /* there is a blank column to match the old budget summary template */
00782         fprintf(  ((Fnum==5)?(budget_Pwat5):
00783                    ((Fnum==4)?(budget_Pwat4):
00784                        ((Fnum==3)?(budget_Pwat3):
00785                         ((Fnum==2)?(budget_Pwat2):
00786                          (budget_Pwat1) ) ) ) ),
00787                  "%9.3f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t%9.3f\t", 
00788                  P_WAT_OLD[ibas]*basins->conv_kgTOmgm2,  
00789                  P_RAIN[ibas]*basins->conv_kgTOmgm2, 
00790                  P_settl[ibas]*basins->conv_kgTOmgm2,
00791                  wat_sfMiner[ibas]*basins->conv_kgTOmgm2, 
00792                  wat_sedMiner[ibas]*basins->conv_kgTOmgm2, 
00793                  wat_sfUpt[ibas]*basins->conv_kgTOmgm2,
00794                  wat_sedUpt[ibas]*basins->conv_kgTOmgm2, 
00795                  dop_desorb[ibas]*basins->conv_kgTOmgm2, 
00796                  dop_sorbIn[ibas]*basins->conv_kgTOmgm2,
00797                  P_IN_STR[ibas]*basins->conv_kgTOmgm2, 
00798                  P_OUT_STR[ibas]*basins->conv_kgTOmgm2,
00799                  (P_WAT_OLD[ibas]+P_WAT_IN[ibas]-P_WAT_OUT[ibas])*basins->conv_kgTOmgm2 );
00800             /* the new mass (mg/m2), error & cumulative error (ug/m2 of basin), cumulative avg Total mass In and Out */
00801         fprintf(  ((Fnum==5)?(budget_Pwat5):
00802                    ((Fnum==4)?(budget_Pwat4):
00803                        ((Fnum==3)?(budget_Pwat3):
00804                         ((Fnum==2)?(budget_Pwat2):
00805                          (budget_Pwat1) ) ) ) ),
00806                  "%9.3f\t%9.4f\t%9.4f\t%9.4f\t%9.4f\t", 
00807                  P_WAT[ibas]*basins->conv_kgTOmgm2, 
00808                  P_WAT_ERR[ibas]*conv_mgTOug*basins->conv_kgTOmgm2, 
00809                  P_WAT_ERR_CUM[ibas]*conv_mgTOug*basins->conv_kgTOmgm2, 
00810                  P_WAT_IN_AVG[ibas]*basins->conv_kgTOmgm2, 
00811                  P_WAT_OUT_AVG[ibas]*basins->conv_kgTOmgm2 );  
00812     } /* end of non-ESPmodeON prints */
00813 
00814 } /* end of BIRbudg_print() */

void BIRstats_date void   ) 
 

Print date stamp on current BIRavg output record.

Definition at line 820 of file BudgStats.c.

References BIRavg1, BIRavg2, BIRavg3, BIRavg4, BIRavg5, simTime::da, simTime::mo, numBasn, ProgAttr, ProgExec, prog_attr::S_ParmName, prog_attr::S_ParmVal, SimTime, and simTime::yr.

Referenced by stats().

00821 {
00822     int Fileset;
00823     int FileNum;
00824     extern ProgAttr *ProgExec;
00825 
00826 /* TODO:  yes, yes all of the output in BIR stuff is absurdly crude/repetitive */
00827 
00828     if (numBasn>=52) { /* with more than 58 (plus whole-system basin == 59) basins: */
00829         Fileset=5;              /* we have five sets of basin files */
00830     }
00831     else if (numBasn>=39) { /* with more than 38 (plus whole-system basin == 39) basins: */
00832         Fileset=4;              /* we have four sets of basin files */
00833     }
00834     else if (numBasn>=26) { /* with more than 25 (plus whole-system basin == 26) basins: */
00835         Fileset=3;              /* we have three sets of basin files */
00836     }
00837     else if (numBasn>=13) { /* with more than 12 (plus whole-system basin == 13) basins: */
00838         Fileset=2;              /* we have two sets of basin files */
00839     }
00840     else {
00841         Fileset=1;       /* otherwise, just one set of files */
00842     }
00843     
00844    /* for (FileNum = 1; FileNum <= Fileset; FileNum++) */
00845    
00846 /* date stamp for each record in the output files, including (feb05) which parameter being evaluated in sensitivity analysis (or "NONE" for standard, nominal run)  */
00847                      fprintf(BIRavg1, "\n%s\t%f\t%d/%d/%d\t",ProgExec->S_ParmName,ProgExec->S_ParmVal,SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00848     if (numBasn>=13) fprintf(BIRavg2, "\n%s\t%f\t%d/%d/%d\t",ProgExec->S_ParmName,ProgExec->S_ParmVal,SimTime.yr[0],SimTime.mo[0],SimTime.da[0] );
00849     if (numBasn>=26) fprintf(BIRavg3, "\n%s\t%f\t%d/%d/%d\t",ProgExec->S_ParmName,ProgExec->S_ParmVal,SimTime.yr[0],SimTime.mo[0],SimTime.da[0] );
00850     if (numBasn>=39) fprintf(BIRavg4, "\n%s\t%f\t%d/%d/%d\t",ProgExec->S_ParmName,ProgExec->S_ParmVal,SimTime.yr[0],SimTime.mo[0],SimTime.da[0] );
00851     if (numBasn>=52) fprintf(BIRavg5, "\n%s\t%f\t%d/%d/%d\t",ProgExec->S_ParmName,ProgExec->S_ParmVal,SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00852       
00853 }

void BIRbudg_date void   ) 
 

Print date stamp on current BIR budget output record.

Definition at line 860 of file BudgStats.c.

References budget_P1, budget_P2, budget_P3, budget_P4, budget_P5, budget_Par1, budget_Par2, budget_Par3, budget_Par4, budget_Par5, budget_Pdead1, budget_Pdead2, budget_Pdead3, budget_Pdead4, budget_Pdead5, budget_Plive1, budget_Plive2, budget_Plive3, budget_Plive4, budget_Plive5, budget_Pwat1, budget_Pwat2, budget_Pwat3, budget_Pwat4, budget_Pwat5, budget_S1, budget_S2, budget_S3, budget_S4, budget_S5, budget_Wacr1, budget_Wacr2, budget_Wacr3, budget_Wacr4, budget_Wacr5, budget_Wcm1, budget_Wcm2, budget_Wcm3, budget_Wcm4, budget_Wcm5, simTime::da, simTime::mo, numBasn, SimTime, and simTime::yr.

Referenced by stats().

00861 {
00862 
00863 /* date stamp for each record in the budget output files (TODO: not labeled (feb05) for sensi analysis) */
00864     
00865     fprintf(budget_Wacr1, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00866     if (numBasn>=13) fprintf(budget_Wacr2, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00867     if (numBasn>=26) fprintf(budget_Wacr3, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00868     if (numBasn>=39) fprintf(budget_Wacr4, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00869     if (numBasn>=52) fprintf(budget_Wacr5, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00870 
00871     fprintf(budget_Wcm1, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00872     if (numBasn>=13) fprintf(budget_Wcm2, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00873     if (numBasn>=26) fprintf(budget_Wcm3, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00874     if (numBasn>=39) fprintf(budget_Wcm4, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00875     if (numBasn>=52) fprintf(budget_Wcm5, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00876 
00877     fprintf(budget_P1, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] );
00878     if (numBasn>=13) fprintf(budget_P2, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00879     if (numBasn>=26) fprintf(budget_P3, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00880     if (numBasn>=39) fprintf(budget_P4, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00881     if (numBasn>=52) fprintf(budget_P5, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00882 
00883     fprintf(budget_Par1, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00884     if (numBasn>=13) fprintf(budget_Par2, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00885     if (numBasn>=26) fprintf(budget_Par3, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00886     if (numBasn>=39) fprintf(budget_Par4, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00887     if (numBasn>=52) fprintf(budget_Par5, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00888 
00889     fprintf(budget_S1, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] );
00890     if (numBasn>=13) fprintf(budget_S2, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] );
00891     if (numBasn>=26) fprintf(budget_S3, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] );
00892     if (numBasn>=39) fprintf(budget_S4, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] );
00893     if (numBasn>=52) fprintf(budget_S5, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] );
00894 
00895     if (!ESPmodeON) {
00896         fprintf(budget_Plive1, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00897         if (numBasn>=13) fprintf(budget_Plive2, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00898         if (numBasn>=26) fprintf(budget_Plive3, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00899         if (numBasn>=39) fprintf(budget_Plive4, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00900         if (numBasn>=52) fprintf(budget_Plive5, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00901 
00902         fprintf(budget_Pdead1, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00903         if (numBasn>=13) fprintf(budget_Pdead2, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00904         if (numBasn>=26) fprintf(budget_Pdead3, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00905         if (numBasn>=39) fprintf(budget_Pdead4, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00906         if (numBasn>=52) fprintf(budget_Pdead5, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00907 
00908         fprintf(budget_Pwat1, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00909         if (numBasn>=13) fprintf(budget_Pwat2, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00910         if (numBasn>=26) fprintf(budget_Pwat3, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00911         if (numBasn>=39) fprintf(budget_Pwat4, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00912         if (numBasn>=52) fprintf(budget_Pwat5, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 
00913     }
00914 } 

void BIRstats_reset void   ) 
 

Reset BIR (non-budget) statistics summations to zero.

Parameters:
ibas Basin/Indicator-Region ID number

Definition at line 921 of file BudgStats.c.

References BIRavg1, BIRavg2, BIRavg3, BIRavg4, BIRavg5, Cperi_avg, Elev_avg, Mac_avg, NCperi_avg, numBasn, Sfwat_avg, TPpore_avg, TPsf_avg, TPsoil_avg, and Unsat_avg.

00922 {
00923     int ibas;
00924     
00925         for (ibas = numBasn; ibas >= 0; ibas--) {
00926             Sfwat_avg[ibas]=Unsat_avg[ibas]=TPsf_avg[ibas]=TPpore_avg[ibas]=TPsoil_avg[ibas]=
00927                 NCperi_avg[ibas]=Cperi_avg[ibas]=Mac_avg[ibas]=Elev_avg[ibas]=0.0;
00928         }
00929         fflush (BIRavg1); 
00930         if (numBasn>=13) fflush (BIRavg2);
00931         if (numBasn>=26) fflush (BIRavg3); 
00932         if (numBasn>=39) fflush (BIRavg4); 
00933         if (numBasn>=52) fflush (BIRavg5); 
00934 
00935 }

void BIRbudg_reset void   ) 
 

Reset BIR budget summations to zero.

For ALL budgets, store the old total volume in array TOT_xxx_OLD and reset any summations and BIRavgs to 0.

Parameters:
ibas Basin/Indicator-Region ID number

Definition at line 943 of file BudgStats.c.

References budget_P1, budget_P2, budget_P3, budget_P4, budget_P5, budget_Par1, budget_Par2, budget_Par3, budget_Par4, budget_Par5, budget_Pdead1, budget_Pdead2, budget_Pdead3, budget_Pdead4, budget_Pdead5, budget_Plive1, budget_Plive2, budget_Plive3, budget_Plive4, budget_Plive5, budget_Pwat1, budget_Pwat2, budget_Pwat3, budget_Pwat4, budget_Pwat5, budget_S1, budget_S2, budget_S3, budget_S4, budget_S5, budget_Wacr1, budget_Wacr2, budget_Wacr3, budget_Wacr4, budget_Wacr5, budget_Wcm1, budget_Wcm2, budget_Wcm3, budget_Wcm4, budget_Wcm5, Calg_GPP, Calg_mort, dop_decomp, dop_desorb, dop_macIn, dop_sorbIn, EVAP, floc_decomp, floc_In, mac_mort, mac_NPP, NCalg_GPP, NCalg_mort, numBasn, P, P_Calg, P_CELL, P_DEAD, P_DEAD_CELL, P_DEAD_OLD, P_IN_GW, P_IN_OVL, P_IN_SPG, P_IN_STR, P_LIVE, P_LIVE_CELL, P_LIVE_OLD, P_MAC, P_NCalg, P_OLD, P_OUT_GW, P_OUT_OVL, P_OUT_SPG, P_OUT_STR, P_RAIN, P_settl, P_WAT, P_WAT_CELL, P_WAT_OLD, RAIN, RCHG, S_IN_GW, S_IN_OVL, S_IN_SPG, S_IN_STR, S_OUT_GW, S_OUT_OVL, S_OUT_SPG, S_OUT_STR, SUMGW, SUMSF, SUMUW, TOT_P_CAN, TOT_S, TOT_S_CAN, TOT_S_CELL, TOT_S_OLD, TOT_VOL, TOT_VOL_CAN, TOT_VOL_OLD, TRANSP, VOL_IN_GW, VOL_IN_OVL, VOL_IN_SPG, VOL_IN_STR, VOL_OUT_GW, VOL_OUT_OVL, VOL_OUT_SPG, VOL_OUT_STR, wat_sedMiner, wat_sedUpt, wat_sfMiner, and wat_sfUpt.

00944 {
00945     int ibas;
00946     
00947         for (ibas = numBasn; ibas >= 0; ibas--) {
00948             TOT_VOL_OLD[ibas] = TOT_VOL[ibas]; 
00949             TOT_S_OLD[ibas] = TOT_S[ibas]; 
00950             P_OLD[ibas] = P[ibas]; 
00951             if (!ESPmodeON) {
00952                 P_LIVE_OLD[ibas] = P_LIVE[ibas]; 
00953                 P_DEAD_OLD[ibas] = P_DEAD[ibas]; 
00954                 P_WAT_OLD[ibas] = P_WAT[ibas];
00955             }
00956          
00957             SUMSF[ibas] = SUMGW[ibas] = SUMUW[ibas] = TOT_VOL[ibas] = TOT_VOL_CAN[ibas] =  0.0;
00958             RAIN[ibas] = VOL_IN_STR[ibas] = VOL_IN_OVL[ibas] = VOL_IN_SPG[ibas] = VOL_IN_GW[ibas] =  0.0;
00959             EVAP[ibas] = TRANSP[ibas] = RCHG[ibas] = VOL_OUT_STR[ibas] = VOL_OUT_OVL[ibas] = VOL_OUT_SPG[ibas] = VOL_OUT_GW[ibas] =  0.0;
00960 
00961             TOT_S[ibas] = TOT_S_CELL[ibas] = TOT_S_CAN[ibas] =  0.0;
00962             S_IN_STR[ibas] = S_IN_OVL[ibas] = S_IN_SPG[ibas] = S_IN_GW[ibas] =  0.0;
00963             S_OUT_STR[ibas] = S_OUT_OVL[ibas] = S_OUT_SPG[ibas] = S_OUT_GW[ibas] =  0.0;
00964 
00965             P[ibas] = P_CELL[ibas] = TOT_P_CAN[ibas] =  0.0;
00966             P_RAIN[ibas] = P_IN_STR[ibas] = P_IN_OVL[ibas] = P_IN_SPG[ibas] = P_IN_GW[ibas] =  0.0;
00967             P_OUT_STR[ibas] = P_OUT_OVL[ibas] = P_OUT_SPG[ibas] = P_OUT_GW[ibas] =  0.0;
00968 
00969             P_LIVE[ibas] = P_LIVE_CELL[ibas] = P_MAC[ibas] = P_Calg[ibas] = P_NCalg[ibas] = 0.0;
00970             Calg_GPP[ibas] = NCalg_GPP[ibas] = Calg_mort[ibas] = NCalg_mort[ibas] = 0.0;
00971             mac_NPP[ibas] = mac_mort[ibas] = 0.0;
00972 
00973             P_DEAD[ibas] = P_DEAD_CELL[ibas] = 0.0;
00974             dop_macIn[ibas] =  dop_sorbIn[ibas] = floc_In[ibas] = 0.0;
00975             dop_decomp[ibas] = dop_desorb[ibas] = floc_decomp[ibas] = 0.0;
00976 
00977             P_WAT[ibas] = P_WAT_CELL[ibas] = 0.0;
00978             wat_sfMiner[ibas] = wat_sedMiner[ibas] = wat_sfUpt[ibas] = wat_sedUpt[ibas] =  P_settl[ibas] = 0.0;
00979 
00980             
00981         }
00982 
00983 
00984         fflush (budget_Wacr1); 
00985         if (numBasn>=13) fflush (budget_Wacr2);
00986         if (numBasn>=26) fflush (budget_Wacr3); 
00987         if (numBasn>=39) fflush (budget_Wacr4); 
00988         if (numBasn>=52) fflush (budget_Wacr5); 
00989 
00990         fflush (budget_Wcm1); 
00991         if (numBasn>=13) fflush (budget_Wcm2); 
00992         if (numBasn>=26) fflush (budget_Wcm3); 
00993         if (numBasn>=39) fflush (budget_Wcm4); 
00994         if (numBasn>=52) fflush (budget_Wcm5); 
00995 
00996         fflush (budget_S1); 
00997         if (numBasn>=13) fflush (budget_S2); 
00998         if (numBasn>=26) fflush (budget_S3); 
00999         if (numBasn>=39) fflush (budget_S4); 
01000         if (numBasn>=52) fflush (budget_S5); 
01001 
01002         fflush (budget_P1); 
01003         if (numBasn>=13) fflush (budget_P2); 
01004         if (numBasn>=26) fflush (budget_P3); 
01005         if (numBasn>=39) fflush (budget_P4); 
01006         if (numBasn>=52) fflush (budget_P5); 
01007 
01008         fflush (budget_Par1); 
01009         if (numBasn>=13) fflush (budget_Par2); 
01010         if (numBasn>=26) fflush (budget_Par3); 
01011         if (numBasn>=39) fflush (budget_Par4); 
01012         if (numBasn>=52) fflush (budget_Par5); 
01013 
01014         if (!ESPmodeON) { 
01015             fflush (budget_Plive1);  
01016             if (numBasn>=13) fflush (budget_Plive2);  
01017             if (numBasn>=26) fflush (budget_Plive3); 
01018             if (numBasn>=39) fflush (budget_Plive4); 
01019             if (numBasn>=52) fflush (budget_Plive5); 
01020 
01021             fflush (budget_Pdead1);  
01022             if (numBasn>=13) fflush (budget_Pdead2);  
01023             if (numBasn>=26) fflush (budget_Pdead3); 
01024             if (numBasn>=39) fflush (budget_Pdead4); 
01025             if (numBasn>=52) fflush (budget_Pdead5); 
01026 
01027             fflush (budget_Pwat1);  
01028             if (numBasn>=13) fflush (budget_Pwat2);  
01029             if (numBasn>=26) fflush (budget_Pwat3); 
01030             if (numBasn>=39) fflush (budget_Pwat4); 
01031             if (numBasn>=52) fflush (budget_Pwat5); 
01032         } 
01033 } /* end of BIRbudg_reset() */

void BIRinit void   ) 
 

Set up the Basin & Indicator Region (BIR) linkages/inheritances.

Definition at line 1041 of file BudgStats.c.

References basInFile, basins, basn, basn_list, basnDef, basndef::basnTxt, conv_kgTOmg, basndef::conv_kgTOmgm2, basndef::conv_m3TOcm, conv_mTOcm, basndef::family, basndef::FLok, basndef::IR, modelFileName, modelName, ModelPath, msgStr, numBasn, numCells, basndef::numFLok, basndef::numIR, ON_MAP, basndef::parent, ProjName, s0, s1, Scip(), T, and usrErr().

01042 {
01043     int ix,iy,cellLoc,ibas;
01044     int ii, jj, basnID;
01045     int basnCnt=-1; /* the whole system basin-0 in the basinIR file is not considered part of this count of the number of Basin/IRs */
01046     char ss[222], *line, modnam[20], boundIR[3];
01047 
01048     sprintf( modelFileName, "%s/%s/Data/basinIR", ModelPath, ProjName );
01049 /* Open file with basin linkage/inheritance data */
01050     if ( ( basInFile = fopen( modelFileName, "r" ) ) ==  NULL )
01051     {
01052         sprintf( msgStr,"Can't open %s basin definition input file! ",modelFileName ) ; usrErr(msgStr);
01053         exit(-1) ;
01054     }
01055 
01056     fgets( ss, 220, basInFile );fgets( ss, 220, basInFile ); /* skip 2 header lines */
01057     fgets( ss, 220, basInFile ); sscanf( ss,"%s", &modnam); 
01058     if (strcmp(modnam,modelName) != 0) {
01059         sprintf(msgStr, "The model name (%s) found in the %s file doesn't match the one (%s) you asked for in Driver.parm!",
01060                 modnam, modelFileName, modelName); usrErr(msgStr);
01061         exit(-1);
01062     }
01063         /* Allocate memory for first basin */
01064     if ( (basins = ( basnDef *) malloc( (size_t) sizeof( basnDef ))) == NULL ) {
01065         printf( "Failed to allocate memory for first basin (%s)\n ", basins->basnTxt ) ;
01066         exit( -2 ) ;
01067     }
01068         /* allocate memory for array of pointers to basin atts */
01069     if ( (basn_list = 
01070           ( basnDef **) malloc( (size_t) sizeof( basnDef *) * (numBasn+1))) == NULL )
01071     {
01072         printf( "Failed to allocate memory for basin_list\n " ) ;
01073         exit( -2 ) ;
01074     };
01075 
01076 
01077     fgets( ss, 220, basInFile ); /* skip the column name header */
01078     
01079     while ( fgets( ss, 220, basInFile ) != NULL && !feof( basInFile ) )
01080     {
01081         line = ss;
01082         sscanf (line, "%d\t%s\t%d",&basnID, &basins->basnTxt,&basins->numIR);
01083         line = Scip( line, '\t' );line = Scip( line, '\t' );line = Scip( line, '\t' );
01084 /* the indicator regions within a hydrologic basin are subscripted starting at 1,
01085    with the 0'th indicator region being the hydrologic basin itself.  Flok is
01086    used to check for allowable flows among basins/indicator-regions, to determine if user configured
01087    BIRs are OK (NOT used to constrain calculated flows, but only used to verify that no unallowed interbasin
01088    overland flow is occuring via some "leak" in the vector topology) */
01089         for (ii=0; ii<basins->numIR; ii++) {
01090             sscanf (line, "%d%", &basins->IR[ii]);
01091             basins->FLok[ii] = basins->IR[ii]; /* flow is allowed among IRegions in a particular hydro basin (family) */
01092             basins->numFLok++;
01093             line = Scip( line, ',' );
01094         }
01095         basnCnt++; /* count the number of basins&IRs to check that the # in the file is same as # defined on the map */
01096 
01097 /* if there are any FlowOk Basin/Indicator-Region attached to this Basin/Indicator-Region, read them */
01098         while (1) {
01099             while ( *line != '#' && *line != '\0' ) line++;
01100             if(*line != '\0') {
01101                 ++line;
01102                 sscanf (line, "%d%", &basins->FLok[ii]);
01103                 basins->numFLok++;
01104                 ii++;
01105             }
01106             else break;
01107         }
01108 
01109         basn_list[basnID] = basins;
01110     
01111             /* Allocate memory for next basin */
01112         if ( ( basins = ( basnDef *) malloc( (size_t) sizeof(  basnDef ))) == NULL )
01113         {
01114             printf( "Failed to allocate memory for next basin (%s)\n ", basins->basnTxt ) ;
01115             exit( -2 ) ;
01116         }
01117 
01118      
01119     } /* end of reading basin lines */
01120     
01121     free ((char *)basins);
01122     fclose(basInFile);
01123 
01124     if (basnCnt != numBasn) { sprintf(msgStr, "Error - the %d basins read from basinIR does not match the %d basins in the basins map! Please fix the basinIR file.\n",
01125                                       basnCnt,numBasn); usrErr(msgStr); exit (-1); }
01126  
01127 /* count the number of cells in the Basins/Indicator-Regions */
01128     for (ibas=numBasn;ibas>=0;ibas--) numCells[ibas] = 0;
01129     for(ix=0; ix<=s0+1; ix++) 
01130         for(iy=0; iy<=s1+1; iy++)
01131             if (ON_MAP[cellLoc= T(ix,iy)]) { 
01132                 numCells[basn[cellLoc]]++; /* count the number of cells in each basin */
01133                 numCells[0]++; /* count the number of cells in each basin */
01134             }
01135         /* whole system (basin 0) is calc'd independently, while each of the hydro basins are
01136            sums of their respective Indicator Regions */
01137     for (ibas=numBasn;ibas>=0;ibas--) {
01138         basins =  basn_list[ibas];
01139         basins->family = ibas; /* set the basin to initially be it's own family; below it may find that it is a child of a diff family */
01140         basins->parent = ibas; /* set the basin to initially be a childless parent */
01141         for (ii=0; ii<basins->numIR; ii++) {
01142         
01143             basn_list[basins->IR[ii]]->family = ibas; /* the hydrologic basin family name of this IRegion */
01144             basn_list[basins->IR[ii]]->parent = 0; /* this IR is a child, not a parent */
01145             numCells[ibas] += numCells[basins->IR[ii]]; /* add the IRegion cells to the parent basin #cells */
01146         }
01147         basins->conv_m3TOcm = conv_mTOcm/(numCells[ibas]*CELL_SIZE);
01148         basins->conv_kgTOmgm2 = conv_kgTOmg/(numCells[ibas]*CELL_SIZE);
01149 
01150     }
01151 } /* end of BIRinit() */

Here is the call graph for this function:

void BIRoutfiles void   ) 
 

Open files and create headers for BIR output.

Definition at line 1159 of file BudgStats.c.

References BIRavg1, BIRavg2, BIRavg3, BIRavg4, BIRavg5, budget_P1, budget_P2, budget_P3, budget_P4, budget_P5, budget_Par1, budget_Par2, budget_Par3, budget_Par4, budget_Par5, budget_Pdead1, budget_Pdead2, budget_Pdead3, budget_Pdead4, budget_Pdead5, budget_Plive1, budget_Plive2, budget_Plive3, budget_Plive4, budget_Plive5, budget_Pwat1, budget_Pwat2, budget_Pwat3, budget_Pwat4, budget_Pwat5, budget_S1, budget_S2, budget_S3, budget_S4, budget_S5, budget_Wacr1, budget_Wacr2, budget_Wacr3, budget_Wacr4, budget_Wacr5, budget_Wcm1, budget_Wcm2, budget_Wcm3, budget_Wcm4, budget_Wcm5, CELL_SIZE, Min, modelFileName, modelName, modelVers, numBasn, numCells, OutputPath, ProjName, SimAlt, and SimModif.

01160 {
01161     int Fnum,Fsets,ibasLow,ibasHigh,ibas;
01162 
01163 
01164     
01165 /********/
01166 /* For the budget & BIRavg files, we can have multiple sets of files, with
01167    >1 sets needed if a large (>12) number of Basins/Indicator-Regions are defined.  First,
01168    we open the files, then go to write headers for them */
01169 
01170     {/*Open the primary files for all of the budgets & BIRavgs */
01171     
01172 /* Indicator region avgs */
01173         sprintf( modelFileName, "%s/%s/Output/Budget/BIRavg1", OutputPath, ProjName ); 
01174         if ( ( BIRavg1 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01175         {printf( "Can't open BIRavg1 file! " );exit(-1) ;} 
01176 /* water budget/massCheck info - units in acre-feet */
01177         sprintf( modelFileName, "%s/%s/Output/Budget/budg_Wacr1", OutputPath, ProjName ); 
01178         if ( ( budget_Wacr1 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01179         {printf( "Can't open budg_Wacr1 file! " );exit(-1) ;} 
01180 /* water budget/massCheck info - units in cm height */
01181         sprintf( modelFileName, "%s/%s/Output/Budget/budg_Wcm1", OutputPath, ProjName ); 
01182         if ( ( budget_Wcm1 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01183         {printf( "Can't open budg_Wcm1 file! " );exit(-1) ;}
01184 /* Phosph budget/massCheck info for all P fractions (units=Mg) */
01185         sprintf( modelFileName, "%s/%s/Output/Budget/budg_P1", OutputPath, ProjName ); 
01186         if ( ( budget_P1 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01187         {printf( "Can't open budg_P1 file! " );exit(-1) ;} 
01188 /* Phosph budget/massCheck info for all P fractions (units=mg/m2) */
01189         sprintf( modelFileName, "%s/%s/Output/Budget/budg_Par1", OutputPath, ProjName ); 
01190         if ( ( budget_Par1 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01191         {printf( "Can't open budg_Par1 file! " );exit(-1) ;} 
01192 /* Salt budget/massCheck info */
01193         sprintf( modelFileName, "%s/%s/Output/Budget/budg_S1", OutputPath, ProjName ); 
01194         if ( ( budget_S1 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01195         {printf( "Can't open budg_S1 file! " );exit(-1) ;} 
01196         if (!ESPmodeON) {
01197 /* Phosph budget/massCheck info for live P fraction */
01198             sprintf( modelFileName, "%s/%s/Output/Budget/budg_Pliv1", OutputPath, ProjName ); 
01199             if ( ( budget_Plive1 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01200             {printf( "Can't open budg_Pliv1 file! " );exit(-1) ;}
01201 /* Phosph budget/massCheck info for dead P fraction */
01202             sprintf( modelFileName, "%s/%s/Output/Budget/budg_Pded1", OutputPath, ProjName ); 
01203             if ( ( budget_Pdead1 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01204             {printf( "Can't open budg_Pded1 file! " );exit(-1) ;} 
01205 /* Phosph budget/massCheck info for water-borne P fraction */
01206             sprintf( modelFileName, "%s/%s/Output/Budget/budg_Pwat1", OutputPath, ProjName ); 
01207             if ( ( budget_Pwat1 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01208             {printf( "Can't open budg_Pwat1 file! " );exit(-1) ;}
01209         }
01210 
01211 
01212         if (numBasn>=13) {
01213 /*Open the secondary files for all of the budgets & BIRavgs if we have more than 12 basins */
01214 /* Indicator region avgs */
01215             sprintf( modelFileName, "%s/%s/Output/Budget/BIRavg2", OutputPath, ProjName ); 
01216             if ( ( BIRavg2 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01217             { printf( "Can't open BIRavg2 file! " ); exit(-1) ;} 
01218 /* water budget/massCheck info - units in acre-feet */
01219             sprintf( modelFileName, "%s/%s/Output/Budget/budg_Wacr2", OutputPath, ProjName ); 
01220             if ( ( budget_Wacr2 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01221             { printf( "Can't open budg_Wacr2 file! " ); exit(-1) ;} 
01222 /* water budget/massCheck info - units in cm height */
01223             sprintf( modelFileName, "%s/%s/Output/Budget/budg_Wcm2", OutputPath, ProjName ); 
01224             if ( ( budget_Wcm2 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01225             {printf( "Can't open budg_Wcm2 file! " ); exit(-1) ;} 
01226 /* Phosph budget/massCheck info for all P fractions (units=Mg) */
01227             sprintf( modelFileName, "%s/%s/Output/Budget/budg_P2", OutputPath, ProjName ); 
01228             if ( ( budget_P2 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01229             {printf( "Can't open budg_P2 file! " );exit(-1) ;} 
01230 /* Phosph budget/massCheck info for all P fractions (units=mg/m2) */
01231             sprintf( modelFileName, "%s/%s/Output/Budget/budg_Par2", OutputPath, ProjName ); 
01232             if ( ( budget_Par2 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01233             {printf( "Can't open budg_Par2 file! " );exit(-1) ;} 
01234 /* Salt budget/massCheck info */
01235             sprintf( modelFileName, "%s/%s/Output/Budget/budg_S2", OutputPath, ProjName ); 
01236             if ( ( budget_S2 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01237             {printf( "Can't open budg_S2 file! " );exit(-1) ;} 
01238 
01239             if (!ESPmodeON) {
01240 /* Phosph budget/massCheck info for live P fraction */
01241                 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Pliv2", OutputPath, ProjName ); 
01242                 if ( ( budget_Plive2 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01243                 {printf( "Can't open budg_Pliv2 file! " );exit(-1) ;}
01244 /* Phosph budget/massCheck info for dead P fraction */
01245                 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Pded2", OutputPath, ProjName ); 
01246                 if ( ( budget_Pdead2 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01247                 {printf( "Can't open budg_Pded2 file! " );exit(-1) ;} 
01248 /* Phosph budget/massCheck info for water-borne P fraction */
01249                 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Pwat2", OutputPath, ProjName ); 
01250                 if ( ( budget_Pwat2 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01251                 {printf( "Can't open budg_Pwat2 file! " );exit(-1) ;} 
01252             }/* end of !ESPmodeON */
01253     
01254         } /* end of opening secondary files */
01255 
01256         
01257         if (numBasn>=26) {
01258 /*Open the tertiary files for all of the budgets if we have more than 25 basins */
01259 /* Indicator region avgs */
01260             sprintf( modelFileName, "%s/%s/Output/Budget/BIRavg3", OutputPath, ProjName ); 
01261             if ( ( BIRavg3 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01262             { printf( "Can't open BIRavg3 file! " ); exit(-1) ;} 
01263 /* water budget/massCheck info - units in acre-feet */
01264             sprintf( modelFileName, "%s/%s/Output/Budget/budg_Wacr3", OutputPath, ProjName ); 
01265             if ( ( budget_Wacr3 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01266             { printf( "Can't open budg_Wacr3 file! " ); exit(-1) ;} 
01267 /* water budget/massCheck info - units in cm height */
01268             sprintf( modelFileName, "%s/%s/Output/Budget/budg_Wcm3", OutputPath, ProjName ); 
01269             if ( ( budget_Wcm3 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01270             {printf( "Can't open budg_Wcm3 file! " ); exit(-1) ;} 
01271 /* Phosph budget/massCheck info for all P fractions (units=Mg) */
01272             sprintf( modelFileName, "%s/%s/Output/Budget/budg_P3", OutputPath, ProjName ); 
01273             if ( ( budget_P3 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01274             {printf( "Can't open budg_P3 file! " );exit(-1) ;} 
01275 /* Phosph budget/massCheck info for all P fractions (units=mg/m2) */
01276             sprintf( modelFileName, "%s/%s/Output/Budget/budg_Par3", OutputPath, ProjName ); 
01277             if ( ( budget_Par3 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01278             {printf( "Can't open budg_Par3 file! " );exit(-1) ;} 
01279 /* Salt budget/massCheck info */
01280             sprintf( modelFileName, "%s/%s/Output/Budget/budg_S3", OutputPath, ProjName ); 
01281             if ( ( budget_S3 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01282             {printf( "Can't open budg_S3 file! " );exit(-1) ;} 
01283 
01284             if (!ESPmodeON) {
01285 /* Phosph budget/massCheck info for live P fraction */
01286                 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Pliv3", OutputPath, ProjName ); 
01287                 if ( ( budget_Plive3 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01288                 {printf( "Can't open budg_Pliv3 file! " );exit(-1) ;}
01289 /* Phosph budget/massCheck info for dead P fraction */
01290                 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Pded3", OutputPath, ProjName ); 
01291                 if ( ( budget_Pdead3 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01292                 {printf( "Can't open budg_Pded3 file! " );exit(-1) ;} 
01293 /* Phosph budget/massCheck info for water-borne P fraction */
01294                 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Pwat3", OutputPath, ProjName ); 
01295                 if ( ( budget_Pwat3 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01296                 {printf( "Can't open budg_Pwat3 file! " );exit(-1) ;} 
01297             }/* end of !ESPmodeON */
01298     
01299         } /* end of opening tertiary files */
01300         
01301         if (numBasn>=39) {
01302 /*Open the fourth set of files for all of the budgets if we have more than 38 basins */
01303 /* Indicator region avgs */
01304             sprintf( modelFileName, "%s/%s/Output/Budget/BIRavg4", OutputPath, ProjName ); 
01305             if ( ( BIRavg4 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01306             { printf( "Can't open BIRavg4 file! " ); exit(-1) ;} 
01307 /* water budget/massCheck info - units in acre-feet */
01308             sprintf( modelFileName, "%s/%s/Output/Budget/budg_Wacr4", OutputPath, ProjName ); 
01309             if ( ( budget_Wacr4 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01310             { printf( "Can't open budg_Wacr4 file! " ); exit(-1) ;} 
01311 /* water budget/massCheck info - units in cm height */
01312             sprintf( modelFileName, "%s/%s/Output/Budget/budg_Wcm4", OutputPath, ProjName ); 
01313             if ( ( budget_Wcm4 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01314             {printf( "Can't open budg_Wcm4 file! " ); exit(-1) ;} 
01315 /* Phosph budget/massCheck info for all P fractions (units=Mg) */
01316             sprintf( modelFileName, "%s/%s/Output/Budget/budg_P4", OutputPath, ProjName ); 
01317             if ( ( budget_P4 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01318             {printf( "Can't open budg_P4 file! " );exit(-1) ;} 
01319 /* Phosph budget/massCheck info for all P fractions (units=mg/m2) */
01320             sprintf( modelFileName, "%s/%s/Output/Budget/budg_Par4", OutputPath, ProjName ); 
01321             if ( ( budget_Par4 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01322             {printf( "Can't open budg_Par4 file! " );exit(-1) ;} 
01323 /* Salt budget/massCheck info */
01324             sprintf( modelFileName, "%s/%s/Output/Budget/budg_S4", OutputPath, ProjName ); 
01325             if ( ( budget_S4 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01326             {printf( "Can't open budg_S4 file! " );exit(-1) ;} 
01327 
01328             if (!ESPmodeON) {
01329 /* Phosph budget/massCheck info for live P fraction */
01330                 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Pliv4", OutputPath, ProjName ); 
01331                 if ( ( budget_Plive4 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01332                 {printf( "Can't open budg_Pliv4 file! " );exit(-1) ;}
01333 /* Phosph budget/massCheck info for dead P fraction */
01334                 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Pded4", OutputPath, ProjName ); 
01335                 if ( ( budget_Pdead4 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01336                 {printf( "Can't open budg_Pded4 file! " );exit(-1) ;} 
01337 /* Phosph budget/massCheck info for water-borne P fraction */
01338                 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Pwat4", OutputPath, ProjName ); 
01339                 if ( ( budget_Pwat4 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01340                 {printf( "Can't open budg_Pwat4 file! " );exit(-1) ;} 
01341             }/* end of !ESPmodeON */
01342     
01343         } /* end of opening fourth set of files */
01344         
01345         if (numBasn>=52) {
01346 /*Open the fifth set of files for all of the budgets if we have more than 51 basins */
01347 /* Indicator region avgs */
01348             sprintf( modelFileName, "%s/%s/Output/Budget/BIRavg5", OutputPath, ProjName ); 
01349             if ( ( BIRavg5 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01350             { printf( "Can't open BIRavg5 file! " ); exit(-1) ;} 
01351 /* water budget/massCheck info - units in acre-feet */
01352             sprintf( modelFileName, "%s/%s/Output/Budget/budg_Wacr5", OutputPath, ProjName ); 
01353             if ( ( budget_Wacr5 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01354             { printf( "Can't open budg_Wacr5 file! " ); exit(-1) ;} 
01355 /* water budget/massCheck info - units in cm height */
01356             sprintf( modelFileName, "%s/%s/Output/Budget/budg_Wcm5", OutputPath, ProjName ); 
01357             if ( ( budget_Wcm5 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01358             {printf( "Can't open budg_Wcm5 file! " ); exit(-1) ;} 
01359 /* Phosph budget/massCheck info for all P fractions (units=Mg) */
01360             sprintf( modelFileName, "%s/%s/Output/Budget/budg_P5", OutputPath, ProjName ); 
01361             if ( ( budget_P5 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01362             {printf( "Can't open budg_P5 file! " );exit(-1) ;} 
01363 /* Phosph budget/massCheck info for all P fractions (units=mg/m2) */
01364             sprintf( modelFileName, "%s/%s/Output/Budget/budg_Par5", OutputPath, ProjName ); 
01365             if ( ( budget_Par5 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01366             {printf( "Can't open budg_Par5 file! " );exit(-1) ;} 
01367 /* Salt budget/massCheck info */
01368             sprintf( modelFileName, "%s/%s/Output/Budget/budg_S5", OutputPath, ProjName ); 
01369             if ( ( budget_S5 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01370             {printf( "Can't open budg_S5 file! " );exit(-1) ;} 
01371 
01372             if (!ESPmodeON) {
01373 /* Phosph budget/massCheck info for live P fraction */
01374                 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Pliv5", OutputPath, ProjName ); 
01375                 if ( ( budget_Plive5 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01376                 {printf( "Can't open budg_Pliv5 file! " );exit(-1) ;}
01377 /* Phosph budget/massCheck info for dead P fraction */
01378                 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Pded5", OutputPath, ProjName ); 
01379                 if ( ( budget_Pdead5 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01380                 {printf( "Can't open budg_Pded5 file! " );exit(-1) ;} 
01381 /* Phosph budget/massCheck info for water-borne P fraction */
01382                 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Pwat5", OutputPath, ProjName ); 
01383                 if ( ( budget_Pwat5 = fopen( modelFileName, "w" ) ) ==  NULL ) 
01384                 {printf( "Can't open budg_Pwat5 file! " );exit(-1) ;} 
01385             }/* end of !ESPmodeON */
01386     
01387         } /* end of opening fifth set of files */
01388         
01389     } /* end of opening all files */
01390 
01391 
01392 
01393 /********/
01394 /* Now we need to print the headers to each set(s) of basin files */
01395 /* First, figure out the number of files sets, and then loop thru that */
01396         /* there are 13 total basins printed per file (basin 0 is whole system,
01397            not counted in numBasn, but always printed out in first file) */
01398     if (numBasn>=52) { /* with more than 58 (plus whole-system basin == 59) basins: */
01399         Fsets=5;              /* we have five sets of basin files */
01400     }
01401     else if (numBasn>=39) { /* with more than 38 (plus whole-system basin == 39) basins: */
01402         Fsets=4;              /* we have four sets of basin files */
01403     }
01404     else if (numBasn>=26) { /* with more than 25 (plus whole-system basin == 26) basins: */
01405         Fsets=3;              /* we have three sets of basin files */
01406     }
01407     else if (numBasn>=13) { /* with more than 12 (plus whole-system basin == 13) basins: */
01408         Fsets=2;              /* we have two sets of basin files */
01409     }
01410     else {
01411         Fsets=1;       /* otherwise, just one set of files */
01412     }
01413 
01414     for (Fnum = 1; Fnum <= Fsets; Fnum++) { 
01415     
01416         if (Fnum == 1) { /* first file set */
01417             if (Fsets > 1) {
01418                 ibasLow = 0;        
01419                 ibasHigh = 12;
01420             }
01421             else {
01422                 ibasLow = 0;
01423                 ibasHigh = Min(12,numBasn);
01424             }
01425         }
01426 
01427         if (Fnum == 2) { /* second file set */
01428             if (Fsets > 2) {
01429                 ibasLow = 13;        
01430                 ibasHigh = 25;
01431             }
01432             else {
01433                 ibasLow = 13;
01434                 ibasHigh = Min(25,numBasn);
01435             }
01436         }
01437 
01438         if (Fnum == 3) { /* third file set */
01439             if (Fsets > 3) {
01440                 ibasLow = 26;        
01441                 ibasHigh = 38;
01442             }
01443             else {
01444                 ibasLow = 26;
01445                 ibasHigh = Min(38,numBasn);
01446             }
01447         }
01448         
01449         if (Fnum == 4) { /* fourth file set */
01450             if (Fsets > 4) {
01451                 ibasLow = 39;        
01452                 ibasHigh = 51;
01453             }
01454             else {
01455                 ibasLow = 39;
01456                 ibasHigh = Min(51,numBasn);
01457             }
01458         }
01459         
01460 
01461         else if (Fnum == 5) {
01462             ibasLow = 52;        
01463             ibasHigh = numBasn;
01464         }
01465 
01466 /*****/
01467 /* now print the 4 header lines for all of the budget & BIRavg files */
01468 
01469 /* LINE 1&2: first header line, providing scenario ID; second line is units, etc. */
01470 /* feb05 added two tabs at end of BIRavg header to accomodate sensitivity parm label & value */
01471         fprintf ( ((Fnum==5)?(BIRavg5):
01472                    ((Fnum==4)?(BIRavg4):
01473                    ((Fnum==3)?(BIRavg3):
01474                     ((Fnum==2)?(BIRavg2):
01475                      (BIRavg1) ) ) ) ), 
01476                   "%s %s %s %s scenario: Basins/Indicator-Regions (BIR): daily mean attributes. \nUnits = Hydro depths== m, TP surface & pore water==mg/L, TP soil==mg/kg, noncalc&calc periph==gC/m2, mac==kgC/m2, LandElevation= m NGVD'29+DATUM_DISTANCE(6m in v2.3).\n          \t\t\t ", &modelName, &modelVers, &SimAlt, &SimModif ); 
01477         fprintf ( ((Fnum==5)?(budget_Wacr5):
01478                    ((Fnum==4)?(budget_Wacr4):
01479                    ((Fnum==3)?(budget_Wacr3):
01480                     ((Fnum==2)?(budget_Wacr2):
01481                      (budget_Wacr1) ) ) ) ), 
01482                   "%s %s %s %s scenario: Basins/Indicator-Regions (BIR): water budget and mass balance check. \nUnits = thousands of acre-feet per basin, with error (and cumulative net error) reporting in mm height across basin.\n          \t ", &modelName, &modelVers, &SimAlt, &SimModif ); 
01483         fprintf ( ((Fnum==5)?(budget_Wcm5):
01484                    ((Fnum==4)?(budget_Wcm4):
01485                    ((Fnum==3)?(budget_Wcm3):
01486                     ((Fnum==2)?(budget_Wcm2):
01487                      (budget_Wcm1) ) ) ) ), 
01488                   "%s %s %s %s scenario: Basins/Indicator-Regions (BIR): water budget and mass balance check. \nUnits = cm per basin, with error (and cumulative net error) reporting in mm height across basin.\n          \t ", &modelName, &modelVers, &SimAlt, &SimModif ); 
01489         fprintf ( ((Fnum==5)?(budget_S5):
01490                    ((Fnum==4)?(budget_S4):
01491                    ((Fnum==3)?(budget_S3):
01492                     ((Fnum==2)?(budget_S2):
01493                      (budget_S1) ) ) ) ), 
01494                   "%s %s %s %s scenario: Basins/Indicator-Regions (BIR): conservative tracer budget and mass balance check. \nUnits = metric tons (Mg) per basin, with error (and cumulative net error) reporting in ug/m2 in basin.\n          \t ", &modelName, &modelVers, &SimAlt, &SimModif ); 
01495         fprintf ( ((Fnum==5)?(budget_P5):
01496                    ((Fnum==4)?(budget_P4):
01497                    ((Fnum==3)?(budget_P3):
01498                     ((Fnum==2)?(budget_P2):
01499                      (budget_P1) ) ) ) ), 
01500                   "%s %s %s %s scenario: Basins/Indicator-Regions (BIR): Total P budget and mass balance check for all fractions. \nUnits = metric tons (Mg) per basin, with error (and cumulative net error) reporting in ug/m2 in basin.\n          \t ", &modelName, &modelVers, &SimAlt, &SimModif ); 
01501         fprintf ( ((Fnum==5)?(budget_Par5):
01502                    ((Fnum==4)?(budget_Par4):
01503                    ((Fnum==3)?(budget_Par3):
01504                     ((Fnum==2)?(budget_Par2):
01505                      (budget_Par1) ) ) ) ), 
01506                   "%s %s %s %s scenario: Basins/Indicator-Regions (BIR): Total P budget and mass balance check for all fractions. \nUnits = mg/m2 in basin, with error (and cumulative net error) reporting in ug/m2 in basin.\n          \t ", &modelName, &modelVers, &SimAlt, &SimModif ); 
01507         if (!ESPmodeON) {
01508 
01509             fprintf ( ((Fnum==5)?(budget_Plive5):
01510                        ((Fnum==4)?(budget_Plive4):
01511                        ((Fnum==3)?(budget_Plive3):
01512                         ((Fnum==2)?(budget_Plive2):
01513                          (budget_Plive1) ) ) ) ), 
01514                       "%s %s %s %s scenario: Basins/Indicator-Regions (BIR): Total P budget and mass balance check for live fraction. \nUnits =  mg/m2 in basin, with error (and cumulative net error) ug/m2.\n          \t ", &modelName, &modelVers, &SimAlt, &SimModif ); 
01515             fprintf ( ((Fnum==5)?(budget_Pdead5):
01516                        ((Fnum==4)?(budget_Pdead4):
01517                        ((Fnum==3)?(budget_Pdead3):
01518                         ((Fnum==2)?(budget_Pdead2):
01519                          (budget_Pdead1) ) ) ) ), 
01520                       "%s %s %s %s scenario: Basins/Indicator-Regions (BIR): Total P budget and mass balance check for dead, non-water-borne fraction. \nUnits =  mg/m2 in basin, with error (and cumulative net error) ug/m2.\n          \t ", &modelName, &modelVers, &SimAlt, &SimModif ); 
01521             fprintf ( ((Fnum==5)?(budget_Pwat5):
01522                        ((Fnum==4)?(budget_Pwat4):
01523                        ((Fnum==3)?(budget_Pwat3):
01524                         ((Fnum==2)?(budget_Pwat2):
01525                          (budget_Pwat1) ) ) ) ), 
01526                       "%s %s %s %s scenario: Basins/Indicator-Regions (BIR): Total P budget and mass balance check for water-borne fraction (some horiz I/O not shown - see budget for all combined fractions). \nUnits =  mg/m2 in basin, with error (and cumulative net error) ug/m2.\n          \t ", &modelName, &modelVers, &SimAlt, &SimModif ); 
01527         }
01528 
01529 /* LINE 3: third header line, looping thru basins, providing basin ID and size */
01530         for (ibas = ibasHigh; ibas >= ibasLow; ibas--) 
01531         {
01532         fprintf ( ((Fnum==5)?(BIRavg5):
01533                   ((Fnum==4)?(BIRavg4):
01534                    ((Fnum==3)?(BIRavg3):
01535                     ((Fnum==2)?(BIRavg2):
01536                      (BIRavg1) ) ) ) ), 
01537                       "  BIR %2d =\t%6.1fmi^2,\t%6.1fkm^2\t         \t         \t         \t         \t         \t         \t",
01538                       ibas,(numCells[ibas]*CELL_SIZE*3.8610039e-7),(numCells[ibas]*CELL_SIZE*1.0e-6) ); 
01539         fprintf ( ((Fnum==5)?(budget_Wacr5):
01540                    ((Fnum==4)?(budget_Wacr4):
01541                    ((Fnum==3)?(budget_Wacr3):
01542                     ((Fnum==2)?(budget_Wacr2):
01543                      (budget_Wacr1) ) ) ) ), 
01544                       "  BIR %2d =\t%6.1fmi^2,\t%6.1fkm^2\t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t",
01545                       ibas,(numCells[ibas]*CELL_SIZE*3.8610039e-7),(numCells[ibas]*CELL_SIZE*1.0e-6) ); 
01546         fprintf ( ((Fnum==5)?(budget_Wcm5):
01547                    ((Fnum==4)?(budget_Wcm4):
01548                    ((Fnum==3)?(budget_Wcm3):
01549                     ((Fnum==2)?(budget_Wcm2):
01550                      (budget_Wcm1) ) ) ) ), 
01551                       "  BIR %2d =\t%6.1fmi^2,\t%6.1fkm^2\t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t",
01552                       ibas,(numCells[ibas]*CELL_SIZE*3.8610039e-7),(numCells[ibas]*CELL_SIZE*1.0e-6) ); 
01553         fprintf ( ((Fnum==5)?(budget_S5):
01554                    ((Fnum==4)?(budget_S4):
01555                    ((Fnum==3)?(budget_S3):
01556                     ((Fnum==2)?(budget_S2):
01557                      (budget_S1) ) ) ) ), 
01558                       "  BIR %2d =\t%6.1fmi^2,\t%6.1fkm^2\t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t",
01559                       ibas,(numCells[ibas]*CELL_SIZE*3.8610039e-7),(numCells[ibas]*CELL_SIZE*1.0e-6) ); 
01560             if (!ESPmodeON) {
01561                 fprintf ( ((Fnum==5)?(budget_P5):
01562                           ((Fnum==4)?(budget_P4):
01563                            ((Fnum==3)?(budget_P3):
01564                             ((Fnum==2)?(budget_P2):
01565                              (budget_P1) ) ) ) ), 
01566                           "  BIR %2d =\t%6.1fmi^2,\t%6.1fkm^2\t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t",
01567                           ibas,(numCells[ibas]*CELL_SIZE*3.8610039e-7),(numCells[ibas]*CELL_SIZE*1.0e-6) );
01568                 fprintf ( ((Fnum==5)?(budget_Par5):
01569                            ((Fnum==4)?(budget_Par4):
01570                            ((Fnum==3)?(budget_Par3):
01571                             ((Fnum==2)?(budget_Par2):
01572                              (budget_Par1) ) ) ) ), 
01573                       "  BIR %2d =\t%6.1fmi^2,\t%6.1fkm^2\t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t",
01574                           ibas,(numCells[ibas]*CELL_SIZE*3.8610039e-7),(numCells[ibas]*CELL_SIZE*1.0e-6) );
01575                 fprintf ( ((Fnum==5)?(budget_Plive5):
01576                            ((Fnum==4)?(budget_Plive4):
01577                             ((Fnum==3)?(budget_Plive3):
01578                              ((Fnum==2)?(budget_Plive2):
01579                               (budget_Plive1) ) ) ) ), 
01580                       "  BIR %2d =\t%6.1fmi^2,\t%6.1fkm^2\t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t",
01581                           ibas,(numCells[ibas]*CELL_SIZE*3.8610039e-7),(numCells[ibas]*CELL_SIZE*1.0e-6) ); 
01582                 fprintf ( ((Fnum==5)?(budget_Pdead5):
01583                            ((Fnum==4)?(budget_Pdead4):
01584                             ((Fnum==3)?(budget_Pdead3):
01585                              ((Fnum==2)?(budget_Pdead2):
01586                               (budget_Pdead1) ) ) ) ), 
01587                       "  BIR %2d =\t%6.1fmi^2,\t%6.1fkm^2\t         \t          \t        \t         \t         \t         \t         \t         \t         \t         \t",
01588                           ibas,(numCells[ibas]*CELL_SIZE*3.8610039e-7),(numCells[ibas]*CELL_SIZE*1.0e-6) ); 
01589                 fprintf ( ((Fnum==5)?(budget_Pwat5):
01590                            ((Fnum==4)?(budget_Pwat4):
01591                             ((Fnum==3)?(budget_Pwat3):
01592                              ((Fnum==2)?(budget_Pwat2):
01593                               (budget_Pwat1) ) ) ) ), 
01594                       "  BIR %2d =\t%6.1fmi^2,\t%6.1fkm^2\t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t",
01595                           ibas,(numCells[ibas]*CELL_SIZE*3.8610039e-7),(numCells[ibas]*CELL_SIZE*1.0e-6) ); 
01596             }
01597     
01598             else {
01599                 fprintf ( ((Fnum==5)?(budget_P5):
01600                            ((Fnum==4)?(budget_P4):
01601                            ((Fnum==3)?(budget_P3):
01602                             ((Fnum==2)?(budget_P2):
01603                              (budget_P1) ) ) ) ), 
01604                       "  BIR %2d =\t%6.1fmi^2,\t%6.1fkm^2\t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t",
01605                           ibas,(numCells[ibas]*CELL_SIZE*3.8610039e-7),(numCells[ibas]*CELL_SIZE*1.0e-6) );
01606                 fprintf ( ((Fnum==5)?(budget_Par5):
01607                            ((Fnum==4)?(budget_Par4):
01608                            ((Fnum==3)?(budget_Par3):
01609                             ((Fnum==2)?(budget_Par2):
01610                              (budget_Par1) ) ) ) ), 
01611                       "  BIR %2d =\t%6.1fmi^2,\t%6.1fkm^2\t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t         \t",
01612                           ibas,(numCells[ibas]*CELL_SIZE*3.8610039e-7),(numCells[ibas]*CELL_SIZE*1.0e-6) );
01613             }
01614         } /*end of loop for second header line */
01615 
01616 /* LINE 4: beginning of fourth header line */
01617 /* feb05 added two tabs prior to "Date" of BIRavg header to accomodate sensitivity parm label & value */
01618         fprintf ( ((Fnum==5)?(BIRavg5):
01619                    ((Fnum==4)?(BIRavg4):
01620                    ((Fnum==3)?(BIRavg3):
01621                     ((Fnum==2)?(BIRavg2):
01622                      (BIRavg1) ) ) ) ), "\nSParm\tSParmValu\t    Date\t" ); 
01623         fprintf ( ((Fnum==5)?(budget_Wacr5):
01624                    ((Fnum==4)?(budget_Wacr4):
01625                    ((Fnum==3)?(budget_Wacr3):
01626                     ((Fnum==2)?(budget_Wacr2):
01627                      (budget_Wacr1) ) ) ) ), "\n    Date\t" ); 
01628         fprintf ( ((Fnum==5)?(budget_Wcm5):
01629                    ((Fnum==4)?(budget_Wcm4):
01630                    ((Fnum==3)?(budget_Wcm3):
01631                     ((Fnum==2)?(budget_Wcm2):
01632                      (budget_Wcm1) ) ) ) ), "\n    Date\t" ); 
01633         fprintf ( ((Fnum==5)?(budget_S5):
01634                    ((Fnum==4)?(budget_S4):
01635                    ((Fnum==3)?(budget_S3):
01636                     ((Fnum==2)?(budget_S2):
01637                      (budget_S1) ) ) ) ), "\n    Date\t" ); 
01638         fprintf ( ((Fnum==5)?(budget_P5):
01639                    ((Fnum==4)?(budget_P4):
01640                    ((Fnum==3)?(budget_P3):
01641                     ((Fnum==2)?(budget_P2):
01642                      (budget_P1) ) ) ) ), "\n    Date\t" ); 
01643         fprintf ( ((Fnum==5)?(budget_Par5):
01644                    ((Fnum==4)?(budget_Par4):
01645                    ((Fnum==3)?(budget_Par3):
01646                     ((Fnum==2)?(budget_Par2):
01647                      (budget_Par1) ) ) ) ), "\n    Date\t" ); 
01648         if (!ESPmodeON) {
01649             fprintf ( ((Fnum==5)?(budget_Plive5):
01650                        ((Fnum==4)?(budget_Plive4):
01651                        ((Fnum==3)?(budget_Plive3):
01652                         ((Fnum==2)?(budget_Plive2):
01653                          (budget_Plive1) ) ) ) ), "\n    Date\t" ); 
01654             fprintf ( ((Fnum==5)?(budget_Pdead5):
01655                        ((Fnum==4)?(budget_Pdead4):
01656                        ((Fnum==3)?(budget_Pdead3):
01657                         ((Fnum==2)?(budget_Pdead2):
01658                          (budget_Pdead1) ) ) ) ), "\n    Date\t" ); 
01659             fprintf ( ((Fnum==5)?(budget_Pwat5):
01660                        ((Fnum==4)?(budget_Pwat4):
01661                        ((Fnum==3)?(budget_Pwat3):
01662                         ((Fnum==2)?(budget_Pwat2):
01663                          (budget_Pwat1) ) ) ) ), "\n    Date\t" ); 
01664         }
01665 
01666 /* LINE 4: remainder of fourth header line, looping thru basins, providing column/variable ID attributes */
01667         for (ibas = ibasHigh; ibas >= ibasLow; ibas--) 
01668         {
01669         
01670         fprintf ( ((Fnum==5)?(BIRavg5):
01671                   ((Fnum==4)?(BIRavg4):
01672                    ((Fnum==3)?(BIRavg3):
01673                     ((Fnum==2)?(BIRavg2):
01674                      (BIRavg1) ) ) ) ), 
01675                       "   SfWat_%d\t   Unsat_%d\t    TPsf_%d\t  TPpore_%d\t  TPsoil_%d\t  NCperi_%d\t   Cperi_%d\t     Mac_%d\t    Elev_%d\t",
01676                       ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas); 
01677         fprintf ( ((Fnum==5)?(budget_Wacr5):
01678                    ((Fnum==4)?(budget_Wacr4):
01679                    ((Fnum==3)?(budget_Wacr3):
01680                     ((Fnum==2)?(budget_Wacr2):
01681                      (budget_Wacr1) ) ) ) ), 
01682                       "  VolOld_%d\t    Rain_%d\t    Evap_%d\t  Transp_%d\t    Rchg_%d\t   StrIn_%d\t  StrOut_%d\t   OvlIn_%d\t  OvlOut_%d\t   SpgIn_%d\t  SpgOut_%d\t    GWin_%d\t   GWout_%d\t VolTarg_%d\t  VolNew_%d\t     Err_%d\t  SumErr_%d\t   InAvg_%d\t  OutAvg_%d\t",
01683                       ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas); 
01684         fprintf ( ((Fnum==5)?(budget_Wcm5):
01685                    ((Fnum==4)?(budget_Wcm4):
01686                    ((Fnum==3)?(budget_Wcm3):
01687                     ((Fnum==2)?(budget_Wcm2):
01688                      (budget_Wcm1) ) ) ) ), 
01689                       "  VolOld_%d\t    Rain_%d\t    Evap_%d\t  Transp_%d\t    Rchg_%d\t   StrIn_%d\t  StrOut_%d\t   OvlIn_%d\t  OvlOut_%d\t   SpgIn_%d\t  SpgOut_%d\t    GWin_%d\t   GWout_%d\t VolTarg_%d\t  VolNew_%d\t     Err_%d\t  SumErr_%d\t   InAvg_%d\t  OutAvg_%d\t",
01690                       ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas); 
01691         fprintf ( ((Fnum==5)?(budget_S5):
01692                    ((Fnum==4)?(budget_S4):
01693                    ((Fnum==3)?(budget_S3):
01694                     ((Fnum==2)?(budget_S2):
01695                      (budget_S1) ) ) ) ), 
01696                       "  MasOld_%d\t   StrIn_%d\t  StrOut_%d\t   OvlIn_%d\t  OvlOut_%d\t   SpgIn_%d\t  SpgOut_%d\t    GWin_%d\t   GWout_%d\t MasTarg_%d\t  MasNew_%d\t     Err_%d\t  SumErr_%d\t   InAvg_%d\t  OutAvg_%d\t",
01697                       ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas); 
01698             if (!ESPmodeON) {
01699                 fprintf ( ((Fnum==5)?(budget_P5):
01700                           ((Fnum==4)?(budget_P4):
01701                            ((Fnum==3)?(budget_P3):
01702                             ((Fnum==2)?(budget_P2):
01703                              (budget_P1) ) ) ) ), 
01704                       "  MasOld_%d\t    Rain_%d\t   StrIn_%d\t  StrOut_%d\t   OvlIn_%d\t  OvlOut_%d\t   SpgIn_%d\t  SpgOut_%d\t    GWin_%d\t   GWout_%d\t MasTarg_%d\t  MasNew_%d\t     Err_%d\t  SumErr_%d\t   InAvg_%d\t  OutAvg_%d\t",
01705                           ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas);
01706                 fprintf ( ((Fnum==5)?(budget_Par5):
01707                            ((Fnum==4)?(budget_Par4):
01708                            ((Fnum==3)?(budget_Par3):
01709                             ((Fnum==2)?(budget_Par2):
01710                              (budget_Par1) ) ) ) ), 
01711                       "  MasOld_%d\t    Rain_%d\t   StrIn_%d\t  StrOut_%d\t   OvlIn_%d\t  OvlOut_%d\t   SpgIn_%d\t  SpgOut_%d\t    GWin_%d\t   GWout_%d\t MasTarg_%d\t  MasNew_%d\t     Err_%d\t  SumErr_%d\t   InAvg_%d\t  OutAvg_%d\t",
01712                           ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas);
01713                 fprintf ( ((Fnum==5)?(budget_Plive5):
01714                            ((Fnum==4)?(budget_Plive4):
01715                             ((Fnum==3)?(budget_Plive3):
01716                              ((Fnum==2)?(budget_Plive2):
01717                               (budget_Plive1) ) ) ) ), 
01718                       "  MacBio_%d\t CPerBio_%d\t NCPerBio_%d\t  MacNPP_%d\t CPerGPP_%d\tNCPerGPP_%d\t MacMort_%d\t CalgMort_%d\t NCalgMort_%d\t MasTarg_%d\t  MasNew_%d\t     Err_%d\t  SumErr_%d\t   InAvg_%d\t  OutAvg_%d\t",
01719                           ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas); 
01720                 fprintf ( ((Fnum==5)?(budget_Pdead5):
01721                            ((Fnum==4)?(budget_Pdead4):
01722                             ((Fnum==3)?(budget_Pdead3):
01723                              ((Fnum==2)?(budget_Pdead2):
01724                               (budget_Pdead1) ) ) ) ), 
01725                       "  MasOld_%d\tMac-soil_%d\tPer-soil_%d\t Decomp_%d\tSettl_to_%d\t Sorb_to_%d\t  Desorb_%d\t MasTarg_%d\t  MasNew_%d\t     Err_%d\t  SumErr_%d\t   InAvg_%d\t  OutAvg_%d\t",
01726                           ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas); 
01727                 fprintf ( ((Fnum==5)?(budget_Pwat5):
01728                            ((Fnum==4)?(budget_Pwat4):
01729                             ((Fnum==3)?(budget_Pwat3):
01730                              ((Fnum==2)?(budget_Pwat2):
01731                               (budget_Pwat1) ) ) ) ), 
01732                       "  MasOld_%d\t  P_rain_%d\tSettl_fr_%d\t SfMiner_%d\tSedMiner_%d\t  AlgUpt_%d\t  MacUpt_%d\t  DeSorb_%d\t Sorb_to_%d\t   StrIn_%d\t  StrOut_%d\t MasTarg_%d\t  MasNew_%d\t     Err_%d\t  SumErr_%d\t   InAvg_%d\t  OutAvg_%d\t",
01733                           ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas); 
01734             }
01735             else {
01736                 fprintf ( ((Fnum==5)?(budget_P5):
01737                            ((Fnum==4)?(budget_P4):
01738                            ((Fnum==3)?(budget_P3):
01739                             ((Fnum==2)?(budget_P2):
01740                              (budget_P1) ) ) ) ), 
01741                       "  MasOld_%d\t    Rain_%d\t   Settl_%d\t   StrIn_%d\t  StrOut_%d\t   OvlIn_%d\t  OvlOut_%d\t   SpgIn_%d\t  SpgOut_%d\t    GWin_%d\t   GWout_%d\t MasTarg_%d\t  MasNew_%d\t     Err_%d\t  SumErr_%d\t   InAvg_%d\t  OutAvg_%d\t",
01742                           ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas);
01743                 fprintf ( ((Fnum==5)?(budget_Par5):
01744                            ((Fnum==4)?(budget_Par4):
01745                            ((Fnum==3)?(budget_Par3):
01746                             ((Fnum==2)?(budget_Par2):
01747                              (budget_Par1) ) ) ) ), 
01748                       "  MasOld_%d\t    Rain_%d\t   Settl_%d\t   StrIn_%d\t  StrOut_%d\t   OvlIn_%d\t  OvlOut_%d\t   SpgIn_%d\t  SpgOut_%d\t    GWin_%d\t   GWout_%d\t MasTarg_%d\t  MasNew_%d\t     Err_%d\t  SumErr_%d\t   InAvg_%d\t  OutAvg_%d\t",
01749                           ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas);
01750             }
01751         } /* end of loop for third header line */
01752 
01753     } /*end of printing all files' headers */
01754 
01755         
01756 } /* end of BIRoutfiles */

void CellAvg void   ) 
 

Generate sums, means (avgs), on cell-by-cell basis (not by Basin/IRegion here).

Definition at line 1763 of file BudgStats.c.

References ALG_LIGHT_CF, ALG_TOT, avg_Intvl, C_ALG, C_ALG_MORT, C_ALG_NPP, C_ALG_NUT_CF, C_ALG_PCrep, C_ALG_RESP, C_Peri_mortAvg, C_Peri_nppAvg, C_Peri_PCAvg, C_PeriAvg, C_PeriNutCFAvg, C_PeriRespAvg, DAYJUL, ETAvg, EvapAvg, Floc_fr_phBio, Floc_fr_phBioAvg, FMOD(), HYD_ET, HYD_MANNINGS_N, HYD_TRANSP, HydPerAnn, HydTotHd, LAI_eff, LAI_effAvg, MAC_NOPH_BIOMAS, mac_nph_PC_rep, mac_nph_PCAvg, Mac_nphBioAvg, Mac_nphMortAvg, Mac_nppAvg, MAC_NUT_CF, MAC_PH_BIOMAS, mac_ph_PC_rep, mac_ph_PCAvg, Mac_phBioAvg, Mac_phMortAvg, MAC_TOT_BIOM, Mac_totBioAvg, MAC_WATER_CF, MacNutCfAvg, MacWatCfAvg, Manning_nAvg, NC_ALG, NC_ALG_MORT, NC_ALG_NPP, NC_ALG_NUT_CF, NC_ALG_PCrep, NC_ALG_RESP, NC_Peri_mortAvg, NC_Peri_nppAvg, NC_Peri_PCAvg, NC_PeriAvg, NC_PeriNutCFAvg, NC_PeriRespAvg, NPHBIO_MORT, ON_MAP, PeriAvg, PeriLiteCFAvg, PHBIO_MORT, PHBIO_NPP, RainAvg, SAL_SED_WT, SAL_SF_WT, SaltSedAvg, SaltSfAvg, SED_ELEV, SedElevAvg, SF_WT_EVAP, SF_WT_FROM_RAIN, SfWatAvg, SURFACE_WAT, T, TotHeadAvg, TP_SED_MINER, TP_SEDWT_CONCACTMG, TP_SEDWT_UPTAKE, TP_settl, TP_settlAvg, TP_SFWT_CONC_MG, TP_SFWT_MINER, TP_SFWT_UPTAK, TP_SORBCONC_rep, TPSedMinAvg, TPSedUptAvg, TPSedWatAvg, TPSfMinAvg, TPSfUptAvg, TPSfWatAvg, TPSorbAvg, TPtoSOIL_rep, TPtoSOILAvg, TPtoVOL_rep, TPtoVOLAvg, TranspAvg, UNSAT_DEPTH, UNSAT_MOIST_PRP, UnsatMoistAvg, and UnsatZavg.

Referenced by stats().

01764 {
01765     int ix, iy, cellLoc;
01766     float avgStep = avg_Intvl / DT;
01767     
01768 /* sums and average (& hydroperiod) calcs, not budget related */
01769     for(ix=1; ix<=s0; ix++) {
01770         for(iy=1; iy<=s1; iy++) {
01771 
01772             if(ON_MAP[cellLoc= T(ix,iy)])  {
01773                     /* annual hydroperiod on Oct 1 = JulDay ~273 (TODO: use true date fctn) */
01774                 if ( FMOD(DAYJUL, 273.0) ) {
01775                     if (SURFACE_WAT[cellLoc] > 0.01 )  HydPerAnn[cellLoc] +=  DT; 
01776                 }
01777                 else {
01778                     HydPerAnn[cellLoc] += DT; /* TODO: (?) remove this line */
01779                 }
01780                     
01781                     SfWatAvg[cellLoc] += SURFACE_WAT[cellLoc]; 
01782                     TotHeadAvg[cellLoc] += HydTotHd[cellLoc]; 
01783                     UnsatZavg[cellLoc] += UNSAT_DEPTH[cellLoc]; 
01784                     UnsatMoistAvg[cellLoc] += UNSAT_MOIST_PRP[cellLoc]; 
01785                     RainAvg[cellLoc]  += SF_WT_FROM_RAIN[cellLoc];
01786                     EvapAvg[cellLoc]  += SF_WT_EVAP[cellLoc];
01787                     TranspAvg[cellLoc]  += HYD_TRANSP[cellLoc];
01788                     ETAvg[cellLoc]  += HYD_ET[cellLoc];
01789 
01790                     TPSfWatAvg[cellLoc] += TP_SFWT_CONC_MG[cellLoc]; 
01791                     TPSedWatAvg[cellLoc] += TP_SEDWT_CONCACTMG[cellLoc]; 
01792                     TPSfUptAvg[cellLoc] += TP_SFWT_UPTAK[cellLoc]; 
01793                     TPSfMinAvg[cellLoc] += TP_SFWT_MINER[cellLoc]; 
01794                     TP_settlAvg[cellLoc] += TP_settl[cellLoc]; 
01795                     TPSedUptAvg[cellLoc] += TP_SEDWT_UPTAKE[cellLoc]; 
01796                     TPSedMinAvg[cellLoc] += TP_SED_MINER[cellLoc];
01797                     TPSorbAvg[cellLoc] += TP_SORBCONC_rep[cellLoc];
01798                     TPtoVOLAvg[cellLoc] +=  TPtoVOL_rep[cellLoc];
01799                     TPtoSOILAvg[cellLoc] +=  TPtoSOIL_rep[cellLoc];
01800                     SaltSfAvg[cellLoc] += SAL_SF_WT[cellLoc];
01801                     SaltSedAvg[cellLoc] += SAL_SED_WT[cellLoc];
01802 
01803                     Floc_fr_phBioAvg[cellLoc]  += Floc_fr_phBio[cellLoc];
01804                     
01805                     NC_PeriAvg[cellLoc] += NC_ALG[cellLoc];
01806                     NC_Peri_nppAvg[cellLoc]  += NC_ALG_NPP[cellLoc];
01807                     NC_Peri_mortAvg[cellLoc]  += NC_ALG_MORT[cellLoc];
01808                     NC_PeriRespAvg[cellLoc]  += NC_ALG_RESP[cellLoc];
01809                     NC_PeriNutCFAvg[cellLoc]  += NC_ALG_NUT_CF[cellLoc];
01810                     NC_Peri_PCAvg[cellLoc]  += NC_ALG_PCrep[cellLoc];
01811                     C_PeriAvg[cellLoc] += C_ALG[cellLoc]; 
01812                     C_Peri_nppAvg[cellLoc]  += C_ALG_NPP[cellLoc];
01813                     C_Peri_mortAvg[cellLoc]  += C_ALG_MORT[cellLoc];
01814                     C_PeriRespAvg[cellLoc]  += C_ALG_RESP[cellLoc];
01815                     C_PeriNutCFAvg[cellLoc]  += C_ALG_NUT_CF[cellLoc];
01816                     C_Peri_PCAvg[cellLoc]  += C_ALG_PCrep[cellLoc];
01817                     PeriLiteCFAvg[cellLoc]  += ALG_LIGHT_CF[cellLoc];
01818                     PeriAvg[cellLoc]  += ALG_TOT[cellLoc];
01819 
01820                     Mac_nphBioAvg[cellLoc]  += MAC_NOPH_BIOMAS[cellLoc];
01821                     Mac_phBioAvg[cellLoc]  += MAC_PH_BIOMAS[cellLoc];
01822                     Mac_nppAvg[cellLoc]  += PHBIO_NPP[cellLoc];
01823                     Mac_nphMortAvg[cellLoc]  += NPHBIO_MORT[cellLoc];
01824                     Mac_phMortAvg[cellLoc]  += PHBIO_MORT[cellLoc];
01825                     LAI_effAvg[cellLoc]  += LAI_eff[cellLoc];
01826                     Manning_nAvg[cellLoc]  += HYD_MANNINGS_N[cellLoc];
01827                     MacNutCfAvg[cellLoc]  += MAC_NUT_CF[cellLoc];
01828                     MacWatCfAvg[cellLoc]  += MAC_WATER_CF[cellLoc];
01829                     mac_nph_PCAvg[cellLoc]  += mac_nph_PC_rep[cellLoc];
01830                     mac_ph_PCAvg[cellLoc]  += mac_ph_PC_rep[cellLoc];
01831                     Mac_totBioAvg[cellLoc]  += MAC_TOT_BIOM[cellLoc];
01832 
01833                     SedElevAvg[cellLoc]  += SED_ELEV[cellLoc];
01834               
01835                 if (avgPrint ) /* get the mean value */
01836                         { 
01837                             SfWatAvg[cellLoc] /= avgStep;
01838                             TotHeadAvg[cellLoc] /= avgStep;
01839                             UnsatZavg[cellLoc] /= avgStep;
01840                             UnsatMoistAvg[cellLoc] /= avgStep;
01841                             RainAvg[cellLoc]  /= avgStep ;
01842                             EvapAvg[cellLoc]  /= avgStep ;
01843                             TranspAvg[cellLoc] /= avgStep ;
01844                             ETAvg[cellLoc]  /= avgStep;
01845 
01846                             TPSfWatAvg[cellLoc] /= avgStep;
01847                             TPSedWatAvg[cellLoc] /= avgStep;
01848                             TPSfUptAvg[cellLoc] /= avgStep;
01849                             TPSfMinAvg[cellLoc] /= avgStep;
01850                             TP_settlAvg[cellLoc] /= avgStep;
01851                             TPSedUptAvg[cellLoc] /= avgStep;
01852                             TPSedMinAvg[cellLoc] /= avgStep;
01853                             TPSorbAvg[cellLoc] /= avgStep; 
01854                             TPtoVOLAvg[cellLoc] /= avgStep;  
01855                             TPtoSOILAvg[cellLoc] /= avgStep; 
01856                             SaltSfAvg[cellLoc] /= avgStep;
01857                             SaltSedAvg[cellLoc] /= avgStep;
01858 
01859                             Floc_fr_phBioAvg[cellLoc] /= avgStep ;
01860 
01861                             NC_PeriAvg[cellLoc] /= avgStep;
01862                             NC_Peri_nppAvg[cellLoc] /= avgStep;
01863                             NC_Peri_mortAvg[cellLoc] /= avgStep;
01864                             NC_PeriRespAvg[cellLoc] /= avgStep;
01865                             NC_PeriNutCFAvg[cellLoc] /= avgStep;
01866                             NC_Peri_PCAvg[cellLoc] /= avgStep;
01867                             C_PeriAvg[cellLoc] /= avgStep;
01868                             C_Peri_nppAvg[cellLoc] /= avgStep;
01869                             C_Peri_mortAvg[cellLoc] /= avgStep;
01870                             C_PeriRespAvg[cellLoc] /= avgStep;
01871                             C_PeriNutCFAvg[cellLoc] /= avgStep;
01872                             C_Peri_PCAvg[cellLoc] /= avgStep;
01873                             PeriLiteCFAvg[cellLoc] /= avgStep;
01874                             PeriAvg[cellLoc] /= avgStep;
01875                         
01876                             Mac_nphBioAvg[cellLoc]  /= avgStep ;
01877                             Mac_phBioAvg[cellLoc]  /= avgStep ;
01878                             Mac_nppAvg[cellLoc]  /= avgStep ;
01879                             Mac_nphMortAvg[cellLoc]  /= avgStep ;
01880                             Mac_phMortAvg[cellLoc]  /= avgStep ;
01881                             LAI_effAvg[cellLoc]  /= avgStep ;
01882                             Manning_nAvg[cellLoc]  /= avgStep ;
01883                             MacNutCfAvg[cellLoc]  /= avgStep ;
01884                             MacWatCfAvg[cellLoc]  /= avgStep ;
01885                             mac_nph_PCAvg[cellLoc]  /= avgStep ;
01886                             mac_ph_PCAvg[cellLoc]  /= avgStep ;
01887                             Mac_totBioAvg[cellLoc]  /= avgStep;
01888 
01889                             SedElevAvg[cellLoc]  /= avgStep ;
01890                         }
01891             }
01892         }
01893     } /* end spatial loop for averages */
01894 } /*end of CellAvg() */

Here is the call graph for this function:

void Cell_reset_hydper void   ) 
 

Zero the array holding hydroperiod data in cells (after printing).

Definition at line 1902 of file BudgStats.c.

References HydPerAnn, ON_MAP, and T.

01903 {
01904     int ix, iy, cellLoc; 
01905 
01906         for(ix=1; ix<=s0; ix++) 
01907             for(iy=1; iy<=s1; iy++) 
01908                 if(ON_MAP[cellLoc= T(ix,iy)]) {
01909                     HydPerAnn[cellLoc] = 0.0;
01910                 }
01911 } 

void Cell_reset_avg void   ) 
 

Zero the arrays holding selected variable averages in cells (after printing)/.

Definition at line 1917 of file BudgStats.c.

References C_Peri_mortAvg, C_Peri_nppAvg, C_Peri_PCAvg, C_PeriAvg, C_PeriNutCFAvg, C_PeriRespAvg, ETAvg, EvapAvg, Floc_fr_phBioAvg, LAI_effAvg, mac_nph_PCAvg, Mac_nphBioAvg, Mac_nphMortAvg, Mac_nppAvg, mac_ph_PCAvg, Mac_phBioAvg, Mac_phMortAvg, Mac_totBioAvg, MacNutCfAvg, MacWatCfAvg, Manning_nAvg, NC_Peri_mortAvg, NC_Peri_nppAvg, NC_PeriAvg, NC_PeriNutCFAvg, NC_PeriRespAvg, ON_MAP, PeriAvg, PeriLiteCFAvg, RainAvg, SaltSedAvg, SaltSfAvg, SedElevAvg, SfWatAvg, T, TotHeadAvg, TP_settlAvg, TPSedMinAvg, TPSedUptAvg, TPSedWatAvg, TPSfMinAvg, TPSfUptAvg, TPSfWatAvg, TPSorbAvg, TPtoSOILAvg, TPtoVOLAvg, TranspAvg, UnsatMoistAvg, and UnsatZavg.

01918 {
01919     int ix, iy, cellLoc; 
01920 
01921     for(ix=1; ix<=s0; ix++) 
01922         for(iy=1; iy<=s1; iy++) 
01923             if(ON_MAP[cellLoc= T(ix,iy)]) {
01924                 TotHeadAvg[cellLoc] = 0.0;
01925                 SfWatAvg[cellLoc] = 0.0;
01926                 UnsatZavg[cellLoc] = 0.0;
01927                 UnsatMoistAvg[cellLoc] = 0.0;
01928                 RainAvg[cellLoc] = 0.0;
01929                 EvapAvg[cellLoc] = 0.0;
01930                 TranspAvg[cellLoc] = 0.0;
01931                 ETAvg[cellLoc] = 0.0;
01932 
01933                 TPSfWatAvg[cellLoc] = 0.0;
01934                 TPSfUptAvg[cellLoc] = 0.0;
01935                 TPSfMinAvg[cellLoc] = 0.0;
01936                 TP_settlAvg[cellLoc] = 0.0;
01937                 TPSedWatAvg[cellLoc] = 0.0;
01938                 TPSedUptAvg[cellLoc] = 0.0;
01939                 TPSedMinAvg[cellLoc] = 0.0;
01940                 TPSorbAvg[cellLoc] = 0.0;
01941                 TPtoVOLAvg[cellLoc] = 0.0;
01942                 TPtoSOILAvg[cellLoc] = 0.0;
01943 
01944                 SaltSfAvg[cellLoc] = 0.0;
01945                 SaltSedAvg[cellLoc] = 0.0;
01946 
01947                 Floc_fr_phBioAvg[cellLoc]  = 0.0;
01948 
01949                 NC_PeriAvg[cellLoc] = 0.0;
01950                 NC_Peri_nppAvg[cellLoc] = 0.0;
01951                 NC_Peri_mortAvg[cellLoc] = 0.0;
01952                 NC_PeriRespAvg[cellLoc] = 0.0;
01953                 NC_PeriNutCFAvg[cellLoc] = 0.0;
01954                 C_Peri_PCAvg[cellLoc] = 0.0;
01955                 C_PeriAvg[cellLoc] = 0.0;
01956                 C_Peri_nppAvg[cellLoc] = 0.0;
01957                 C_Peri_mortAvg[cellLoc] = 0.0;
01958                 C_PeriRespAvg[cellLoc] = 0.0;
01959                 C_PeriNutCFAvg[cellLoc] = 0.0;
01960                 C_Peri_PCAvg[cellLoc] = 0.0;
01961                 PeriAvg[cellLoc] = 0.0;
01962                 PeriLiteCFAvg[cellLoc] = 0.0;
01963 
01964                 Mac_nphBioAvg[cellLoc]  = 0.0;
01965                 Mac_phBioAvg[cellLoc]  = 0.0;
01966                 Mac_totBioAvg[cellLoc]  = 0.0;
01967                 Mac_nppAvg[cellLoc]  = 0.0;
01968                 Mac_nphMortAvg[cellLoc]  = 0.0;
01969                 Mac_phMortAvg[cellLoc]  = 0.0;
01970                 LAI_effAvg[cellLoc]  = 0.0;
01971                 Manning_nAvg[cellLoc]  = 0.0;
01972                 MacNutCfAvg[cellLoc]  = 0.0;
01973                 MacWatCfAvg[cellLoc]  = 0.0;
01974                 mac_nph_PCAvg[cellLoc]  = 0.0;
01975                 mac_ph_PCAvg[cellLoc]  = 0.0;
01976 
01977                 SedElevAvg[cellLoc]  = 0.0;
01978             }   
01979 } /* end of Cell_reset_avg() */

void alloc_mem_stats void   ) 
 

Allocate memory for the BIR-based and cell-based stats variables.

Definition at line 1986 of file BudgStats.c.

References basn, C_Peri_mortAvg, C_Peri_nppAvg, C_Peri_PCAvg, C_PeriAvg, C_PeriNutCFAvg, C_PeriRespAvg, Calg_GPP, Calg_mort, Cperi_avg, dop_decomp, dop_desorb, dop_macIn, dop_sorbIn, Elev_avg, ETAvg, EVAP, EvapAvg, floc_decomp, Floc_fr_phBioAvg, floc_In, HydPerAnn, init_pvar(), LAI_effAvg, Mac_avg, mac_mort, mac_nph_PCAvg, Mac_nphBioAvg, Mac_nphMortAvg, mac_NPP, Mac_nppAvg, mac_ph_PCAvg, Mac_phBioAvg, Mac_phMortAvg, Mac_totBioAvg, MacNutCfAvg, MacWatCfAvg, Manning_nAvg, msgStr, nalloc(), NC_Peri_mortAvg, NC_Peri_nppAvg, NC_Peri_PCAvg, NC_PeriAvg, NC_PeriNutCFAvg, NC_PeriRespAvg, NCalg_GPP, NCalg_mort, NCperi_avg, numBasn, numCells, ON_MAP, P, P_Calg, P_CELL, P_DEAD, P_DEAD_CELL, P_DEAD_ERR, P_DEAD_ERR_CUM, P_DEAD_IN, P_DEAD_IN_AVG, P_DEAD_IN_SUM, P_DEAD_OLD, P_DEAD_OUT, P_DEAD_OUT_AVG, P_DEAD_OUT_SUM, P_ERR, P_ERR_CUM, P_IN, P_IN_AVG, P_IN_GW, P_IN_OVL, P_IN_SPG, P_IN_STR, P_IN_SUM, P_LIVE, P_LIVE_CELL, P_LIVE_ERR, P_LIVE_ERR_CUM, P_LIVE_IN, P_LIVE_IN_AVG, P_LIVE_IN_SUM, P_LIVE_OLD, P_LIVE_OUT, P_LIVE_OUT_AVG, P_LIVE_OUT_SUM, P_MAC, P_NCalg, P_OLD, P_OUT, P_OUT_AVG, P_OUT_GW, P_OUT_OVL, P_OUT_SPG, P_OUT_STR, P_OUT_SUM, P_RAIN, P_settl, P_WAT, P_WAT_CELL, P_WAT_ERR, P_WAT_ERR_CUM, P_WAT_IN, P_WAT_IN_AVG, P_WAT_IN_SUM, P_WAT_OLD, P_WAT_OUT, P_WAT_OUT_AVG, P_WAT_OUT_SUM, PeriAvg, PeriLiteCFAvg, RAIN, RainAvg, RCHG, s0, s1, S_ERR_CUM, S_IN, S_IN_AVG, S_IN_GW, S_IN_OVL, S_IN_SPG, S_IN_STR, S_IN_SUM, S_OUT, S_OUT_AVG, S_OUT_GW, S_OUT_OVL, S_OUT_SPG, S_OUT_STR, S_OUT_SUM, SaltSedAvg, SaltSfAvg, SedElevAvg, Sfwat_avg, SfWatAvg, SUMGW, SUMSF, SUMUW, T, TOT_P_CAN, TOT_S, TOT_S_CAN, TOT_S_CELL, TOT_S_ERR, TOT_S_OLD, TOT_VOL, TOT_VOL_AVG_ERR, TOT_VOL_CAN, TOT_VOL_CUM_ERR, TOT_VOL_ERR, TOT_VOL_OLD, TotHeadAvg, TP_settlAvg, TPpore_avg, TPSedMinAvg, TPSedUptAvg, TPSedWatAvg, TPsf_avg, TPSfMinAvg, TPSfUptAvg, TPSfWatAvg, TPsoil_avg, TPSorbAvg, TPtoSOILAvg, TPtoVOLAvg, TRANSP, TranspAvg, Unsat_avg, UnsatMoistAvg, UnsatZavg, usrErr0(), VOL_ERR_PER_INFL, VOL_IN, VOL_IN_AVG, VOL_IN_GW, VOL_IN_OVL, VOL_IN_SPG, VOL_IN_STR, VOL_IN_SUM, VOL_OUT, VOL_OUT_AVG, VOL_OUT_GW, VOL_OUT_OVL, VOL_OUT_SPG, VOL_OUT_STR, VOL_OUT_SUM, wat_sedMiner, wat_sedUpt, wat_sfMiner, and wat_sfUpt.

01987 {
01988     int ix,iy,cellLoc, numBasnMax=0;
01989 
01990 
01991     for(ix=0; ix<=s0+1; ix++) 
01992         for(iy=0; iy<=s1+1; iy++)
01993             if (ON_MAP[cellLoc= T(ix,iy)]) { 
01994                 if (basn[cellLoc] > numBasnMax) numBasnMax = basn[cellLoc]; 
01995             }
01996     numBasn = numBasnMax; /* total number of basins in domain */
01997     
01998     sprintf (msgStr," %d Basins/Indicator-Regions...",numBasn); usrErr0(msgStr);
01999     
02000 /* basin budget arrays (number of actual basins plus basin 0, which is whole system) */
02001     numCells = (int *) nalloc (sizeof(int)*(numBasn+1),"numCells"); /* number of cells in a basin */
02002 
02003 /* Indicator region averages (non-budget) */
02004         Sfwat_avg = (double *) nalloc(sizeof(double)*(numBasn+1),"Sfwat_avg");
02005         init_pvar(Sfwat_avg,NULL,'b',0.0);
02006         Unsat_avg = (double *) nalloc(sizeof(double)*(numBasn+1),"Unsat_avg");
02007         init_pvar(Unsat_avg,NULL,'b',0.0);
02008         TPsf_avg = (double *) nalloc(sizeof(double)*(numBasn+1),"TPsf_avg");
02009         init_pvar(TPsf_avg,NULL,'b',0.0);
02010         TPpore_avg = (double *) nalloc(sizeof(double)*(numBasn+1),"TPpore_avg");
02011         init_pvar(TPpore_avg,NULL,'b',0.0);
02012         TPsoil_avg = (double *) nalloc(sizeof(double)*(numBasn+1),"TPsoil_avg");
02013         init_pvar(TPsoil_avg,NULL,'b',0.0);
02014         NCperi_avg = (double *) nalloc(sizeof(double)*(numBasn+1),"NCperi_avg");
02015         init_pvar(NCperi_avg,NULL,'b',0.0);
02016         Cperi_avg = (double *) nalloc(sizeof(double)*(numBasn+1),"Cperi_avg");
02017         init_pvar(Cperi_avg,NULL,'b',0.0);
02018         Mac_avg = (double *) nalloc(sizeof(double)*(numBasn+1),"Mac_avg");
02019         init_pvar(Mac_avg,NULL,'b',0.0);
02020         Elev_avg = (double *) nalloc(sizeof(double)*(numBasn+1),"Elev_avg");
02021         init_pvar(Elev_avg,NULL,'b',0.0);
02022 /* hydro mass bal vars */
02023         SUMSF = (double *) nalloc(sizeof(double)*(numBasn+1),"SUMSF");
02024         init_pvar(SUMSF,NULL,'b',0.0);
02025         SUMGW = (double *) nalloc(sizeof(double)*(numBasn+1),"SUMGW");
02026         init_pvar(SUMGW,NULL,'b',0.0);
02027         SUMUW = (double *) nalloc(sizeof(double)*(numBasn+1),"SUMUW");
02028         init_pvar(SUMUW,NULL,'b',0.0);
02029         RAIN = (double *) nalloc(sizeof(double)*(numBasn+1),"RAIN");
02030         init_pvar(RAIN,NULL,'b',0.0);
02031         EVAP = (double *) nalloc(sizeof(double)*(numBasn+1),"EVAP");
02032         init_pvar(EVAP,NULL,'b',0.0);
02033         TRANSP = (double *) nalloc(sizeof(double)*(numBasn+1),"TRANSP");
02034         init_pvar(TRANSP,NULL,'b',0.0);
02035         RCHG = (double *) nalloc(sizeof(double)*(numBasn+1),"RCHG");
02036         init_pvar(RCHG,NULL,'b',0.0);
02037 
02038         TOT_VOL = (double *) nalloc(sizeof(double)*(numBasn+1),"TOT_VOL");
02039         init_pvar(TOT_VOL,NULL,'b',0.0);
02040         TOT_VOL_OLD = (double *) nalloc(sizeof(double)*(numBasn+1),"TOT_VOL_OLD");
02041         init_pvar(TOT_VOL_OLD,NULL,'b',0.0);
02042         VOL_IN = (double *) nalloc(sizeof(double)*(numBasn+1),"VOL_IN");
02043         init_pvar(VOL_IN,NULL,'b',0.0);
02044         VOL_OUT = (double *) nalloc(sizeof(double)*(numBasn+1),"VOL_OUT");
02045         init_pvar(VOL_OUT,NULL,'b',0.0);
02046         TOT_VOL_ERR = (double *) nalloc(sizeof(double)*(numBasn+1),"TOT_VOL_ERR");
02047         init_pvar(TOT_VOL_ERR,NULL,'b',0.0);
02048         TOT_VOL_CUM_ERR = (double *) nalloc(sizeof(double)*(numBasn+1),"TOT_VOL_CUM_ERR");
02049         init_pvar(TOT_VOL_CUM_ERR,NULL,'b',0.0);
02050         TOT_VOL_AVG_ERR = (double *) nalloc(sizeof(double)*(numBasn+1),"TOT_VOL_AVG_ERR");
02051         init_pvar(TOT_VOL_AVG_ERR,NULL,'b',0.0);
02052         VOL_ERR_PER_INFL = (double *) nalloc(sizeof(double)*(numBasn+1),"VOL_ERR_PER_INFL");
02053         init_pvar(VOL_ERR_PER_INFL,NULL,'b',0.0);
02054 
02055         VOL_IN_SUM = (double *) nalloc(sizeof(double)*(numBasn+1),"VOL_IN_SUM");
02056         init_pvar(VOL_IN_SUM,NULL,'b',0.0);
02057         VOL_OUT_SUM = (double *) nalloc(sizeof(double)*(numBasn+1),"VOL_OUT_SUM");
02058         init_pvar(VOL_OUT_SUM,NULL,'b',0.0);
02059         VOL_IN_AVG = (double *) nalloc(sizeof(double)*(numBasn+1),"VOL_IN_AVG");
02060         init_pvar(VOL_IN_AVG,NULL,'b',0.0);
02061         VOL_OUT_AVG = (double *) nalloc(sizeof(double)*(numBasn+1),"VOL_OUT_AVG");
02062         init_pvar(VOL_OUT_AVG,NULL,'b',0.0);
02063 
02064         TOT_VOL_CAN = (double *) nalloc(sizeof(double)*(numBasn+1),"TOT_VOL_CAN");
02065         init_pvar(TOT_VOL_CAN,NULL,'b',0.0);
02066 
02067         VOL_IN_STR = (double *) nalloc(sizeof(double)*(numBasn+1),"VOL_IN_STR");
02068         init_pvar(VOL_IN_STR,NULL,'b',0.0);
02069         VOL_IN_OVL = (double *) nalloc(sizeof(double)*(numBasn+1),"VOL_IN_OVL");
02070         init_pvar(VOL_IN_OVL,NULL,'b',0.0);
02071         VOL_IN_SPG = (double *) nalloc(sizeof(double)*(numBasn+1),"VOL_IN_SPG");
02072         init_pvar(VOL_IN_SPG,NULL,'b',0.0);
02073         VOL_IN_GW = (double *) nalloc(sizeof(double)*(numBasn+1),"VOL_IN_GW");
02074         init_pvar(VOL_IN_GW,NULL,'b',0.0);
02075 
02076         VOL_OUT_STR = (double *) nalloc(sizeof(double)*(numBasn+1),"VOL_OUT_STR");
02077         init_pvar(VOL_OUT_STR,NULL,'b',0.0);
02078         VOL_OUT_OVL = (double *) nalloc(sizeof(double)*(numBasn+1),"VOL_OUT_OVL");
02079         init_pvar(VOL_OUT_OVL,NULL,'b',0.0);
02080         VOL_OUT_SPG = (double *) nalloc(sizeof(double)*(numBasn+1),"VOL_OUT_SPG");
02081         init_pvar(VOL_OUT_SPG,NULL,'b',0.0);
02082         VOL_OUT_GW = (double *) nalloc(sizeof(double)*(numBasn+1),"VOL_OUT_GW");
02083         init_pvar(VOL_OUT_GW,NULL,'b',0.0);
02084 
02085 /* phosph mass bal vars for all storage fractions */
02086         P_CELL = (double *) nalloc(sizeof(double)*(numBasn+1),"P_CELL");
02087         init_pvar(P_CELL,NULL,'b',0.0);
02088         P_RAIN = (double *) nalloc(sizeof(double)*(numBasn+1),"P_RAIN");
02089         init_pvar(P_RAIN,NULL,'b',0.0);
02090 
02091         P = (double *) nalloc(sizeof(double)*(numBasn+1),"P");
02092         init_pvar(P,NULL,'b',0.0);
02093         P_OLD = (double *) nalloc(sizeof(double)*(numBasn+1),"P_OLD");
02094         init_pvar(P_OLD,NULL,'b',0.0);
02095         P_IN = (double *) nalloc(sizeof(double)*(numBasn+1),"P_IN");
02096         init_pvar(P_IN,NULL,'b',0.0);
02097         P_OUT = (double *) nalloc(sizeof(double)*(numBasn+1),"P_OUT");
02098         init_pvar(P_OUT,NULL,'b',0.0);
02099         P_ERR = (double *) nalloc(sizeof(double)*(numBasn+1),"P_ERR");
02100         init_pvar(P_ERR,NULL,'b',0.0);
02101         P_ERR_CUM = (double *) nalloc(sizeof(double)*(numBasn+1),"P_ERR_CUM");
02102         init_pvar(P_ERR_CUM,NULL,'b',0.0);
02103 
02104         P_IN_SUM = (double *) nalloc(sizeof(double)*(numBasn+1),"P_IN_SUM");
02105         init_pvar(P_IN_SUM,NULL,'b',0.0);
02106         P_OUT_SUM = (double *) nalloc(sizeof(double)*(numBasn+1),"P_OUT_SUM");
02107         init_pvar(P_OUT_SUM,NULL,'b',0.0);
02108         P_IN_AVG = (double *) nalloc(sizeof(double)*(numBasn+1),"P_IN_AVG");
02109         init_pvar(P_IN_AVG,NULL,'b',0.0);
02110         P_OUT_AVG = (double *) nalloc(sizeof(double)*(numBasn+1),"P_OUT_AVG");
02111         init_pvar(P_OUT_AVG,NULL,'b',0.0);
02112 
02113         TOT_P_CAN = (double *) nalloc(sizeof(double)*(numBasn+1),"TOT_P_CAN");
02114         init_pvar(TOT_P_CAN,NULL,'b',0.0);
02115 
02116         P_IN_STR = (double *) nalloc(sizeof(double)*(numBasn+1),"P_IN_STR");
02117         init_pvar(P_IN_STR,NULL,'b',0.0);
02118         P_IN_OVL = (double *) nalloc(sizeof(double)*(numBasn+1),"P_IN_OVL");
02119         init_pvar(P_IN_OVL,NULL,'b',0.0);
02120         P_IN_SPG = (double *) nalloc(sizeof(double)*(numBasn+1),"P_IN_SPG");
02121         init_pvar(P_IN_SPG,NULL,'b',0.0);
02122         P_IN_GW = (double *) nalloc(sizeof(double)*(numBasn+1),"P_IN_GW");
02123         init_pvar(P_IN_GW,NULL,'b',0.0);
02124 
02125         P_OUT_STR = (double *) nalloc(sizeof(double)*(numBasn+1),"P_OUT_STR");
02126         init_pvar(P_OUT_STR,NULL,'b',0.0);
02127         P_OUT_OVL = (double *) nalloc(sizeof(double)*(numBasn+1),"P_OUT_OVL");
02128         init_pvar(P_OUT_OVL,NULL,'b',0.0);
02129         P_OUT_SPG = (double *) nalloc(sizeof(double)*(numBasn+1),"P_OUT_SPG");
02130         init_pvar(P_OUT_SPG,NULL,'b',0.0);
02131         P_OUT_GW = (double *) nalloc(sizeof(double)*(numBasn+1),"P_OUT_GW");
02132         init_pvar(P_OUT_GW,NULL,'b',0.0);
02133 
02134 /* phosph mass bal vars for live fraction */
02135         P_LIVE_CELL = (double *) nalloc(sizeof(double)*(numBasn+1),"P_LIVE_CELL");
02136         init_pvar(P_LIVE_CELL,NULL,'b',0.0);
02137         P_MAC = (double *) nalloc(sizeof(double)*(numBasn+1),"P_MAC");
02138         init_pvar(P_MAC,NULL,'b',0.0);
02139         P_Calg = (double *) nalloc(sizeof(double)*(numBasn+1),"P_Calg");
02140         init_pvar(P_Calg,NULL,'b',0.0);
02141         P_NCalg = (double *) nalloc(sizeof(double)*(numBasn+1),"P_NCalg");
02142         init_pvar(P_NCalg,NULL,'b',0.0);
02143         Calg_GPP = (double *) nalloc(sizeof(double)*(numBasn+1),"Calg_GPP");
02144         init_pvar(Calg_GPP,NULL,'b',0.0);
02145         NCalg_GPP = (double *) nalloc(sizeof(double)*(numBasn+1),"NCalg_GPP");
02146         init_pvar(NCalg_GPP,NULL,'b',0.0);
02147         Calg_mort = (double *) nalloc(sizeof(double)*(numBasn+1),"Calg_mort");
02148         init_pvar(Calg_mort,NULL,'b',0.0);
02149         NCalg_mort = (double *) nalloc(sizeof(double)*(numBasn+1),"NCalg_mort");
02150         init_pvar(NCalg_mort,NULL,'b',0.0);
02151 
02152         mac_NPP = (double *) nalloc(sizeof(double)*(numBasn+1),"mac_NPP");
02153         init_pvar(mac_NPP,NULL,'b',0.0);
02154         mac_mort = (double *) nalloc(sizeof(double)*(numBasn+1),"mac_mort");
02155         init_pvar(mac_mort,NULL,'b',0.0);
02156 
02157         P_LIVE = (double *) nalloc(sizeof(double)*(numBasn+1),"P_LIVE");
02158         init_pvar(P_LIVE,NULL,'b',0.0);
02159 
02160         P_LIVE_OLD = (double *) nalloc(sizeof(double)*(numBasn+1),"P_LIVE_OLD");
02161         init_pvar(P_LIVE_OLD,NULL,'b',0.0);
02162         P_LIVE_IN = (double *) nalloc(sizeof(double)*(numBasn+1),"P_LIVE_IN");
02163         init_pvar(P_LIVE_IN,NULL,'b',0.0);
02164         P_LIVE_OUT = (double *) nalloc(sizeof(double)*(numBasn+1),"P_LIVE_OUT");
02165         init_pvar(P_LIVE_OUT,NULL,'b',0.0);
02166         P_LIVE_ERR = (double *) nalloc(sizeof(double)*(numBasn+1),"P_LIVE_ERR");
02167         init_pvar(P_LIVE_ERR,NULL,'b',0.0);
02168         P_LIVE_ERR_CUM = (double *) nalloc(sizeof(double)*(numBasn+1),"P_LIVE_ERR_CUM");
02169         init_pvar(P_LIVE_ERR_CUM,NULL,'b',0.0);
02170 
02171         P_LIVE_IN_SUM = (double *) nalloc(sizeof(double)*(numBasn+1),"P_LIVE_IN_SUM");
02172         init_pvar(P_LIVE_IN_SUM,NULL,'b',0.0);
02173         P_LIVE_OUT_SUM = (double *) nalloc(sizeof(double)*(numBasn+1),"P_LIVE_OUT_SUM");
02174         init_pvar(P_LIVE_OUT_SUM,NULL,'b',0.0);
02175         P_LIVE_IN_AVG = (double *) nalloc(sizeof(double)*(numBasn+1),"P_LIVE_IN_AVG");
02176         init_pvar(P_LIVE_IN_AVG,NULL,'b',0.0);
02177         P_LIVE_OUT_AVG = (double *) nalloc(sizeof(double)*(numBasn+1),"P_LIVE_OUT_AVG");
02178         init_pvar(P_LIVE_OUT_AVG,NULL,'b',0.0);
02179 
02180 /* phosph mass bal vars for dead fraction */
02181         P_DEAD_CELL = (double *) nalloc(sizeof(double)*(numBasn+1),"P_DEAD_CELL");
02182         init_pvar(P_DEAD_CELL,NULL,'b',0.0);
02183         dop_macIn = (double *) nalloc(sizeof(double)*(numBasn+1),"dop_macIn");
02184         init_pvar(dop_macIn,NULL,'b',0.0);
02185         dop_sorbIn = (double *) nalloc(sizeof(double)*(numBasn+1),"dop_sorbIn");
02186         init_pvar(dop_sorbIn,NULL,'b',0.0);
02187         dop_decomp = (double *) nalloc(sizeof(double)*(numBasn+1),"dop_decomp");
02188         init_pvar(dop_decomp,NULL,'b',0.0);
02189         dop_desorb = (double *) nalloc(sizeof(double)*(numBasn+1),"dop_desorb");
02190         init_pvar(dop_desorb,NULL,'b',0.0);
02191         floc_decomp = (double *) nalloc(sizeof(double)*(numBasn+1),"floc_decomp");
02192         init_pvar(floc_decomp,NULL,'b',0.0);
02193         floc_In = (double *) nalloc(sizeof(double)*(numBasn+1),"floc_In");
02194         init_pvar(floc_In,NULL,'b',0.0);
02195 
02196         P_DEAD = (double *) nalloc(sizeof(double)*(numBasn+1),"P_DEAD");
02197         init_pvar(P_DEAD,NULL,'b',0.0);
02198 
02199         P_DEAD_OLD = (double *) nalloc(sizeof(double)*(numBasn+1),"P_DEAD_OLD");
02200         init_pvar(P_DEAD_OLD,NULL,'b',0.0);
02201         P_DEAD_IN = (double *) nalloc(sizeof(double)*(numBasn+1),"P_DEAD_IN");
02202         init_pvar(P_DEAD_IN,NULL,'b',0.0);
02203         P_DEAD_OUT = (double *) nalloc(sizeof(double)*(numBasn+1),"P_DEAD_OUT");
02204         init_pvar(P_DEAD_OUT,NULL,'b',0.0);
02205         P_DEAD_ERR = (double *) nalloc(sizeof(double)*(numBasn+1),"P_DEAD_ERR");
02206         init_pvar(P_DEAD_ERR,NULL,'b',0.0);
02207         P_DEAD_ERR_CUM = (double *) nalloc(sizeof(double)*(numBasn+1),"P_DEAD_ERR_CUM");
02208         init_pvar(P_DEAD_ERR_CUM,NULL,'b',0.0);
02209 
02210         P_DEAD_IN_SUM = (double *) nalloc(sizeof(double)*(numBasn+1),"P_DEAD_IN_SUM");
02211         init_pvar(P_DEAD_IN_SUM,NULL,'b',0.0);
02212         P_DEAD_OUT_SUM = (double *) nalloc(sizeof(double)*(numBasn+1),"P_DEAD_OUT_SUM");
02213         init_pvar(P_DEAD_OUT_SUM,NULL,'b',0.0);
02214         P_DEAD_IN_AVG = (double *) nalloc(sizeof(double)*(numBasn+1),"P_DEAD_IN_AVG");
02215         init_pvar(P_DEAD_IN_AVG,NULL,'b',0.0);
02216         P_DEAD_OUT_AVG = (double *) nalloc(sizeof(double)*(numBasn+1),"P_DEAD_OUT_AVG");
02217         init_pvar(P_DEAD_OUT_AVG,NULL,'b',0.0);
02218 
02219 /* phosph mass bal vars for water-borne fraction */
02220         P_WAT_CELL = (double *) nalloc(sizeof(double)*(numBasn+1),"P_WAT_CELL");
02221         init_pvar(P_WAT_CELL,NULL,'b',0.0);
02222         wat_sfMiner = (double *) nalloc(sizeof(double)*(numBasn+1),"wat_sfMiner");
02223         init_pvar(wat_sfMiner,NULL,'b',0.0);
02224         wat_sedMiner = (double *) nalloc(sizeof(double)*(numBasn+1),"wat_sedMiner");
02225         init_pvar(wat_sedMiner,NULL,'b',0.0);
02226         wat_sfUpt = (double *) nalloc(sizeof(double)*(numBasn+1),"wat_sfUpt");
02227         init_pvar(wat_sfUpt,NULL,'b',0.0);
02228         P_settl = (double *) nalloc(sizeof(double)*(numBasn+1),"P_settl");
02229         init_pvar(P_settl,NULL,'b',0.0);
02230         wat_sedUpt = (double *) nalloc(sizeof(double)*(numBasn+1),"wat_sedUpt");
02231         init_pvar(wat_sedUpt,NULL,'b',0.0);
02232 
02233         P_WAT = (double *) nalloc(sizeof(double)*(numBasn+1),"P_WAT");
02234         init_pvar(P_WAT,NULL,'b',0.0);
02235 
02236         P_WAT_OLD = (double *) nalloc(sizeof(double)*(numBasn+1),"P_WAT_OLD");
02237         init_pvar(P_WAT_OLD,NULL,'b',0.0);
02238         P_WAT_IN = (double *) nalloc(sizeof(double)*(numBasn+1),"P_WAT_IN");
02239         init_pvar(P_WAT_IN,NULL,'b',0.0);
02240         P_WAT_OUT = (double *) nalloc(sizeof(double)*(numBasn+1),"P_WAT_OUT");
02241         init_pvar(P_WAT_OUT,NULL,'b',0.0);
02242         P_WAT_ERR = (double *) nalloc(sizeof(double)*(numBasn+1),"P_WAT_ERR");
02243         init_pvar(P_WAT_ERR,NULL,'b',0.0);
02244         P_WAT_ERR_CUM = (double *) nalloc(sizeof(double)*(numBasn+1),"P_WAT_ERR_CUM");
02245         init_pvar(P_WAT_ERR_CUM,NULL,'b',0.0);
02246 
02247         P_WAT_IN_SUM = (double *) nalloc(sizeof(double)*(numBasn+1),"P_WAT_IN_SUM");
02248         init_pvar(P_WAT_IN_SUM,NULL,'b',0.0);
02249         P_WAT_OUT_SUM = (double *) nalloc(sizeof(double)*(numBasn+1),"P_WAT_OUT_SUM");
02250         init_pvar(P_WAT_OUT_SUM,NULL,'b',0.0);
02251         P_WAT_IN_AVG = (double *) nalloc(sizeof(double)*(numBasn+1),"P_WAT_IN_AVG");
02252         init_pvar(P_WAT_IN_AVG,NULL,'b',0.0);
02253         P_WAT_OUT_AVG = (double *) nalloc(sizeof(double)*(numBasn+1),"P_WAT_OUT_AVG");
02254         init_pvar(P_WAT_OUT_AVG,NULL,'b',0.0);
02255 
02256 /* salt mass bal vars */
02257         TOT_S_CELL = (double *) nalloc(sizeof(double)*(numBasn+1),"TOT_S_CELL");
02258         init_pvar(TOT_S_CELL,NULL,'b',0.0);
02259 
02260         TOT_S = (double *) nalloc(sizeof(double)*(numBasn+1),"TOT_S");
02261         init_pvar(TOT_S,NULL,'b',0.0);
02262         TOT_S_OLD = (double *) nalloc(sizeof(double)*(numBasn+1),"TOT_S_OLD");
02263         init_pvar(TOT_S_OLD,NULL,'b',0.0);
02264         S_IN = (double *) nalloc(sizeof(double)*(numBasn+1),"S_IN");
02265         init_pvar(S_IN,NULL,'b',0.0);
02266         S_OUT = (double *) nalloc(sizeof(double)*(numBasn+1),"S_OUT");
02267         init_pvar(S_OUT,NULL,'b',0.0);
02268         TOT_S_ERR = (double *) nalloc(sizeof(double)*(numBasn+1),"TOT_S_ERR");
02269         init_pvar(TOT_S_ERR,NULL,'b',0.0);
02270         S_ERR_CUM = (double *) nalloc(sizeof(double)*(numBasn+1),"S_ERR_CUM");
02271         init_pvar(S_ERR_CUM,NULL,'b',0.0);
02272 
02273         S_IN_SUM = (double *) nalloc(sizeof(double)*(numBasn+1),"S_IN_SUM");
02274         init_pvar(S_IN_SUM,NULL,'b',0.0);
02275         S_OUT_SUM = (double *) nalloc(sizeof(double)*(numBasn+1),"S_OUT_SUM");
02276         init_pvar(S_OUT_SUM,NULL,'b',0.0);
02277         S_IN_AVG = (double *) nalloc(sizeof(double)*(numBasn+1),"S_IN_AVG");
02278         init_pvar(S_IN_AVG,NULL,'b',0.0);
02279         S_OUT_AVG = (double *) nalloc(sizeof(double)*(numBasn+1),"S_OUT_AVG");
02280         init_pvar(S_OUT_AVG,NULL,'b',0.0);
02281 
02282         TOT_S_CAN = (double *) nalloc(sizeof(double)*(numBasn+1),"TOT_S_CAN");
02283         init_pvar(TOT_S_CAN,NULL,'b',0.0);
02284 
02285         S_IN_STR = (double *) nalloc(sizeof(double)*(numBasn+1),"S_IN_STR");
02286         init_pvar(S_IN_STR,NULL,'b',0.0);
02287         S_IN_OVL = (double *) nalloc(sizeof(double)*(numBasn+1),"S_IN_OVL");
02288         init_pvar(S_IN_OVL,NULL,'b',0.0);
02289         S_IN_SPG = (double *) nalloc(sizeof(double)*(numBasn+1),"S_IN_SPG");
02290         init_pvar(S_IN_SPG,NULL,'b',0.0);
02291         S_IN_GW = (double *) nalloc(sizeof(double)*(numBasn+1),"S_IN_GW");
02292         init_pvar(S_IN_GW,NULL,'b',0.0);
02293 
02294         S_OUT_STR = (double *) nalloc(sizeof(double)*(numBasn+1),"S_OUT_STR");
02295         init_pvar(S_OUT_STR,NULL,'b',0.0);
02296         S_OUT_OVL = (double *) nalloc(sizeof(double)*(numBasn+1),"S_OUT_OVL");
02297         init_pvar(S_OUT_OVL,NULL,'b',0.0);
02298         S_OUT_SPG = (double *) nalloc(sizeof(double)*(numBasn+1),"S_OUT_SPG");
02299         init_pvar(S_OUT_SPG,NULL,'b',0.0);
02300         S_OUT_GW = (double *) nalloc(sizeof(double)*(numBasn+1),"S_OUT_GW");
02301         init_pvar(S_OUT_GW,NULL,'b',0.0);
02302 
02303 /* map arrays with summary stats */
02304         HydPerAnn = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"HydPerAnn");
02305         init_pvar(HydPerAnn,NULL,'f',0.0);
02306         SfWatAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"SfWatAvg");
02307         init_pvar(SfWatAvg,NULL,'f',0.0);
02308         TotHeadAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TotHeadAvg");
02309         init_pvar(TotHeadAvg,NULL,'f',0.0);
02310         UnsatZavg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"UnsatZavg");
02311         init_pvar(UnsatZavg,NULL,'f',0.0);
02312 
02313         RainAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"RainAvg");
02314         init_pvar(RainAvg,NULL,'f',0.0);
02315         ETAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"ETAvg"); 
02316         init_pvar(ETAvg,NULL,'f',0.0);
02317         EvapAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"EvapAvg");
02318         init_pvar(EvapAvg,NULL,'f',0.0);
02319         TranspAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TranspAvg");
02320         init_pvar(TranspAvg,NULL,'f',0.0);
02321         UnsatMoistAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"UnsatMoistAvg");
02322         init_pvar(UnsatMoistAvg,NULL,'f',0.0);
02323 
02324         TPSfWatAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TPSfWatAvg");
02325         init_pvar(TPSfWatAvg,NULL,'f',0.0);
02326         TPSfUptAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TPSfUptAvg");
02327         init_pvar(TPSfUptAvg,NULL,'f',0.0);
02328         TPSfMinAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TPSfMinAvg");
02329         init_pvar(TPSfMinAvg,NULL,'f',0.0);
02330         TP_settlAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TP_settlAvg");
02331         init_pvar(TP_settlAvg,NULL,'f',0.0);
02332         TPSedWatAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TPSedWatAvg");
02333         init_pvar(TPSedWatAvg,NULL,'f',0.0);
02334         TPSedUptAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TPSedUptAvg");
02335         init_pvar(TPSedUptAvg,NULL,'f',0.0);
02336         TPSedMinAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TPSedMinAvg");
02337         init_pvar(TPSedMinAvg,NULL,'f',0.0);
02338         TPSorbAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TPSorbAvg");
02339         init_pvar(TPSorbAvg,NULL,'f',0.0);
02340         TPtoVOLAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TPtoVOLAvg");
02341         init_pvar(TPtoVOLAvg,NULL,'f',0.0);
02342         TPtoSOILAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TPtoSOILAvg");
02343         init_pvar(TPtoSOILAvg,NULL,'f',0.0);
02344 
02345         SaltSfAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"SaltSfAvg");
02346         init_pvar(SaltSfAvg,NULL,'f',0.0);
02347         SaltSedAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"SaltSedAvg");
02348         init_pvar(SaltSedAvg,NULL,'f',0.0);
02349 
02350         Floc_fr_phBioAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"Floc_fr_phBioAvg");
02351         init_pvar(Floc_fr_phBioAvg,NULL,'f',0.0);
02352 
02353         NC_PeriAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NC_PeriAvg");
02354         init_pvar(NC_PeriAvg,NULL,'f',0.0);
02355         NC_Peri_nppAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NC_Peri_nppAvg");
02356         init_pvar(NC_Peri_nppAvg,NULL,'f',0.0);
02357         NC_Peri_mortAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NC_Peri_mortAvg");
02358         init_pvar(NC_Peri_mortAvg,NULL,'f',0.0);
02359         NC_PeriRespAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NC_PeriRespAvg");
02360         init_pvar(NC_PeriRespAvg,NULL,'f',0.0);
02361         NC_PeriNutCFAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NC_PeriNutCFAvg");
02362         init_pvar(NC_PeriNutCFAvg,NULL,'f',0.0);
02363         NC_Peri_PCAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NC_Peri_PCAvg");
02364         init_pvar(NC_Peri_PCAvg,NULL,'f',0.0);
02365         C_PeriAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"C_PeriAvg");
02366         init_pvar(C_PeriAvg,NULL,'f',0.0);
02367         C_Peri_nppAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"C_Peri_nppAvg");
02368         init_pvar(C_Peri_nppAvg,NULL,'f',0.0);
02369         C_Peri_mortAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"C_Peri_mortAvg");
02370         init_pvar(C_Peri_mortAvg,NULL,'f',0.0);
02371         C_PeriRespAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"C_PeriRespAvg");
02372         init_pvar(C_PeriRespAvg,NULL,'f',0.0);
02373         C_PeriNutCFAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"C_PeriNutCFAvg");
02374         init_pvar(C_PeriNutCFAvg,NULL,'f',0.0);
02375         C_Peri_PCAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"C_Peri_PCAvg");
02376         init_pvar(C_Peri_PCAvg,NULL,'f',0.0);
02377         PeriAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"PeriAvg");
02378         init_pvar(PeriAvg,NULL,'f',0.0);
02379         PeriLiteCFAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"PeriLiteCFAvg");
02380         init_pvar(PeriLiteCFAvg,NULL,'f',0.0);
02381 
02382         Mac_nphBioAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"Mac_nphBioAvg");
02383         init_pvar(Mac_nphBioAvg,NULL,'f',0.0);
02384         Mac_phBioAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"Mac_phBioAvg");
02385         init_pvar(Mac_phBioAvg,NULL,'f',0.0);
02386         Mac_totBioAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"Mac_totBioAvg");
02387         init_pvar(Mac_totBioAvg,NULL,'f',0.0);
02388         Mac_nppAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"Mac_nppAvg");
02389         init_pvar(Mac_nppAvg,NULL,'f',0.0);
02390         Mac_nphMortAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"Mac_nphMortAvg");
02391         init_pvar(Mac_nphMortAvg,NULL,'f',0.0);
02392         Mac_phMortAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"Mac_phMortAvg");
02393         init_pvar(Mac_phMortAvg,NULL,'f',0.0);
02394         LAI_effAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"LAI_effAvg");
02395         init_pvar(LAI_effAvg,NULL,'f',0.0);
02396         Manning_nAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"Manning_nAvg");
02397         init_pvar(Manning_nAvg,NULL,'f',0.0);
02398         MacNutCfAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"MacNutCfAvg");
02399         init_pvar(MacNutCfAvg,NULL,'f',0.0);
02400         MacWatCfAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"MacWatCfAvg");
02401         init_pvar(MacWatCfAvg,NULL,'f',0.0);
02402         mac_nph_PCAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"mac_nph_PCAvg");
02403         init_pvar(mac_nph_PCAvg,NULL,'f',0.0);
02404         mac_ph_PCAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"mac_ph_PCAvg");
02405         init_pvar(mac_ph_PCAvg,NULL,'f',0.0);
02406 
02407         SedElevAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"SedElevAvg");
02408         init_pvar(SedElevAvg,NULL,'f',0.0);
02409 
02410 } /* end of alloc_mem_stats */

Here is the call graph for this function:


Generated on Thu Jul 6 11:18:03 2006 for ELM source code by  doxygen 1.3.9.1