9/3/2010 Original code for this version was based on that developed for the SFFP found in C:\WaSSi\2010\SFFP\ORIGINAL\codes Changes to the original code incorporated into this version include: 1. Corrected LAI assignment code in PET.FOR lines 86-118. Prior version assigned LAI data to year J as defined by the general.for loop, which is not the same J as assigned in WARMUP.FOR. Replaced "J" in lines 86-118 with "BYEAR-1960+J" 2. Corrected LAI input data file LANDLAI.TXT, prior version had missing data that were assigned a zero. 3. Incorporated new snow algorithm based on McCABE AND WOLOCK 2007 4. Corrected population assignment code in FLOWROUTING.FOR line 223, similar issues to #1 above with LAI 5. Revised FLOWROUTING.FOR to calculate WASSI for 3 HUCs in WRR 15 6. Romoved LANDUSE.TXT from input file list because no longer used and modified code accordingly 7. Removed season start dates from GENERAL.TXT input file because no longer used, and modified code accordingly 8. corrected code in FLOWROUTING.FOR so that wateruse, groundwater, and returnflow are assigned to the correct sector (new input files have sectors in a different order than old files) 9. corrected elevation in HUCAREA.TXT, also removed slope column. Revised code in WARMUP.FOR to not read in slope. 10. updated PRISM climate input file for corrected HUC averaging of ppt and temp (particularly for coastal HUCs with no-data pixels) 9/13/10: Corrected CELLINFO.TXT: sign on lat/long for cell 4100001 was reversed (was negative for lat, positive for long) 9/14/10: removed temperature limitation on AET (AET was 0 if T<-1) in WATERBAL.FOR 9/14/10: added limitation on PAET in PET.FOR so that PAET can not be greater than 2*PET (esp. in winter with high rainfall) 9/20/10: removed limitation on PAET described above. Changed PAET equation so that winter months use the 9/17/10 (no PPT term) equation and the rest of year uses the 9/10/10 equation. This limits PAET in winter months when there is high rainfall but low energy. 9/21/10: Corrected GENERAL.FOR code relating to leap year determination 9/21/10: Corrected day length code in PET.FOR, did not assign correct day length to the correct month 9/23/10: removed seasonal ET equation dependency. Since ET model prediction vs. Average annual P-Q in WRR 1,2,4,5 with >20% forest cover was improved with the new ET equation (PAET = 0.00169*PET*RAIN + 0.4*PET+7.83*LAI) the new equation was applied to those conditions while the "old" ET equation (PAET = PET*LAI*0.0222+0.174*RAIN+0.502*PET+5.31*LAI) was applied to all other WRR and when Forest cover <20% 10/7/10: corrected equation for calculating water use by domestic sector based on population in FLOWROUTING.FOR...Equation assigned calculated water use to sector 2(industrial) instead of sector 1(domestic) 10/7/10: Added 4th category for population scenario flag in GENERAL.TXT input file to allow use of domestic water use data in WATERUSE.TXT rather than calculated water use based on population 10/7/10: Added condition to calculated domestic water use equation in FLOWROUTING.FOR to only calculate domestic water use if POP_FLAG <4. 10/13/10: Copied code and inputs from WASSICBUS to INTERFACE to modify code and inputs for interface use 10/13/10: Removed writing of soil moisture to SOILSTORAGE.TXT 10/13/10: Remove years from heading of SUMMARRUNOFF.TXT 10/13/10: Remove “press return to continue” from GENERAL.FOR 10/14/10: Calculate total runoff for MONTHRUNOFF.TXT and remove extra parameters 10/14/10: Calculate AET:PET ratio in MONTHRUNOFF.TXT, SUMMARRUNOFF.TXT, ANNUALFLOW.TXT 10/14/10: Add column headings to HUCBIO 10/18/10: Remove number of land cover categories from GENERAL.TXT input file, modify WARMUP.FOR 10/18/10: Change GENERAL.TXT to read in a population year instead of population scenario, MODIFY WARMUP.FOR AND FLOWROUTING.FOR 10/18/10: Changed FLOWROUTING.FOR to include both avg monthly and total annual supply, demand, and wassi in ANNUALWASSI.TXT output file for each year 10/18/10: Calculate average annual values in HUCWASSI.TXT for user specified range (same range as for SUMMARRUNOFF.TXT) rather than for all years, modify FLOWROUTING.FOR 10/19/10: Revised regression equation used to calculate domestic WU as a function of population. Since PS sector contributes to domestic, set PS to zero if domestic is calculated as function of population 10/19/10: ELIMINATED NGRID INPUT FROM GENERAL.TXT, IS NOW ASSIGNED IN WARMUP.FOR (RPSINT) BASED ON THE NUMBER OF CELLS (ROWS) IN CELLINFO.TXT 10/19/10: ELIMINATED NONODE INPUT FROM GENERAL.TXT, IS NOW ASSIGNED IN WARMUP.FOR (RPSWATERUSE) BASED ON NUMBER OF NODES (ROWS) IN NODEHUC.TXT 10/19/10: ELIMINATED BYEAR AND NYEAR INPUT FROM GENERAL.TXT, IS NOW ASSIGNED IN WARMUP.FOR (RPSCLIMATE) BASED ON FIRST YEAR AND NUMBER OF YEARS IN CLIMATE.TXT MOVED CALL RPSCLIMATE IN GENERAL.FOR MOVED RPSCLIMATE IN WARMUP.FOR RESORTED CLIMATE.TXT BY YEAR, HUC, THEN MONTH (WAS HUC, YEAR, THEN MONTH) 10/19/10: PULLED IN GE'S NEW CARBONBAL.FOR CODE, MODIFIED TO OUTPUT ANNUAL DATA FOR EACH YEAR IN ANNUALCARBON.TXT AND ANNUALBIO.TXT, AND TO OUTPUT AVERAGE ANNUAL DATA BETWEEN IYSTART AND IYEND TO HUCBIO.TXT AND HUCCARBON.TXT 10/21/10: MODIFIED CODE TO ALLOW ONE EXECUTABLE TO RUN BOTH US AND MEXICO REGIONS, ADDED FIELD IN GENERAL.TXT TO SPECIFY THE REGION 10/25/10: ADDED CODE IN GENERAL.FOR TO READ THE CLIMATE SCENARIO IN GENERAL.TXT, CLIMATE FILES ARE IN INPUTS/CLIMATE AND ARE LABELED AS TO THE SCENARIO 10/26/10: ADDED PARAMETERS TO GENERAL.TXT TO PERFORM GLOBAL EDITS OF INPUTS. PARAMETERS ARE READ WARMUP.FOR AND ALL INPUT DATA MODIFICATIONS ARE PERFORMED IN WARMUP.FOR 10/27/10: ADDED CODE TO GENERAL.FOR TO READ IN UID FROM COMMAND LINE. THE UID WILL BE ADDED BY THE INTERFACE TO THE GENERAL INPUT FILE NAME (E.G. GENERAL_123456.TXT) AFTER COLLECTING USER SELECTIONS THE FORTRAN CODE ADDS UID TO ALL OF THE OUTPUT FILES 10/28/10: ADDED CODE TO GENERAL.FOR TO READ IN USERNAME FROM COMMAND LINE. CHANGED DIRECTORY STRUCTURE PER CHRIS PEPES REQUEST 12/20/10: ADDED FUTURE CLIMATE SCENARIOS FOR MEXICO IN C:\WaSSi\2010\WASSICB_WEB_1_0\USERS\SGCP\Inputs\INPUTS_MX\CLIMATE. MODIFIED CODE IN GENERAL.FOR TO READ IN THESE CLIMATE FILES. 12/20/10: MODIFIED CODE IN WARMUP.FOR TO ALLOW CONVERSION OF FOREST LAND COVER TO GRASS, SHRUB, SAVANNA, IN ADDITION TO THE PREVIOUSLY ALLOWED CROP AND W/U/B. 12/20/10: REMOVED INITIAL SNOWPACK (1.0 MM) FROM WARMUP.FOR AND ADDED TO WATERBALANCE.FOR, AND CALCULATED BASED ON LATITUDE SO THAT INITIAL SNOWPACK FOR EACH HUC IS SET TO THIS VALUE PRIOR TO SIMULATING THAT HUC. ORIGINALLY, INITIAL SNOWPACK APPLIED ONLY TO THE FIRST HUC SIMULATED, INITIAL SNOWPACK FOR SUCCESSIVE HUCS WAS SET TO THE SNOWPACK OF THE FINAL MONTH FROM THE PREVIOUS HUC. 12/21/10: MODIFIED CODE IN GENERAL.FOR, WATERBAL.FOR, FLOWROUTING.FOR, CARBONBAL.FOR TO ALLOW SHORTER SIMULATION BASED ON USER INPUTTED IYSTART AND IYEND. 2/16/11: CORRECTED A TYPO IN WATERBALANCE.FOR LINE 431; NOW: PERCM(K) = LZFPM(I) * LZPK(I) + LZFSM(I) * LZSK(I); WAS: PERCM(K) = LZFPM(K) * LZPK(I) + LZFSM(K) * LZSK(I) 3/7/11: CREATED A NEW ROUTING ALGORITHM USING HUC CONNECTIVITY DATA IN ROUTEMATRIX.TXT. NEW ROUTING COMPUTATIONS IN FLOWROUTING.FOR, AND INPUT FILE READ IN WARMUP.FOR. 3/10/11: REVISED CODE TO START SIMULATION ON YEAR PRIOR TO IYSTART TO ALLOW MODEL TO "WARM UP" FROM INITIAL CONDITIONS. OUTPUT IS ONLY WRITTEN/CALCULATED FOR YEARS >= IYSTART 3/11/11: CHANGED PUBLIC SUPPLY WATER USE FROM A CONSTANT MONTHLY % OF ANNUAL TO A VARIABLE % USING THE DOMESTIC WATER USE MONTHLY DISTRIBUTION 3/11/11: SET WASSI TO 0.0 FOR HUCS BORDERING THE GREAT LAKES SINCE THEY LIKELY TAKE WATER FROM THE LAKES. WITHOUT THIS MODIFICATION, THESE HUCS SHOW UNREALISTICALLY HIGH WASSI. 3/18/11: MODIFIED CODE TO READ IN THE 2010-2060 A1 POPULATION DATA FROM Zarnoch (http://www.treesearch.fs.fed.us/pubs/35892), RESCALED TO THE HUC BY BRIAN TAVERNIA FOR NFFP 4/7/11: CORRECTED TYPO IN WARMUP.FOR WHERE POPULATION DATA IS ASSIGNED BASED ON A USER-SELECTED YEAR, LINE 627 WAS: POPULATION(I,J) = POPULATION(I,(POP_FLAG - (BYEAR - 1))), NOW POPULATION(I,J) = POPULATION(I,(POP_FLAG - (1960 - 1))) 5/11/11: CHANGED PET.FOR TO COMPUTE FOREST BASED ON THE FOREST COVER PRIOR TO USER ADJUSTMENT SO THAT REDUCING FOREST COVER DOES NOT CAUSE FOREST TO GO FROM >0.2 TO <0.2, THEREBY USING 2 ET EQUATIONS (BEFORE AND AFTER FOREST COVER REDUCTION) 5/23/11: LANDLAI_US.TXT input file was not sorted properly by HUC, year, month. Replaced LANDLAI_US.TXT with sorted input file. 6/8/11: REVISED FLOWROUTING SUPPLY AND DEMAND CODE TO COMPUTE THE ANNUAL SUPPLY AND DEMAND AS THE SUM OF THE MONTHLY SUPPLY AND DEMAND IN MGD FOR THE YEAR DIVIDED BY 12 6/8/11: ADDED DECLARATION FOR REGION AND CLIMATE_FLAG WHERE THE BASIC COMMON BLOCK IS CALLED, APPARENTLY CAUSED MISALIGNMENT 6/23/11: REVISED OUTPUT.FOR AND SUMMARY.FOR TO WRITE SOIL MOISTURE AS % OF SATURATION INSTEAD OF MM OF SOIL MOISTURE 10/4/11: MADE CHANGES FOR WRR VALIDATION PAPER: CHANGED WATERBAL.FOR TO COMPUTE WATER BALANCE ON MONTHLY BASIS RATHER THAN DAILY (EXCEPT FOR MONTHS WITH EXTREME PPT WHERE THE WATER BALANCE IS COMPUTED ON A SUB-MONTHLY BASIS) CHANGED WARMUP.FOR TO COMPUTE MONTHLY SOIL FLUX PARAMETERS FOR THE NEW MONTHLY WATER BALANCE ALGORITHM CHANGED WATERBAL.FOR TO ONLY KEEP SNOWPACK IF >10MM. IF LESS, ALL MELTS AND REMAINDER GOES TO SNOWW. REVISED WATERBALANCE.FOR TO COMPUTE SNOW ACCUMULATION AND MELT BASED ON REGION SPECIFIC SNOW WATER MODEL PARAMETERS CHANGED OUTPUT COMMON BLOCK TO REMOVE BASE FLOW, INTERFLOW, ETC...OCCURS IN SEVERAL SUBROUTINES. 10/4/11: CHANGED PET.FOR TO CALCULATE PAET FOR FORESTED LAND COVER IN NORTHERN LATITUDES USING ALTERNATE PAET EQUATION, WAS "IF (WRR.EQ.1.OR.WRR.EQ.2.OR.WRR.EQ.4.OR.WRR.EQ.5.OR.WRR.EQ.17) THEN", NOW "IF (WRR.EQ.1.OR.(WRR.EQ.2.AND.LATUDE(I).GT.40).OR.WRR.EQ.4.OR.WRR.EQ.5) THEN" REMOVED HUCS 13030200, 17110003, 18060014, 18070107 FROM ALL INPUT FILES TO MATCH THE NEW FUTURE CLIMATE SCENARIOS ADDED 9 FUTURE CLIMATE INPUT FILES (CGCM3, CM2, HADCM3 A1B, A2, B1), CHANGED GENERAL.TXT AND GENERAL.FOR TO READ IN NEW CLIMATE DATA REVISED FLOWROUTING.FOR TO OUTPUT ONLY ANNUAL SUPPLY, DEMAND, WASSI AND FLOW TO ANNUALWASSI.TXT REVISED FLOWROUTING.FOR TO OUTPUT SURFACE WATER SUPPLY (MGD), GROUNDWATER SUPPLY (MGD) TO AVGANNWaSSI.TXT REVISED OUTPUT.FOR AND SUMMARY.FOR TO OUTPUT ANNUAL MAX SWE AND MEAN ANNUAL MAX SWE TO ANNUALRUNOFF.TXT AND AVGANNRUNOFF.TXT, RESPECTIVELY. REVISED OUTPUT.FOR AND SUMMARY.FOR TO OUTPUT MEAN ANNUAL TEMP TO AVGANNRUNOFF.TXT REVISED TO OUTPUT MONTHLY MEAN WATER BALANCE, WASSI, AND CARBON OUTPUT TO MOMEANRUNFF.TXT, ETC. REVISED FLOWROUTING.FOR TO CALCULATE WASSI AS NET DEMAND/(SUPPLY-CONSUMPTIVE USE), ALSO SUBTRACTING CONSUMPTIVE USE FROM FLOW DURING FLOW ROUTING. 11/22/11: CORRECTED WATERBALANCE.FOR LINE 724 "IF (PINC+UZFWC(K).GT.UZFWM(K)) GOTO 248", SHOULD BE UZFWM(I) NOT UZFWM(K) 11/25/11: UPDATED WARMUP.FOR TO READ IN NEW 2006 NLCD LAND COVER FOR US REGION (10 LAND COVER CLASSES) AND ASSOCIATED LAI DATA (MONTHLY MEAN) REVISED MEXICO LAI TO BE MONTHLY MEAN LAI BY CELL INSTEAD OF 2000-2006 MONTHLY LAI REVISED PET.FOR TO CALCULATE PAET USING MONTHLY MEAN LAI DATA, AND SET PAET FOR OPEN WATER TO PET REVISED WATERBAL.FOR TO CALCULATE WATER BALANCE FOR OPEN WATER LAND COVER AS ET=PAET=PET, SURFACERO=INFIL-ET CALCULATE GEP, RE FOR NEW LAND COVER CLASSES (NEED TO RUN THIS BY GE) REVISED WARMUP.FOR TO READ IN IMPERVIOUS COVER DATA FOR US REGION (10 LAND COVER CLASSES) REVISED WATERBAL.FOR TO ACCOUNT FOR IMPERVIOUS COVER ON WATER BALANCE 12/19/11: REVISED FLOWROUTING.FOR TO COMPUTE DOMESTIC WU AS A FUNCTION OF POPULATION USING HUC-SPECIFIC PER CAPITA WATER USE. PER CAPITA WATER USE IS COMPUTED IN WARMUP.FOR (RPSWATERUSE) USING THE SUM OF DOM AND PS WU (2005) DIVIDED BY 2010 POPULATION REVISED RETURNFLOW TABLE TO HAVE PS RETURNFLOW PERCENTAGE AS THE WU WEIGHTED AVERAGE OF DOMESTIC AND INDUSTRIAL (WAS SET TO ZERO) 12/20/11: UPDATED PRISM CLIMATE DATA USING HUC12 DATA AGGREGATED TO THE HUC8 THROUGH 2010 REVISED WATERBAL.FOR TO ACCOUNT FOR IMPERVIOUS COVER ON CARBON REVISED WATERBAL.FOR TO SIMULATE BOTH US AND MX REGIONS WITH DIFFERENT LAND COVER CLASSES AND IMPERVIOUS DATA 1/3/12: REVISED FLOWROUTING.FOR TO COMPUTE WASSI USING GROSS DEMAND INSTEAD OF NET DEMAND 1/11/12: REVISED WATER USE TABLE TO INCLUDE COLUMN FOR PUBLIC SUPPLY DELIVERIES TO DOMESTIC SO WE CAN BETTER COMPUTE THE DOMESTIC WATER USE AS A FUNCTION OF POPULATION. REVISED WARMUP.FOR TO READ IN THE COLUMN AND COMPUTE PERCAPITA WATER USE. REVISED FLOWROUTING.FOR. 1/27/12: REVISED FLOWROUTING.FOR TO CORRECT DOMESTIC, IRRIGATION, AND THERMOPOWER MONPER SO THAT THE SOME OF THE 12 MONPER = 1 1/27/12: REVISED FLOWROUTING.FOR TO COMPUTE ACTUAL NUMBER OF DAYS IN YEAR AND MONTH SO THAT ACCUMULATED MONTHLY AND ANNUAL TOTAL WATER USE WILL BE THE SAME AS THE USGS INPUT DATA (IF UNADJUSTED BY USER) 2/6/12: REVISED WARMUP.FOR TO ELIMINATE FORMATTED READING OF INPUTS FROM GENERAL.TXT...CAUSED PROBLEMS WITH INTERFACE. 2/22/12: REVISED FLOWROUTING.FOR TO CORRECT BUG IN CONSUMPTIVE USE REMOVAL FROM STREAMFLOW, USED TO REMOVE CONSUMPTIVE USE MULTIPLE TIMES IF A HUC HAD MORE THAN ONE HUC DRAINING TO IT. NOW ONLY REMOVES CONSUMPTIVE USE ONCE, THE FIRST TIME (ROW) IT OCCURS IN THE ROUTING MATRIX. 3/9/12: REVISED OUTPUT.FOR, SUMMARY.FOR, AND WARMUP.FOR TO ADD THE R-FACTOR CALCULATIONS USED IN CCAMMO 7/25/12: REVISED WARMUP.FOR, HAD A LEGACY DO LOOP IN ALGORITHM CHANGING FOREST LAI BASED ON USER SELECTIONS, CAUSED LAI CHANGE LOOP TO BE SKIPPED 11/8/12: CORRECTED BUG IN WATER BALANCE CODE THAT ALLOWED UZFWC TO GO NEGATIVE AFTER INTERFLOW WAS CALCULATED (LINES 647-661) 12/17/12: CORRECTED TYPO IN r FACTOR CALCULATIONS, REPLACED 17.2 WITH 17.02 FOR UNIT CONVERSION 1/9/13: ADDED RWANDA REGION, CHANGED VERSION FROM 2.0 TO 2.1