# B.2 - Descriptions of Program Subroutines

This section describes the function of each subroutine contained in the StateCU FORTRAN Program.

annuacrp.for

This subroutine computes the crop coefficient, mean temperature and percent daylight hours of the month for annual crops for the Blaney-Criddle ET method. It includes the calculation required for part months (i.e., beginning and ending months) of the growing season. It is called by subroutine calpcrop for every structure in every year requiring arguments that indicate the beginning and ending of the growing season of the crop. It calls the subroutine intertd to calculate the monthly mean temperature and percent daylight hours during the part months. It calls the subroutine interkc to calculate the monthly crop coefficient. Error trapping capability is provided by calling the subroutine myexit. The main routines of subroutine annuacrp were taken from USBR XCONS2 program, which uses the SCS Modified Blaney-Criddle ET Estimation Method.

calpcrop.for

This subroutine calculates the crop consumptive use based on the SCS Modified Blaney-Criddle method. It is called by subroutine mainxc, which is the main subroutine for calculating crop consumptive use. It calls the subroutines perencrp and annuacrp to calculate monthly parameters and coefficients for perennial and annual crops, respectively. It calls the subroutine xcrain to calculate monthly effective rainfall. The subroutine calpcrop also generates an output file *.obc that contains detailed results of the crop consumptive use calculation.

clndr.for

This subroutine calculated the equivalent of Julian day (or day of the year) to calendar month (1-12) and day (1-31). Leap years are also handled. It is called by the subroutines annuacrp, perencrp, and calpcrop.

dayhrs.for

This subroutine calculates the monthly percent daylight hours associated with a given latitude. A table of monthly values of percent daylight hours with respect to selected latitudes (0-64 degrees North) is used. This table is taken from the ASCE Manuals and Reports No. 70 on ET and Irrigation Water Requirements (Jensen et al. 1990), using the latitude assigned to the cropped area. It is called by subroutine mainxc to compute the percent daylight hours associated with the latitude of the cropped area associated with a structure. It is called by subroutine summary to compute the percent daylight hours associated with the latitude of the weather station for incorporation in the input summary file.

This subroutine reads the daily climate data required for the Penman-Monteith, ASCE Standardized Penman-Monteith, and Daily Modified Hargreaves methods. It is called by the main program statecu.

dsum.for

This subroutine summarizes the input information and saves it to the *.sum output file when performing a daily ET analysis. Depending on a user-specified flag, the summary can either be basic or detailed. In addition, the weighted mean monthly temperature and precipitation value for each structure are calculated in this subroutine. Summary is called from the main program statecu. It calls subroutines clndr and dayhrs. Error trapping capability is provided by calling the subroutine myexit.

dxcrain.for

This subroutine computes the daily effective rainfall using three methods: 1) Maximum effective inches per day, 2) Fraction of daily precipitation is effective, and 3) SCS NEH4 method. The user can also specify to ignore the monthly effective rainfall. The subroutine dxcrain is called by the subroutine proto.

etasce.for

This subroutine computes the alfalfa-based reference ET during the given day. The equation formulations are based on ASCE Standardization of Reference Evapotranspiration Task Committee. The subroutine etasce is called by etref.

etref.for

This subroutine computes the daily reference ET using alfalfa-based formulas for the Penman-Monteith and ASCE Standardized Penman-Monteith methods for the given weather station for the current year of simulation. The daily climate datasets have units in English; however, the computations are performed in metric units. The results are then converted back to English units. The subroutine etref is called by the subroutine proto, which is the main subroutine for computing crop consumptive use by the Penman-Monteith and ASCE Standardized Penman-Monteith ET methods. This subroutine also computes the daily reference ET for the Modified Hargreaves ET method developed by Agro Engineering, Inc. Etref calls the subroutines etoref and etrref for grass-based and alfalfa-based Penman-Monteith and ASCE Standardized Penman-Monteith formulas.

etrref.for

This subroutine computes the alfalfa-based reference ET during the given day. The equation formulations are based on ASCE Manuals and Reports on Engineering Practice – No. 70. The subroutine etrref is called by etref.

export.for

This subroutine summarizes in tabular form the consumptive use from the export (transmountain diversions) category as read from the *.oth file. It is called by subroutine other, which is the main subroutine for computing consumptive use from non-irrigation categories (other uses). It calls subroutine otable, which prepares the summary table for the given category.

fall.for

This subroutine computes the first day of frost in fall based on mean monthly temperature. It assumes that the fall frost temperature occurs only after July 15. If the weather data does not satisfy this assumption, the program may fail. The subroutine fall is called by subroutine frost, which is the main subroutine for determining the growing season of the given crop. These routines were taken from the USBR XCONS2 program, which uses the SCS Modified Blaney-Criddle ET Estimation Method.

findsta.for

This subroutine returns the structure match ‘index’ for routines that loop through structure information, such as time-series of acreage and diversions. It is called by multiple routines.

foutput.for

This subroutine generates a detailed daily tabular output of the consumptive use computation for Penman-Monteith, ASCE Standardized Penman-Monteith, and Modified Hargreaves methods for each structure. The detailed output for the selected structures are combined and saved in *.opm. The subroutine fall is called by proto, which is the main subroutine for both daily ET calculations.

frost.for

This subroutine determines the start and end of the growing season from the user specified dates, computed frost dates based on monthly mean temperature, and published 28 or 32 degree F frost dates. This subroutine calculates the growing season for a structure for a single year in the simulation. Each crop is assigned a separate set of flags (one each for the start and end of the growing season) indicating the type of frost date method to use. If the value is 0, the frost date is based on the monthly mean temperature. If the value is 1, the frost date is based on the published 28 degree F frost date. If the value is 2, the frost date is based on the published 32 degree F frost date. The final frost dates are compared to the user-specified dates, always choosing the date which shortens the growing season (less critical date). The subroutine frost is called by the subroutine frostall. It calls the subroutine spring and fall for determining frost dates based on monthly mean temperature for spring and fall, respectively. Error trapping capability is provided by calling the subroutine myexit.

frostall.for

This subroutine loops through years and calls the subroutine frost for each year. It is called by the subroutines mainxc and proto.

growth.for

This subroutine computes the daily crop coefficient for the Penman-Monteith and ASCE Standardized Penman-Monteith methods by straight line interpolation using the crop coefficient dataset provided for the Penman-Monteith and ASCE Standardized Penman-Monteith calculations. It is called by the subroutine proto.

indcrop.for

This subroutine assigns an internal crop indices to correspond with the crop name. It is called by the subroutine readin.

init.for

This subroutine initializes constants assigned to variables used in StateCU, such as days in each month. It is called by the main program statecu.

interkc.for

This subroutine computes the crop coefficient $$k_c$$, climatic coefficient $$k_t$$, and $$(t * d) /100$$ for the current month for the annual crops only. It is called by the subroutine annuacrp. The routines are based on USBR XCONS2 program, which uses the SCS Modified Blaney-Criddle ET Estimation Method.

intertd.for

This subroutine computes the monthly mean temperature percent daylight hours for part months (beginning month in the spring and ending month in the fall). It is called by the subroutines annuacrp and perencrp. The routines are based on USBR XCONS2 program, which uses the SCS Modified Blaney-Criddle ET Estimation Method.

julian.for

This subroutine computes the equivalent of calendar date to Julian day (day of the year). Leap years are handled. It is called by the subroutines annuacrp, perencrp, fall, spring, frost, and intertd.

kbasal.for

This subroutine reads the Penman-Monteith crop coefficient file. The subroutine kbasal is called by proto.

kcpm.for

This subroutine calculates the daily crop coefficients for the Penman-Monteith and ASCE Standardized Penman-Monteith equations by straight line interpolation using the crop coefficient data provided in the *.kpm file for all crops for the entire growing season, except for alfalfa and pasture for the period after effective cover. The subroutine is called by growth.

kcpm2.for

This subroutine calculates the daily crop coefficients for the Penman-Monteith and ASCE Standardized Penman-Montieth equations by straight line interpolation using the crop coefficient data provided in the *.kpm file for crops other than alfalfa and pasture for the period after effective cover. The subroutine is called by growth.

mainxc.for

This subroutine is the main calling subroutine for computing Blaney-Criddle crop consumptive use. It is called by the main program statecu. It calls the subroutines dayhrs, readin, calpcrop, and frost.

myexit.for

This subroutine implements the exit routines when the program is about to stop. The history of execution is saved in the *.log file. The subroutine myexit is called by the subroutines annuacrp, dayhrs, fall, frost, indcrop, julian, perencrp, readin, statecu, and summary.

perencrp.for

This subroutine computes the crop coefficient, mean temperature, percent daylight hours, and parameter f of the month for perennial crops. It includes the computation required for part months (i.e., beginning and ending months) of the growing season. It is called by subroutine calpcrop for structure for every year requiring arguments that indicate the beginning and ending of the growing season of the crop. It calls the subroutine intertd to calculate the monthly mean temperature and percent daylight hours during the part months. Error trapping capability is provided by calling the subroutine myexit. The main routines of subroutine perencrp were taken from USBR XCONS2 program, which uses the SCS Modified Blaney-Criddle ET Estimation Method.

pmclim.for

This subroutine reads the daily climate files for the Penman-Monteith, ASCE Standardized Penman-Monteith, and Modified Hargreaves ET methods and writes them to the input summary file. The subroutine pmclim is called by proto.

proj.for

This subroutine generates the *.pcu and *.wsl files, which are tabular summaries of the monthly and yearly potential and water supply limited consumptive use, respectively. The consumptive use is expressed in acre-feet. The subroutine proj is called by the main program statecu. It calls the subroutine table that creates the summary table for each structure.

proto.for

This subroutine is the main calling subroutine for computing crop consumptive use by the Penman-Monteith, ASCE Standardized Penman-Monteith, and Modified Hargreaves methods. The subroutine proto is called by the main program statecu. It calls the subroutines etref, frost2, kbasal, growth, clndr, rain, and foutput.

rain.for

This subroutine computes the daily effective rainfall used with the Penman-Monteith, ASCE Standardized Penman-Monteith, and Modified Hargreaves ET methods. The daily effective rainfall can be computed using three methods: 1) all daily total rainfall below a user-specified amount is considered effective; 2) effective rainfall is equal to a user-specified fraction of the total rainfall; and 3) curve number method based on the NEH SEC 4 method. The subroutine rain is called by the subroutine proto each day of the computation.

This subroutine reads the file names and corresponding file type identifier in the *.rcu file. This subroutine is called by the main program statecu.

This subroutine reads the Blaney-Criddle crop coefficients from the *.kbc file. This subroutine is called by mainxc.

skipln.for

This subroutine skips a fixed number of lines in an input file, to position the file for the program to read the appropriate input data. It is called by subroutines lstock, reserv, munic, fswild, stockp, minera, therma, export, and recrea.

skipn.for

This subroutine skips CDSS header cards placed on input files, defined by a ‘#’ in the first column, to position the file for the program to read the appropriate input data. It is called by subroutines other, readin, statecu, slimit, summary, kbasal, and proto.

slimit.for

This subroutine reads the structure parameter file for all analyses. In addition, if a water supply limited consumptive use analysis is chosen, this subroutine reads the water supply information (usually a StateMod .ddh file) and converts the diversions from water year to calendar year. If water supply limited consumptive use by priority is chosen, water rights information for the structures in the scenario is also read. This subroutine is called by the main program statecu.

spring.for

This subroutine computes the last day of frost in spring based on mean monthly temperature. It assumes that the spring frost temperature occurs no later than July 15. If the weather data does not satisfy this assumption, the program may fail. The subroutine spring is called by subroutine frost, which is the main subroutine for determining the growing season of the given crop. These routines were taken from the USBR XCONS2 program, which uses the SCS Modified Blaney-Criddle ET Estimation Method.

stable.for

This subroutine prepares the summary tables (month and year) for water supply. It is called by the subroutine wsupply to incorporate water supply in the input summary file.

statecu.for

This is the main routine for the StateCU FORTRAN program. It reads the response file and control file and calls the appropriate subroutines based on the level of analysis chosen.

summary.for

This subroutine summarizes the input information and saves it to the *.sum output file when performing a monthly ET analysis. Depending on a user-specified flag, the summary can either be basic or detailed. In addition, the weighted mean monthly temperature and precipitation valued for each structure are calculated in this subroutine. Summary is called from the main program statecu. It calls subroutines clndr and dayhrs. Error trapping capability is provided by calling the subroutine myexit.

table.for

This subroutine creates the potential and water supply limited consumptive use summary tables (month and year) for each structure. The consumptive use values are provided in acre-feet. This subroutine is called by the subroutine proj.

wsupply.for

This subroutine writes the water supply information to the input summary file when a water supply analysis is chosen. This subroutine is called by the main program statecu.

wsupsum.for

This subroutine performs the structure water budget and prepares the *.swb,*.dwb, and binary output files when a water supply limited analysis is requested. Water supply from direct diversions, ground water, and the soil moisture reservoir is tracked for direct crop use and soil storage. If water rights are considered, the water is ‘colored’ to account for senior, junior, and other water use. If a river depletion analysis is requested, wsupsum accounts for return flow percentages and timing. This subroutine is called by the main program statecu.

xcrain.for

This subroutine computes the monthly effective rainfall using two methods: 1) SCS method with net application depth, and 2) USBR method. The user can also specify to ignore the monthly effective rainfall. The subroutine xcrain is called by the subroutine calpcrop. The routines are based on USBR XCONS2 program, which uses the SCS Modified Blaney-Criddle ET Estimation Method.