void gage_initState(int j) // // Input: j = rain gage index // Output: none // Purpose: initializes state of rain gage. // { // --- assume gage not used by any subcatchment // (will be updated in subcatch_initState) Gage[j].isUsed = FALSE; Gage[j].rainfall = 0.0; Gage[j].reportRainfall = 0.0; if ( IgnoreRainfall ) return; // --- for gage with file data: if ( Gage[j].dataSource == RAIN_FILE ) { // --- set current file position to start of period of record Gage[j].currentFilePos = Gage[j].startFilePos; // --- assign units conversion factor // (rain depths on interface file are in inches) if ( UnitSystem == SI ) Gage[j].unitsFactor = MMperINCH; } // --- get first & next rainfall values if ( getFirstRainfall(j) ) { // --- find date at end of starting rain interval Gage[j].endDate = datetime_addSeconds( Gage[j].startDate, Gage[j].rainInterval); // --- if rainfall record begins after start of simulation, if ( Gage[j].startDate > StartDateTime ) { // --- make next rainfall date the start of the rain record Gage[j].nextDate = Gage[j].startDate; Gage[j].nextRainfall = Gage[j].rainfall; // --- make start of current rain interval the simulation start Gage[j].startDate = StartDateTime; Gage[j].endDate = Gage[j].nextDate; Gage[j].rainfall = 0.0; } // --- otherwise find next recorded rainfall else if ( !getNextRainfall(j) ) Gage[j].nextDate = NO_DATE; } else Gage[j].startDate = NO_DATE; }
void gage_initState(int j) // // Input: j = rain gage index // Output: none // Purpose: initializes state of rain gage. // { int i, k; // --- assume gage not used by any subcatchment // (will be updated in subcatch_initState) Gage[j].isUsed = FALSE; Gage[j].rainfall = 0.0; //(5.0.010 - LR) Gage[j].reportRainfall = 0.0; //(5.0.010 - LR) if ( IgnoreRainfall ) return; //(5.0.010 - LR) // --- for gage with file data: if ( Gage[j].dataSource == RAIN_FILE ) { // --- set current file position to start of period of record Gage[j].currentFilePos = Gage[j].startFilePos; // --- assign units conversion factor // (rain depths on interface file are in inches) if ( UnitSystem == SI ) Gage[j].unitsFactor = MMperINCH; } // --- for gage with time series data, determine if gage uses // same time series as another gage with lower index // (no check required for gages sharing same rain file) if ( Gage[j].dataSource == RAIN_TSERIES ) { k = Gage[j].tSeries; for (i=0; i<j; i++) { if ( Gage[i].dataSource == RAIN_TSERIES && Gage[i].tSeries == k) { Gage[j].coGage = i; return; } } } // --- get first & next rainfall values if ( getFirstRainfall(j) ) { // --- find date at end of starting rain interval Gage[j].endDate = datetime_addSeconds( Gage[j].startDate, Gage[j].rainInterval); // --- if rainfall record begins after start of simulation, if ( Gage[j].startDate > StartDateTime ) { // --- make next rainfall date the start of the rain record Gage[j].nextDate = Gage[j].startDate; Gage[j].nextRainfall = Gage[j].rainfall; // --- make start of current rain interval the simulation start Gage[j].startDate = StartDateTime; Gage[j].endDate = Gage[j].nextDate; Gage[j].rainfall = 0.0; } // --- otherwise find next recorded rainfall else if ( !getNextRainfall(j) ) Gage[j].nextDate = NO_DATE; } else Gage[j].startDate = NO_DATE; }