﻿based on src_20100112_v1_snow

08/26/2009	(drs) Compile program with Darwin's gcc compiler (gcc version 4.0.1 (Apple Inc. build 5493) (i686-apple-darwin9))
01/05/2011	(drs) Compile program with Darwin's gcc compiler (gcc version 4.2.1 (Apple Inc. build 5574) (i686-apple-darwin9))
01/05/2011	(drs) Compile program with Darwin's gcc compiler (gcc version 4.2.1 (Apple Inc. build 5664) (i686-apple-darwin10))


SW_Model.c
08/26/2009	(drs) stricmp -> strcmp
SW_Output.c
08/26/2009	(drs) stricmp -> strcmp -> Str_CompareI;
			in SW_OUT_sum_today () added 'break;' after 'default: '
09/09/2009	(drs) strcmp -> Str_CompareI (not case-sensitive)
SW_VegEstabl.c
08/26/2009	(drs) added 'return;' after 'LBL_Normal_Exit:'


Fixed miscellaneous bugs:

SW_Output.c
08/27/2009	(drs) changed output-strings str[12] to #define OUTSTRLEN 18; str[OUTSTRLEN]; because of sprintf(str, ...) overflow and memory corruption into for-index i 
09/15/2009	(drs) wetdays output was not working: changed in get_wetdays() the output from sprintf(fmt, "%c%%3.0f", _Sep); to sprintf(str, "%c%i", _Sep, val);
10/13/2009	(drs) output period of static void get_swcm(void) was erroneously set to eSW_SWP instead of eSW_SWCM
SW_Weather.c
20090916	(drs) changed  in SW_WTH_new_day() the following code:
				wn->temp_avg[Today]     = (tmpmax + tmpmin) / 2.;
				to wn->temp_avg[Today]     = (wn->temp_max[Today] + wn->temp_min[Today]) / 2.;
				such that monthly scaling factors also influence average T and not only Tmin and Tmax
Times.c (v6)
03/12/2010	(drs) "365:366" --> Time_get_lastdoy_y(TimeInt year) {return isleapyear(year) ? 366 : 365; }
SW_Model.c
03/12/2010	(drs) "DAYLAST_NORTH [==366]  : DAYLAST_SOUTH;" --> "m->endend = (m->isnorth) ? Time_get_lastdoy_y(m->endyr)  : DAYLAST_SOUTH;"
Sky.c (v8)
06/16/2010	(drs) all cloud.in input files contain on line 1 cloud cover, line 2 wind speed, line 3 rel. humidity, and line 4 transmissivity, but SW_SKY_read() was reading rel. humidity from line 1 and cloud cover from line 3 instead -> SW_SKY_read() is now reading as the input files are formatted 
generic.h (v11-v12)
10/22/2010	(drs)	replaced every occurence of F_DELTA, #define F_DELTA (10*FLT_EPSILON), with ( max( 10.*FLT_EPSILON, FLT_EPSILON*pow(10., ceil(log10(max(fabs(x),max(fabs(y), FLT_EPSILON))+1.)) ) ) ) and similar for D_DELTA
					because earlier version worked only for 0<=x<fabs(31)


Comments:

SW_Weather.h
10/15/2009	(drs) the RealF ppt_actual  in typedef struct SW_WEATHER_2DAYS was in code previously, but not used in code as of today
SW_Sky.h
10/15/2009	(drs) the RealF transmission  in typedef struct SW_SKY is used as input in the call in SW_Flow.c from SW_Water_Flow(void) to petfunc(...),
			but the algorithm used in petfunc(...) in SW_Flow_lib.c cancels it out
				solrad = 917. * transcoeff
               			* (ahou * sin(rlat) *sin(declin)
                  		+ cos(rlat) *cos(declin) *sin(ahou));
				shwave = solrad *.0168 / transcoeff;

(v0)
Added snow routines:

SW_Flow.c
10/09/2009	(drs) added calls to snow accumulation/snowdrift, snow sublimation and snow melt in SW_Water_Flow(); 
			if there is a snowpack then rain doesnt hit vegetation or litter instead infiltrates directly into soil
SW_Output.c
10/15/2009	(drs) ppt is divided into rain and snow sumof_wth() and all three values plus snowmelt are output into get_precip();
			snowpack was previously called 'snow' -> renamed to 'snowpack' since 'snow' now refers to the snow-part of precipitation
SW_Site.c
10/12/2009	(drs) added altitude (used for snow sublimation and in the future for petfunc() ) in SW_SIT_read(void) as case 17 in and _echo_inputs(void)
SW_Site.h
10/12/2009	(drs) added altitude (used for snow sublimation and in the future for petfunc() ) in typedef struct SW_SITE /* altitude a.s.l (m) of the site */
SW_Sky.c
10/12/2009	(drs) added pressure (used for snow sublimation) in SW_SKY_read(void) as case 4
SW_Sky.h
10/12/2009	(drs) added pressure (used for snow sublimation) to typedef struct SW_Sky /* mean sea level pressure (hPa) */
SW_SoilWater.c
10/09/2009	(drs) replaced SW_SWC_adjust_snow( RealF temp, RealF *rain) with
			SW_SWC_snow_melt( RealF temp, RealF *snowmelt),
			SW_SWC_snow_accumulation(  RealF snow, RealF pct_snowdrift ) and
			SW_SWC_snow_sublimation( RealF temp, RealF windspeed, RealF pressure, RealF rel_humidity) [not functional]
SW_SoilWater.h
10/09/2009	(drs) replaced SW_SWC_adjust_snow( RealF temp, RealF *rain) with
			SW_SWC_snow_melt( RealF temp, RealF *snowmelt),
			SW_SWC_snow_accumulation(  RealF snow, RealF pct_snowdrift ) and
			SW_SWC_snow_sublimation( RealF temp, RealF windspeed, RealF pressure, RealF rel_humidity) [not functional]
SW_Weather.c
10/09/2009	(drs) moved call to SW_SWC_adjust_snow () to SW_Flow.c, commented it out in SW_WTH_new_day()
10/14/2009	(drs) added pct_snowdrift as input to weathsetup.in
10/15/2009	(drs) ppt is divided into rain and snow, added snowmelt in SW_WTH_new_day() and in _update_yesterday()
SW_Weather.h
10/14/2009	(drs) added pct_snowdrift in typedef struct SW_WEATHER
10/15/2009	(drs) ppt is divided into rain and snow, added snowmelt in typedef struct SW_WEATHER_2DAYS, SW_WEATHER_OUTPUTS, 
			in typedef struct SW_WEATHER_2DAYS, the RealF ppt_actual variable was here previously, but not used in code as of today

(v1)
Cleaned up snow routines: made snow sublimation function empty, removed pressure 

SW_Flow.c
01/12/2010	(drs) made not-fuctional snow sublimation to snow_sublimation (void)
SW_Sky.c
01/12/2010	(drs) removed pressure (used for snow sublimation) in SW_SKY_read(void) as case 4
SW_Sky.h
01/12/2010	(drs) removed pressure (used for snow sublimation) from typedef struct SW_SKY
SW_SoilWater.c
01/12/2010	(drs) SW_SWC_snow_sublimation( void )
SW_SoilWater.h
01/12/2010	(drs) SW_SWC_snow_sublimation( void )


Added new output (interception of litter and of vegetation canopy (standing crop), infiltration of water to top soil layer, soil water drainage from layer to layer

SW_Output.h
02/02/2010	(drs) changed SW_CANOPY to SW_CANOPYEV and SW_LITTER to SW_LITTEREV and eSW_Canopy to eSW_CanopyEv and eSW_Litter to eSW_LitterEv;
			added SWC_CANOPYINT, SW_LITTERINT, SW_SOILINF, SW_LYRDRAIN; updated SW_OUTNKEYS from 19 to 23;
			added eSW_CanopyInt, eSW_LitterInt, eSW_SoilInf, eSW_LyrDrain to enum OutKey
SW_Output.c
02/02/2010	(drs) changed SW_CANOPY to SW_CANOPYEV and SW_LITTER to SW_LITTEREV;
			and eSW_Canopy to eSW_CanopyEv and eSW_Litter to eSW_LitterEv;
			added SWC_CANOPYINT, SW_LITTERINT, SW_SOILINF, SW_LYRDRAIN;
			added eSW_CanopyInt, eSW_LitterInt, eSW_SoilInf, eSW_LyrDrain;
			updated key2str, key2obj;
			added private functions get_canint(), get_litint(), get_soilinf(), get_lyrdrain();
			updated SW_OUT_construct(), sumof_swc() and average_for() with new functions and keys
			for layer drain use only ForEachSoilLayer(i-1)
SW_SoilWater.h
02/02/2010	(drs) added lyrdrain[MAX_LAYERS], crop_int, litt_int, soil_inf to SW_SOILWAT_OUTPUTS;
			added standcrop_int, litter_int, soil_inf to SW_SOILWAT; /*drain[MAX_LAYERS] was already declared */
SW_Flow.c
02/02/2010	(drs) added to SW_Water_Flow(): saving values for standcrop_int, litter_int and soil_inf


Rearranged how snowpack influences interception, melt, infiltration and soil evaporation and transpiration (v5)

SW_Flow.c
02/08/2010	(drs) if there is a snowpack then
				- rain infiltrates directly to soil (no vegetation or litter interception of today)
				- no transpiration or evaporation (except evaporation of yesterdays interception)
			only
				- infiltrate water high
				- infiltrate water low

(v7)
Added new output (available soil water) 
SW_Output.c
04/16/2010	(drs) added SWC_SWA, eSW_SWA; updated key2str, key2obj; added private functions get_swa();
			updated SW_OUT_construct(), sumof_swc()[->make calculation here] and average_for() with new functions and keys
SW_Output.h
04/16/2010	(drs) added SW_SWA, updated SW_OUTNKEYS to 24, added eSW_SWA to enum OutKey
SW_SoilWater.h
04/16/2010	(drs) added swa[MAX_LAYERS] to SW_SOILWAT_OUTPUTS /* available soil water (cm/layer) = swc - (wilting point) */


(v9)
Sky.c
06/16/2010	(drs) all cloud.in input files contain on line 1 cloud cover, line 2 wind speed, line 3 rel. humidity, and line 4 transmissivity, but SW_SKY_read() was reading rel. humidity from line 1 and cloud cover from line 3 instead -> SW_SKY_read() is now reading as the input files are formatted 


(v10) added snowMAUS snow accumulation, sublimation and melt algorithm: Trnka, M., Kocmánková, E., Balek, J., Eitzinger, J., Ruget, F., Formayer, H., Hlavinka, P., Schaumberger, A., Horáková, V., Mozny, M. & Zalud, Z. (2010) Simple snow cover model for agrometeorological applications. Agricultural and Forest Meteorology, 150, 1115-1127.
SW_SoilWater.h
10/04/2010	(drs) added snowMAUS model parameters, replaced SW_SWC_snow_accumulation, SW_SWC_snow_sublimation, and SW_SWC_snow_melt with SW_SWC_adjust_snow(temp_min, temp_max, *ppt, *rain, *snow, *snowmelt)
SW_SoilWater.c
10/04/2010	(drs) replaced SW_SWC_snow_accumulation, SW_SWC_snow_sublimation, and SW_SWC_snow_melt with SW_SWC_adjust_snow (temp_min, temp_max, *ppt, *rain, *snow, *snowmelt)
SW_Weather.c
10/04/2010	(drs) moved call to SW_SWC_adjust_snow() from SW_Flow.c back to SW_WTH_new_day(), see comment 20091009
SW_Flow.c
10/04/2010	(drs) moved call to SW_SWC_adjust_snow() back to SW_WTH_new_day()


(v11) replaced snowMaus snowmelt simulation with optimized SWAT2K: Neitsch S, Arnold J, Kiniry J, Williams J. 2005. Soil and water assessment tool (SWAT) theoretical documentation. version 2005. Blackland Research Center, Texas Agricultural Experiment Station: Temple, TX.
moved snow model parameters to siteparam.in file
SW_SoilWater.h
10/19/2010	(drs) replaced snowMAUS parameters with optimized SWAT2K parameters: Neitsch S, Arnold J, Kiniry J, Williams J. 2005. Soil and water assessment tool (SWAT) theoretical documentation. version 2005. Blackland Research Center, Texas Agricultural Experiment Station: Temple, TX.
11/02/2010	(drs) moved snow parameters to SW_Site.h/c to be read in from siteparam.in
SW_SoilWater.c
10/19/2010	(drs) replaced snowMAUS simulation with SWAT2K routines: Neitsch S, Arnold J, Kiniry J, Williams J. 2005. Soil and water assessment tool (SWAT) theoretical documentation. version 2005. Blackland Research Center, Texas Agricultural Experiment Station: Temple, TX.
SW_Site.h
11/02/2010	(drs) added snow parameters to SW_SITE to be read in from siteparam.in
SW_Site.c
11/02/2010	(drs) added 5 snow parameters to SW_SITE to be read in from siteparam.in


(v12) added hydraulic redistribution
SW_Site.h
10/19/2010	(drs) added Bool HydraulicRedistribution flag and RealF maxCondroot, swp50, and shapeCond parameters to the structure SW_SITE
SW_Site.c
10/19/2010	(drs) added HydraulicRedistribution flag, and maxCondroot, swp50, and shapeCond parameters to SW_SIT_read()  and _echo_inputs()
SW_Flow.c
10/19/2010	(drs) added call to hydraulic_redistribution() in SW_Water_Flow() after all the evap/transp/infiltration is computed
					added temporary array lyrHydRed to arrays2records() and records2arrays()
SW_Flow_lib.h
10/19/2010	(drs) added function hydraulic_redistribution()
SW_Flow_lib.c
10/19/2010	(drs) added function hydraulic_redistribution() according to Ryel, Ryel R, Caldwell, Caldwell M, Yoder, Yoder C, Or, Or D, Leffler, Leffler A. 2002. Hydraulic redistribution in a stand of Artemisia tridentata: evaluation of benefits to transpiration assessed with a simulation model. Oecologia 130: 173-184.
SW_SoilWater.h
10/19/2010 (drs)	added for hydraulic redistribution: hydred [MAX_LAYERS] to SW_SOILWAT_OUTPUTS and SW_SOILWAT
SW_SoilWater.c
10/25/2010	(drs)	in SW_SWC_water_flow(): replaced test that "swc can't be adjusted on day 1 of year 1" to "swc can't be adjusted on start day of first year of simulation"
SW_Output.h
10/20/2010 (drs) added SW_HYDRED, updated SW_OUTNKEYS to 25, added eSW_HydRed to enum OutKey
SW_Output.c
10/20/2010 (drs) added SW_HYDRED, eSW_HydRed; updated key2str, key2obj; added private functions get_hydred();
				updated SW_OUT_construct(), sumof_swc()[->make calculation here] and average_for() with new functions and keys


(v13) choose between grassland/shrubland or forest interception
SW_Flow_lib.h
11/16/2010	(drs) added function forest_intercepted_water() and MAX_WINTFOR
					renamed evap_litter_stdcrop() -> evap_litter_veg()
SW_Flow_lib.c
11/16/2010	(drs) added function forest_intercepted_water()
					renamed evap_litter_stdcrop() -> evap_litter_veg()
SW_VegProd.h
11/16/2010	(drs) added LAIforest, biofoliage_for, lai_conv_for, TypeGrassOrShrub, TypeForest to SW_VEGPROD
SW_VegProd.c
11/16/2010	(drs) added LAIforest, biofoliage_for, lai_conv_for, TypeGrassOrShrub, TypeForest to SW_VEGPROD
						lai_live/biolive/total_agb include now LAIforest, respectively biofoliage_for 
						updated SW_VPD_read(), SW_VPD_init(), and _echo_inits(), /*
						increased length of char outstr[1000] to outstr[1500] because of increased echo
SW_SoilWater.h
11/16/2010	(drs) added for_int to SW_SOILWAT_OUTPUTS, and forest_int to SW_SOILWAT
					renamed crop_evap -> veg_evap, standcrop_evap -> vegetation_evap
SW_Flow.c
11/16/2010	(drs) added call to forest_intercepted_water() depending on SW_VegProd.Type..., added forest_h2o to trace forest intercepted water
SW_Output.c
11/16/2010	(drs) added forest intercepted water to canopy interception
					updated get_canint(), SW_OUT_construct(), sumof_swc()[->make calculation here] and average_for()


(v14) check conservation of mass in water balance
- AET = sum(transp) + (sum(evap_soil) + evap_veg + evap_litt)
- inf_soil = (rain + snowmelt) - (intc_litt + intc_veg)
- swc.l1(today) = swc.l1(yesterday) + inf_soil + hydred.l1 - (lyrdrain.l1 + transp.l1 + evap_soil.l1)
  swc.li(today) = swc.li(yesterday) + lyrdrain.l(i-1) + hydred.li - (lyrdrain.li + transp.li + evap_soil.li)
  swc.llast(today) = swc.llast(yesterday) + lyrdrain.l(last-1) + hydred.llast - (deep.drain + transp.llast + evap_soil.llast)
- daily: (rain + snowmelt) = AET + deep.drain + swc(today-yesterday) + litter(intc-evap) + veg(intc-evap)
  yearly: (rain + snowmelt) = AET + deep.drain + sum(swc(today-yesterday)) + litter(intc-evap) + veg(intc-evap)
  
- fix AET
SW_Flow.c
01/04/2011	(drs) added snowmelt to h2o_for_soil after interception, otherwise last day of snowmelt (when snowpack is gone) wasn't made available and aet became too small
Changed all float to double respectively RealF to RealD (except for variables for sscanf input and SW_Sky):
SW_Flow_lib.c, SW_Flow_lib.h, SW_Flow_subs.h, SW_Flow.c, SW_Output.c, SW_Site.c, SW_Site.h, SW_SoilWater.c, SW_SoilWater.h, SW_VegProd.c, SW_VegProd.h, SW_Weather.c, SW_Weather.h, SW_Markov.c, SW_Markov.h

- fix water balance
SW_Flow_lib.c
01/06/2011	(drs) drainout is calculated in 1. infiltrate_water_high() and 2. infiltrate_water_low(), but was not added up -> fixed it by changing '(*drainout) = drainlw' to '(*drainout) += drainlw' in function infiltrate_water_low()
01/06/2011	(drs) drainlw was not set to 0. in the for-loop, i.e. a layer with swc below pwp inherited incorrectly drainlw from layer above instead of drainlw=0
SW_Output.c
01/06/2011	(drs) changed all floating-point output from %7.4f to %7.6f to avoid rounding errors in post-run output calculations 
SW_Flow.c
01/06/2011	(drs) layer drainage was incorrectly calculated if hydraulic redistribution pumped water into a layer below pwp such that its swc was finally higher than pwp -> fixed it by first calculating hydraulic redistribution and then as final step infiltrate_water_low()
01/06/2011	(drs) call to infiltrate_water_low() has to be the last swc affecting calculation
			

- track snowloss and add to output
SW_Weather.h
01/04/2011	(drs) added variable 'snowloss' to SW_WEATHER_2DAYS and to SW_WEATHER_OUTPUTS
SW_SoilWater.c
01/04/2011	(drs) added parameter '*snowloss' to function SW_SWC_adjust_snow()
SW_SoilWater.h
01/04/2011	(drs) added parameter '*snowloss' to function SW_SWC_adjust_snow()
SW_Weather.c
01/04/2011	(drs) added parameter '*snowloss' to function SW_SWC_adjust_snow() call and updated functions SW_WTH_new_year(), SW_WTH_new_day(), _update_yesterday()
SW_Output.c
01/04/2011	(drs) added snowloss output to get_precip(), sumof_wth(), average_for(), 

- fix warnings during compilation and update compiler
generic.h
01/03/2011	(drs) macro 'isless' renamed to 'isless2'
SW_Output.c
01/03/2011	(drs) changed parameter type of str2period(), str2key(), and str2type() from 'const char *' to 'char *' to avoid 'discard qualifiers from pointer target type' in Str_ComparI()
SW_Flows.c
01/03/2011	(drs) changed type of lyrTrRegions[MAX_LAYERS] from int to IntU = unsigned int to avoid warning message that ' pointer targets differ in signedness' in function transp_weighted_avg()
filefuncs.c
01/05/2011	(drs) removed unused variable *p from MkDir()
SW_Weather.c
01/05/2011	(drs) removed unused variables rain and snow from SW_WTH_new_day()

-change from gcc --target=i686-apple-darwin9 to --target=i686-apple-darwin10: at runtime "Abort trap" during call to get_temp() from SW_Output[k].pfunc() in SW_Output.c
SW_Output.c
01/05/2011	(drs) made typecast explicit: changed in SW_OUT_write_today(): SW_Output[k].pfunc() to ((void (*)(void))SW_Output[k].pfunc)(); -> doesn't solve problem under darwin10
				-> 'abort trap' was due to str[OUTSTRLEN] being too short (OUTSTRLEN 18), changed to OUTSTRLEN 100
				
				
(v15) fixing leap year calculations for end.year = 2000
gen_funcs.c
2011/01/27	(drs) renamed from "gen_funcs.c" to "generic.c"

years.in
2011/01/27	(drs) undocumented feature; changed "365	# ending day of last year" to  "end	# ending day of last year (either doy = {1, 366} or end)"

SW_Model.c
2011/01/27	(drs) when 'ending day of last year' in years.in was set to 366 and 'last year' was not a leap year, SoilWat would still calculate 366 days for the last (non-leap) year
				improved code to calculate SW_Model.endend in SW_MDL_read() in case strcmp(enddyval, "end")!=0 with
					d = atoi(enddyval);
					m->endend = (d < 365) ? d : Time_get_lastdoy_y(m->endyr);
					
					
					
(v16) runoff added: percentage from snowmelt is substracted before water infiltrates into soil
SW_Weather.h
	02/16/2011	(drs) added variable 'pct_runoff' to SW_WEATHER as input to weathsetup.in
	02/19/2011	(drs) added variable 'runoff' to SW_WEATHER and to SW_WEATHER_OUTPUTS
						moved soil_inf from SW_Soilwat to SW_Weather (added to SW_WEATHER and to SW_WEATHER_OUTPUTS)

SW_Weather.c
	02/16/2011	(drs) added pct_runoff read from input file to SW_WTH_read()
	02/19/2011	(drs) to track 'runoff', updated functions SW_WTH_new_year(), SW_WTH_new_day()
						moved soil_inf from SW_Soilwat to SW_Weather

SW_Flow.c
	02/19/2011	(drs) calculate runonoff as adjustment to snowmelt events before infiltration

SW_Output.c
	02/19/2011	(drs) added runoff output to get_soilinf(), sumof_wth(), average_for()
	02/19/2011	(drs) moved soil_inf from SW_Soilwat to SW_Weather: key2str, key2obj, updated get_soilinf(), sumof_wth(), sumof_swc(), average_for()
SW_Output.h
	02/19/2011	(drs) moved soil_inf output from swc- to weather-output: updated enum Outkey

SW_SoilWater.h
	02/19/2011	(drs) moved soil_inf from SW_SOILWAT and SW_SOILWAT_OUTPUTS to SW_WEATHER and SW_WEATHER_OUTPUTS


(v17) AET: included snowloss; fixed forest evaporation, added forest litter; compiled with -fast optimization (apple only option)
SW_Flow.c
	02/22/2011	(drs) init aet for the day in SW_Water_Flow(), instead implicitely in evap_litter_veg()
	02/22/2011	(drs) added snowloss to AET

SW_Flow_lib.c
	02/22/2011	(drs) evap_litter_veg() set aet implicitely to 0. and then added litter evap; changed such that litter evap is now added to whatever value aet has previously

SW_VegProd.h
	02/22/2011	(drs) added variable litter_for to SW_VEGPROD

SW_VegProd.c
	02/22/2011	(drs) added litter_for to SW_VegProd.litter and to SW_VegProd.tot_agb
	02/22/2011	(drs) if TypeGrassOrShrub is turned off, then its biomass, litter, etc. values are set to 0



(v18) HD: Hydraulic Redistribution didn't output deepest layer for weekly, monthly and yearly output
SW_Output.c
	03/06/2011	(drs) in average_for() changed loop to average hydred from "for(i=0; i < SW_Site.n_layers-1; i++)" to "ForEachSoilLayer(i)" because deepest layer was not averaged



(v19) Impermeable Layer: Adding the possibility to add % restriction to the permeability of each soil layer and 'soak' up the soil above it (between saturation and field capacity);
						also added as a consequence possibility for surface water that is pushed up, this can infiltrate or evaporate;
						added calculation for saturated soil water content
SW_Site.h
	07/20/2011	(drs) added RealD impermeability to struct SW_LAYER_INFO: fraction of how impermeable a layer is (0=permeable, 1=impermeable)
 					added RealD swc_saturated to struct SW_LAYER_INFO: saturated soil water content (cm) * width

SW_Site.c
	07/20/2011	(drs) updated _read_layers() to read impermeability values from each soil layer from soils.in file
						added calculation for saturated swc in water_eqn()
						updated _echo_inputs() to print impermeability and saturated swc values

SW_Flow_lib.c
	07/21/2011	(drs) infiltrate_water_high() & infiltrate_water_low();
						- added variables: saturated water content - swcsat, impermeability, water standing above soil - standingWater
						- percolation is adjusted by (1-impermeability)
						- if a lower soil layer becomes saturated then water is pushed back up even above the soil surface into standingWater
	07/22/2011	(drs) included evaporation from standingWater into evap_litter_veg_surfaceWater() previously called evap_litter_veg()
	07/22/2011	(drs) included evaporation from standingWater into reduce_rates_by_surfaceEvaporation() previously called reduce_rates_by_intercepted()

SW_Flow.c
	07/21/2011	(drs) added module variables 'lyrImpermeability' and 'lyrSWCsaturated' and initialize them in records2arrays()
	07/22/2011	(drs) adjusted soil_infiltration for pushed back or infiltrated surface water (difference in standingWater)
	07/22/2011	(drs) included evaporation from standingWater into evap_litter_veg_surfaceWater() and reduce_rates_by_surfaceEvaporation(): it includes it to AET

SW_SoilWater.h
	07/22/2011	(drs) added for saturated conditions: surfaceWater and surfaceWater_evap to SW_SOILWAT_OUTPUTS and SW_SOILWAT

SW_Output.h
	07/22/2011	(drs) added SW_SURFACEW and SW_EVAPSURFACE, updated SW_OUTNKEYS to 27, added eSW_SurfaceWater to enum eSW_EvapSurface

SW_Output.c
	07/22/2011 (drs) added SW_SURFACEW and SW_EVAPSURFACE, eSW_SurfaceWater and eSW_EvapSurface; updated key2str, key2obj; added private functions get_surfaceWater() and get_EvapsurfaceWater();
					updated SW_OUT_construct(), sumof_swc()[->make calculation here] and average_for() with new functions and keys



(v20) Forest: Vegetation is a composite of fractions of tree, shrubs, and grass components; moved all vegetation related input parameters to prod.in;
			added snow depth to estimate how much vegetation is protruding from snow and can transpire or intercept;
			all parameters into intput files instead of constants hidden in code;
			include option for constant vegetation height, e.g, for shrubs and trees;
			daily linear interpolation of monthly values;
			optional output directory;

snow depth:
SW_Sky.h
	08/22/2011	(drs) added monthly parameter 'snow_density' to struct SW_SKY to estimate snow depth
SW_Sky.c
	08/22/2011	(drs) new 5th line in cloud.in containing snow densities (kg/m3): read in SW_SKY_read(void) as case 4

SW_SoilWater.h
	08/22/2011	(drs) added function RealD SW_SnowDepth( RealD SWE, RealD snowdensity)
	09/12/2011	(drs) added RealD snowdepth to struct SW_SOILWAT_OUTPUTS and SW_SOILWAT
SW_SoilWater.c
	08/22/2011	(drs) added function RealD SW_SnowDepth( RealD SWE, RealD snowdensity)
SW_VegProd.h
	08/22/2011	(drs) added variable veg_height [MAX_MONTHS] to SW_VEGPROD
SW_VegProd.c
	08/22/2011	(drs) use variable veg_height [MAX_MONTHS] from SW_VEGPROD instead of static canopy_ht
SW_Flow.c
	08/22/2011	(drs) in SW_Water_Flow(void): added snowdepth_scale = 1 - snow depth/vegetation height
						- vegetation interception = only when snowdepth_scale > 0, scaled by snowdepth_scale
						- litter interception = only when no snow cover
						- transpiration = only when snowdepth_scale > 0, scaled by snowdepth_scale
						- bare-soil evaporation = only when no snow cover

constant vegetation height option:
SW_VegProd.h
	09/13/2011	9drs)	added variable RealD canopy_height_constant to struct VegType; if > 0 then constant canopy height (cm) and overriding cnpy-tangens=f(biomass)
SW_VegProd.c
	09/13/2011	(drs) added input in SW_VPD_read() of RealD canopy_height_constant and updated SW_VPD_init() (as option: if > 0 then constant canopy height (cm) and overriding cnpy-tangens=f(biomass))


three vegetation types:
SW_Defines.h
	09/09/2011	(drs) added #define ForEachXXXTranspLayer() for each vegetation type (XXX = tree, shrub, grass)
SW_VegProd.h
	09/08/2011	(drs) struct SW_VEGPROD now contains an element each for the types grasses, shrubs, and trees, as well as a variable describing the relative composition of vegetation by grasses, shrubs, and trees (changed from Bool to RealD types)
						the earlier SW_VEGPROD variables describing the vegetation is now contained in an additional struct VegType
	09/08/2011	(drs) added variables tanfunc_t tr_shade_effects, and RealD shade_scale and shade_deadmax to struct VegType (they were previously hidden in code in SW_Flow_lib.h)
	09/08/2011	(drs) moved all hydraulic redistribution variables from SW_Site.h to struct VegType
	09/08/2011	(drs) added variables RealD veg_intPPT_a, veg_intPPT_b, veg_intPPT_c, veg_intPPT_d to struct VegType for parameters in intercepted rain = (a + b*veg) + (c+d*veg) * ppt; Grasses+Shrubs: veg=vegcov, Trees: veg=LAI, which were previously hidden in code in SW_Flow_lib.c
	09/09/2011	(drs) added variable RealD EsTpartitioning_param to struct VegType as parameter for partitioning of bare-soil evaporation and transpiration as in Es = exp(-param*LAI)
	09/09/2011	(drs) added variable RealD Es_param_limit to struct VegType as parameter for scaling and limiting bare soil evaporation rate: if totagb > Es_param_limit then no bare-soil evaporation 
	09/13/2011	(drs) added variables RealD litt_intPPT_a, litt_intPPT_b, litt_intPPT_c, litt_intPPT_d to struct VegType for parameters in litter intercepted rain = (a + b*litter) + (c+d*litter) * ppt, which were previously hidden in code in SW_Flow_lib.c
	09/15/2011	9drs)	added variable RealD albedo to struct VegType (previously in SW_Site.h struct SW_SITE)
SW_VegProd.c
	09/08/2011	(drs) adapted SW_VPD_read() and SW_VPD_init() to reflect that now each vegetation type has own elements
	09/08/2011	(drs) added input in SW_VPD_read() of tanfunc_t tr_shade_effects, and RealD shade_scale and shade_deadmax (they were previously hidden as constants in code in SW_Flow_lib.h)
	09/08/2011	(drs) moved all input of hydraulic redistribution variables from SW_Site.c to SW_VPD_read() for each vegetation type
	09/08/2011	(drs) added input in SW_VPD_read() of RealD veg_intPPT_a, veg_intPPT_b, veg_intPPT_c, veg_intPPT_d (they were previously hidden as constants in code in SW_Flow_lib.h)
	09/09/2011	(drs) added input in SW_VPD_read() of RealD EsTpartitioning_param (it was previously hidden as constant in code in SW_Flow_lib.h)
	09/09/2011	(drs) added input in SW_VPD_read() of RealD Es_param_limit (it was previously hidden as constant in code in SW_Flow_lib.h)
	09/13/2011	(drs) added input in SW_VPD_read() of RealD litt_intPPT_a, litt_intPPT_b, litt_intPPT_c, litt_intPPT_d (they were previously hidden as constants in code in SW_Flow_lib.h)
	09/15/2011	(drs) added input in SW_VPD_read() of RealD albedo
SW_Site.h
	09/08/2011	(drs) moved all hydraulic redistribution parameters to SW_VegProd.h struct VegType
	09/09/2011	(drs) added RealD transp_coeff_xx for each vegetation type (tree, shrub, grass) to struct SW_LAYER_INFO
	09/09/2011	(drs) added RealD my_transp_rgn_xx for each vegetation type (tree, shrub, grass) to struct SW_LAYER_INFO
						added RealD n_transp_lyrs_xx for each vegetation type (tree, shrub, grass) to struct SW_SITE
	09/15/2011	(drs)	deleted RealD albedo in struct SW_SITE and moved it to SW_VegProd.h struct VegType to make input vegetation type dependent
SW_Site.c
	09/08/2011	(drs) moved all hydraulic redistribution parameters to SW_VegProd.h struct VegType
	09/15/2011	(drs)	deleted albedo from SW_SIT_read() and _echo_inputs(): moved it to SW_VegProd.h to make input vegetation type dependent
SW_Flow_lib.c
	09/08/2011	(drs) renamed stcrp_intercepted_water() to grass_intercepted_water();
						added shrub_intercepted_water() as current copy from grass_intercepted_water();
						added double scale to each xx_intercepted_water() function to scale for snowdepth effects and vegetation type fraction
						added double a,b,c,d to each xx_intercepted_water() function for for parameters in intercepted rain = (a + b*veg) + (c+d*veg) * ppt
	09/09/2011	(drs) added xx_EsT_partitioning() for each vegetation type (grass, shrub, tree); added double lai_param as parameter in exp-equation
	09/09/2011	(drs) replaced evap_litter_veg_surfaceWater() with evap_fromSurface() to be called for each surface water pool seperately
	09/09/2011	(drs) replaced SHD_xx constanst with input parameters in pot_transp()
	09/09/2011	(drs) added double Es_param_limit to pot_soil_evap() to scale and limit bare-soil evaporation rate (previously hidden constant in code)
	09/09/2011	(drs) renamed reduce_rates_by_surfaceEvaporation() to reduce_rates_by_unmetEvapDemand()
	09/11/2011	(drs) added double scale to hydraulic_redistribution() function to scale for vegetation type fraction
	09/13/2011	(drs)	added double scale, a,b,c,d to each litter_intercepted_water() function for parameters in litter intercepted rain = ((a + b*blitter) + (c+d*blitter) * ppt) * scale
	09/21/2011	(drs)	reduce_rates_by_unmetEvapDemand() is obsolete, complete E and T scaling in SW_Flow.c
SW_Flow_lib.h
	09/08/2011	(drs) renamed stcrp_intercepted_water() to grass_intercepted_water();
						added shrub_intercepted_water() as current copy from grass_intercepted_water();
						added double scale to each xx_intercepted_water() function to scale for snowdepth effects and vegetation type fraction
						added double a,b,c,d to each xx_intercepted_water() function for for parameters in intercepted rain = (a + b*veg) + (c+d*veg) * ppt
	09/09/2011	(drs) added xx_EsT_partitioning() for each vegetation type (grass, shrub, tree); added double lai_param as parameter in exp-equation
	09/09/2011	(drs) replaced evap_litter_veg_surfaceWater() with evap_fromSurface() to be called for each surface water pool seperately
	09/09/2011	(drs) replaced SHD_xx constanst with input parameters in pot_transp()
	09/09/2011	(drs) added double Es_param_limit to pot_soil_evap() to scale and limit bare-soil evaporation rate (previously hidden constant in code)
	09/09/2011	(drs) renamed reduce_rates_by_surfaceEvaporation() to reduce_rates_by_unmetEvapDemand()
	09/11/2011	(drs) added double scale to hydraulic_redistribution() function to scale for vegetation type fraction
	09/13/2011	(drs)	added double scale, a,b,c,d to each litter_intercepted_water() function for parameters in litter intercepted rain = ((a + b*blitter) + (c+d*blitter) * ppt) * scale
	09/21/2011	(drs)	reduce_rates_by_unmetEvapDemand() is obsolete, complete E and T scaling in SW_Flow.c
SW_SoilWater.h
	09/08/2011	(drs) replaced in both struct SW_SOILWAT_OUTPUTS and SW_SOILWAT RealD crop_int, forest_int with RealD tree_int, shrub_int, grass_int
	09/09/2011	(drs) replaced in both struct SW_SOILWAT_OUTPUTS and SW_SOILWAT RealD veg_evap with RealD tree_evap, shrub_evap, grass_evap
	09/09/2011	(drs) replaced in both struct SW_SOILWAT_OUTPUTS and SW_SOILWAT RealD transpiration and hydred with RealD transpiration_xx, hydred_xx for each vegetation type (tree, shrub, grass)

SW_Flow.c
	09/08/2011	(drs) interception, evaporation from intercepted, E-T partitioning, transpiration, and hydraulic redistribution for each vegetation type (tree, shrub, grass) of SW_VegProd separately, scaled by their fractions
						replaced PET with unevaped in pot_soil_evap() and pot_transp(): to simulate reduction of atmospheric demand underneath canopies
	09/09/2011	(drs) moved transp_weighted_avg() from before infiltration and percolation to directly before call to pot_transp()
	09/08/2011	(drs) call hydraulic_redistribution() for each vegetation type of SW_VegProd
	09/21/2011	(drs)	scaled all (potential) evaporation and transpiration flux rates with PET: SW_Flow_lib.h: reduce_rates_by_unmetEvapDemand() is obsolete

SW_Output.c: transpiration and hydraulic redistribution: total output and then for each vegetation type separately; surface evaporation and interception (surface water, trees, shrubs, grasses, and litter) combined into one output file each
	09/12/2011	(drs)	renamed SW_EVAP to SW_EVAPSOIL, and eSW_Evap to eSW_EvapSoil;
						deleted SW_CANOPYEV, eSW_CanopyEv, SW_LITTEREV, eSW_LitterEv, SW_CANOPYINT, eSW_CanopyInt, SW_LITTERINT, and eSW_LitterInt;
						added SW_INTERCEPTION and eSW_Interception
	09/12/2011	(drs)	renamed get_evap() to get_evapSoil(); renamed get_EvapsurfaceWater() to get_evapSurface()
						deleted get_canevap(), get_litevap(), get_canint(), and get_litint()
						added get_interception()
	09/12/2011	(drs)	increased #define OUTSTRLEN from 100 to 400 (since transpiration and hydraulic redistribution will be 4x as long)
						increased static char outstr[0xff] from 0xff=255 to OUTSTRLEN
	09/12/2011	(drs)	updated SW_OUT_construct(), sumof_swc()[->make calculation here] and average_for() with new functions and keys
	09/12/2011	(drs)	added snowdepth as output to snowpack, i.e., updated get_snowpack(), sumof_swc()[->make calculation here] and average_for()
SW_Output.h
	09/12/2011	(drs)	renamed SW_EVAP to SW_EVAPSOIL, and eSW_Evap to eSW_EvapSoil;
						deleted SW_CANOPYEV, eSW_CanopyEv, SW_LITTEREV, eSW_LitterEv, SW_CANOPYINT, eSW_CanopyInt, SW_LITTERINT, and eSW_LitterInt;
						added SW_INTERCEPTION and eSW_Interception

daily linear interpolation of monthly values (VegProd, Sky):
SW_Sky.h
	09/26/2011	(drs)	added a daily variable for each monthly input in struct SW_SKY: RealD cloudcov_daily, windspeed_daily, r_humidity_daily, transmission_daily, snow_density_daily each of [MAX_DAYS]
SW_Sky.c
	09/26/2011	(drs)	added calls to Times.c:interpolate_monthlyValues() to SW_SKY_init() for each monthly input variable
SW_VegProd.h
	09/26/2011	(drs)	added a daily variable for each monthly input in struct VegType: RealD litter_daily, biomass_daily, pct_live_daily, veg_height_daily, lai_conv_daily, lai_conv_daily, lai_live_daily, pct_cover_daily, vegcov_daily, biolive_daily, biodead_daily, total_agb_daily each of [MAX_DAYS]
	09/26/2011	(dsr)	removed monthly variables RealD veg_height, lai_live, pct_cover, vegcov, biolive, biodead, total_agb each [MAX_MONTHS] from struct VegType because replaced with daily records
SW_VegProd.c
	09/26/2011	(drs)	added calls to Times.c:interpolate_monthlyValues() in SW_VPD_init() for each monthly input variable; replaced monthly loop with a daily loop for additional daily variables; adjusted _echo_inits()
SW_Flow.c
	09/26/2011	(drs)	replaced all uses of monthly SW_VegProd and SW_Sky records with the daily replacements
Times.h
	09/26/2011	(drs)	added function interpolate_monthlyValues()
Times.c
	09/26/2011	(drs)	added function interpolate_monthlyValues(): interpolating a record with monthly values and outputs a record with daily values


moved the input of the yearly weather input filename from weathsetup.in to files.in: so that all weather input directory paths are at one place
SW_Files.h
	09/30/2011	(drs)	added function SW_WeatherPrefix()
SW_Files.c
	09/30/2011	(drs)	added function SW_WeatherPrefix(): so that SW_Weather can access local variable weather_prefix that is read in now in SW_F_read()
						new module-level variable static char weather_prefix[FILENAME_MAX]; read in in function SW_F_read() from file files.in line 6
SW_Weather.c
	09/30/2011	(drs)	weather name prefix no longer read in from file weathersetup.in with function SW_WTH_read(), but extracted from SW_Files.c:SW_WeatherPrefix()


add 'relative' path option for output files in files.in: / for same directory, or e.g., Output/
SW_Files.h
	09/30/2011	(drs)	added function SW_OutputPrefix()
SW_Files.c
	09/30/2011	(drs)	added function SW_WeatherPrefix(): so that SW_Weather can access local variable weather_prefix that is read in now in SW_F_read()
						new module-level variable static char weather_prefix[FILENAME_MAX]; read in in function SW_F_read() from file files.in line 6
	09/30/2011	(drs)	added function SW_OutputPrefix(): so that SW_Output can access local variable output_prefix that is read in now in SW_F_read()
						new module-level variable static char output_prefix[FILENAME_MAX]; read in in function SW_F_read() from file files.in line 12: / for same directory, or e.g., Output/
SW_Output.c
	09/30/2011	(drs)	in SW_OUT_read(): opening of output files: SW_Output[k].outfile is extended by SW_Files.in:SW_OutputPrefix()


scaling of potential bare-soil evaporation in forests by biomass and litter:
SW_VegProd.c
	10/17/2011	(drs)	in SW_VPD_init(): v->tree.total_agb_daily[doy] = v->tree.litter_daily[doy] + v->tree.biolive_daily[doy] instead of = v->tree.litter_daily[doy] + v->tree.biomass_daily[doy] to adjust for better scaling of potential bare-soil evaporation

Fixing miscellaneous bugs:
SW_Output.c
	01/09/2012	(drs)	'abort trap' in get_transp due to outstr[OUTSTRLEN] being too short (OUTSTRLEN 400), changed to OUTSTRLEN 1000

SW_Weather.c
	01/13/2011	(drs)	function '_read_hist' didn't close opened files: after reaching OS-limit of openend connections, no files could be read any more -> added 'fclose(f);' to close open connections after use


when snow density was 0, it produced in NaNs in snow depth and accordingly, transpiration didn't occur any more:
SW_SoilWater.c
	01/20/2012	(drs)	in function 'SW_SnowDepth': catching division by 0 if snowdensity is 0

	
Snow loss was not scaled to PET: it was possible due to snow loss that AET was bigger than PET
SW_Flow.c
	02/03/2012	(drs)	added variable 'snow_evap_rate': snow loss is part of aet and needs accordingly also to be scaled so that sum of all et rates is not more than pet 



(v21) Role of SWCmin and SWCwp:
	- unsaturated percolation drains soils down to SWCmin which can be layer specific and calculated after Rawls WJ, Brakensiek DL (1985) Prediction of soil water properties for hydrological modeling. In Watershed management in the Eighties (eds Jones EB, Ward TJ), pp. 293-299. American Society of Civil Engineers, New York.
	- soil evaporation extracts water down to 0.5 * SWC at -1.5 MPa (according to FAO-56, e.g., Burt CM, Mutziger AJ, Allen RG, Howell TA (2005) Evaporation Research: Review and Interpretation. Journal of Irrigation and Drainage Engineering, 131, 37-58.; or Torres EA, Calera A (2010) Bare soil evaporation under high evaporation demand: a proposed modification to the FAO-56 model. Hydrological Sciences Journal-Journal Des Sciences Hydrologiques, 55, 303-315.)
	- transpiration extracts water down to a SWC at a vegetation type specific critical SWP

unsaturated percolation:
SW_Flow_lib.c
	01/28/2011	(drs)	unsaturated flow drains now to swcmin instead of swcwp: changed infiltrate_water_low() accordingly

layer specific calculated SWCmin:
SW_SoilWater.h
	02/03/2012	(drs)	added function 'RealD SW_SWC_SWCres(RealD sand, RealD clay, RealD porosity)': which calculates 'Brooks-Corey' residual volumetric soil water based on Rawls & Brakensiek (1985)

SW_SoilWater.c
	02/03/2012	(drs)	added function 'RealD SW_SWC_SWCres(RealD sand, RealD clay, RealD porosity)': which calculates 'Brooks-Corey' residual volumetric soil water based on Rawls & Brakensiek (1985)

SW_Site.c
	02/03/2012	(drs)	if input of SWCmin < 0 then estimate SWCmin with 'SW_SWC_SWCres' for each soil layer


soil evaporation:
SW_Flow.c
	02/03/2012	(drs)	added 'lyrHalfWiltpts' = 0.5 * SWC at -1.5 MPa 
						soil evaporation extracts water down to 'lyrHalfWiltpts' (instead lyrSWCmin) according to the FAO-56 model, e.g., Burt CM, Mutziger AJ, Allen RG, Howell TA (2005) Evaporation Research: Review and Interpretation. Journal of Irrigation and Drainage Engineering, 131, 37-58.


transpiration extracts water down to a SWC at a vegetation type specific critical SWP
SW_Flow.c
	01/28/2011	(drs)	transpiration can only extract water from soil down to lyrWiltpts (instead lyrSWCmin)
	02/04/2012	(drs)	added 'lyrSWCatSWPcrit_xx' for each vegetation type
						transpiration can only remove water from soil down to 'lyrSWCatSWPcrit_xx' (instead lyrSWCmin)
SW_Flow_lib.c
	02/04/2012	(drs)	in 'remove_from_soil': control that swc_avail >= 0

SW_VegProd.h
	02/04/2012	(drs)	added variable RealD SWPcrit to struct VegType: critical soil water potential below which vegetation cannot sustain transpiration */
SW_VegProd.c
	02/04/2012	(drs)	added input in SW_VPD_read() of RealD SWPcrit

SW_Site.h
	02/04/2012	(drs)	added RealD swc_atSWPcrit_xx for each vegetation type (tree, shrub, grass) to struct SW_LAYER_INFO: swc at the critical soil water potential
SW_Site.c
	02/04/2012	(drs)	included SW_VegProd.h and created global variable extern SW_VegProd: to access vegetation-specific SWPcrit
	02/04/2012	(drs)	added calculation of swc at SWPcrit for each vegetation type and layer to function '_init_site_info()'
						added vwc/swc at SWPcrit to '_echo_inputs()'

SW_Control.c
 	02/04/2012	(drs)	in function '_read_inputs()' moved order of 'SW_VPD_read' from after 'SW_VES_read' to before 'SW_SIT_read': SWPcrit is read in in 'SW_VPD_read' and then calculated SWC_atSWPcrit is assigned to each layer in 'SW_SIT_read'



(v22) Percolation fixed: top soil layer had no unsaturated percolation

SW_Flow_lib.c
	03/26/2012	(drs)	infiltrate_water_low(): allow unsaturated percolation in first layer

 Hydraulic redistribution excluded from top soil layer
		 "the HR-induced moisture flux to the topsoil layer (0– 1.5 cm) is set to 0." (Wang et al. 2011 WRR 47)
		 "HR does not transport water to the soil immediately near the land surface because many shallow roots (e.g., in the top 5 cm of the soil) die in very dry soils [Ryel et al., 2003; Lee et al., 2005]. Therefore for flux to the top soil layer, the term qHR is set to zero." (Zheng et al. 2007 Journal of Geophysical Research-Biogeosciences 112)

SW_Flow_lib.c
	03/23/2012	(drs)	excluded hydraulic redistribution from top soil layer (assuming that this layer is <= 5 cm deep)




(v23) Soil temperature

NOTE: The equation for soil temperature DOESN'T work for big biomass values, values of like 15000 say, (ie trees) very well

05/24/2012  (DLM) wrote a makefile to make compiling easier, instructions included for how to use in the makefile's source

SW_Flow_lib.c
	05/24/2012  (DLM) started writing soil_temperature function
	05/25/2012  (DLM) added all this 'fun' crazy linear regression stuff to soil_temperature function
	05/29/2012  (DLM) linear regression stuff in soil_temperature should work now, function needs testing
	05/30/2012  (DLM) got rid of nasty segmentation fault error in soil_temperature function, also tested math seems correct after checking by hand.  added the ability to change the value of deltaX
	05/30/2012  (DLM) added soil_temp_error variable... it simply keeps track of whether or not an error has been reported in the soil_temperature function.  0 for no, 1 for yes.
	05/30/2012  (DLM) added # of lyrs check & maxdepth check at the beginning of soil_temperature function to make sure code doesn't blow up... if there isn't enough lyrs (ie < 2) or the maxdepth is too little (ie < deltaX * 2), the function quits out and reports an error to the user
	05/31/2012  (DLM) added theMaxDepth variable to soil_temperature function to allow the changing of the maxdepth of the equation	
	05/31/2012  (DLM) added soil_temperature_init() function for use in the soil_temperature function to initialize the values for use in the regressions... it is not apart of the header file, because it's not meant to be an external function
	05/31/2012  (DLM) soil_temperature() function now stores most regression data in a structure to reduce redundant regression calculations & speeds things up
	06/01/2012  (DLM) edited soil_temperature function(), changed deltaT variable from hours to seconds, also changed some of the regression calculations so that swc, fc, & wp regressions are scaled properly... results are actually starting to look usable!
	06/13/2012  (DLM) soil_temperature function no longer extrapolates values for regression layers that are out of the bounds of the soil layers... instead they are now set to the last soil layers values.  extrapolating code is still in the function and can be commented out and used if wishing to go back to extrapolating the values...

SW_Flow_lib.h
	05/25/2012  (DLM) added function soil_temperature to header file
	05/31/2012  (DLM) added ST_RGR_VALUES struct to keep track of variables used in the soil_temperature function
	
SW_Flow.c
	05/25/2012  (DLM) added module level variables lyroldsTemp [MAX_LAYERS] & lyrsTemp [MAX_LAYERS] to keep track of soil temperatures, added lyrbDensity to keep track of the bulk density for each layer
	05/25/2012  (DLM) edited records2arrays(void); & arrays2records(void); functions to move values to / from lyroldsTemp & lyrTemp & lyrbDensity
	05/25/2012  (DLM) added call to soil_temperature function in SW_Water_Flow(void)
	
SW_Site.c
	05/24/2012  (DLM) edited SW_SIT_read(void) function to be able to read in Soil Temperature constants from siteparam.in file
	05/24/2012  (DLM) edited _echo_inputs(void) function to echo the Soil Temperature constants to the logfile
	05/25/2012  (DLM) edited _read_layers( void) function to read in the initial soil temperature for each layer
	05/25/2012  (DLM) edited _echo_inputs( void) function to echo the read initial soil temperatures for each layer
	05/30/2012  (DLM) edited _read_layers & _echo_inputs functions to read in/echo the deltaX parameter
	05/31/2012  (DLM) edited _read_layers & _echo_inputs functions to read in/echo stMaxDepth & use_soil_temp variables
	05/31/2012  (DLM) edited _init_site_info(void) to check if stMaxDepth & stDeltaX values are usable, if not it resets them to the defaults (180 & 15).
	
SW_Site.h
	05/24/2012  (DLM) added variables for Soil Temperature constants to SW_SITE struct
	05/25/2012  (DLM) added variable sTemp to SW_LAYER_INFO struct to keep track of the soil temperature for each soil layer
	05/30/2012  (DLM) added stDeltaX variable for soil_temperature function to SW_SITE struct
	05/31/2012  (DLM) added use_soil_temp, stMaxDepth, stNRGR variables to SW_SITE struct
	
SW_SoilWater.c
	05/25/2012  (DLM) edited SW_SWC_read(void) function to get the initial values for soil temperature from SW_Site
	
SW_SoilWater.h
	05/25/2012  (DLM) added sTemp[MAX_LAYERS] var to SW_SOILWAT_OUTPUTS struct & SW_SOILWAT struct to keep track of the soil temperatures 
	
SW_Output.c
	05/25/2012  (DLM) added SW_SOILTEMP to keytostr, updated keytoobj;  wrote get_soiltemp(void) function, added code in the _construct() function to link to get_soiltemp() correctly;  added code to sumof and average_for() to handle the new key
	05/25/2012  (DLM) added a few lines of nonsense to sumof_ves() function in order to get rid of the annoying compiler warnings

SW_Output.h
	05/25/2012	(DLM) added SW_SOILTEMP, updated SW_OUTNKEYs to 28, added eSW_SoilTemp to enum	

generic.c
	05/25/2012  (DLM) added regression() function for use in soil_temperature function
	05/29/2012  (DLM) added lobf(), lobfM(), & lobfB() functions
	05/31/2012  (DLM) added st_getBounds() function for use in the soil_temperature function located in SW_Flow_lib.c
	
generic.h
	05/25/2012  (DLM) added regression() function to header file
	05/29/2012  (DLM) added lobf(), lobfM(), & lobfB() functions to header file
	05/29/2012  (DLM) added squared(x) definition, this squares the value x (ie. returns the value of x^2).  the definition simply calls pow(x, 2) in the cmath library.  x must be a double. added for convenience
	05/31/2012  (DLM) added st_getBounds() function to header file	

SW_Defines.h
	05/31/2012  (DLM) added MAX_ST_RGR definition for the maximum amount of soil temperature regressions allowed...
	
SW_Weather.c
	06/01/2012  (DLM) edited _read_hist() function to calculate the yearly avg air temperature & the monthly avg air temperatures...
	
SW_Weather.h
	06/01/2012  (DLM) added temp_year_avg variable to SW_WEATHER_HIST struct & temp_month_avg[MAX_MONTHS] variable

SiteParam.in
	05/24/2012  (DLM) added in Soil Temperature constants to the file
	
Soils.in
	05/25/2012  (DLM) added in initial soil temperature for each soil layer
	


(v24) Updated PET
SW_Flow_lib.c
	10/11/2012	(drs)	annotated all equations;
					replaced unknown equation for solar declination with one by Spencer (1971);
					replaced unknown equation for 'Slope of the Saturation Vapor Pressure-Temperature Curve' = arads with one provided by Allen et al. (1998) and (2005);
					replaced constant psychrometric constant (0.27 [mmHg/F]) as function of pressure, and pressure as function of elevation of site (Allen et al. (1998) and (2005));
					windspeed data is in [m/s] and not in code-required [miles/h] -> fixed conversation factor so that code now requires [m/s];
					replaced conversion addend from C to K (previously, 273) with 273.15;
					updated solar constant from S = 2.0 [ly/min] to S = 1.952 [ly/min] (Kopp et al. 2011) in the equation to calculate solrad;
					replaced unknown numerical factor of 0.201 in black-body long wave radiation to sigma x conversion-factor = 0.196728 [mm/day/K4];
					--> further update suggestions:
						- add Seller's factor '(mean(d)/d)^2' with (mean(d) = mean distance and d = instantaneous distance of the earth from the sun) to shortwave calculations


(v25) Adjust PET for topography (slope, aspect)
SW_Flow_lib.c
	11/06/2012	(clk)	allowed slope and aspect to be used in the calculation for solar radiation;
					if slope is 0, will still use old equation,
					else will sum up Seller (1965), page 35, eqn. 3.15 from sunrise to sunset.	


(v26) Added percentage of runoff loss per day
SW_Weather.h
	11/30/2012	(clk) added variable 'surfaceRunoff' to SW_WEATHER and SW_WEATHER_OUTPUTS
					changed 'runoff' to 'snowRunoff' to better distinguish between surface runoff and snowmelt runoff
SW_Weather.c
	11/30/2010	(clk) added appopriate lines for 'surfaceRunoff' in SW_WTH_new_year() and SW_WTH_new_day()

SW_Flow.c
	11/30/2012	(clk)	added lines to calculate the surface runoff and to adjust the surface water level based on that value

SW_Site.h
	11/30/2010	(clk)	added the variable 'percentRunoff' which is the percent of surface water that is lost do to surface runoff

SW_Site.c
	11/30/2012	(clk)	In SW_SIT_read(void), added lines to read in percentRunoff from siteparam.in
	11/30/2012	(clk)	In _echo_inputs(void), added lines to echo percentRunoff to logfile

SW_Output.c
	11/30/2012	(clk)	changed get_surfaceWater() to ouput amound of surface water, surface runoff, and snowmelt runoff, respectively.
	12/13/2012	(clk, drs)	changed get_surfaceWater() to output amount of surface water
						added get_runoff() to output surface runoff, and snowmelt runoff, respectively, in a separate file -> new version of outsetupin
						updated key2str and OutKey
	12/14/2012 (drs)	changed OUTSTRLEN from 2000 to 3000 to prevent 'Abort trap: 6' at runtime

SW_Output.h
	12/13/2012	(clk) added SW_RUNOFF, updated SW_OUTNKEYs to 29, added eSW_Runoff to enum
	12/14/2012	(drs) updated SW_OUTNKEYs from 29 to 26 [incorrect number probably introduced 09/12/2011]

(v27) Allowed all time steps to be output
SW_Output.h
	01/10/2013	(clk)	instead of using one FILE pointer named fp, created four new 
					FILE pointers; fp_dy, fp_wk, fp_mo, and fp_yr. This allows us to keep track
					of all time steps for each OutKey. 

SW_Output.c
	01/10/2013	(clk)	in function SW_OUT_read, when creating the output files, needed to loop through this four times
					for each OutKey, giving us the output files for day, week, month, and year. Also, added
					a switch statement to acqurie the dy, wk, mo, or yr suffix based on the iteration of the for loop.
					When reading in lines from outsetup, removed PERIOD from the read in because it is unneeded in since
					we are doing all time steps.
					Removed the line SW_Output[k].period = str2period(Str_ToUpper(period, ext)), since we are no longer
					reading in a period.
				in function SW_OUT_close_files need to loop through and close all four time step files for each
					OutKey, determined which file to close based on the iteration of the for loop.
				in function SW_OUT_write_today needed to loop through the code four times for each OutKey, changing
					the period of the output for each iteration. With the for loop, I am also able to pick the
					proper FILE pointer to choose when outputting the data.
				in function average_for needed to loop through the code four times for each OutKey, changing
					the period of the output for each iteration.
				the function str2period is no longer used in the code, but will leave it in the code for now.
	01/17/2013	(clk)	in function SW_OUT_read, created an additional condition that if the keyname was TIMESTEP,
					the code would rescan the line looking for up to 5 strings. The first one would be saved 
					back into keyname, while the other four would be stored in a matrix. These values would be
					the desired timesteps to output. Then you would convert these strings to periods, and store 
					them in an array of integers and keep track of how many timesteps were actually read in.
				The other changes are modifications of the changes made on 01/10/2013. For all the for loops, instead of 
					looping through 4 times, we now loop through for as many times as periods that we read in from the
					TIMESTEP line. Also, in all the switch cases where we increased that value which changed the period
					to the next period, we now use the array of integers that stored the period and move through that with
					each iteration.

Input Files
	01/10/2013	(clk)	Since we are now doing all time steps at the same time, there is no need for four different files.in and outsetup.in,
				therefore, reduced those four into one file.
	01/17/2013	(clk)	In the file outsetup.in added the line:
					TIMESTEP __ __ __ __, where __ is where the desired periods to output would be placed,
					can use all four or just one, so for example,
					TIMESTEP dy yr would output just the daily and yearly results.


(v28) added in a fourth vegetation component, bare ground
SW_VegProd.h
	01/29/2013	(clk) added variable RealD fractionBareGround to now allow for bare ground as a part of the total vegetation.
	01/31/2013	(clk)	added varilabe RealD bareGround_albedo instead of creating a bareGround VegType, because only need albedo and not the other data members

SW_VegProg.c
	01/29/2013	(clk)	changed the read in to account for the extra fractional component in total vegetation, bare ground
					added the variable RealF help_bareGround as a place holder for the sscanf call.
	01/31/2013	(clk)	changed the read in to account for the albedo for bare ground, storing the input in bareGround_albedo
				changed _echo_inits() to now display the bare ground components in logfile.log

SW_Flow_lib.h
	01/31/2013	(clk) added new function, pot_soil_evap_bs()	

SW_Flow_lib.c
	01/31/2013	(clk)	Added new function, pot_soil_evap_bs() to the code. This function is similar to pot_soil_evap() but since it deals with bare ground as the type of vegetation, doesn't need several parameters, i.e. totagb, which also simplifies the function.

SW_Flow.c
	01/31/2013	(clk)	With the addition of a new type of vegetation, bare ground, needed to add a new function call to pot_soil_evap_bs() and create a few new variables:
					RealD lyrEvap_BareGround [MAX_LAYERS] was created,
					RealD soil_evap_rate_bs was created, and initialized at 1.0,
					new function, pot_soil_evap_bs(), is called if fractionBareGround is not zero and there is no snowpack on the ground,
					Added soil_evap_rate_bs to rate_help, and then adjusted soil_evap_rate_bs by rate_help if needed,
					Added call to remove bare-soil evap from swv,
					And added lyrEvap_BareGround into the calculation for SW_Soilwat.evaporation. 
				Also, added SW_W_VegProd.bareGround_albedo*SW_VegProd.fractionBareGround to the paramater in petfunc() that was originally SW_VegProd.grass.albedo*SW_VegProd.fractionGrass + SW_VegProd.shrub.albedo*SW_VegProd.fractionShrub + SW_VegProd.tree.albedo*SW_VegProd.fractionTree


(v28) Bug Correction
SW_Output.c
	02/05/2013	(clk) in the function get_soiltemp(), when determing the period, the code was using SW_Output[eSW_SWCM].period, 
					which needed to be SW_Output[eSW_SoilTemp].period, since we are looking at soil temp, not SWCM.
	01/15/2014	(drs) output period of get_swa() was eSW_SWP instead of eSW_SWA: fixed


(v29) Frozen soil and SoilWater
SW_Flow_lib.h
	03/07/2013	(clk) add new array, lyrFrozen to keep track of whether a certain soil layer is frozen. 1 = frozen, 0 = not frozen.

SW_Flow_lib.c
	03/07/2013	(clk)	In the functions soil_temperature and soil_temperature_init, added code to determine whether or not a soil layer was frozen
							Used the Eitzinger 2000 article, equation 3 to calculate the fusion pool that needed to be accounted for when freezing/thawing since, when freezing/thawing something, the temperature will remain the same until all of that material has froze/thawed. The amount of energy needed to do this is the fusion pool. The the rest of the temperature change can be adjusted from there.
						Also, now that we are incorporating freezing soil layers into the model, needed to account for these frozen layers with the soil water content movement. 
							Needed to adjust the functions infiltrate_water_high(), evap_from_soil(), infiltrate_water_low(), and hydraulic_redistribution()
								Adjusted these function so that they only made changes to the output as long as the current soil layer was not frozen.
								In the case of drainage though, needed to make sure that the layer below the current layer was not frozen, to make sure that the drainage had somewhere to go. This uses the assumption that any soil layer located above a soil layer will not be frozen, since it should always be warm as you go higher.

generic.h
	03/08/2013	(clk) added abs(x) definition, this returns the absolute value of x. If x < 0, returns -x, else returns x.

(v29_2) Frozen soil and SoilWater_version 2
SW_Flow_lib.c
	03/28/2013	(clk) Changed the soil_temperature function to use the actual soil temp values when determining for freezing soils, instead of using the regression values. Since the regression values were no longer being updated when the temperature would change this way, made the function call soil_temperature_init everytime that the soil temperature would change due to freezing/thawing of the soil.
					Also moved the initialization of oldsFusionPool to its own function becuase you are now possibly calling soil_temperature_init multiple times, to adjust the temperatures, and don't want to also initialize the fusion pools again.
	04/04/2013	(clk)	In infiltrate_water_high(), needed to also change the lines
					swc[0] += pptleft;
					(*standingWater) = 0.;
				to only happen when the top soil layer is not frozen.

(v30)	Gravel in the soil
soils.in
	04/16/2013	(clk)	Removed fieldcap and wiltpt inputs
				Added gravel_content (fractional volume of gravel)
				Changed the bulk density to matric density (does not include gravel)

outsetup.in
	04/16/2013	(clk)	added two new output files: vwc_matric, swa_matric
				Also, changed the names of three of the existing outputs: swc->vwc_bulk, swcm->swc_bulk, and swa->swa_bulk

SW_Site.h
	04/16/2013	(clk)	added the variables soilMatric_density and fractionVolBulk_gravel
					soilMatric_density is the soil density excluding the gravel component
					fractionVolBulk_gravel is the gravel content as a fraction of the bulk soil
				renamed many of the of the variables in SW_LAYER_INFO to better reflect BULK and MATRIC values
					due to the renaming, also had to update the use of these variables in the other files.

SW_Site.c
	04/16/2013	(clk)	changed the water_eqn to use the fraction of gravel content in the calculation
				Added the function calculate_soilBulkDensity() which is used to calculate the bulk density of the soil from the inputed matric density. Using eqn 20 from Saxton 2006
					Needed to change the input from soils.in to save to soilMatric_density instead of soilBulk_density
				Changed read_layers() to do a few different things
					First, it now reads in a value for fractionVolBulk_gravel from soils.in
					Secondly, it calls the calculate_soilBulkDensity function for each layer
					Lastly, since fieldcap and wiltpt were removed from soils.in, those values are now calculated within read_layers()

SW_SoilWater.h
	04/16/2013	(clk)	Added the variables vwcMatric, swcMatric, and swaMatric to SW_SOILWAT_OUTPUTS
				Also, renamed a few of the other variables to better reflect MATRIC vs BULK values and SWC vs VWC.
					modified the use of these variables throughout the rest of the code.

SW_SoilWater.c
	04/16/2013	(clk)	Changed SW_SWC_vol2bars() to SW_SWCbulk2SWPmatric(), and changed the code to incorporate the fraction of gravel content in the soil
					theta1 = ... / (1. - fractionVolBulk_gravel)
				Changed SW_SWC_bars2vol() to SW_SWPmatric2VWCBulk(), and changed the code to incorporate the fraction of gravel content in the soil
					t = ... * (1. - fractionVolBulk_gravel)
				Changed SW_SWC_SWCres() to SW_VWCBulkRes(), and changed the code to incorporate the fraction of gravel content in the soil
					res = ... * (1. - fractionVolBulk_gravel)
				Updated the use of these three function in all files

SW_Flow_subs.h
	04/16/2013	(clk)	Changed swpotentl() to SWCbulk2SWPmatric
					the function now requires the fraction of gravel content as a parameter
					Updated the use of swpotentl in other files

SW_Flow.c
	04/16/2013	(clk)	Renamed a lot of the variables to better reflect BULK versus MATRIC values
					updated the use of these variables in all the files

SW_Output.c
	04/16/2013	(clk)	Added three new ouputs: vwcMatric, and swaMatric.
					in the get functions, the calculation is
						(the matric value) = (the bulk value)/(1-fractionVolBulk_gravel)
				Also changed the names of swp->swpMatric, swc->swcBulk, swcm->vwcBulk, and swa->swaBulk

Bug fix:
SW_Site.c
	05/16/2013	(drs)	fixed in _init_site_info() the check of transpiration region validity: it gave error if only one layer was present
SW_Weather.c
	06/21/2013	(DLM)	variable 'tail' got too large by 1 and leaked memory when accessing array runavg_list[] in function _runavg_temp(): changed test from '(tail < SW_Weather.days_in_runavg)' to '(tail < (SW_Weather.days_in_runavg-1))'
						in function _clear_hist_weather() temp_max was tested twice, one should be temp_min
filefuncs.c
	06/21/2013	(DLM)	memory leak in function getfiles(): variables dname and fname need to be free'd
SW_Main.c
	06/24/2013	(rjm)	included "SW_Site.h" and "SW_Weather.h";
						added calls at end of main() to SW_SIT_clear_layers() and SW_WTH_clear_runavg_list() to free memory
SW_Weather.c
	06/24/2013	(rjm) added function void SW_WTH_clear_runavg_list(void) to free memory
SW_Site.c
	06/24/2013	(rjm) added function void SW_SIT_clear_layers(void) to free allocated soil layers
SW_SoilWater.c
	06/26/2013	(rjm)	closed open files at end of functions SW_SWC_read(), _read_hist() or if LogError() with LOGFATAL is called
SW_VegEstab.c
 	06/26/2013	(rjm)	closed open files in function SW_VES_read() or if LogError() with LOGFATAL is called in _read_spp()
SW_Markov.c
 	06/27/2013	(drs)	closed open files if LogError() with LOGFATAL is called in SW_MKV_read_prob(), SW_MKV_read_cov()
SW_Model.c
 	06/27/2013	(drs)	closed open files if LogError() with LOGFATAL is called in SW_MDL_read()
SW_Output.c
 	06/27/2013	(drs)	closed open files if LogError() with LOGFATAL is called in SW_OUT_read()
SW_Site.c
 	06/27/2013	(drs)	closed open files if LogError() with LOGFATAL is called in SW_SIT_read(), _read_layers()
SW_Sky.c
 	06/27/2013	(drs)	closed open files if LogError() with LOGFATAL is called in SW_SKY_read()
SW_VegProd.c
 	06/27/2013	(drs)	closed open files if LogError() with LOGFATAL is called in SW_VPD_read()
SW_Weather.c
 	06/27/2013	(drs)	closed open files if LogError() with LOGFATAL is called in SW_WTH_read(), _read_hist()


Code improvement:
generic.h
	06/19/2013	(dlm)	new (MUCH faster) isequal(), isless2(), ismore(), and iszero() macros which should give a major performance boost (like 4x) to soilwat/stepwat
	06/26/2013 (dlm)	powe(): an alternate definition of pow(x, y) for x>0... this is faster (ca. 20%) then the one in math.h, but comes with a cost as the precision is slightly lower.  The measured precision drop I was getting was at max a relative error of about 100 billion percent (12 places after the decimal point) per calculation though so I don't think it's a big deal... (though it's hard to even accurately tell)
						--> replaced pow() throughout the code with powe()

Code changes to handle SoilWat being repeatedly called as dynamic library:
SW_SoilWater.c
	06/24/2013	(rjm)	made temp_snow a module-level static variable (instead of function-level): otherwise it will not get reset to 0 between consecutive calls as a dynamic library
						need to set temp_snow to 0 in function SW_SWC_construct()
SW_Weather.c
	06/24/2013	(rjm) 	made 'tail' and 'firsttime' a module-level static variable (instead of function-level): otherwise it will not get reset to 0 between consecutive calls as a dynamic library
						need to set these variables to 0 resp TRUE in function SW_WTH_construct()
SW_Flow_lib.c
	06/24/2013	(rjm)	made 'soil_temp_error', 'soil_temp_init' and 'fusion_pool_init' into global variable (instead of module-level) and moved them to SW_Flow.c: otherwise they will not get reset to 0 (in call to construct) between consecutive calls as a dynamic library
SW_Flow.c
	06/24/2013	(rjm)	added 'soil_temp_error', 'soil_temp_init' and 'fusion_pool_init' as global variable
						added function SW_FLW_construct() to init global variables between consecutive calls to SoilWat as dynamic library
SW_Control.c
	06/24/2013	(rjm)	added call to SW_FLW_construct() in function SW_CTL_init_model()


Changes to the Output(TIMESTEP)
SW_Output.c
	07/01/2013	(clk)	Changed the outsetup file so that the TIMESTEP line could be used or not used, depending on the need
						If the TIMESTEP line is not used, need to have an additional column for the period again
					Within the code, changed the timesteps array to be two dimensional, and keep track of the periods to be used
						for each of the outputs. Then, at every for loop that was implemented for the TIMESTEP code, put in 
						place a conditional that will determine which of the four possible periods are to be used for each output.

outsetup_v30_1.in
	07/01/2013	(clk)	Created this outsetup file to test whether the changes will work. This file has no TIMESTEP line and has the period column again.


(v31) Inclusion of Forbs as a vegtype

SW_SoilWater.h
	07/09/2013	(clk)	Added the variables transp_forb, forb_evap, hydred_forb, and forb_int to SW_SOILWAT_OUTPUTS
				Added the variables transpiration_forb, hydred_forb, forb_evap, and forb_int to SW_SOILWAT

SW_VegProd.h
	07/09/2013	(clk)	add the variables forb and fractionForb to SW_VEGPROD

SW_VegProd.c
	07/09/2013	(clk)	added initialization of all the values of the new vegtype variable forb and fractionForb

SW_Site.h
	07/09/2013	(clk)	added the variables transp_coeff_forb, swcBulk_atSWPcrit_forb, and my_transp_rgn_forb to SW_LAYER_INFO
	07/09/2013	(clk)	added the variable n_transp_lyrs_forb to SW_SITE

SW_Site.c
	07/09/2013	(clk)	added the initialization of all the new variables

SW_Flow_lib.h
	07/09/2013	(clk) added two new functions: forb_intercepted_water and forb_EsT_partitioning

SW_Flow_lib.c
	07/09/2013	(clk)	initialized the two new functions: forb_intercepted_water and forb_EsT_partitioning

SW_Flow.c
	07/09/2013	(clk)	with the addition of forbs as a vegtype, needed to add a lot of calls to this code and so basically just copied and pasted the code for the other vegtypes

SW_Output.c
	07/09/2013	(clk)	Added forb to the outputs: transpiration, surface evaporation, interception, and hydraulic redistribution

SW_Defines.h
	07/09/2013	(clk) added the ForEachForbTranspLayer(i) function

sbe_prod_v30.in
	07/09/2013	(clk)	Added all the necessary input variables for the new vegtype forb

soils_v30.in
	07/09/2013	(clk)	Added a column for forb transpiration

Modification to Forb
SW_Flow.c & SW_Output.c
	08/01/2013	(clk) 	Modified the order of calls and output to the proper order: Tree->Shrub->Forb->Grass->BareSoil


Modifications for Establishment to work
SW_VegEstab.c
	08/21/2013	(clk)	changed the line v = SW_VegEstab.parms[ _new_species() ]; -> v = SW_VegEstab.parms[ count ], where count = _new_species();
				for some reason, without this change, a segmenation fault was occuring

SW_Output.c
	08/21/2013	(clk)	Modified the establisment output to actually output for each species and not just the last one in the group.

Estab.in
	08/21/2013	(clk)	To allow the xx.estab files to be in the input folder, changed the listing of the filenames to point to the right place
				for example, changed bromus.estab -> Input/bromus.estab


Bug fix:
SW_Flow.c
	09/26/2013 (drs) records2arrays(): Init hydraulic redistribution to zero; if not used and not initialized, then there could be non-zero values resulting

SW_R_Lib.c/SW_Output.c:
	04/18/2015 (drs) fixed output of forb interception and evaporation

#-----------

--> use Saxton 2006 pedotransfer functions adding organic content
--> use Saxton 2006 hydraulic conductivity: sat and unsaturated
--> replace fgets() in filefuncs.c GetALine() with something safe and make program work with both CRLF and LF end-of-line characters whether compiled on UNIX or Microsoft systems
--> get rid of transpiration regions or not
--> snow adjusted albedo


(v32) DeltaX Modification Implementation

SW_Flow.c
	05/15/2016	(ctd)	Added a function ("tempError") to determine if there are any errors in the calculation of "parts" (line 1770 - SW_Flow_lib.c) and return a boolean if true, or not.
				The function is called within RSoilwat as a means to modify soil layer widths in order to prevent errors. 
SW_Flow_lib.c
	05/15/2016	(ctd)	Modified the error checking for, "parts" so that the error was flagged inside an external struct that corresponds to each layer. **See below**				

SW_SoilWater.h
	05/15/2016	(ctd)	Added field to struct, SW_SOILWAT_OUTPUTS, called "parts" and is used to collect error points in soil layers when there exists an error during the calculation of "parts" (line 1770 - SW_Flow_lib.c).