<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.agrineer.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Agrineer</id>
	<title>agrineer_wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.agrineer.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Agrineer"/>
	<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Special:Contributions/Agrineer"/>
	<updated>2026-05-08T13:06:23Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=ETo_Calculation&amp;diff=602</id>
		<title>ETo Calculation</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=ETo_Calculation&amp;diff=602"/>
		<updated>2026-05-04T18:01:00Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This package calculates standard evapotranspiration data, ETo, for a given sector and merges it into a netCDF file along with WRF precipitation, and temperature data. Refer to [[WRF Hindcast]] for more information on sectors.&lt;br /&gt;
&lt;br /&gt;
The merged file is used as input data for the [[Soil Moisture Estimator]] (SME) application.&lt;br /&gt;
 &lt;br /&gt;
A GUI implementation of the SME is on the Agrineer.org [https://agrineer.org/sme/sme.php website]&lt;br /&gt;
and currently covers about half of the western United States, with a ~3km pixel resolution. &lt;br /&gt;
You can go [https://gitlab.com/agrineer/sme here] to download a command-line version of the SME software.&lt;br /&gt;
&lt;br /&gt;
This package was developed using GNU/Linux Mint 17, but other &lt;br /&gt;
Debian platforms are known to work (Ubuntu 12,14; Mint 18,19).&lt;br /&gt;
&lt;br /&gt;
There are two class/main programs in this package:  &lt;br /&gt;
&lt;br /&gt;
- eto.py -  Calculates standard evapotranspiration (ETo) using Weather, Research, and Forecasting (WRF) model data as input, accumulated hourly per day.&lt;br /&gt;
&lt;br /&gt;
- merge.py - Selectively reads WRF meta and data variables (lat, long, min/max temp, rain) used for ETo calculation in &amp;quot;eto.py&amp;quot; class, then merges these variables with the output ETo data, to be used as input for the SME package. &lt;br /&gt;
&lt;br /&gt;
Data generated daily by Agrineer.org are produced by &amp;quot;merge.py&amp;quot; and serve as input for the SME application. Zipped versions of the daily runs can be found here [https://www.agrineer.org/downloads/sectors.php here].&lt;br /&gt;
&lt;br /&gt;
These programs are provided for review purposes on the data flow. They show how the ETo is calculated and merged with other data. They are made available in case you want to modify and run your own WRF/Eto runs. You can find WRF input namelist files for each sector used [here](https://www.agrineer.org/downloads/sectors.php).&lt;br /&gt;
&lt;br /&gt;
The FAO Penman-Monteith equation for hourly time steps is given below. Equation numbers refer to [http://www.fao.org/docrep/X0490E/x0490e08.htm FAO paper #56, Chapter 4]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;ET_o=\frac{0.408\Delta(R_n-G)+\gamma\frac{37}{T_{hr}+273}u_2(e^o(T_{hr})-e_a)}{\Delta+\gamma(1+0.34u_2)}&amp;lt;/math&amp;gt; (Equation 53)&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;ET_o&amp;lt;/math&amp;gt;   &lt;br /&gt;
|reference evapotranspiration &amp;lt;math&amp;gt;[mm~hour^{-1}]&amp;lt;/math&amp;gt;,&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;R_n&amp;lt;/math&amp;gt;    &lt;br /&gt;
|net radiation at the grass surface &amp;lt;math&amp;gt;[MJ~m^{-2}~hour^{-1}]&amp;lt;/math&amp;gt; (Equation 40),&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;      &lt;br /&gt;
|soil heat flux density &amp;lt;math&amp;gt;[MJ~m^{-2}~hour^{-1}] &amp;lt;/math&amp;gt;(Equations 45 and 46),&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;T_{hr}&amp;lt;/math&amp;gt; &lt;br /&gt;
|mean hourly air temperature at 2 meter height &amp;lt;math&amp;gt;[^{o}C]&amp;lt;/math&amp;gt;,&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; &lt;br /&gt;
|saturation slope vapour pressure curve at &amp;lt;math&amp;gt;T_{hr}~[kPa~^{o}C^{-1}]&amp;lt;/math&amp;gt; (Equation 13),&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; &lt;br /&gt;
|psychrometric constant &amp;lt;math&amp;gt;[kPa~^{o}C^{-1}] &amp;lt;/math&amp;gt;(Equation 8),&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;e^o(T_{hr})&amp;lt;/math&amp;gt; &lt;br /&gt;
|saturation vapour pressure at air temperature &amp;lt;math&amp;gt;T_{hr}~[kPa] &amp;lt;/math&amp;gt; (Equation 11),&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;e_a&amp;lt;/math&amp;gt; &lt;br /&gt;
|average hourly actual vapour pressure &amp;lt;math&amp;gt;[kPa]&amp;lt;/math&amp;gt; (Equation 54),&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;u_2&amp;lt;/math&amp;gt; &lt;br /&gt;
|average hourly wind speed at 2 meter height &amp;lt;math&amp;gt;[m~s^{-1}]&amp;lt;/math&amp;gt;.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=ETo_Calculation&amp;diff=601</id>
		<title>ETo Calculation</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=ETo_Calculation&amp;diff=601"/>
		<updated>2026-05-04T18:00:01Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This package calculates standard evapotranspiration data, ETo, for a given sector and merges it into a netCDF file along with WRF precipitation, and temperature data. Refer to [[WRF Hindcast]] for more information on sectors.&lt;br /&gt;
&lt;br /&gt;
The merged file is used as input data for the [[Soil Moisture Estimator]] (SME) application.&lt;br /&gt;
 &lt;br /&gt;
A GUI implementation of the SME is on the Agrineer.org [https://agrineer.org/sme/sme.php website]&lt;br /&gt;
and currently covers about half of the western United States, with a ~3km pixel resolution. &lt;br /&gt;
You can go [https://gitlab.com/agrineer/sme here] to download a command-line version of the SME software.&lt;br /&gt;
&lt;br /&gt;
This package was developed using GNU/Linux Mint 17, but other &lt;br /&gt;
Debian platforms are known to work (Ubuntu 12,14; Mint 18,19).&lt;br /&gt;
&lt;br /&gt;
There are two class/main programs in this package:  &lt;br /&gt;
&lt;br /&gt;
- eto.py -  Calculates standard evapotranspiration (ETo) using Weather, Research, and Forecasting (WRF) model data as input, accumulated hourly per day.&lt;br /&gt;
&lt;br /&gt;
- merge.py - Selectively reads WRF meta and data variables (lat, long, min/max temp, rain) used for ETo calculation in &amp;quot;eto.py&amp;quot; class, then merges these variables with the output ETo data, to be used as input for the SME package. &lt;br /&gt;
&lt;br /&gt;
Data generated daily by Agrineer.org are produced by &amp;quot;merge.py&amp;quot; and serve as input for the SME application. Zipped versions of the daily runs can be found here [https://www.agrineer.org/downloads/sectors.php here].&lt;br /&gt;
&lt;br /&gt;
These programs are provided for review purposes on the data flow. They show how the ETo is calculated and merged with other data. They are made available in case you want to modify and run your own WRF/Eto runs. You can find WRF input namelist files for each sector used [here](https://www.agrineer.org/downloads/sectors.php).&lt;br /&gt;
&lt;br /&gt;
The FAO Penman-Monteith equation for hourly time steps is given below. Equation numbers refer to [http://www.fao.org/docrep/X0490E/x0490e08.htm FAO paper #56, Chapter 4]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;ET_o=\frac{0.408\Delta(R_n-G)+\gamma\frac{37}{T_{hr}+273}u_2(e^o(T_{hr})-e_a)}{\Delta+\gamma(1+0.34u_2)}&amp;lt;/math&amp;gt; (Equation 53)&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;ET_o&amp;lt;/math&amp;gt;   &lt;br /&gt;
|reference evapotranspiration &amp;lt;math&amp;gt;[mm~hour^{-1}]&amp;lt;/math&amp;gt;,&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;R_n&amp;lt;/math&amp;gt;    &lt;br /&gt;
|net radiation at the grass surface &amp;lt;math&amp;gt;[MJ~m^{-2}~hour^{-1}]&amp;lt;/math&amp;gt; (Equation 40),&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;G&amp;lt;/math&amp;gt;      &lt;br /&gt;
|soil heat flux density &amp;lt;math&amp;gt;[MJ~m^{-2}~hour^{-1}] &amp;lt;/math&amp;gt;(Equations 45 and 46),&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;T_{hr}&amp;lt;/math&amp;gt; &lt;br /&gt;
|mean hourly air temperature at 2 meter height &amp;lt;math&amp;gt;[^{o}C]&amp;lt;/math&amp;gt;,&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; &lt;br /&gt;
|saturation slope vapour pressure curve at &amp;lt;math&amp;gt;T_{hr}~[kPa~°C^{-1}]&amp;lt;/math&amp;gt; (Equation 13),&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; &lt;br /&gt;
|psychrometric constant &amp;lt;math&amp;gt;[kPa~°C^{-1}] &amp;lt;/math&amp;gt;(Equation 8),&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;e^o(T_{hr})&amp;lt;/math&amp;gt; &lt;br /&gt;
|saturation vapour pressure at air temperature &amp;lt;math&amp;gt;T_{hr}~[kPa] &amp;lt;/math&amp;gt; (Equation 11),&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;e_a&amp;lt;/math&amp;gt; &lt;br /&gt;
|average hourly actual vapour pressure &amp;lt;math&amp;gt;[kPa]&amp;lt;/math&amp;gt; (Equation 54),&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;u_2&amp;lt;/math&amp;gt; &lt;br /&gt;
|average hourly wind speed at 2 meter height &amp;lt;math&amp;gt;[m~s^{-1}]&amp;lt;/math&amp;gt;.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Agrineer_wiki:General_disclaimer&amp;diff=598</id>
		<title>Agrineer wiki:General disclaimer</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Agrineer_wiki:General_disclaimer&amp;diff=598"/>
		<updated>2019-12-30T21:16:40Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This website is an educational platform disseminating research ideas and applications. We hope that the user can benefit from the software and hardware sources provided but we do not take any responsibility for the consequences of decisions based on data released or on the results given in our applications.&lt;br /&gt;
&lt;br /&gt;
Licenses&lt;br /&gt;
&lt;br /&gt;
    Software - All computer source code published by Agrineer.org is free software. You may redistribute them and/or modify them under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. These programs are distributed in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details at [https://www.gnu.org/licenses/gpl-3.0-standalone.html GPLv3 License]. External software referred to may carry their own licenses.&lt;br /&gt;
&lt;br /&gt;
    Hardware - Published documentation describing hardware designed by Agrineer.org is licensed under the CERN OHL v.1.2. You may redistribute and modify this documentation under the terms of the [https://en.wikipedia.org/wiki/CERN_Open_Hardware_Licence CERN OHL v.1.2 License].&lt;br /&gt;
&lt;br /&gt;
    Data - Published data generated by Agrineer.org may be re-distributed only if attribution is given to &amp;quot;Agrineer.org, a division of IndieCompLabs,LLC.&amp;quot;, and that the restrictions below are explicitly reiterated and enforced.&lt;br /&gt;
&lt;br /&gt;
    Downloading our data files means you agree NOT to:&lt;br /&gt;
&lt;br /&gt;
        * make the data available for a charge.&lt;br /&gt;
        * compile into databases or websites to which only registered members or customers can have access.&lt;br /&gt;
        * use a proprietary or closed technology or encryption which creates a barrier for open access to the data and to the application software source code.&lt;br /&gt;
        * copyright forbidding (or obfuscating) re-use of the data, including the use of &amp;quot;no derivatives&amp;quot; requirements.&lt;br /&gt;
        * patent forbidding re-use of the data (for example the 3-dimensional coordinates of some experimental protein structures have been patented).&lt;br /&gt;
        * restrict the use of robots to websites, with preference to certain search engines.&lt;br /&gt;
        * aggregate data into &amp;quot;databases&amp;quot; which may be covered by &amp;quot;database rights&amp;quot; or &amp;quot;database directives&amp;quot; (e.g. Directive on the legal protection of databases).&lt;br /&gt;
        * time-limit access to resources such as e-journals (which on traditional print were available to the purchaser indefinitely).&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Main_Page&amp;diff=597</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Main_Page&amp;diff=597"/>
		<updated>2019-12-28T19:59:00Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Project Status */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;strong&amp;gt;Welcome to Agrineer.org&#039;s main wiki page.&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This wiki provides documentation and development reports of Agrineer&#039;s projects. Use the navigation panel on the left to visit our projects&#039; descriptions and documentation. More information regarding Agrineer&#039;s  philosophy, goals, and structure can be found [[Agrineer.org_Wiki:About|here]].  &lt;br /&gt;
&lt;br /&gt;
== Project Status ==&lt;br /&gt;
   Project                       Status                   Notes &amp;lt;br&amp;gt;&lt;br /&gt;
   [[WRF Hindcast]]                   operational          back-end, daily uploads to server&lt;br /&gt;
   [[ETo Calculation]]                under review         used in Soil Moisture Estimator&lt;br /&gt;
   [[Agrineer Package]]               operational          class used to interface weather data&lt;br /&gt;
   [[Grow Degree Calculator]]         operational          grow degrees units&lt;br /&gt;
   [[Soil Moisture Estimator]]        operational          currently using Sacramento SMA&lt;br /&gt;
   [[Sacramento SMA]]                 operational          backend C program for SME&lt;br /&gt;
   [[Soil Moisture Radar]]            under development    hardware/software GPS bi-static&lt;br /&gt;
   Soil Moisture TDR              under development    hardware/software soil reflectometry&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Main_Page&amp;diff=596</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Main_Page&amp;diff=596"/>
		<updated>2019-12-28T19:58:04Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Project Status */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;strong&amp;gt;Welcome to Agrineer.org&#039;s main wiki page.&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This wiki provides documentation and development reports of Agrineer&#039;s projects. Use the navigation panel on the left to visit our projects&#039; descriptions and documentation. More information regarding Agrineer&#039;s  philosophy, goals, and structure can be found [[Agrineer.org_Wiki:About|here]].  &lt;br /&gt;
&lt;br /&gt;
== Project Status ==&lt;br /&gt;
   Project                       Status                   Notes &amp;lt;br&amp;gt;&lt;br /&gt;
   [[WRF Hindcast]]                   operational          back-end, daily uploads to server&lt;br /&gt;
   [[ETo Calculation]]                operational          used in Soil Moisture Estimator&lt;br /&gt;
   [[Agrineer Package]]               operational          class used to interface weather data&lt;br /&gt;
   [[Grow Degree Calculator]]         operational          grow degrees units&lt;br /&gt;
   [[Soil Moisture Estimator]]        operational          currently using Sacramento SMA&lt;br /&gt;
   [[Sacramento SMA]]                 operational          backend C program for SME&lt;br /&gt;
   [[Soil Moisture Radar]]            under development    hardware/software GPS bi-static&lt;br /&gt;
   Soil Moisture TDR              under development    hardware/software soil reflectometry&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=SME_FAQ&amp;diff=595</id>
		<title>SME FAQ</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=SME_FAQ&amp;diff=595"/>
		<updated>2019-01-28T23:52:12Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Frequently Asked Questions for the Soil Moisture Estimator&lt;br /&gt;
== I am a county extension agent. How can I use the SME to help the farmers in my county? ==&lt;br /&gt;
&lt;br /&gt;
Ideally, an extension office would have a catalogue of working crop coefficients and soil attributes for local farms. &lt;br /&gt;
The farmer would use the SME with these input files, along with irrigation events, to monitor a crop&#039;s water usage throughout the growing season.&lt;br /&gt;
&lt;br /&gt;
Presently, we are in the initial stages of exercising the SME in the field and so we ask extension agents to:&lt;br /&gt;
&lt;br /&gt;
- get familiar with the SME tool. Learn how to construct input files and how to use the output files (eg. import into spreadsheets).&lt;br /&gt;
&lt;br /&gt;
- get local rain data and compare with the WRF model rain data. We are interested in compiling wide-scale data for analysis. Sharing comparison data with us would help in model adjustments. &lt;br /&gt;
&lt;br /&gt;
- compile a set of input files of local crop cultivars and associated coefficients.  See this link.(not yet active)&lt;br /&gt;
&lt;br /&gt;
- show farmers how to derive soil attributes used in the soil model. See this link.(not yet active)&lt;br /&gt;
&lt;br /&gt;
- ask farmers with soil moisture sensors to use the SME and share their experience. We actively seek the participation of farmer-scientists for feedback.&lt;br /&gt;
&lt;br /&gt;
Assuming a set of working input files, a useful exercise for farmers is to review the past growing season using different irrigation schedules to see how the soil responds. Crops can also be changed to see what their water usage would have been. See the question below.&lt;br /&gt;
&lt;br /&gt;
== I am an irrigation specialist at a large farm. How can I use the SME ? ==&lt;br /&gt;
&lt;br /&gt;
The purpose of the SME is to provide a working estimate of water usage for different crops and soils. This allows for general monitoring of soil moisture and to apply irrigations as needed to avoid plant stress. &lt;br /&gt;
&lt;br /&gt;
Because the SME can be run historically, it is possible for the irrigation specialist to run &amp;quot;what if&amp;quot; scenarios. &lt;br /&gt;
For example,&lt;br /&gt;
&lt;br /&gt;
- What if the crop was different, how much water would that crop have used in our soil? &lt;br /&gt;
&lt;br /&gt;
- What if I irrigated small amounts more often or large amounts less often? Is there a sweet spot between the two?&lt;br /&gt;
&lt;br /&gt;
- What is the optimal irrigation amount to give available water to roots and not drain excessively beyond the root zone? &lt;br /&gt;
&lt;br /&gt;
The SME, with working parameters, can be used to address and give insight to the above questions.&lt;br /&gt;
&lt;br /&gt;
== I am an agricultural professor. How can I use the SME? ==&lt;br /&gt;
Here are some ways to use the SME: &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
- show your students the website tools and indicate that source code is available for review and improvements.&lt;br /&gt;
&lt;br /&gt;
- incorporate the tools into classroom lectures/exercises/labs for critique. We would appreciate feedback on usage.&lt;br /&gt;
&lt;br /&gt;
- suggest projects/studies to students regarding comparison with data (soil moisture, ETo, ETc, precipitation, etc.) from research stations currently covered geographically. &lt;br /&gt;
&lt;br /&gt;
- generate WRF data for areas of interest (sectors). See below on generating data.&lt;br /&gt;
&lt;br /&gt;
- consider implementing other backend soil moisture models for research and comparison purposes.&lt;br /&gt;
&lt;br /&gt;
== I am an agricultural student with programming skills. How can I use the SME? ==&lt;br /&gt;
Here are some ways to use the SME: &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- download and install the code from our [https://gitlab.com.agrineer repository] and exercise the command line versions of GDC and SME.  Learn the processing stream on a local platform to get familiar with the model. You do not need to generate data as it can be downloaded. Linux navigation skills are required. &lt;br /&gt;
&lt;br /&gt;
- inspect, in detail, parts of the model code that are of interest to you and look for improvements. For example, look at the [https://gitlab.com/agrineer/eto ETo] code and improve on relative humidity calculations, or you could implement crop coefficients using smooth curves, instead of discrete steps. There are many aspects of the implementation stream that are interesting and improvable. This type of exploration gives a student an in depth understanding of modelling. Python/NumPy programming skills are required.&lt;br /&gt;
&lt;br /&gt;
- compile and compare aspects of predicted and sensed data for local areas, eg. How close is historical WRF modelled rain to measured rain in your pixel (area)? Many components can be compared that would be available with regular weather sensors, such as temperatures, relative humidity and wind speed.&lt;br /&gt;
&lt;br /&gt;
- graduate endeavours could include long term studies to compare sensed soil moisture to different SME outputs with various parameters, ie.crop coefficients, soil descriptions, etc.&lt;br /&gt;
&lt;br /&gt;
- consider implementing other backend soil moisture models for research and comparison purposes.&lt;br /&gt;
&lt;br /&gt;
- become the administrator for data contribution for a sector. See below.&lt;br /&gt;
&lt;br /&gt;
== I do not see a sector defined that I am interested in. Can I generate data for that sector? ==&lt;br /&gt;
&lt;br /&gt;
Yes.&lt;br /&gt;
&lt;br /&gt;
We currently cover only half of the western US and invite data contributions from third parties. We have released a Docker file package for container implementation of the data generation, where necessary code is automatically downloaded and bundled for use. All software is free. This requires a Docker friendly platform, with multi-core CPU, and of course somebody to maintain it (eg. check that data gets delivered, etc.). We have tested the container on a Linux platform, but not yet on Macs or Windows. The computer does not need to be dedicated to generate the data, as only ~4hrs is used per sector per day. Docker claims it should work on Mac and Windows.&lt;br /&gt;
&lt;br /&gt;
== Can I download the input and output files from an SME run? ==&lt;br /&gt;
Yes. Click on the &amp;quot;Download&amp;quot; checkbox next to the &amp;quot;Apply&amp;quot; button. You will be asked where to download the zipped file containing all input and output files.&lt;br /&gt;
&lt;br /&gt;
== Your model is historically based using WRF in hindcast mode. Can the SME run in forecast mode? ==&lt;br /&gt;
Yes, and it would be useful in deciding near future irrigation scheduling for harvest, market, and efficiency purposes.&lt;br /&gt;
&lt;br /&gt;
It would only require a small modification to the GFS ingestion. All other aspects would remain the same. The forecast implementation requires WRF data generation into the future for some interested amount of time. So, instead of using reanalyzed GFS files the model would use predicted forecast GFS files. &lt;br /&gt;
&lt;br /&gt;
It would also be possible to merge both hindcast and forecast data for an SME run. So, data contributions could be based on either hindcast (yesterday and before) and/or some number of days into future, including today. Daily forecast files would incrementally be replaced with the hindcast, reanalyzed, version. However, the addition of future days would dramatically increase the need for data contributions. For example, if we wanted to predict seven days into the future it would take 8 data contributions per sector per day: 1 hindcast + 7 future days, as opposed to just 1 hindcast contributor per sector per day. Implementing this &amp;quot;merged&amp;quot; version is possible with enough data contributors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
== How do I setup the input files for the SME tool? == &lt;br /&gt;
== Where can I find crop coefficients? == &lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=SME_FAQ&amp;diff=594</id>
		<title>SME FAQ</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=SME_FAQ&amp;diff=594"/>
		<updated>2019-01-28T23:46:01Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Frequently Asked Questions for the Soil Moisture Estimator&lt;br /&gt;
== I am a county extension agent. How can I use the SME to help the farmers in my county? ==&lt;br /&gt;
&lt;br /&gt;
Ideally, an extension office would have a catalogue of working crop coefficients and soil attributes for local farms. &lt;br /&gt;
The farmer would use the SME with these input files, along with irrigation events, to monitor a crop&#039;s water usage throughout the growing season.&lt;br /&gt;
&lt;br /&gt;
Presently, we are in the initial stages of exercising the SME in the field and so we ask extension agents to:&lt;br /&gt;
&lt;br /&gt;
- get familiar with the SME tool. Learn how to construct input files and how to use the output files (eg. import into spreadsheets).&lt;br /&gt;
&lt;br /&gt;
- get local rain data and compare with the WRF model rain data. We are interested in compiling wide-scale data for analysis. Sharing comparison data with us would help in model adjustments. &lt;br /&gt;
&lt;br /&gt;
- compile a set of input files of local crop cultivars and associated coefficients.  See this link.(not yet active)&lt;br /&gt;
&lt;br /&gt;
- show farmers how to derive soil attributes used in the soil model. See this link.(not yet active)&lt;br /&gt;
&lt;br /&gt;
- ask farmers with soil moisture sensors to use the SME and share their experience. We actively seek the participation of farmer-scientists for feedback.&lt;br /&gt;
&lt;br /&gt;
Assuming a set of working input files, a useful exercise for farmers is to review the past growing season using different irrigation schedules to see how the soil responds. Crops can also be changed to see what their water usage would have been. See the question below.&lt;br /&gt;
&lt;br /&gt;
== I am an irrigation specialist at a large farm. How can I use the SME ? ==&lt;br /&gt;
&lt;br /&gt;
The purpose of the SME is to provide a working estimate of water usage for different crops and soils. This allows for general monitoring of soil moisture and to apply irrigations as needed to avoid plant stress. &lt;br /&gt;
&lt;br /&gt;
Because the SME can be run historically, it is possible for the irrigation specialist to run &amp;quot;what if&amp;quot; scenarios. &lt;br /&gt;
For example,&lt;br /&gt;
&lt;br /&gt;
- What if the crop was different, how much water would that crop have used in our soil? &lt;br /&gt;
&lt;br /&gt;
- What if I irrigated small amounts more often or large amounts less often? Is there a sweet spot between the two?&lt;br /&gt;
&lt;br /&gt;
- What is the optimal irrigation amount to give available water to roots and not drain excessively beyond the root zone? &lt;br /&gt;
&lt;br /&gt;
The SME, with working parameters, can be used to address and give insight to the above questions.&lt;br /&gt;
&lt;br /&gt;
== I am an agricultural professor. How can I use the SME? ==&lt;br /&gt;
Here are some ways to use the SME: &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
- show your students the website tools and indicate that source code is available for review and improvements.&lt;br /&gt;
&lt;br /&gt;
- incorporate the tools into classroom lectures/exercises/labs for critique. We would appreciate feedback on usage.&lt;br /&gt;
&lt;br /&gt;
- suggest projects/studies to students regarding comparison with data (soil moisture, ETo, ETc, precipitation, etc.) from research stations currently covered geographically. &lt;br /&gt;
&lt;br /&gt;
- generate WRF data for areas of interest (sectors). See below on generating data.&lt;br /&gt;
&lt;br /&gt;
- consider implementing other backend soil moisture models for research and comparison purposes.&lt;br /&gt;
&lt;br /&gt;
== I am an agricultural student with programming skills. How can I use the SME? ==&lt;br /&gt;
Here are some ways to use the SME: &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- download and install the code from our [https://gitlab.com.agrineer repository] and exercise the command line versions of GDC and SME.  Learn the processing stream on a local platform to get familiar with the model. You do not need to generate data as it can be downloaded. Linux navigation skills are required. &lt;br /&gt;
&lt;br /&gt;
- inspect, in detail, parts of the model code that are of interest to you and look for improvements. For example, look at the [https://gitlab.com/agrineer/eto ETo] code and improve on relative humidity calculations, or you could implement crop coefficients using smooth curves, instead of discrete steps. There are many aspects of the implementation stream that are interesting and improvable. This type of explore gives a student an in depth understanding of modelling. Python/NumPy programming skills are required.&lt;br /&gt;
&lt;br /&gt;
- compile and compare aspects of predicted and sensed data for local areas, eg. How close is historical WRF modelled rain to measured rain in your pixel (area)? Many components can be compared that would be available with regular weather sensors, such as temperatures, relative humidity and wind speed.&lt;br /&gt;
&lt;br /&gt;
- graduate endeavours could include long term studies to compare sensed soil moisture to different SME outputs with various parameters, ie.crop coefficients, soil descriptions, etc.&lt;br /&gt;
&lt;br /&gt;
- consider implementing other backend soil moisture models for research and comparison purposes.&lt;br /&gt;
&lt;br /&gt;
- become the administrator for data contribution for a sector. See below.&lt;br /&gt;
&lt;br /&gt;
== I do not see a sector defined that I am interested in. Can I generate data for that sector? ==&lt;br /&gt;
&lt;br /&gt;
Yes.&lt;br /&gt;
&lt;br /&gt;
We currently cover only half of the western US and invite data contributions from third parties. We have released a Docker file package for container implementation of the data generation, where necessary code is automatically downloaded and bundled for use. All software is free. This requires a Docker friendly platform, with multi-core CPU, and of course somebody to maintain it (eg. check that data gets delivered, etc.). We have tested the container on a Linux platform, but not yet on Macs or Windows. The computer does not need to be dedicated to generate the data, as only ~4hrs is used per sector per day. Docker claims it should work on Mac and Windows.&lt;br /&gt;
&lt;br /&gt;
== Can I download the input and output files from an SME run? ==&lt;br /&gt;
Yes. Click on the &amp;quot;Download&amp;quot; checkbox next to the &amp;quot;Apply&amp;quot; button. You will be asked where to download the zipped file containing all input and output files.&lt;br /&gt;
&lt;br /&gt;
== Your model is historically based using WRF in hindcast mode. Can the SME run in forecast mode? ==&lt;br /&gt;
Yes, and it would be useful in deciding near future irrigation scheduling for harvest, market, and efficiency purposes.&lt;br /&gt;
&lt;br /&gt;
It would only require a small modification to the GFS ingestion. All other aspects would remain the same. The forecast implementation requires WRF data generation into the future for some interested amount of time. So, instead of using reanalyzed GFS files the model would use predicted forecast GFS files. &lt;br /&gt;
&lt;br /&gt;
It would also be possible to merge both hindcast and forecast data for an SME run. So, data contributions could be based on either hindcast (yesterday and before) and/or some number of days into future, including today. Daily forecast files would incrementally be replaced with the hindcast, reanalyzed, version. However, the addition of future days would dramatically increase the need for data contributions. For example, if we wanted to predict seven days into the future it would take 8 data contributions per sector per day: 1 hindcast + 7 future days, as opposed to just 1 hindcast contributor per sector per day. Implementing this &amp;quot;merged&amp;quot; version is possible with enough data contributors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
== How do I setup the input files for the SME tool? == &lt;br /&gt;
== Where can I find crop coefficients? == &lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=593</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=593"/>
		<updated>2019-01-28T21:57:03Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The first two are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the &amp;quot;Sacramento&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the &amp;quot;sacramento&amp;quot; directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
  [FILES]&lt;br /&gt;
  loads = /home/agrineer/sma/input/loads.csv&lt;br /&gt;
  soil = /home/agrineer/sma/input/soil.csv&lt;br /&gt;
  output = /home/agrineer/sma/output/output.csv&lt;br /&gt;
  rain = /home/agrineer/sma/input/rain.csv&lt;br /&gt;
  irr = /home/agrineer/sma/input/irr.csv&lt;br /&gt;
&lt;br /&gt;
Note that when the sme.py invokes the SMA module the SMA configuration file is constructed on the fly, based on SME data and configuration input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameter input files in the SME configuration file.&lt;br /&gt;
&lt;br /&gt;
For example, to reference the SMA with parameters in the sme.py, the SME configuration file might have:&lt;br /&gt;
&lt;br /&gt;
  [SoilModel]&lt;br /&gt;
  model = SMA&lt;br /&gt;
  &lt;br /&gt;
  [SMA]&lt;br /&gt;
  program = /home/agrineer/sme/sme/sma&lt;br /&gt;
  soil = /home/agrineer/sme/tmp/soil.csv&lt;br /&gt;
  rain = /home/agrineer/sme/tmp/rain.csv&lt;br /&gt;
  irr = /home/agrineer/sme/tmp/irr.csv&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;loads&amp;quot; file (data) would be generated by the WRF model data and ETo calculations and then submitted to the SMA program.&lt;br /&gt;
&lt;br /&gt;
Note that the web SME tool constructs the configuration file for the sme.py program as above. See the SME description [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
All input files are text based with comma separable variables (.csv). These files can be are read by spreadsheets for presentation and general analysis purposes.&lt;br /&gt;
&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
The &amp;quot;loads&amp;quot; input file consists of a title line followed by value lines. Line values are comma separated (CSV) and the values are for date, precipitation, and ETc. Precipitation and ETc values are given in millimeters. For example,&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
  Date,P,E &lt;br /&gt;
  2018-01-02,0.00,1.0348 &lt;br /&gt;
  2018-01-03,0.00,0.8603 &lt;br /&gt;
  2018-01-04,0.00,0.8630 &lt;br /&gt;
  . &lt;br /&gt;
  . &lt;br /&gt;
  .&lt;br /&gt;
&lt;br /&gt;
Currently, comments cannot be placed above the title line.&lt;br /&gt;
Note that the precipitation values normally originate from the WRF model and can be overridden by local data input.&lt;br /&gt;
&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;soil&amp;quot; input file contains comma separated values (CSV) consisting of just a title line and a value line.&lt;br /&gt;
&lt;br /&gt;
The value line has values consisting of:&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
    soil    - given soil name (string)&lt;br /&gt;
&lt;br /&gt;
    comment - make a comment (string)&lt;br /&gt;
&lt;br /&gt;
    uztwm   - upper layer (zone) tension water maximum capacity, mm. &lt;br /&gt;
              The maximum volume of water (normalized to mm) held by the &lt;br /&gt;
              upper zone between field capacity and the wilting point which can &lt;br /&gt;
              be lost by direct evaporation and transpiration from soil. This &lt;br /&gt;
              storage is filled before any water in the upper zone is transferred &lt;br /&gt;
              to other storages. Use field capacity and wilt point water content &lt;br /&gt;
              ratios to determine normalized volume (mm) for some depth. ie. &lt;br /&gt;
              (Ofc - Owp)*depth = uztwm (max et storage capacity).&lt;br /&gt;
&lt;br /&gt;
    uzfwm   - upper layer free water maximum capacity, mm. This storage is the &lt;br /&gt;
              source of water for interflow and the driving force for &lt;br /&gt;
              transferring water to deeper depths.&lt;br /&gt;
&lt;br /&gt;
    uzk     - interflow depletion rate from the upper layer free water storage, &lt;br /&gt;
              uzfwm per day. That is, lateral drainage rate of upper zone &lt;br /&gt;
              free water expressed as a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    pctim   - permanent impervious area fraction of the catchment which &lt;br /&gt;
              produces impervious runoff during low flow conditions.&lt;br /&gt;
&lt;br /&gt;
    adimp   - maximum fraction of an additional impervious area due to &lt;br /&gt;
              saturation. That is, the additional fraction of the catchment &lt;br /&gt;
              which exhibits impervious characteristics when the catchment&#039;s&lt;br /&gt;
              tension water requirements are met.&lt;br /&gt;
&lt;br /&gt;
    perc    - maximum percolation rate coefficient (from upper zone free &lt;br /&gt;
              water into the lower zone).&lt;br /&gt;
&lt;br /&gt;
    rexp    - shape parameter of the percolation curve. An exponent &lt;br /&gt;
              determining the rate of change of the percolation &lt;br /&gt;
              rate with changing lower zone water contents.&lt;br /&gt;
&lt;br /&gt;
    lztwm   - lower layer tension water maximum capacity, mm. Water from &lt;br /&gt;
              this store can only be removed through transpiration.&lt;br /&gt;
&lt;br /&gt;
    lzfsm   - lower layer supplemental free water maximum capacity, mm. &lt;br /&gt;
              The maximum volume from which supplemental baseflow can be drawn.&lt;br /&gt;
&lt;br /&gt;
    lzfpm   - lower layer primary free water maximum capacity, mm. The maximum&lt;br /&gt;
              capacity from which primary base flow can be drawn.&lt;br /&gt;
&lt;br /&gt;
    lzsk    - depletion rate of the lower layer supplemental &lt;br /&gt;
              free water storage, lzfsm per day. That is, lateral drainage rate&lt;br /&gt;
              of lower zone supplemental free water expressed as&lt;br /&gt;
              a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    lzpk    - depletion rate of the lower layer primary free water storage, &lt;br /&gt;
              lzfpm, per day. That is, lateral drainage rate of lower zone &lt;br /&gt;
              primary free water expressed as a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    pfree   - percolation fraction that goes directly to the lower layer free &lt;br /&gt;
              water storages. Direct percolation fraction from upper to &lt;br /&gt;
              lower zone free water (the percentage of percolated &lt;br /&gt;
              water which is available to the lower zone free water &lt;br /&gt;
              before all lower zone tension water deficiencies are satisfied).&lt;br /&gt;
&lt;br /&gt;
    uztwc_0 - initial upper zone tension water content as proportion of ‘uztwm’&lt;br /&gt;
&lt;br /&gt;
    uzfwc_0 - initial upper zone free water content as proportion of ‘uzfwm&#039;&lt;br /&gt;
&lt;br /&gt;
    lztwc_0 - initial lower zone tension water content as proportion of ‘lztwm’&lt;br /&gt;
&lt;br /&gt;
    lzfsc_0 - initial lower zone free water secondary as proportion of ‘lzfsm’&lt;br /&gt;
&lt;br /&gt;
    lzfpc_0 - initial lower zone free water primary as proportion of ‘lzfpm’&lt;br /&gt;
&lt;br /&gt;
    adimc_0 - initial additional impervious flow store, as proportion of ‘uztwm+lztwm’&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Value ranges and default values from different studies:&lt;br /&gt;
&lt;br /&gt;
            | Blasone et. al.(2008)  |   Surrgo (2004) |  default   | units&lt;br /&gt;
    uztwm   |        1-150           |    10-300       |   50.1     | mm&lt;br /&gt;
    uzfwm   |        1-150           |     5-150       |   40.2     | mm&lt;br /&gt;
    uzk     |      0.1-0.5           |  0.10-0.75      |   0.1      | frac/day&lt;br /&gt;
    pctim   | 0.000001-0.1           |     N/A         |   0.000001 | none&lt;br /&gt;
    adimp   |        0-0.4           |     N/A         |   0.0      | none&lt;br /&gt;
    zperc   |        1-250           |     5-350       |   1.0      | none&lt;br /&gt;
    rexp    |        0-5             |     1-5         |   0.0      | none&lt;br /&gt;
    lztwm   |        1-500           |    10-500       | 250.0      | mm&lt;br /&gt;
    lzfsm   |        1-1000          |     5-400       | 500.0      | mm&lt;br /&gt;
    lzfpm   |        1-1000          |    10-1000      | 500.0      | mm&lt;br /&gt;
    lzsk    |     0.01-0.25          |  0.01-0.35      |   0.01     | frac/day&lt;br /&gt;
    lzpk    |   0.0001-0.25          | 0.001-0.05      |   0.1      | frac/day&lt;br /&gt;
    pfree   |        0-0.6           |   0.0-0.8       |   0.1      | none&lt;br /&gt;
&lt;br /&gt;
Soil input file example:&lt;br /&gt;
soil,comment,uztwm,uzfwm,uzk,pctim,adimp,zperc,rexp,lztwm,lzfsm,lzfpm,lzsk,lzpk,pfree,uztwc_0,uzfwc_0,lztwc_0,lzfsc_0,lzfpc_0,adimc_0&lt;br /&gt;
soil_default,demo purposes,50.1,40.2,0.1,0.000001,0.0,1.0,0.0,250.0,500.0,500.0,0.01,0.1,0.1,0.5,0.5,0.5,0.5,0.5,0.&lt;br /&gt;
&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
The input file &amp;quot;rain&amp;quot; consists of a title line and value lines with comma separated values (CSV). The values are a date followed by the value in millimeters. Use this file to give local rain events. For example,&lt;br /&gt;
&lt;br /&gt;
   Date,Rain (mm)&lt;br /&gt;
   2018-01-14,11.67&lt;br /&gt;
   2018-01-15,17.27&lt;br /&gt;
   2018-01-17,0.73&lt;br /&gt;
        .&lt;br /&gt;
        .&lt;br /&gt;
        .&lt;br /&gt;
Providing this file will override the WRF rain values given in the &amp;quot;loads&amp;quot; input file.&lt;br /&gt;
&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
The input file &amp;quot;irr&amp;quot; consists of a title line and value lines with comma separated values (CSV). The values are a date followed by the value in millimeters. Use this file to give irrigation dates. For example,&lt;br /&gt;
&lt;br /&gt;
    Date,Irrigation (mm)&lt;br /&gt;
    2018-01-10,10.0&lt;br /&gt;
    2018-01-20,10.0&lt;br /&gt;
    2018-01-30,10.0&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
&lt;br /&gt;
== Output File ==&lt;br /&gt;
The output file has a title line followed by value lines. All lines are in CSV format.&lt;br /&gt;
&lt;br /&gt;
The title line looks like:&lt;br /&gt;
    Date,U,uztwc,uzfwc,lztwc,lzfsc,lzfpc,adimc,sett,se1,se3,se4,se5,roimp,sdro,ssur,sif,bfp,bfs,bfcc&lt;br /&gt;
&lt;br /&gt;
A value line consists of:&lt;br /&gt;
     Date   - daily time stamp&lt;br /&gt;
     U      - the simulated effective rainfall (“total channel inflow”)&lt;br /&gt;
     uztwc  - upper zone tension water content&lt;br /&gt;
     uzfwc  - upper zone free water content&lt;br /&gt;
     lztwc  - lower zone tension water content&lt;br /&gt;
     lzfsc  - lower zone free secondary water content&lt;br /&gt;
     lzfpc  - lower zone free primary water content&lt;br /&gt;
     adimc  - tension water contents of the additional impervious area&lt;br /&gt;
     sett   - cumulative total evapotranspiration&lt;br /&gt;
     se1    - cumulative evapotranspiration from upper zone tension water&lt;br /&gt;
     se3    - cumulative evapotranspiration from lower zone tension water&lt;br /&gt;
     se4    - cumulative evapotranspiration&lt;br /&gt;
     se5    - cumulative evapotranspiration from riparian zone&lt;br /&gt;
     roimp  - runoff from impervious area&lt;br /&gt;
     sdro   - six hour sum of runoff&lt;br /&gt;
     ssur   - surface runoff&lt;br /&gt;
     sif    - interflow&lt;br /&gt;
     bfp    - primary baseflow&lt;br /&gt;
     bfs    - secondary baseflow&lt;br /&gt;
     bfcc   - channel baseflow (bfp+bfs)&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Some links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator&amp;diff=592</id>
		<title>Soil Moisture Estimator</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator&amp;diff=592"/>
		<updated>2019-01-28T02:14:45Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* 6 images: ETo 3.3km, 10km, 30km; Precipitation 3.3km, 10km, 30km */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Soil Moisture Estimator (SME) is a numerically based program which estimates water usage on a crop basis.&lt;br /&gt;
It is designed for world-wide coverage, currently at 3km resolution, with customization for local crops, soil, irrigation, and rain events. &lt;br /&gt;
&lt;br /&gt;
[[File:Smehowto4.png|300px|thumb|right|Soil Moisture Estimator application.]]&lt;br /&gt;
&lt;br /&gt;
== Intent ==&lt;br /&gt;
&lt;br /&gt;
Our intent is to create a community based, hydrological atmosphere-soil model platform that is large scale, yet customizable for local environments and crops, with the aim to improve agricultural water management.&lt;br /&gt;
&lt;br /&gt;
* Our short term goal is to introduce to interested parties the computational platform that we have developed. &lt;br /&gt;
  - The SME is open-sourced and therefore easily reviewed by users and developers for errors and improvements.&lt;br /&gt;
&lt;br /&gt;
* Our intermediate goal is to develop reliable methods to integrate soil moisture sensor data into the computational platform.&lt;br /&gt;
  - This includes developing and integrating open-source moisture sensor and acquisition stations.&lt;br /&gt;
* Our long-term goal is to apply lessons learned whereby parameters can be adjusted for local conditions. &lt;br /&gt;
  - Estimating soil moisture numerically is a difficult task. Our approach is to lay a theoretical baseline and then heuristically adjust according to local conditions.&lt;br /&gt;
&lt;br /&gt;
The SME is available as a web [https://agrineer.org/sme/sme.php application] or as a stand alone, command line, program which can be downloaded [https://gitlab.com/agrineer/sme here] and used on GNU/Linux systems.&lt;br /&gt;
&lt;br /&gt;
Note: This is an educational platform disseminating research ideas and applications. We hope that the user can benefit from the software and hardware sources provided but we do not take any responsibility for the consequences of decisions based on data released or on the results given in our applications. See the footer disclaimer for more information.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
The Soil Moisture Estimator (SME) package contains two components.&lt;br /&gt;
&lt;br /&gt;
One component is the &amp;quot;sme.py&amp;quot; program which coordinates the required data for the other component, a specified soil moisture model, which is modular.&lt;br /&gt;
&lt;br /&gt;
We initiate this package with the well-studied [[Sacramento SMA | Sacramento Soil Moisture Accounting]] (SMA) method as the back-end soil moisture model. Other soil moisture models will be available in the future.&lt;br /&gt;
&lt;br /&gt;
=== Implementation Stream ===&lt;br /&gt;
&lt;br /&gt;
Briefly, the implementation stream looks like this:  &lt;br /&gt;
&lt;br /&gt;
Modelled Weather -&amp;gt; Large Scale ETo -&amp;gt; Local ETc/Soil/Rain/Irr -&amp;gt; Soil Moisture&lt;br /&gt;
&lt;br /&gt;
This initial release uses reanalyzed [https://www.ncdc.noaa.gov/data-access/model-data/model-datasets/global-forcast-system-gfs Global Forecast System] (GFS) data as input to the [[WRF Hindcast | Weather, Research and Forecast]] (WRF) model to produce modelled, hindcast weather data; although other models and input data can be used, including forecast data. Current spatial resolution is about 3km.&lt;br /&gt;
&lt;br /&gt;
The output data from the WRF model are used to calculate standard evapotranspiration [[ETo Calculation | (ETo) ]] according to United Nation&#039;s Food and Agriculture Organization [http://www.fao.org/docrep/X0490E/x0490e08.htm (FAO)] guidelines, over all of a sector&#039;s pixels on an hourly basis, for a given period of days. Then, the sme.py program calculates the evapotranspiration value, ETc, over the growing season for a specified location, on a daily basis accumulated hourly. The ETc values are reported together with modelled rain events, irrigation events, grow degree days, and temporal crop coefficients. &lt;br /&gt;
&lt;br /&gt;
The reported atmospheric load data (precip/irrigation and ETc) are then used in soil moisture model to calculate water content of the soil over the given period of days. Modelled rain events can be overridden with local data.&lt;br /&gt;
&lt;br /&gt;
=== ETc FAO Implemention ===&lt;br /&gt;
&lt;br /&gt;
We implement the FAO guidelines in calculating ETc. An introductory chapter can be found [http://www.fao.org/docrep/X0490E/x0490e0a.htm#TopOfPage here] and followed by a more in-depth chapter [http://www.fao.org/docrep/X0490E/x0490e0b.htm#TopOfPage here]. The single crop model is currently employed.&lt;br /&gt;
&lt;br /&gt;
The procedure is straight forward, a (crop) coefficient is applied to the ETo value, accumulated hourly throughout the day, for the growing season:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;ET_c=K_{ci}*ET_o&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;ET_c&amp;lt;/math&amp;gt;   &lt;br /&gt;
|is the crop evapotranspiration &amp;lt;math&amp;gt;[mm~hour^{-1}]&amp;lt;/math&amp;gt;,&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;K_{ci}&amp;lt;/math&amp;gt;    &lt;br /&gt;
|is the crop coefficient at some time i,&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;math&amp;gt;ET_o&amp;lt;/math&amp;gt;   &lt;br /&gt;
|is the reference evapotranspiration &amp;lt;math&amp;gt;[mm~hour^{-1}]&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
 &lt;br /&gt;
Crop coefficients can be described as a curve over time or, in the case of the FAO guidelines, as discrete values over stages of the growing season. Following FAO, we use four stages of coefficients: initial, development, middle, and late with associated day intervals. A complete description of crop input file is given below.&lt;br /&gt;
&lt;br /&gt;
Deriving the correct coefficients is key to accurate estimates, and this is a difficult task as a myriad of variables are at play, eg. soil physics, micro-climates, cultivars, spacing, etc. As above, our intent is to create a platform which can be used to converge on working coefficients for local conditions. However, this requires ground sensor data for comparison purposes and so community participation is necessary for local adjustments.&lt;br /&gt;
&lt;br /&gt;
With community participation we hope to compile working coefficients for local areas. An excellent resource for crop coefficients is in the FAO paper referenced above and can serve as starting point for local implementation.&lt;br /&gt;
&lt;br /&gt;
=== Backend Soil Moisture Models ===&lt;br /&gt;
&lt;br /&gt;
The [[Sacramento SMA | Soil Moisture Accounting]] (SMA) model is currently implemented in this release and delivers moisture content estimates in the soil at two levels (horizons A and B). It is part of the SME package, available [https://gitlab.com/agrineer/sme here]&lt;br /&gt;
&lt;br /&gt;
== How to run ==&lt;br /&gt;
&lt;br /&gt;
For an estimate of soil water content at different soil levels users can specify the location, run dates, crop, and soil types, in addition to local rain and irrigation events.  Currently, with the SMA module there are just two soil levels, corresponding to the &amp;quot;A&amp;quot; (topsoil) and &amp;quot;B&amp;quot; (subsoil) horizons.&lt;br /&gt;
&lt;br /&gt;
== SME application with numbered sections ==&lt;br /&gt;
[[File:Smehowto5.png|center|Guide to SME application.]]&lt;br /&gt;
=== Input section ===&lt;br /&gt;
==== Location (decimal degrees) ====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:rgb(204,112,0)&amp;quot;&amp;gt; yellow #1 in the above image&amp;lt;/pre&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Note: currently about 1/3 of the geographical area of the contiguous 48 states is available for processing. See [[WRF Hindcast]] for current operational sectors. If the provided latitude and longitude values are not within the active sectors an error message will appear stating &#039;Cannot find given location in active sectors&#039;. &lt;br /&gt;
&lt;br /&gt;
The latitude and longitude values of the area of interest, in decimal form. Example: 32.25049, -106.74516&lt;br /&gt;
     &#039;&#039;&#039;latitude&#039;&#039;&#039;  32.25049&lt;br /&gt;
&lt;br /&gt;
     &#039;&#039;&#039;longitude&#039;&#039;&#039;  -106.74516&lt;br /&gt;
&lt;br /&gt;
==== Dates (yyyymmdd) ====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:rgb(204,112,0)&amp;quot;&amp;gt; yellow #2 in the above image&amp;lt;/pre&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
     &#039;&#039;&#039;planted&#039;&#039;&#039; date crop planted&amp;lt;br /&amp;gt;&lt;br /&gt;
     &#039;&#039;&#039;start&#039;&#039;&#039; run application from this start date&amp;lt;br /&amp;gt;&lt;br /&gt;
     &#039;&#039;&#039;end&#039;&#039;&#039; run application to this end date&lt;br /&gt;
&lt;br /&gt;
Note: if you are using your own irrigation and/or rain files (see #6 and #8 ) be sure their dates sync up with the &#039;start&#039; and &#039;end&#039; dates here.&lt;br /&gt;
&lt;br /&gt;
==== Save location and dates ====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:rgb(204,112,0)&amp;quot;&amp;gt; yellow #3 in the above image&amp;lt;/pre&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
If you wish to save the shown Location &amp;amp; Dates values to a file (to quickly load at a later time) enter a file name for the file (ex: area3April) and then click &#039;Save&#039;. Follow your computer&#039;s directions to save the file. You may create and save as many files as you like.&lt;br /&gt;
&lt;br /&gt;
==== Load location and dates ====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:rgb(204,112,0)&amp;quot;&amp;gt; yellow #4 in the above image&amp;lt;/pre&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
To load a previously created and saved Location and Dates file click &#039;Load&#039;, find and open the file you want to use.&lt;br /&gt;
&lt;br /&gt;
==== Crop ====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:rgb(204,112,0)&amp;quot;&amp;gt; yellow #5 in the above image&amp;lt;/pre&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
For more precise results or experimentation you may create and save your own &#039;Crop&#039; files. These files must be &#039;csv&#039; files.&lt;br /&gt;
&lt;br /&gt;
See &amp;quot;Create &#039;csv&#039; files&amp;quot; below.&lt;br /&gt;
&lt;br /&gt;
If you choose not to use your own &#039;Crop&#039; file a default file will be used. Here are the attribute names and values for the default &#039;Crop&#039; file:&lt;br /&gt;
&lt;br /&gt;
crop -&amp;gt; bean; kc ini -&amp;gt; 0.15; kc mid -&amp;gt; 1.19; kc end -&amp;gt; 0.35; ln ini -&amp;gt; 25; ln dev -&amp;gt; 25; ln mid -&amp;gt; 30; ln late -&amp;gt; 20; gdd basetemp -&amp;gt; 5.1; gdd uppertemp -&amp;gt; 30.5; wilt point -&amp;gt; 10.7;&lt;br /&gt;
&lt;br /&gt;
==== Irrigation ====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:rgb(204,112,0)&amp;quot;&amp;gt; yellow #6 in the above image&amp;lt;/pre&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
If you irrigate you may create and save your own &#039;Irrigation&#039; files (See &amp;quot;Create &#039;csv&#039; files&amp;quot; below). To use one of your own &#039;Irrigation&#039; files click on the &#039;Load&#039; button and open the desired file. The name of the file you chose will be listed to the right of the &#039;Load&#039; button. The irrigation values are added to the precipitation/rain values.&lt;br /&gt;
&lt;br /&gt;
If you do not use your own &#039;Irrigation&#039; file the application defaults to no irrigation.&lt;br /&gt;
&lt;br /&gt;
==== Soil ====&lt;br /&gt;
The soil input file depends on the backend soil program. For the Sacramento SMA program&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:rgb(204,112,0)&amp;quot;&amp;gt; yellow #7 in the above image&amp;lt;/pre&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
To make and save your own &#039;Soil&#039; files see &amp;quot;Create &#039;csv&#039; files&amp;quot; below.&lt;br /&gt;
&lt;br /&gt;
If you choose not to use your own &#039;Soil&#039; file a default file will be used for demonstration purposes only. Here are the attribute names and values for the default &#039;Soil&#039; file:&lt;br /&gt;
&lt;br /&gt;
soil -&amp;gt; soil_default; comment -&amp;gt; demo purposes; uztwm -&amp;gt; 50.1; uzfwm -&amp;gt; 40.2; uzk -&amp;gt; 0.1; pctim -&amp;gt; 0.000001; adimp -&amp;gt; 0.0; zperc -&amp;gt; 1.0; rexp -&amp;gt; 0.0; lztwm -&amp;gt; 250.0; lzfsm -&amp;gt; 500.0; lzfpm -&amp;gt; 500.0; lzsk -&amp;gt; 0.01; lzpk -&amp;gt; 0.1; pfree -&amp;gt; 0.1; uztwc_0 -&amp;gt; 0.5; uzfwc_0 -&amp;gt; 0.5; lztwc_0 -&amp;gt; 0.5; lzfsc_0 -&amp;gt; 0.5; lzfpc_0 -&amp;gt; 0.5; adimc_0 -&amp;gt; 0.5;&lt;br /&gt;
&lt;br /&gt;
==== Rain ====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:rgb(204,112,0)&amp;quot;&amp;gt; yellow #8 in the above image&amp;lt;/pre&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The data we use from the Weather Research and Forecasting program includes daily precipitation data. It is accurate in a general way, but for a more precise run of the SME application you can provide your own rain values.&lt;br /&gt;
&lt;br /&gt;
See &amp;quot;Create &#039;csv&#039; files&amp;quot; below. The rain values from this file will replace the rain values from the WRF data.&lt;br /&gt;
&lt;br /&gt;
If you do not use your own &#039;Rain&#039; file the application defaults to the WRF rain data.&lt;br /&gt;
&lt;br /&gt;
==== Create &#039;csv&#039; files ====&lt;br /&gt;
If your going to use your own files for more precise values on crop, soil, irrigation and rain data the files must be in the so-called &#039;csv&#039; (comma separated values) format. There are a good number of ways to create csv files, such as using vi, Notepad or Excel. See [http://www.wikihow.com/Create-a-CSV-File How to Create a CSV file] and/or this other [http://www.computerhope.com/issues/ch001356.htm How to Create a CSV file].&lt;br /&gt;
&lt;br /&gt;
Note that if you are creating a csv file directly, not through Excel, etc., it&#039;s easier to use a [http://www.computerhope.com/jargon/e/editor.htm text editor] such as vi or Notepad and not a word processor, and do not end the last line of the file with an &#039;Enter&#039;, just save the file as is.&lt;br /&gt;
&lt;br /&gt;
You may create, save and use as many as you like of each of the 4 files. To use one of your own files click the &#039;Load&#039; button and open the file of interest. The name of the file you chose will be listed to the right of the &#039;Load&#039; button.&lt;br /&gt;
&lt;br /&gt;
Below are the formats for each of the 4 files. The first row contains the &#039;header&#039; elements and the next row(s) is an example of a data row(s).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Crop csv format&#039;&#039;:&lt;br /&gt;
[[File:crop.png|center|Crop csv format]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Irrigation csv format&#039;&#039;: the irrigation values are millimeters, mm.&lt;br /&gt;
[[File:irrigation.png|center|Irrigation csv format]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Soil csv format&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
soil,comment,uztwm,uzfwm,uzk,pctim,adimp,zperc,rexp,lztwm,lzfsm,lzfpm,lzsk,lzpk,pfree,&lt;br /&gt;
uztwc_0,uzfwc_0,lztwc_0,lzfsc_0,lzfpc_0,adimc_0&lt;br /&gt;
&lt;br /&gt;
soil_default,demo purposes,50.1,40.2,0.1,0.000001,0.0,1.0,0.0,250.0,500.0,500.0,0.01,0.1,0.1,&lt;br /&gt;
0.5,0.5,0.5,0.5,0.5,0.5&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Rain csv format&#039;&#039;: the rain values are millimeters, mm.&lt;br /&gt;
[[File:rain.png|center|Rain csv format]]&lt;br /&gt;
&lt;br /&gt;
==== Apply ====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:rgb(204,112,0)&amp;quot;&amp;gt; yellow #9 in the above image&amp;lt;/pre&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Run the application with the provided input values.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download results&#039;&#039;&#039; checkbox: activate this checkbox if you wish to receive a .zip file which contains files of data on your run and its results. In effect these are &#039;hardcopies&#039; of a particular run of the application. For example, the included &#039;sme.log&#039; file is a text file which contains the same data as the &#039;Text report&#039; (yellow #14).&lt;br /&gt;
&lt;br /&gt;
Follow your computer&#039;s instructions to save the file. Write down the name of the file because it can be a real doozy to recall (ex: SME_59516e5551758.zip). After it is saved you will need to &#039;extract&#039; the contents of the .zip file.&lt;br /&gt;
&lt;br /&gt;
=== Output section ===&lt;br /&gt;
==== 6 images: ETo and Precipitation  ====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:rgb(204,112,0)&amp;quot;&amp;gt; yellow #10 in the above image&amp;lt;/pre&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
There are 2 image display areas. The left one is for ETo (evapotranspiration) data, the right one for Precipitation data. Both have 3 tabs for a total of 6 available images. All 6 images are 171 x 171 pixels in size but the resolution of each pixel varies in each of the tabs.&lt;br /&gt;
     &#039;&#039;&#039;3.3km&#039;&#039;&#039;  each pixel in this image represents an area approximately 3.3 km by 3.3 km.&lt;br /&gt;
&lt;br /&gt;
     &#039;&#039;&#039;10km&#039;&#039;&#039;   each pixel in this image represents an area approximately 10 km by 10 km.&lt;br /&gt;
&lt;br /&gt;
     &#039;&#039;&#039;30km&#039;&#039;&#039;   each pixel in this image represents an area approximately 30 km by 30 km.&lt;br /&gt;
&lt;br /&gt;
Clicking on the &#039;+&#039; in the image will &#039;zoom-in&#039; the image.&lt;br /&gt;
&lt;br /&gt;
Clicking on the &#039;-&#039; in the image will &#039;zoom-out&#039; the image. &lt;br /&gt;
&lt;br /&gt;
If your mouse has a wheel you can use it to zoom in and out.&lt;br /&gt;
&lt;br /&gt;
Clicking and holding down the left button on the mouse enables moving the image.&lt;br /&gt;
&lt;br /&gt;
Clicking on the &#039;house&#039; in the image will restore the image to its initial display size and position.&lt;br /&gt;
&lt;br /&gt;
In the ETo 3.3km image you should see a small blinking red square; in the Precipitation 3.3km image there is a small blinking black square. Your latitude and longitude of interest will be inside this square. Use the &#039;+&#039; sign or the wheel on your mouse to zoom in. Move the mouse around inside the square until the latitude and longitude values shown in #11 &#039;&#039;&#039;approximate&#039;&#039;&#039; the values you entered in #1 for latitude and longitude. It is unlikely they will match exactly, a small disappointing aspect of the display software. Note that the &#039;Text report&#039; (yellow #14) has the exact latitude and longitude.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t see the small blinking red or black square it&#039;s because the underlying or surrounding area is the same or similar color. In this case move the mouse around in the image and look at the latitude and longitude values displayed in #11 until you have homed in on the desired area, then  zoom in, etc.&lt;br /&gt;
&lt;br /&gt;
==== Latitude, Longitude, ETo value; Latitude, Longitude, Precipitation value ====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:rgb(204,112,0)&amp;quot;&amp;gt; yellow #11 in the above image&amp;lt;/pre&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Each pixel of a displayed image (171 x 171 pixels = 29,241 total pixels per image) has values representing the pixel&#039;s latitude, longitude, and the calculated ETo or Precipitation values. Move your mouse over the image and watch #11 to see the results.&lt;br /&gt;
&lt;br /&gt;
==== Plot of soil UPPER layer water content for dates provided ====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:rgb(204,112,0)&amp;quot;&amp;gt; yellow #12 in the above image&amp;lt;/pre&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Plot of soil LOWER layer water content for dates provided ====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:rgb(204,112,0)&amp;quot;&amp;gt; yellow #13 in the above image&amp;lt;/pre&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Text report ====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:rgb(204,112,0)&amp;quot;&amp;gt; yellow #14 in the above image&amp;lt;/pre&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Text description of the SME run and its results.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=SME_FAQ&amp;diff=591</id>
		<title>SME FAQ</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=SME_FAQ&amp;diff=591"/>
		<updated>2019-01-28T02:11:08Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Frequently Asked Questions for the Soil Moisture Estimator&lt;br /&gt;
== I am a county extension agent. How can I use the SME to help the farmers in my county? ==&lt;br /&gt;
&lt;br /&gt;
Ideally, an extension office would have a catalogue of working crop coefficients and soil attributes for local farms. &lt;br /&gt;
The farmer would use the SME with these input files, along with irrigation events, to monitor a crop&#039;s water usage throughout the growing season.&lt;br /&gt;
&lt;br /&gt;
Presently, we are in the initial stages of exercising the SME in the field and so we ask extension agents to:&lt;br /&gt;
&lt;br /&gt;
- get familiar with the SME tool. Learn how to construct input files and how to use the output files (eg. import into spreadsheets).&lt;br /&gt;
&lt;br /&gt;
- get local rain data and compare with the WRF model rain data. We are interested in compiling wide-scale data for analysis. Sharing comparison data with us would help in model adjustments. &lt;br /&gt;
&lt;br /&gt;
- compile a set of input files of local crop cultivars and associated coefficients.  See this link.(not yet active)&lt;br /&gt;
&lt;br /&gt;
- show farmers how to derive soil attributes used in the soil model. See this link.(not yet active)&lt;br /&gt;
&lt;br /&gt;
- ask farmers with soil moisture sensors to use the SME and share their experience. We actively seek the participation of farmer-scientists for feedback.&lt;br /&gt;
&lt;br /&gt;
Assuming a set of working input files, a useful exercise for farmers is to review the past growing season using different irrigation schedules to see how the soil responds. Crops can also be changed to see what their water usage would have been. See the question below.&lt;br /&gt;
&lt;br /&gt;
== I am a irrigation specialist at a large farm. How can I use the SME ? ==&lt;br /&gt;
&lt;br /&gt;
The purpose of the SME is to provide a working estimate of water usage for different crops and soils. This allows for general monitoring of soil moisture and to apply irrigations as needed to avoid plant stress. &lt;br /&gt;
&lt;br /&gt;
Because the SME can be run historically, it is possible for the irrigation specialist to run &amp;quot;what if&amp;quot; scenarios. &lt;br /&gt;
For example,&lt;br /&gt;
&lt;br /&gt;
- What if the crop was different, how much water would that crop have used in our soil? &lt;br /&gt;
&lt;br /&gt;
- What if I irrigated small amounts more often or large amounts less often? Is there a sweet spot between the two?&lt;br /&gt;
&lt;br /&gt;
- What is the optimal irrigation amount to give available water to roots and not drain excessively beyond the root zone? &lt;br /&gt;
&lt;br /&gt;
The SME, with working parameters, can be used to address and give insight to the above questions.&lt;br /&gt;
&lt;br /&gt;
== I am an agricultural professor. How can I use the SME? ==&lt;br /&gt;
Here are some ways to use the SME: &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
- show your students the website tools and indicate that source code is available for review and improvements.&lt;br /&gt;
&lt;br /&gt;
- incorporate the tools into classroom lectures/exercises/labs for critique. We would appreciate feedback on usage.&lt;br /&gt;
&lt;br /&gt;
- suggest projects/studies to students regarding comparison with data (soil moisture, ETo, ETc, precipitation, etc.) from research stations currently covered geographically. &lt;br /&gt;
&lt;br /&gt;
- generate WRF data for areas of interest (sectors). See below on generating data.&lt;br /&gt;
&lt;br /&gt;
- consider implementing other backend soil moisture models for research and comparison purposes.&lt;br /&gt;
&lt;br /&gt;
== I am an agricultural student with programming skills. How can I use the SME? ==&lt;br /&gt;
Here are some ways to use the SME: &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- download and install the code from our [https://gitlab.com.agrineer repository] and exercise the command line versions of GDC and SME.  Learn the processing stream on a local platform to get familiar with the model. You do not need to generate data as it can be downloaded. Linux navigation skills are required. &lt;br /&gt;
&lt;br /&gt;
- inspect, in detail, parts of the model code that are of interest to you and look for improvements. For example, look at the [https://gitlab.com/agrineer/eto ETo] code and improve on relative humidity calculations, or you could implement crop coefficients using smooth curves, instead of discrete steps. There are many aspects of the implementation stream that are interesting and improvable. This type of explore gives a student an in depth understanding of modelling. Python/NumPy programming skills are required.&lt;br /&gt;
&lt;br /&gt;
- compile and compare aspects of predicted and sensed data for local areas, eg. How close is historical WRF modelled rain to measured rain in your pixel (area)? Many components can be compared that would be available with regular weather sensors, such as temperatures, relative humidity and wind speed.&lt;br /&gt;
&lt;br /&gt;
- graduate endeavours could include long term studies to compare sensed soil moisture to different SME outputs with various parameters, ie.crop coefficients, soil descriptions, etc.&lt;br /&gt;
&lt;br /&gt;
- consider implementing other backend soil moisture models for research and comparison purposes.&lt;br /&gt;
&lt;br /&gt;
- become the administrator for data contribution for a sector. See below.&lt;br /&gt;
&lt;br /&gt;
== I do not see a sector defined that I am interested in. Can I generate data for that sector? ==&lt;br /&gt;
&lt;br /&gt;
Yes.&lt;br /&gt;
&lt;br /&gt;
We currently cover only half of the western US and invite data contributions from third parties. We have released a Docker file package for container implementation of the data generation, where necessary code is automatically downloaded and bundled for use. All software is free. This requires a Docker friendly platform, with multi-core CPU, and of course somebody to maintain it (eg. check that data gets delivered, etc.). We have tested the container on a Linux platform, but not yet on Macs or Windows. The computer does not need to be dedicated to generate the data, as only ~4hrs is used per sector per day. Docker claims it should work on Mac and Windows.&lt;br /&gt;
&lt;br /&gt;
== Can I download the input and output files from an SME run? ==&lt;br /&gt;
Yes. Click on the &amp;quot;Download&amp;quot; checkbox next to the &amp;quot;Apply&amp;quot; button. You will be asked where to download the zipped file containing all input and output files.&lt;br /&gt;
&lt;br /&gt;
== Your model is historically based using WRF in hindcast mode. Can the SME run in forecast mode? ==&lt;br /&gt;
Yes, and it would be useful in deciding near future irrigation scheduling for harvest, market, and efficiency purposes.&lt;br /&gt;
&lt;br /&gt;
It would only require a small modification to the GFS ingestion. All other aspects would remain the same. The forecast implementation requires WRF data generation into the future for some interested amount of time. So, instead of using reanalyzed GFS files the model would use predicted forecast GFS files. &lt;br /&gt;
&lt;br /&gt;
It would also be possible to merge both hindcast and forecast data for an SME run. So, data contributions could be based on either hindcast (yesterday and before) and/or some number of days into future, including today. Daily forecast files would incrementally be replaced with the hindcast, reanalyzed, version. However, the addition of future days would dramatically increase the need for data contributions. For example, if we wanted to predict seven days into the future it would take 8 data contributions per sector per day: 1 hindcast + 7 future days, as opposed to just 1 hindcast contributor per sector per day. Implementing this &amp;quot;merged&amp;quot; version is possible with enough data contributors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
== How do I setup the input files for the SME tool? == &lt;br /&gt;
== Where can I find crop coefficients? == &lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Main_Page&amp;diff=590</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Main_Page&amp;diff=590"/>
		<updated>2019-01-28T02:08:23Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;strong&amp;gt;Welcome to Agrineer.org&#039;s main wiki page.&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This wiki provides documentation and development reports of Agrineer&#039;s projects. Use the navigation panel on the left to visit our projects&#039; descriptions and documentation. More information regarding Agrineer&#039;s  philosophy, goals, and structure can be found [[Agrineer.org_Wiki:About|here]].  &lt;br /&gt;
&lt;br /&gt;
== Project Status ==&lt;br /&gt;
   Project                       Status                   Notes &amp;lt;br&amp;gt;&lt;br /&gt;
   [[WRF Hindcast]]                   operational          back-end, daily uploads to server&lt;br /&gt;
   [[ETo Calculation]]                operational          used in Soil Moisture Estimator&lt;br /&gt;
   [[Agrineer Package]]               operational          class used to interface weather data&lt;br /&gt;
   [[Grow Degree Calculator]]         operational          grow degrees units&lt;br /&gt;
   [[Soil Moisture Estimator]]        operational          currently using Sacramento SMA&lt;br /&gt;
   [[Sacramento SMA]]                 operational          backend C program for Soil Moisture Estimator&lt;br /&gt;
   [[Soil Moisture Radar]]            under development    hardware/software GPS bi-static&lt;br /&gt;
   Soil Moisture TDR              under development    hardware/software soil reflectometry&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=589</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=589"/>
		<updated>2019-01-28T02:03:27Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Output File */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The first two are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the &amp;quot;Sacramento&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
  [FILES]&lt;br /&gt;
  loads = /home/agrineer/sma/input/loads.csv&lt;br /&gt;
  soil = /home/agrineer/sma/input/soil.csv&lt;br /&gt;
  output = /home/agrineer/sma/output/output.csv&lt;br /&gt;
  rain = /home/agrineer/sma/input/rain.csv&lt;br /&gt;
  irr = /home/agrineer/sma/input/irr.csv&lt;br /&gt;
&lt;br /&gt;
Note that when the sme.py invokes the SMA module the SMA configuration file is constructed on the fly, based on SME data and configuration input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameter input files in the SME configuration file.&lt;br /&gt;
&lt;br /&gt;
For example, to reference the SMA with parameters in the sme.py, the SME configuration file might have:&lt;br /&gt;
&lt;br /&gt;
  [SoilModel]&lt;br /&gt;
  model = SMA&lt;br /&gt;
  &lt;br /&gt;
  [SMA]&lt;br /&gt;
  program = /home/agrineer/sme/sme/sma&lt;br /&gt;
  soil = /home/agrineer/sme/tmp/soil.csv&lt;br /&gt;
  rain = /home/agrineer/sme/tmp/rain.csv&lt;br /&gt;
  irr = /home/agrineer/sme/tmp/irr.csv&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;loads&amp;quot; file (data) would be generated by the WRF model data and ETo calculations and then submitted to the SMA program.&lt;br /&gt;
&lt;br /&gt;
Note that the web SME tool constructs the configuration file for the sme.py program as above. See the SME description [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
All input files are text based with comma separable variables (.csv). These files can be are read by spreadsheets for presentation and general analysis purposes.&lt;br /&gt;
&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
The &amp;quot;loads&amp;quot; input file consists of a title line followed by value lines. Line values are comma separated (CSV) and the values are for date, precipitation, and ETc. Precipitation and ETc values are given in millimeters. For example,&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
  Date,P,E &lt;br /&gt;
  2018-01-02,0.00,1.0348 &lt;br /&gt;
  2018-01-03,0.00,0.8603 &lt;br /&gt;
  2018-01-04,0.00,0.8630 &lt;br /&gt;
  . &lt;br /&gt;
  . &lt;br /&gt;
  .&lt;br /&gt;
&lt;br /&gt;
Currently, comments cannot be placed above the title line.&lt;br /&gt;
Note that the precipitation values normally originate from the WRF model and can be overridden by local data input.&lt;br /&gt;
&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;soil&amp;quot; input file contains comma separated values (CSV) consisting of just a title line and a value line.&lt;br /&gt;
&lt;br /&gt;
The value line has values consisting of:&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
    soil    - given soil name (string)&lt;br /&gt;
&lt;br /&gt;
    comment - make a comment (string)&lt;br /&gt;
&lt;br /&gt;
    uztwm   - upper layer (zone) tension water maximum capacity, mm. &lt;br /&gt;
              The maximum volume of water (normalized to mm) held by the &lt;br /&gt;
              upper zone between field capacity and the wilting point which can &lt;br /&gt;
              be lost by direct evaporation and transpiration from soil. This &lt;br /&gt;
              storage is filled before any water in the upper zone is transferred &lt;br /&gt;
              to other storages. Use field capacity and wilt point water content &lt;br /&gt;
              ratios to determine normalized volume (mm) for some depth. ie. &lt;br /&gt;
              (Ofc - Owp)*depth = uztwm (max et storage capacity).&lt;br /&gt;
&lt;br /&gt;
    uzfwm   - upper layer free water maximum capacity, mm. This storage is the &lt;br /&gt;
              source of water for interflow and the driving force for &lt;br /&gt;
              transferring water to deeper depths.&lt;br /&gt;
&lt;br /&gt;
    uzk     - interflow depletion rate from the upper layer free water storage, &lt;br /&gt;
              uzfwm per day. That is, lateral drainage rate of upper zone &lt;br /&gt;
              free water expressed as a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    pctim   - permanent impervious area fraction of the catchment which &lt;br /&gt;
              produces impervious runoff during low flow conditions.&lt;br /&gt;
&lt;br /&gt;
    adimp   - maximum fraction of an additional impervious area due to &lt;br /&gt;
              saturation. That is, the additional fraction of the catchment &lt;br /&gt;
              which exhibits impervious characteristics when the catchment&#039;s&lt;br /&gt;
              tension water requirements are met.&lt;br /&gt;
&lt;br /&gt;
    perc    - maximum percolation rate coefficient (from upper zone free &lt;br /&gt;
              water into the lower zone).&lt;br /&gt;
&lt;br /&gt;
    rexp    - shape parameter of the percolation curve. An exponent &lt;br /&gt;
              determining the rate of change of the percolation &lt;br /&gt;
              rate with changing lower zone water contents.&lt;br /&gt;
&lt;br /&gt;
    lztwm   - lower layer tension water maximum capacity, mm. Water from &lt;br /&gt;
              this store can only be removed through transpiration.&lt;br /&gt;
&lt;br /&gt;
    lzfsm   - lower layer supplemental free water maximum capacity, mm. &lt;br /&gt;
              The maximum volume from which supplemental baseflow can be drawn.&lt;br /&gt;
&lt;br /&gt;
    lzfpm   - lower layer primary free water maximum capacity, mm. The maximum&lt;br /&gt;
              capacity from which primary base flow can be drawn.&lt;br /&gt;
&lt;br /&gt;
    lzsk    - depletion rate of the lower layer supplemental &lt;br /&gt;
              free water storage, lzfsm per day. That is, lateral drainage rate&lt;br /&gt;
              of lower zone supplemental free water expressed as&lt;br /&gt;
              a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    lzpk    - depletion rate of the lower layer primary free water storage, &lt;br /&gt;
              lzfpm, per day. That is, lateral drainage rate of lower zone &lt;br /&gt;
              primary free water expressed as a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    pfree   - percolation fraction that goes directly to the lower layer free &lt;br /&gt;
              water storages. Direct percolation fraction from upper to &lt;br /&gt;
              lower zone free water (the percentage of percolated &lt;br /&gt;
              water which is available to the lower zone free water &lt;br /&gt;
              before all lower zone tension water deficiencies are satisfied).&lt;br /&gt;
&lt;br /&gt;
    uztwc_0 - initial upper zone tension water content as proportion of ‘uztwm’&lt;br /&gt;
&lt;br /&gt;
    uzfwc_0 - initial upper zone free water content as proportion of ‘uzfwm&#039;&lt;br /&gt;
&lt;br /&gt;
    lztwc_0 - initial lower zone tension water content as proportion of ‘lztwm’&lt;br /&gt;
&lt;br /&gt;
    lzfsc_0 - initial lower zone free water secondary as proportion of ‘lzfsm’&lt;br /&gt;
&lt;br /&gt;
    lzfpc_0 - initial lower zone free water primary as proportion of ‘lzfpm’&lt;br /&gt;
&lt;br /&gt;
    adimc_0 - initial additional impervious flow store, as proportion of ‘uztwm+lztwm’&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Value ranges and default values from different studies:&lt;br /&gt;
&lt;br /&gt;
            | Blasone et. al.(2008)  |   Surrgo (2004) |  default   | units&lt;br /&gt;
    uztwm   |        1-150           |    10-300       |   50.1     | mm&lt;br /&gt;
    uzfwm   |        1-150           |     5-150       |   40.2     | mm&lt;br /&gt;
    uzk     |      0.1-0.5           |  0.10-0.75      |   0.1      | frac/day&lt;br /&gt;
    pctim   | 0.000001-0.1           |     N/A         |   0.000001 | none&lt;br /&gt;
    adimp   |        0-0.4           |     N/A         |   0.0      | none&lt;br /&gt;
    zperc   |        1-250           |     5-350       |   1.0      | none&lt;br /&gt;
    rexp    |        0-5             |     1-5         |   0.0      | none&lt;br /&gt;
    lztwm   |        1-500           |    10-500       | 250.0      | mm&lt;br /&gt;
    lzfsm   |        1-1000          |     5-400       | 500.0      | mm&lt;br /&gt;
    lzfpm   |        1-1000          |    10-1000      | 500.0      | mm&lt;br /&gt;
    lzsk    |     0.01-0.25          |  0.01-0.35      |   0.01     | frac/day&lt;br /&gt;
    lzpk    |   0.0001-0.25          | 0.001-0.05      |   0.1      | frac/day&lt;br /&gt;
    pfree   |        0-0.6           |   0.0-0.8       |   0.1      | none&lt;br /&gt;
&lt;br /&gt;
Soil input file example:&lt;br /&gt;
soil,comment,uztwm,uzfwm,uzk,pctim,adimp,zperc,rexp,lztwm,lzfsm,lzfpm,lzsk,lzpk,pfree,uztwc_0,uzfwc_0,lztwc_0,lzfsc_0,lzfpc_0,adimc_0&lt;br /&gt;
soil_default,demo purposes,50.1,40.2,0.1,0.000001,0.0,1.0,0.0,250.0,500.0,500.0,0.01,0.1,0.1,0.5,0.5,0.5,0.5,0.5,0.&lt;br /&gt;
&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
The input file &amp;quot;rain&amp;quot; consists of a title line and value lines with comma separated values (CSV). The values are a date followed by the value in millimeters. Use this file to give local rain events. For example,&lt;br /&gt;
&lt;br /&gt;
   Date,Rain (mm)&lt;br /&gt;
   2018-01-14,11.67&lt;br /&gt;
   2018-01-15,17.27&lt;br /&gt;
   2018-01-17,0.73&lt;br /&gt;
        .&lt;br /&gt;
        .&lt;br /&gt;
        .&lt;br /&gt;
Providing this file will override the WRF rain values given in the &amp;quot;loads&amp;quot; input file.&lt;br /&gt;
&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
The input file &amp;quot;irr&amp;quot; consists of a title line and value lines with comma separated values (CSV). The values are a date followed by the value in millimeters. Use this file to give irrigation dates. For example,&lt;br /&gt;
&lt;br /&gt;
    Date,Irrigation (mm)&lt;br /&gt;
    2018-01-10,10.0&lt;br /&gt;
    2018-01-20,10.0&lt;br /&gt;
    2018-01-30,10.0&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
&lt;br /&gt;
== Output File ==&lt;br /&gt;
The output file has a title line followed by value lines. All lines are in CSV format.&lt;br /&gt;
&lt;br /&gt;
The title line looks like:&lt;br /&gt;
    Date,U,uztwc,uzfwc,lztwc,lzfsc,lzfpc,adimc,sett,se1,se3,se4,se5,roimp,sdro,ssur,sif,bfp,bfs,bfcc&lt;br /&gt;
&lt;br /&gt;
A value line consists of:&lt;br /&gt;
     Date   - daily time stamp&lt;br /&gt;
     U      - the simulated effective rainfall (“total channel inflow”)&lt;br /&gt;
     uztwc  - upper zone tension water content&lt;br /&gt;
     uzfwc  - upper zone free water content&lt;br /&gt;
     lztwc  - lower zone tension water content&lt;br /&gt;
     lzfsc  - lower zone free secondary water content&lt;br /&gt;
     lzfpc  - lower zone free primary water content&lt;br /&gt;
     adimc  - tension water contents of the additional impervious area&lt;br /&gt;
     sett   - cumulative total evapotranspiration&lt;br /&gt;
     se1    - cumulative evapotranspiration from upper zone tension water&lt;br /&gt;
     se3    - cumulative evapotranspiration from lower zone tension water&lt;br /&gt;
     se4    - cumulative evapotranspiration&lt;br /&gt;
     se5    - cumulative evapotranspiration from riparian zone&lt;br /&gt;
     roimp  - runoff from impervious area&lt;br /&gt;
     sdro   - six hour sum of runoff&lt;br /&gt;
     ssur   - surface runoff&lt;br /&gt;
     sif    - interflow&lt;br /&gt;
     bfp    - primary baseflow&lt;br /&gt;
     bfs    - secondary baseflow&lt;br /&gt;
     bfcc   - channel baseflow (bfp+bfs)&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Some links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=588</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=588"/>
		<updated>2019-01-28T01:56:33Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Local Rain Events */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The first two are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the &amp;quot;Sacramento&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
  [FILES]&lt;br /&gt;
  loads = /home/agrineer/sma/input/loads.csv&lt;br /&gt;
  soil = /home/agrineer/sma/input/soil.csv&lt;br /&gt;
  output = /home/agrineer/sma/output/output.csv&lt;br /&gt;
  rain = /home/agrineer/sma/input/rain.csv&lt;br /&gt;
  irr = /home/agrineer/sma/input/irr.csv&lt;br /&gt;
&lt;br /&gt;
Note that when the sme.py invokes the SMA module the SMA configuration file is constructed on the fly, based on SME data and configuration input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameter input files in the SME configuration file.&lt;br /&gt;
&lt;br /&gt;
For example, to reference the SMA with parameters in the sme.py, the SME configuration file might have:&lt;br /&gt;
&lt;br /&gt;
  [SoilModel]&lt;br /&gt;
  model = SMA&lt;br /&gt;
  &lt;br /&gt;
  [SMA]&lt;br /&gt;
  program = /home/agrineer/sme/sme/sma&lt;br /&gt;
  soil = /home/agrineer/sme/tmp/soil.csv&lt;br /&gt;
  rain = /home/agrineer/sme/tmp/rain.csv&lt;br /&gt;
  irr = /home/agrineer/sme/tmp/irr.csv&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;loads&amp;quot; file (data) would be generated by the WRF model data and ETo calculations and then submitted to the SMA program.&lt;br /&gt;
&lt;br /&gt;
Note that the web SME tool constructs the configuration file for the sme.py program as above. See the SME description [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
All input files are text based with comma separable variables (.csv). These files can be are read by spreadsheets for presentation and general analysis purposes.&lt;br /&gt;
&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
The &amp;quot;loads&amp;quot; input file consists of a title line followed by value lines. Line values are comma separated (CSV) and the values are for date, precipitation, and ETc. Precipitation and ETc values are given in millimeters. For example,&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
  Date,P,E &lt;br /&gt;
  2018-01-02,0.00,1.0348 &lt;br /&gt;
  2018-01-03,0.00,0.8603 &lt;br /&gt;
  2018-01-04,0.00,0.8630 &lt;br /&gt;
  . &lt;br /&gt;
  . &lt;br /&gt;
  .&lt;br /&gt;
&lt;br /&gt;
Currently, comments cannot be placed above the title line.&lt;br /&gt;
Note that the precipitation values normally originate from the WRF model and can be overridden by local data input.&lt;br /&gt;
&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;soil&amp;quot; input file contains comma separated values (CSV) consisting of just a title line and a value line.&lt;br /&gt;
&lt;br /&gt;
The value line has values consisting of:&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
    soil    - given soil name (string)&lt;br /&gt;
&lt;br /&gt;
    comment - make a comment (string)&lt;br /&gt;
&lt;br /&gt;
    uztwm   - upper layer (zone) tension water maximum capacity, mm. &lt;br /&gt;
              The maximum volume of water (normalized to mm) held by the &lt;br /&gt;
              upper zone between field capacity and the wilting point which can &lt;br /&gt;
              be lost by direct evaporation and transpiration from soil. This &lt;br /&gt;
              storage is filled before any water in the upper zone is transferred &lt;br /&gt;
              to other storages. Use field capacity and wilt point water content &lt;br /&gt;
              ratios to determine normalized volume (mm) for some depth. ie. &lt;br /&gt;
              (Ofc - Owp)*depth = uztwm (max et storage capacity).&lt;br /&gt;
&lt;br /&gt;
    uzfwm   - upper layer free water maximum capacity, mm. This storage is the &lt;br /&gt;
              source of water for interflow and the driving force for &lt;br /&gt;
              transferring water to deeper depths.&lt;br /&gt;
&lt;br /&gt;
    uzk     - interflow depletion rate from the upper layer free water storage, &lt;br /&gt;
              uzfwm per day. That is, lateral drainage rate of upper zone &lt;br /&gt;
              free water expressed as a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    pctim   - permanent impervious area fraction of the catchment which &lt;br /&gt;
              produces impervious runoff during low flow conditions.&lt;br /&gt;
&lt;br /&gt;
    adimp   - maximum fraction of an additional impervious area due to &lt;br /&gt;
              saturation. That is, the additional fraction of the catchment &lt;br /&gt;
              which exhibits impervious characteristics when the catchment&#039;s&lt;br /&gt;
              tension water requirements are met.&lt;br /&gt;
&lt;br /&gt;
    perc    - maximum percolation rate coefficient (from upper zone free &lt;br /&gt;
              water into the lower zone).&lt;br /&gt;
&lt;br /&gt;
    rexp    - shape parameter of the percolation curve. An exponent &lt;br /&gt;
              determining the rate of change of the percolation &lt;br /&gt;
              rate with changing lower zone water contents.&lt;br /&gt;
&lt;br /&gt;
    lztwm   - lower layer tension water maximum capacity, mm. Water from &lt;br /&gt;
              this store can only be removed through transpiration.&lt;br /&gt;
&lt;br /&gt;
    lzfsm   - lower layer supplemental free water maximum capacity, mm. &lt;br /&gt;
              The maximum volume from which supplemental baseflow can be drawn.&lt;br /&gt;
&lt;br /&gt;
    lzfpm   - lower layer primary free water maximum capacity, mm. The maximum&lt;br /&gt;
              capacity from which primary base flow can be drawn.&lt;br /&gt;
&lt;br /&gt;
    lzsk    - depletion rate of the lower layer supplemental &lt;br /&gt;
              free water storage, lzfsm per day. That is, lateral drainage rate&lt;br /&gt;
              of lower zone supplemental free water expressed as&lt;br /&gt;
              a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    lzpk    - depletion rate of the lower layer primary free water storage, &lt;br /&gt;
              lzfpm, per day. That is, lateral drainage rate of lower zone &lt;br /&gt;
              primary free water expressed as a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    pfree   - percolation fraction that goes directly to the lower layer free &lt;br /&gt;
              water storages. Direct percolation fraction from upper to &lt;br /&gt;
              lower zone free water (the percentage of percolated &lt;br /&gt;
              water which is available to the lower zone free water &lt;br /&gt;
              before all lower zone tension water deficiencies are satisfied).&lt;br /&gt;
&lt;br /&gt;
    uztwc_0 - initial upper zone tension water content as proportion of ‘uztwm’&lt;br /&gt;
&lt;br /&gt;
    uzfwc_0 - initial upper zone free water content as proportion of ‘uzfwm&#039;&lt;br /&gt;
&lt;br /&gt;
    lztwc_0 - initial lower zone tension water content as proportion of ‘lztwm’&lt;br /&gt;
&lt;br /&gt;
    lzfsc_0 - initial lower zone free water secondary as proportion of ‘lzfsm’&lt;br /&gt;
&lt;br /&gt;
    lzfpc_0 - initial lower zone free water primary as proportion of ‘lzfpm’&lt;br /&gt;
&lt;br /&gt;
    adimc_0 - initial additional impervious flow store, as proportion of ‘uztwm+lztwm’&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Value ranges and default values from different studies:&lt;br /&gt;
&lt;br /&gt;
            | Blasone et. al.(2008)  |   Surrgo (2004) |  default   | units&lt;br /&gt;
    uztwm   |        1-150           |    10-300       |   50.1     | mm&lt;br /&gt;
    uzfwm   |        1-150           |     5-150       |   40.2     | mm&lt;br /&gt;
    uzk     |      0.1-0.5           |  0.10-0.75      |   0.1      | frac/day&lt;br /&gt;
    pctim   | 0.000001-0.1           |     N/A         |   0.000001 | none&lt;br /&gt;
    adimp   |        0-0.4           |     N/A         |   0.0      | none&lt;br /&gt;
    zperc   |        1-250           |     5-350       |   1.0      | none&lt;br /&gt;
    rexp    |        0-5             |     1-5         |   0.0      | none&lt;br /&gt;
    lztwm   |        1-500           |    10-500       | 250.0      | mm&lt;br /&gt;
    lzfsm   |        1-1000          |     5-400       | 500.0      | mm&lt;br /&gt;
    lzfpm   |        1-1000          |    10-1000      | 500.0      | mm&lt;br /&gt;
    lzsk    |     0.01-0.25          |  0.01-0.35      |   0.01     | frac/day&lt;br /&gt;
    lzpk    |   0.0001-0.25          | 0.001-0.05      |   0.1      | frac/day&lt;br /&gt;
    pfree   |        0-0.6           |   0.0-0.8       |   0.1      | none&lt;br /&gt;
&lt;br /&gt;
Soil input file example:&lt;br /&gt;
soil,comment,uztwm,uzfwm,uzk,pctim,adimp,zperc,rexp,lztwm,lzfsm,lzfpm,lzsk,lzpk,pfree,uztwc_0,uzfwc_0,lztwc_0,lzfsc_0,lzfpc_0,adimc_0&lt;br /&gt;
soil_default,demo purposes,50.1,40.2,0.1,0.000001,0.0,1.0,0.0,250.0,500.0,500.0,0.01,0.1,0.1,0.5,0.5,0.5,0.5,0.5,0.&lt;br /&gt;
&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
The input file &amp;quot;rain&amp;quot; consists of a title line and value lines with comma separated values (CSV). The values are a date followed by the value in millimeters. Use this file to give local rain events. For example,&lt;br /&gt;
&lt;br /&gt;
   Date,Rain (mm)&lt;br /&gt;
   2018-01-14,11.67&lt;br /&gt;
   2018-01-15,17.27&lt;br /&gt;
   2018-01-17,0.73&lt;br /&gt;
        .&lt;br /&gt;
        .&lt;br /&gt;
        .&lt;br /&gt;
Providing this file will override the WRF rain values given in the &amp;quot;loads&amp;quot; input file.&lt;br /&gt;
&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
The input file &amp;quot;irr&amp;quot; consists of a title line and value lines with comma separated values (CSV). The values are a date followed by the value in millimeters. Use this file to give irrigation dates. For example,&lt;br /&gt;
&lt;br /&gt;
    Date,Irrigation (mm)&lt;br /&gt;
    2018-01-10,10.0&lt;br /&gt;
    2018-01-20,10.0&lt;br /&gt;
    2018-01-30,10.0&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
&lt;br /&gt;
== Output File ==&lt;br /&gt;
The output file has a title line followed by value lines. All lines are in CSV format.&lt;br /&gt;
&lt;br /&gt;
The title line looks like:&lt;br /&gt;
    Date,U,uztwc,uzfwc,lztwc,lzfsc,lzfpc,adimc,sett,se1,se3,se4,se5,roimp,sdro,ssur,sif,bfp,bfs,bfcc&lt;br /&gt;
&lt;br /&gt;
A value line consists of:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
     Date   - daily time stamp&lt;br /&gt;
     U      - the simulated effective rainfall (“total channel inflow”)&lt;br /&gt;
     uztwc  - upper zone tension water content&lt;br /&gt;
     uzfwc  - upper zone free water content&lt;br /&gt;
     lztwc  - lower zone tension water content&lt;br /&gt;
     lzfsc  - lower zone free secondary water content&lt;br /&gt;
     lzfpc  - lower zone free primary water content&lt;br /&gt;
     adimc  - tension water contents of the additional impervious area&lt;br /&gt;
     sett   - cumulative total evapotranspiration&lt;br /&gt;
     se1    - cumulative evapotranspiration from upper zone tension water&lt;br /&gt;
     se3    - cumulative evapotranspiration from lower zone tension water&lt;br /&gt;
     se4    - cumulative evapotranspiration&lt;br /&gt;
     se5    - cumulative evapotranspiration from riparian zone&lt;br /&gt;
     roimp  - runoff from impervious area&lt;br /&gt;
     sdro   - six hour sum of runoff&lt;br /&gt;
     ssur   - surface runoff&lt;br /&gt;
     sif    - interflow&lt;br /&gt;
     bfp    - primary baseflow&lt;br /&gt;
     bfs    - secondary baseflow&lt;br /&gt;
     bfcc   - channel baseflow (bfp+bfs)&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Some links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=587</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=587"/>
		<updated>2019-01-28T01:54:42Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Irrigation Events */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The first two are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the &amp;quot;Sacramento&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
  [FILES]&lt;br /&gt;
  loads = /home/agrineer/sma/input/loads.csv&lt;br /&gt;
  soil = /home/agrineer/sma/input/soil.csv&lt;br /&gt;
  output = /home/agrineer/sma/output/output.csv&lt;br /&gt;
  rain = /home/agrineer/sma/input/rain.csv&lt;br /&gt;
  irr = /home/agrineer/sma/input/irr.csv&lt;br /&gt;
&lt;br /&gt;
Note that when the sme.py invokes the SMA module the SMA configuration file is constructed on the fly, based on SME data and configuration input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameter input files in the SME configuration file.&lt;br /&gt;
&lt;br /&gt;
For example, to reference the SMA with parameters in the sme.py, the SME configuration file might have:&lt;br /&gt;
&lt;br /&gt;
  [SoilModel]&lt;br /&gt;
  model = SMA&lt;br /&gt;
  &lt;br /&gt;
  [SMA]&lt;br /&gt;
  program = /home/agrineer/sme/sme/sma&lt;br /&gt;
  soil = /home/agrineer/sme/tmp/soil.csv&lt;br /&gt;
  rain = /home/agrineer/sme/tmp/rain.csv&lt;br /&gt;
  irr = /home/agrineer/sme/tmp/irr.csv&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;loads&amp;quot; file (data) would be generated by the WRF model data and ETo calculations and then submitted to the SMA program.&lt;br /&gt;
&lt;br /&gt;
Note that the web SME tool constructs the configuration file for the sme.py program as above. See the SME description [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
All input files are text based with comma separable variables (.csv). These files can be are read by spreadsheets for presentation and general analysis purposes.&lt;br /&gt;
&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
The &amp;quot;loads&amp;quot; input file consists of a title line followed by value lines. Line values are comma separated (CSV) and the values are for date, precipitation, and ETc. Precipitation and ETc values are given in millimeters. For example,&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
  Date,P,E &lt;br /&gt;
  2018-01-02,0.00,1.0348 &lt;br /&gt;
  2018-01-03,0.00,0.8603 &lt;br /&gt;
  2018-01-04,0.00,0.8630 &lt;br /&gt;
  . &lt;br /&gt;
  . &lt;br /&gt;
  .&lt;br /&gt;
&lt;br /&gt;
Currently, comments cannot be placed above the title line.&lt;br /&gt;
Note that the precipitation values normally originate from the WRF model and can be overridden by local data input.&lt;br /&gt;
&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;soil&amp;quot; input file contains comma separated values (CSV) consisting of just a title line and a value line.&lt;br /&gt;
&lt;br /&gt;
The value line has values consisting of:&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
    soil    - given soil name (string)&lt;br /&gt;
&lt;br /&gt;
    comment - make a comment (string)&lt;br /&gt;
&lt;br /&gt;
    uztwm   - upper layer (zone) tension water maximum capacity, mm. &lt;br /&gt;
              The maximum volume of water (normalized to mm) held by the &lt;br /&gt;
              upper zone between field capacity and the wilting point which can &lt;br /&gt;
              be lost by direct evaporation and transpiration from soil. This &lt;br /&gt;
              storage is filled before any water in the upper zone is transferred &lt;br /&gt;
              to other storages. Use field capacity and wilt point water content &lt;br /&gt;
              ratios to determine normalized volume (mm) for some depth. ie. &lt;br /&gt;
              (Ofc - Owp)*depth = uztwm (max et storage capacity).&lt;br /&gt;
&lt;br /&gt;
    uzfwm   - upper layer free water maximum capacity, mm. This storage is the &lt;br /&gt;
              source of water for interflow and the driving force for &lt;br /&gt;
              transferring water to deeper depths.&lt;br /&gt;
&lt;br /&gt;
    uzk     - interflow depletion rate from the upper layer free water storage, &lt;br /&gt;
              uzfwm per day. That is, lateral drainage rate of upper zone &lt;br /&gt;
              free water expressed as a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    pctim   - permanent impervious area fraction of the catchment which &lt;br /&gt;
              produces impervious runoff during low flow conditions.&lt;br /&gt;
&lt;br /&gt;
    adimp   - maximum fraction of an additional impervious area due to &lt;br /&gt;
              saturation. That is, the additional fraction of the catchment &lt;br /&gt;
              which exhibits impervious characteristics when the catchment&#039;s&lt;br /&gt;
              tension water requirements are met.&lt;br /&gt;
&lt;br /&gt;
    perc    - maximum percolation rate coefficient (from upper zone free &lt;br /&gt;
              water into the lower zone).&lt;br /&gt;
&lt;br /&gt;
    rexp    - shape parameter of the percolation curve. An exponent &lt;br /&gt;
              determining the rate of change of the percolation &lt;br /&gt;
              rate with changing lower zone water contents.&lt;br /&gt;
&lt;br /&gt;
    lztwm   - lower layer tension water maximum capacity, mm. Water from &lt;br /&gt;
              this store can only be removed through transpiration.&lt;br /&gt;
&lt;br /&gt;
    lzfsm   - lower layer supplemental free water maximum capacity, mm. &lt;br /&gt;
              The maximum volume from which supplemental baseflow can be drawn.&lt;br /&gt;
&lt;br /&gt;
    lzfpm   - lower layer primary free water maximum capacity, mm. The maximum&lt;br /&gt;
              capacity from which primary base flow can be drawn.&lt;br /&gt;
&lt;br /&gt;
    lzsk    - depletion rate of the lower layer supplemental &lt;br /&gt;
              free water storage, lzfsm per day. That is, lateral drainage rate&lt;br /&gt;
              of lower zone supplemental free water expressed as&lt;br /&gt;
              a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    lzpk    - depletion rate of the lower layer primary free water storage, &lt;br /&gt;
              lzfpm, per day. That is, lateral drainage rate of lower zone &lt;br /&gt;
              primary free water expressed as a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    pfree   - percolation fraction that goes directly to the lower layer free &lt;br /&gt;
              water storages. Direct percolation fraction from upper to &lt;br /&gt;
              lower zone free water (the percentage of percolated &lt;br /&gt;
              water which is available to the lower zone free water &lt;br /&gt;
              before all lower zone tension water deficiencies are satisfied).&lt;br /&gt;
&lt;br /&gt;
    uztwc_0 - initial upper zone tension water content as proportion of ‘uztwm’&lt;br /&gt;
&lt;br /&gt;
    uzfwc_0 - initial upper zone free water content as proportion of ‘uzfwm&#039;&lt;br /&gt;
&lt;br /&gt;
    lztwc_0 - initial lower zone tension water content as proportion of ‘lztwm’&lt;br /&gt;
&lt;br /&gt;
    lzfsc_0 - initial lower zone free water secondary as proportion of ‘lzfsm’&lt;br /&gt;
&lt;br /&gt;
    lzfpc_0 - initial lower zone free water primary as proportion of ‘lzfpm’&lt;br /&gt;
&lt;br /&gt;
    adimc_0 - initial additional impervious flow store, as proportion of ‘uztwm+lztwm’&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Value ranges and default values from different studies:&lt;br /&gt;
&lt;br /&gt;
            | Blasone et. al.(2008)  |   Surrgo (2004) |  default   | units&lt;br /&gt;
    uztwm   |        1-150           |    10-300       |   50.1     | mm&lt;br /&gt;
    uzfwm   |        1-150           |     5-150       |   40.2     | mm&lt;br /&gt;
    uzk     |      0.1-0.5           |  0.10-0.75      |   0.1      | frac/day&lt;br /&gt;
    pctim   | 0.000001-0.1           |     N/A         |   0.000001 | none&lt;br /&gt;
    adimp   |        0-0.4           |     N/A         |   0.0      | none&lt;br /&gt;
    zperc   |        1-250           |     5-350       |   1.0      | none&lt;br /&gt;
    rexp    |        0-5             |     1-5         |   0.0      | none&lt;br /&gt;
    lztwm   |        1-500           |    10-500       | 250.0      | mm&lt;br /&gt;
    lzfsm   |        1-1000          |     5-400       | 500.0      | mm&lt;br /&gt;
    lzfpm   |        1-1000          |    10-1000      | 500.0      | mm&lt;br /&gt;
    lzsk    |     0.01-0.25          |  0.01-0.35      |   0.01     | frac/day&lt;br /&gt;
    lzpk    |   0.0001-0.25          | 0.001-0.05      |   0.1      | frac/day&lt;br /&gt;
    pfree   |        0-0.6           |   0.0-0.8       |   0.1      | none&lt;br /&gt;
&lt;br /&gt;
Soil input file example:&lt;br /&gt;
soil,comment,uztwm,uzfwm,uzk,pctim,adimp,zperc,rexp,lztwm,lzfsm,lzfpm,lzsk,lzpk,pfree,uztwc_0,uzfwc_0,lztwc_0,lzfsc_0,lzfpc_0,adimc_0&lt;br /&gt;
soil_default,demo purposes,50.1,40.2,0.1,0.000001,0.0,1.0,0.0,250.0,500.0,500.0,0.01,0.1,0.1,0.5,0.5,0.5,0.5,0.5,0.&lt;br /&gt;
&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
The input file &amp;quot;rain&amp;quot; consists of a title line and value lines with comma separated values (CSV). The values are a date followed by the value in millimeters. For example,&lt;br /&gt;
&lt;br /&gt;
   Date,Rain (mm)&lt;br /&gt;
   2018-01-14,11.67&lt;br /&gt;
   2018-01-15,17.27&lt;br /&gt;
   2018-01-17,0.73&lt;br /&gt;
        .&lt;br /&gt;
        .&lt;br /&gt;
        .&lt;br /&gt;
&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
The input file &amp;quot;irr&amp;quot; consists of a title line and value lines with comma separated values (CSV). The values are a date followed by the value in millimeters. Use this file to give irrigation dates. For example,&lt;br /&gt;
&lt;br /&gt;
    Date,Irrigation (mm)&lt;br /&gt;
    2018-01-10,10.0&lt;br /&gt;
    2018-01-20,10.0&lt;br /&gt;
    2018-01-30,10.0&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
&lt;br /&gt;
== Output File ==&lt;br /&gt;
The output file has a title line followed by value lines. All lines are in CSV format.&lt;br /&gt;
&lt;br /&gt;
The title line looks like:&lt;br /&gt;
    Date,U,uztwc,uzfwc,lztwc,lzfsc,lzfpc,adimc,sett,se1,se3,se4,se5,roimp,sdro,ssur,sif,bfp,bfs,bfcc&lt;br /&gt;
&lt;br /&gt;
A value line consists of:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
     Date   - daily time stamp&lt;br /&gt;
     U      - the simulated effective rainfall (“total channel inflow”)&lt;br /&gt;
     uztwc  - upper zone tension water content&lt;br /&gt;
     uzfwc  - upper zone free water content&lt;br /&gt;
     lztwc  - lower zone tension water content&lt;br /&gt;
     lzfsc  - lower zone free secondary water content&lt;br /&gt;
     lzfpc  - lower zone free primary water content&lt;br /&gt;
     adimc  - tension water contents of the additional impervious area&lt;br /&gt;
     sett   - cumulative total evapotranspiration&lt;br /&gt;
     se1    - cumulative evapotranspiration from upper zone tension water&lt;br /&gt;
     se3    - cumulative evapotranspiration from lower zone tension water&lt;br /&gt;
     se4    - cumulative evapotranspiration&lt;br /&gt;
     se5    - cumulative evapotranspiration from riparian zone&lt;br /&gt;
     roimp  - runoff from impervious area&lt;br /&gt;
     sdro   - six hour sum of runoff&lt;br /&gt;
     ssur   - surface runoff&lt;br /&gt;
     sif    - interflow&lt;br /&gt;
     bfp    - primary baseflow&lt;br /&gt;
     bfs    - secondary baseflow&lt;br /&gt;
     bfcc   - channel baseflow (bfp+bfs)&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Some links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=586</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=586"/>
		<updated>2019-01-28T01:47:11Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Local Rain Events */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The first two are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the &amp;quot;Sacramento&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
  [FILES]&lt;br /&gt;
  loads = /home/agrineer/sma/input/loads.csv&lt;br /&gt;
  soil = /home/agrineer/sma/input/soil.csv&lt;br /&gt;
  output = /home/agrineer/sma/output/output.csv&lt;br /&gt;
  rain = /home/agrineer/sma/input/rain.csv&lt;br /&gt;
  irr = /home/agrineer/sma/input/irr.csv&lt;br /&gt;
&lt;br /&gt;
Note that when the sme.py invokes the SMA module the SMA configuration file is constructed on the fly, based on SME data and configuration input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameter input files in the SME configuration file.&lt;br /&gt;
&lt;br /&gt;
For example, to reference the SMA with parameters in the sme.py, the SME configuration file might have:&lt;br /&gt;
&lt;br /&gt;
  [SoilModel]&lt;br /&gt;
  model = SMA&lt;br /&gt;
  &lt;br /&gt;
  [SMA]&lt;br /&gt;
  program = /home/agrineer/sme/sme/sma&lt;br /&gt;
  soil = /home/agrineer/sme/tmp/soil.csv&lt;br /&gt;
  rain = /home/agrineer/sme/tmp/rain.csv&lt;br /&gt;
  irr = /home/agrineer/sme/tmp/irr.csv&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;loads&amp;quot; file (data) would be generated by the WRF model data and ETo calculations and then submitted to the SMA program.&lt;br /&gt;
&lt;br /&gt;
Note that the web SME tool constructs the configuration file for the sme.py program as above. See the SME description [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
All input files are text based with comma separable variables (.csv). These files can be are read by spreadsheets for presentation and general analysis purposes.&lt;br /&gt;
&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
The &amp;quot;loads&amp;quot; input file consists of a title line followed by value lines. Line values are comma separated (CSV) and the values are for date, precipitation, and ETc. Precipitation and ETc values are given in millimeters. For example,&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
  Date,P,E &lt;br /&gt;
  2018-01-02,0.00,1.0348 &lt;br /&gt;
  2018-01-03,0.00,0.8603 &lt;br /&gt;
  2018-01-04,0.00,0.8630 &lt;br /&gt;
  . &lt;br /&gt;
  . &lt;br /&gt;
  .&lt;br /&gt;
&lt;br /&gt;
Currently, comments cannot be placed above the title line.&lt;br /&gt;
Note that the precipitation values normally originate from the WRF model and can be overridden by local data input.&lt;br /&gt;
&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;soil&amp;quot; input file contains comma separated values (CSV) consisting of just a title line and a value line.&lt;br /&gt;
&lt;br /&gt;
The value line has values consisting of:&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
    soil    - given soil name (string)&lt;br /&gt;
&lt;br /&gt;
    comment - make a comment (string)&lt;br /&gt;
&lt;br /&gt;
    uztwm   - upper layer (zone) tension water maximum capacity, mm. &lt;br /&gt;
              The maximum volume of water (normalized to mm) held by the &lt;br /&gt;
              upper zone between field capacity and the wilting point which can &lt;br /&gt;
              be lost by direct evaporation and transpiration from soil. This &lt;br /&gt;
              storage is filled before any water in the upper zone is transferred &lt;br /&gt;
              to other storages. Use field capacity and wilt point water content &lt;br /&gt;
              ratios to determine normalized volume (mm) for some depth. ie. &lt;br /&gt;
              (Ofc - Owp)*depth = uztwm (max et storage capacity).&lt;br /&gt;
&lt;br /&gt;
    uzfwm   - upper layer free water maximum capacity, mm. This storage is the &lt;br /&gt;
              source of water for interflow and the driving force for &lt;br /&gt;
              transferring water to deeper depths.&lt;br /&gt;
&lt;br /&gt;
    uzk     - interflow depletion rate from the upper layer free water storage, &lt;br /&gt;
              uzfwm per day. That is, lateral drainage rate of upper zone &lt;br /&gt;
              free water expressed as a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    pctim   - permanent impervious area fraction of the catchment which &lt;br /&gt;
              produces impervious runoff during low flow conditions.&lt;br /&gt;
&lt;br /&gt;
    adimp   - maximum fraction of an additional impervious area due to &lt;br /&gt;
              saturation. That is, the additional fraction of the catchment &lt;br /&gt;
              which exhibits impervious characteristics when the catchment&#039;s&lt;br /&gt;
              tension water requirements are met.&lt;br /&gt;
&lt;br /&gt;
    perc    - maximum percolation rate coefficient (from upper zone free &lt;br /&gt;
              water into the lower zone).&lt;br /&gt;
&lt;br /&gt;
    rexp    - shape parameter of the percolation curve. An exponent &lt;br /&gt;
              determining the rate of change of the percolation &lt;br /&gt;
              rate with changing lower zone water contents.&lt;br /&gt;
&lt;br /&gt;
    lztwm   - lower layer tension water maximum capacity, mm. Water from &lt;br /&gt;
              this store can only be removed through transpiration.&lt;br /&gt;
&lt;br /&gt;
    lzfsm   - lower layer supplemental free water maximum capacity, mm. &lt;br /&gt;
              The maximum volume from which supplemental baseflow can be drawn.&lt;br /&gt;
&lt;br /&gt;
    lzfpm   - lower layer primary free water maximum capacity, mm. The maximum&lt;br /&gt;
              capacity from which primary base flow can be drawn.&lt;br /&gt;
&lt;br /&gt;
    lzsk    - depletion rate of the lower layer supplemental &lt;br /&gt;
              free water storage, lzfsm per day. That is, lateral drainage rate&lt;br /&gt;
              of lower zone supplemental free water expressed as&lt;br /&gt;
              a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    lzpk    - depletion rate of the lower layer primary free water storage, &lt;br /&gt;
              lzfpm, per day. That is, lateral drainage rate of lower zone &lt;br /&gt;
              primary free water expressed as a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    pfree   - percolation fraction that goes directly to the lower layer free &lt;br /&gt;
              water storages. Direct percolation fraction from upper to &lt;br /&gt;
              lower zone free water (the percentage of percolated &lt;br /&gt;
              water which is available to the lower zone free water &lt;br /&gt;
              before all lower zone tension water deficiencies are satisfied).&lt;br /&gt;
&lt;br /&gt;
    uztwc_0 - initial upper zone tension water content as proportion of ‘uztwm’&lt;br /&gt;
&lt;br /&gt;
    uzfwc_0 - initial upper zone free water content as proportion of ‘uzfwm&#039;&lt;br /&gt;
&lt;br /&gt;
    lztwc_0 - initial lower zone tension water content as proportion of ‘lztwm’&lt;br /&gt;
&lt;br /&gt;
    lzfsc_0 - initial lower zone free water secondary as proportion of ‘lzfsm’&lt;br /&gt;
&lt;br /&gt;
    lzfpc_0 - initial lower zone free water primary as proportion of ‘lzfpm’&lt;br /&gt;
&lt;br /&gt;
    adimc_0 - initial additional impervious flow store, as proportion of ‘uztwm+lztwm’&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Value ranges and default values from different studies:&lt;br /&gt;
&lt;br /&gt;
            | Blasone et. al.(2008)  |   Surrgo (2004) |  default   | units&lt;br /&gt;
    uztwm   |        1-150           |    10-300       |   50.1     | mm&lt;br /&gt;
    uzfwm   |        1-150           |     5-150       |   40.2     | mm&lt;br /&gt;
    uzk     |      0.1-0.5           |  0.10-0.75      |   0.1      | frac/day&lt;br /&gt;
    pctim   | 0.000001-0.1           |     N/A         |   0.000001 | none&lt;br /&gt;
    adimp   |        0-0.4           |     N/A         |   0.0      | none&lt;br /&gt;
    zperc   |        1-250           |     5-350       |   1.0      | none&lt;br /&gt;
    rexp    |        0-5             |     1-5         |   0.0      | none&lt;br /&gt;
    lztwm   |        1-500           |    10-500       | 250.0      | mm&lt;br /&gt;
    lzfsm   |        1-1000          |     5-400       | 500.0      | mm&lt;br /&gt;
    lzfpm   |        1-1000          |    10-1000      | 500.0      | mm&lt;br /&gt;
    lzsk    |     0.01-0.25          |  0.01-0.35      |   0.01     | frac/day&lt;br /&gt;
    lzpk    |   0.0001-0.25          | 0.001-0.05      |   0.1      | frac/day&lt;br /&gt;
    pfree   |        0-0.6           |   0.0-0.8       |   0.1      | none&lt;br /&gt;
&lt;br /&gt;
Soil input file example:&lt;br /&gt;
soil,comment,uztwm,uzfwm,uzk,pctim,adimp,zperc,rexp,lztwm,lzfsm,lzfpm,lzsk,lzpk,pfree,uztwc_0,uzfwc_0,lztwc_0,lzfsc_0,lzfpc_0,adimc_0&lt;br /&gt;
soil_default,demo purposes,50.1,40.2,0.1,0.000001,0.0,1.0,0.0,250.0,500.0,500.0,0.01,0.1,0.1,0.5,0.5,0.5,0.5,0.5,0.&lt;br /&gt;
&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
The input file &amp;quot;rain&amp;quot; consists of a title line and value lines with comma separated values (CSV). The values are a date followed by the value in millimeters. For example,&lt;br /&gt;
&lt;br /&gt;
   Date,Rain (mm)&lt;br /&gt;
   2018-01-14,11.67&lt;br /&gt;
   2018-01-15,17.27&lt;br /&gt;
   2018-01-17,0.73&lt;br /&gt;
        .&lt;br /&gt;
        .&lt;br /&gt;
        .&lt;br /&gt;
&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
The input file &amp;quot;irr&amp;quot; consists of a title line and value lines with comma separated values (CSV). The values are a date followed by the value in millimeters. For example,&lt;br /&gt;
&lt;br /&gt;
    Date,Irrigation (mm)&lt;br /&gt;
    2018-01-10,10.0&lt;br /&gt;
    2018-01-20,10.0&lt;br /&gt;
    2018-01-30,10.0&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
== Output File ==&lt;br /&gt;
The output file has a title line followed by value lines. All lines are in CSV format.&lt;br /&gt;
&lt;br /&gt;
The title line looks like:&lt;br /&gt;
    Date,U,uztwc,uzfwc,lztwc,lzfsc,lzfpc,adimc,sett,se1,se3,se4,se5,roimp,sdro,ssur,sif,bfp,bfs,bfcc&lt;br /&gt;
&lt;br /&gt;
A value line consists of:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
     Date   - daily time stamp&lt;br /&gt;
     U      - the simulated effective rainfall (“total channel inflow”)&lt;br /&gt;
     uztwc  - upper zone tension water content&lt;br /&gt;
     uzfwc  - upper zone free water content&lt;br /&gt;
     lztwc  - lower zone tension water content&lt;br /&gt;
     lzfsc  - lower zone free secondary water content&lt;br /&gt;
     lzfpc  - lower zone free primary water content&lt;br /&gt;
     adimc  - tension water contents of the additional impervious area&lt;br /&gt;
     sett   - cumulative total evapotranspiration&lt;br /&gt;
     se1    - cumulative evapotranspiration from upper zone tension water&lt;br /&gt;
     se3    - cumulative evapotranspiration from lower zone tension water&lt;br /&gt;
     se4    - cumulative evapotranspiration&lt;br /&gt;
     se5    - cumulative evapotranspiration from riparian zone&lt;br /&gt;
     roimp  - runoff from impervious area&lt;br /&gt;
     sdro   - six hour sum of runoff&lt;br /&gt;
     ssur   - surface runoff&lt;br /&gt;
     sif    - interflow&lt;br /&gt;
     bfp    - primary baseflow&lt;br /&gt;
     bfs    - secondary baseflow&lt;br /&gt;
     bfcc   - channel baseflow (bfp+bfs)&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Some links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=585</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=585"/>
		<updated>2019-01-28T01:46:27Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Output File */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The first two are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the &amp;quot;Sacramento&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
  [FILES]&lt;br /&gt;
  loads = /home/agrineer/sma/input/loads.csv&lt;br /&gt;
  soil = /home/agrineer/sma/input/soil.csv&lt;br /&gt;
  output = /home/agrineer/sma/output/output.csv&lt;br /&gt;
  rain = /home/agrineer/sma/input/rain.csv&lt;br /&gt;
  irr = /home/agrineer/sma/input/irr.csv&lt;br /&gt;
&lt;br /&gt;
Note that when the sme.py invokes the SMA module the SMA configuration file is constructed on the fly, based on SME data and configuration input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameter input files in the SME configuration file.&lt;br /&gt;
&lt;br /&gt;
For example, to reference the SMA with parameters in the sme.py, the SME configuration file might have:&lt;br /&gt;
&lt;br /&gt;
  [SoilModel]&lt;br /&gt;
  model = SMA&lt;br /&gt;
  &lt;br /&gt;
  [SMA]&lt;br /&gt;
  program = /home/agrineer/sme/sme/sma&lt;br /&gt;
  soil = /home/agrineer/sme/tmp/soil.csv&lt;br /&gt;
  rain = /home/agrineer/sme/tmp/rain.csv&lt;br /&gt;
  irr = /home/agrineer/sme/tmp/irr.csv&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;loads&amp;quot; file (data) would be generated by the WRF model data and ETo calculations and then submitted to the SMA program.&lt;br /&gt;
&lt;br /&gt;
Note that the web SME tool constructs the configuration file for the sme.py program as above. See the SME description [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
All input files are text based with comma separable variables (.csv). These files can be are read by spreadsheets for presentation and general analysis purposes.&lt;br /&gt;
&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
The &amp;quot;loads&amp;quot; input file consists of a title line followed by value lines. Line values are comma separated (CSV) and the values are for date, precipitation, and ETc. Precipitation and ETc values are given in millimeters. For example,&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
  Date,P,E &lt;br /&gt;
  2018-01-02,0.00,1.0348 &lt;br /&gt;
  2018-01-03,0.00,0.8603 &lt;br /&gt;
  2018-01-04,0.00,0.8630 &lt;br /&gt;
  . &lt;br /&gt;
  . &lt;br /&gt;
  .&lt;br /&gt;
&lt;br /&gt;
Currently, comments cannot be placed above the title line.&lt;br /&gt;
Note that the precipitation values normally originate from the WRF model and can be overridden by local data input.&lt;br /&gt;
&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;soil&amp;quot; input file contains comma separated values (CSV) consisting of just a title line and a value line.&lt;br /&gt;
&lt;br /&gt;
The value line has values consisting of:&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
    soil    - given soil name (string)&lt;br /&gt;
&lt;br /&gt;
    comment - make a comment (string)&lt;br /&gt;
&lt;br /&gt;
    uztwm   - upper layer (zone) tension water maximum capacity, mm. &lt;br /&gt;
              The maximum volume of water (normalized to mm) held by the &lt;br /&gt;
              upper zone between field capacity and the wilting point which can &lt;br /&gt;
              be lost by direct evaporation and transpiration from soil. This &lt;br /&gt;
              storage is filled before any water in the upper zone is transferred &lt;br /&gt;
              to other storages. Use field capacity and wilt point water content &lt;br /&gt;
              ratios to determine normalized volume (mm) for some depth. ie. &lt;br /&gt;
              (Ofc - Owp)*depth = uztwm (max et storage capacity).&lt;br /&gt;
&lt;br /&gt;
    uzfwm   - upper layer free water maximum capacity, mm. This storage is the &lt;br /&gt;
              source of water for interflow and the driving force for &lt;br /&gt;
              transferring water to deeper depths.&lt;br /&gt;
&lt;br /&gt;
    uzk     - interflow depletion rate from the upper layer free water storage, &lt;br /&gt;
              uzfwm per day. That is, lateral drainage rate of upper zone &lt;br /&gt;
              free water expressed as a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    pctim   - permanent impervious area fraction of the catchment which &lt;br /&gt;
              produces impervious runoff during low flow conditions.&lt;br /&gt;
&lt;br /&gt;
    adimp   - maximum fraction of an additional impervious area due to &lt;br /&gt;
              saturation. That is, the additional fraction of the catchment &lt;br /&gt;
              which exhibits impervious characteristics when the catchment&#039;s&lt;br /&gt;
              tension water requirements are met.&lt;br /&gt;
&lt;br /&gt;
    perc    - maximum percolation rate coefficient (from upper zone free &lt;br /&gt;
              water into the lower zone).&lt;br /&gt;
&lt;br /&gt;
    rexp    - shape parameter of the percolation curve. An exponent &lt;br /&gt;
              determining the rate of change of the percolation &lt;br /&gt;
              rate with changing lower zone water contents.&lt;br /&gt;
&lt;br /&gt;
    lztwm   - lower layer tension water maximum capacity, mm. Water from &lt;br /&gt;
              this store can only be removed through transpiration.&lt;br /&gt;
&lt;br /&gt;
    lzfsm   - lower layer supplemental free water maximum capacity, mm. &lt;br /&gt;
              The maximum volume from which supplemental baseflow can be drawn.&lt;br /&gt;
&lt;br /&gt;
    lzfpm   - lower layer primary free water maximum capacity, mm. The maximum&lt;br /&gt;
              capacity from which primary base flow can be drawn.&lt;br /&gt;
&lt;br /&gt;
    lzsk    - depletion rate of the lower layer supplemental &lt;br /&gt;
              free water storage, lzfsm per day. That is, lateral drainage rate&lt;br /&gt;
              of lower zone supplemental free water expressed as&lt;br /&gt;
              a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    lzpk    - depletion rate of the lower layer primary free water storage, &lt;br /&gt;
              lzfpm, per day. That is, lateral drainage rate of lower zone &lt;br /&gt;
              primary free water expressed as a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    pfree   - percolation fraction that goes directly to the lower layer free &lt;br /&gt;
              water storages. Direct percolation fraction from upper to &lt;br /&gt;
              lower zone free water (the percentage of percolated &lt;br /&gt;
              water which is available to the lower zone free water &lt;br /&gt;
              before all lower zone tension water deficiencies are satisfied).&lt;br /&gt;
&lt;br /&gt;
    uztwc_0 - initial upper zone tension water content as proportion of ‘uztwm’&lt;br /&gt;
&lt;br /&gt;
    uzfwc_0 - initial upper zone free water content as proportion of ‘uzfwm&#039;&lt;br /&gt;
&lt;br /&gt;
    lztwc_0 - initial lower zone tension water content as proportion of ‘lztwm’&lt;br /&gt;
&lt;br /&gt;
    lzfsc_0 - initial lower zone free water secondary as proportion of ‘lzfsm’&lt;br /&gt;
&lt;br /&gt;
    lzfpc_0 - initial lower zone free water primary as proportion of ‘lzfpm’&lt;br /&gt;
&lt;br /&gt;
    adimc_0 - initial additional impervious flow store, as proportion of ‘uztwm+lztwm’&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Value ranges and default values from different studies:&lt;br /&gt;
&lt;br /&gt;
            | Blasone et. al.(2008)  |   Surrgo (2004) |  default   | units&lt;br /&gt;
    uztwm   |        1-150           |    10-300       |   50.1     | mm&lt;br /&gt;
    uzfwm   |        1-150           |     5-150       |   40.2     | mm&lt;br /&gt;
    uzk     |      0.1-0.5           |  0.10-0.75      |   0.1      | frac/day&lt;br /&gt;
    pctim   | 0.000001-0.1           |     N/A         |   0.000001 | none&lt;br /&gt;
    adimp   |        0-0.4           |     N/A         |   0.0      | none&lt;br /&gt;
    zperc   |        1-250           |     5-350       |   1.0      | none&lt;br /&gt;
    rexp    |        0-5             |     1-5         |   0.0      | none&lt;br /&gt;
    lztwm   |        1-500           |    10-500       | 250.0      | mm&lt;br /&gt;
    lzfsm   |        1-1000          |     5-400       | 500.0      | mm&lt;br /&gt;
    lzfpm   |        1-1000          |    10-1000      | 500.0      | mm&lt;br /&gt;
    lzsk    |     0.01-0.25          |  0.01-0.35      |   0.01     | frac/day&lt;br /&gt;
    lzpk    |   0.0001-0.25          | 0.001-0.05      |   0.1      | frac/day&lt;br /&gt;
    pfree   |        0-0.6           |   0.0-0.8       |   0.1      | none&lt;br /&gt;
&lt;br /&gt;
Soil input file example:&lt;br /&gt;
soil,comment,uztwm,uzfwm,uzk,pctim,adimp,zperc,rexp,lztwm,lzfsm,lzfpm,lzsk,lzpk,pfree,uztwc_0,uzfwc_0,lztwc_0,lzfsc_0,lzfpc_0,adimc_0&lt;br /&gt;
soil_default,demo purposes,50.1,40.2,0.1,0.000001,0.0,1.0,0.0,250.0,500.0,500.0,0.01,0.1,0.1,0.5,0.5,0.5,0.5,0.5,0.&lt;br /&gt;
&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
The file &amp;quot;rain&amp;quot; consists of a title line and value lines with comma separated values (CSV). The values are a date followed by the value in millimeters. For example,&lt;br /&gt;
&lt;br /&gt;
   Date,Rain (mm)&lt;br /&gt;
   2018-01-14,11.67&lt;br /&gt;
   2018-01-15,17.27&lt;br /&gt;
   2018-01-17,0.73&lt;br /&gt;
        .&lt;br /&gt;
        .&lt;br /&gt;
        .&lt;br /&gt;
&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
The input file &amp;quot;irr&amp;quot; consists of a title line and value lines with comma separated values (CSV). The values are a date followed by the value in millimeters. For example,&lt;br /&gt;
&lt;br /&gt;
    Date,Irrigation (mm)&lt;br /&gt;
    2018-01-10,10.0&lt;br /&gt;
    2018-01-20,10.0&lt;br /&gt;
    2018-01-30,10.0&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
== Output File ==&lt;br /&gt;
The output file has a title line followed by value lines. All lines are in CSV format.&lt;br /&gt;
&lt;br /&gt;
The title line looks like:&lt;br /&gt;
    Date,U,uztwc,uzfwc,lztwc,lzfsc,lzfpc,adimc,sett,se1,se3,se4,se5,roimp,sdro,ssur,sif,bfp,bfs,bfcc&lt;br /&gt;
&lt;br /&gt;
A value line consists of:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
     Date   - daily time stamp&lt;br /&gt;
     U      - the simulated effective rainfall (“total channel inflow”)&lt;br /&gt;
     uztwc  - upper zone tension water content&lt;br /&gt;
     uzfwc  - upper zone free water content&lt;br /&gt;
     lztwc  - lower zone tension water content&lt;br /&gt;
     lzfsc  - lower zone free secondary water content&lt;br /&gt;
     lzfpc  - lower zone free primary water content&lt;br /&gt;
     adimc  - tension water contents of the additional impervious area&lt;br /&gt;
     sett   - cumulative total evapotranspiration&lt;br /&gt;
     se1    - cumulative evapotranspiration from upper zone tension water&lt;br /&gt;
     se3    - cumulative evapotranspiration from lower zone tension water&lt;br /&gt;
     se4    - cumulative evapotranspiration&lt;br /&gt;
     se5    - cumulative evapotranspiration from riparian zone&lt;br /&gt;
     roimp  - runoff from impervious area&lt;br /&gt;
     sdro   - six hour sum of runoff&lt;br /&gt;
     ssur   - surface runoff&lt;br /&gt;
     sif    - interflow&lt;br /&gt;
     bfp    - primary baseflow&lt;br /&gt;
     bfs    - secondary baseflow&lt;br /&gt;
     bfcc   - channel baseflow (bfp+bfs)&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Some links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=584</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=584"/>
		<updated>2019-01-28T01:45:54Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The first two are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the &amp;quot;Sacramento&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
  [FILES]&lt;br /&gt;
  loads = /home/agrineer/sma/input/loads.csv&lt;br /&gt;
  soil = /home/agrineer/sma/input/soil.csv&lt;br /&gt;
  output = /home/agrineer/sma/output/output.csv&lt;br /&gt;
  rain = /home/agrineer/sma/input/rain.csv&lt;br /&gt;
  irr = /home/agrineer/sma/input/irr.csv&lt;br /&gt;
&lt;br /&gt;
Note that when the sme.py invokes the SMA module the SMA configuration file is constructed on the fly, based on SME data and configuration input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameter input files in the SME configuration file.&lt;br /&gt;
&lt;br /&gt;
For example, to reference the SMA with parameters in the sme.py, the SME configuration file might have:&lt;br /&gt;
&lt;br /&gt;
  [SoilModel]&lt;br /&gt;
  model = SMA&lt;br /&gt;
  &lt;br /&gt;
  [SMA]&lt;br /&gt;
  program = /home/agrineer/sme/sme/sma&lt;br /&gt;
  soil = /home/agrineer/sme/tmp/soil.csv&lt;br /&gt;
  rain = /home/agrineer/sme/tmp/rain.csv&lt;br /&gt;
  irr = /home/agrineer/sme/tmp/irr.csv&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;loads&amp;quot; file (data) would be generated by the WRF model data and ETo calculations and then submitted to the SMA program.&lt;br /&gt;
&lt;br /&gt;
Note that the web SME tool constructs the configuration file for the sme.py program as above. See the SME description [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
All input files are text based with comma separable variables (.csv). These files can be are read by spreadsheets for presentation and general analysis purposes.&lt;br /&gt;
&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
The &amp;quot;loads&amp;quot; input file consists of a title line followed by value lines. Line values are comma separated (CSV) and the values are for date, precipitation, and ETc. Precipitation and ETc values are given in millimeters. For example,&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
  Date,P,E &lt;br /&gt;
  2018-01-02,0.00,1.0348 &lt;br /&gt;
  2018-01-03,0.00,0.8603 &lt;br /&gt;
  2018-01-04,0.00,0.8630 &lt;br /&gt;
  . &lt;br /&gt;
  . &lt;br /&gt;
  .&lt;br /&gt;
&lt;br /&gt;
Currently, comments cannot be placed above the title line.&lt;br /&gt;
Note that the precipitation values normally originate from the WRF model and can be overridden by local data input.&lt;br /&gt;
&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;soil&amp;quot; input file contains comma separated values (CSV) consisting of just a title line and a value line.&lt;br /&gt;
&lt;br /&gt;
The value line has values consisting of:&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
    soil    - given soil name (string)&lt;br /&gt;
&lt;br /&gt;
    comment - make a comment (string)&lt;br /&gt;
&lt;br /&gt;
    uztwm   - upper layer (zone) tension water maximum capacity, mm. &lt;br /&gt;
              The maximum volume of water (normalized to mm) held by the &lt;br /&gt;
              upper zone between field capacity and the wilting point which can &lt;br /&gt;
              be lost by direct evaporation and transpiration from soil. This &lt;br /&gt;
              storage is filled before any water in the upper zone is transferred &lt;br /&gt;
              to other storages. Use field capacity and wilt point water content &lt;br /&gt;
              ratios to determine normalized volume (mm) for some depth. ie. &lt;br /&gt;
              (Ofc - Owp)*depth = uztwm (max et storage capacity).&lt;br /&gt;
&lt;br /&gt;
    uzfwm   - upper layer free water maximum capacity, mm. This storage is the &lt;br /&gt;
              source of water for interflow and the driving force for &lt;br /&gt;
              transferring water to deeper depths.&lt;br /&gt;
&lt;br /&gt;
    uzk     - interflow depletion rate from the upper layer free water storage, &lt;br /&gt;
              uzfwm per day. That is, lateral drainage rate of upper zone &lt;br /&gt;
              free water expressed as a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    pctim   - permanent impervious area fraction of the catchment which &lt;br /&gt;
              produces impervious runoff during low flow conditions.&lt;br /&gt;
&lt;br /&gt;
    adimp   - maximum fraction of an additional impervious area due to &lt;br /&gt;
              saturation. That is, the additional fraction of the catchment &lt;br /&gt;
              which exhibits impervious characteristics when the catchment&#039;s&lt;br /&gt;
              tension water requirements are met.&lt;br /&gt;
&lt;br /&gt;
    perc    - maximum percolation rate coefficient (from upper zone free &lt;br /&gt;
              water into the lower zone).&lt;br /&gt;
&lt;br /&gt;
    rexp    - shape parameter of the percolation curve. An exponent &lt;br /&gt;
              determining the rate of change of the percolation &lt;br /&gt;
              rate with changing lower zone water contents.&lt;br /&gt;
&lt;br /&gt;
    lztwm   - lower layer tension water maximum capacity, mm. Water from &lt;br /&gt;
              this store can only be removed through transpiration.&lt;br /&gt;
&lt;br /&gt;
    lzfsm   - lower layer supplemental free water maximum capacity, mm. &lt;br /&gt;
              The maximum volume from which supplemental baseflow can be drawn.&lt;br /&gt;
&lt;br /&gt;
    lzfpm   - lower layer primary free water maximum capacity, mm. The maximum&lt;br /&gt;
              capacity from which primary base flow can be drawn.&lt;br /&gt;
&lt;br /&gt;
    lzsk    - depletion rate of the lower layer supplemental &lt;br /&gt;
              free water storage, lzfsm per day. That is, lateral drainage rate&lt;br /&gt;
              of lower zone supplemental free water expressed as&lt;br /&gt;
              a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    lzpk    - depletion rate of the lower layer primary free water storage, &lt;br /&gt;
              lzfpm, per day. That is, lateral drainage rate of lower zone &lt;br /&gt;
              primary free water expressed as a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    pfree   - percolation fraction that goes directly to the lower layer free &lt;br /&gt;
              water storages. Direct percolation fraction from upper to &lt;br /&gt;
              lower zone free water (the percentage of percolated &lt;br /&gt;
              water which is available to the lower zone free water &lt;br /&gt;
              before all lower zone tension water deficiencies are satisfied).&lt;br /&gt;
&lt;br /&gt;
    uztwc_0 - initial upper zone tension water content as proportion of ‘uztwm’&lt;br /&gt;
&lt;br /&gt;
    uzfwc_0 - initial upper zone free water content as proportion of ‘uzfwm&#039;&lt;br /&gt;
&lt;br /&gt;
    lztwc_0 - initial lower zone tension water content as proportion of ‘lztwm’&lt;br /&gt;
&lt;br /&gt;
    lzfsc_0 - initial lower zone free water secondary as proportion of ‘lzfsm’&lt;br /&gt;
&lt;br /&gt;
    lzfpc_0 - initial lower zone free water primary as proportion of ‘lzfpm’&lt;br /&gt;
&lt;br /&gt;
    adimc_0 - initial additional impervious flow store, as proportion of ‘uztwm+lztwm’&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Value ranges and default values from different studies:&lt;br /&gt;
&lt;br /&gt;
            | Blasone et. al.(2008)  |   Surrgo (2004) |  default   | units&lt;br /&gt;
    uztwm   |        1-150           |    10-300       |   50.1     | mm&lt;br /&gt;
    uzfwm   |        1-150           |     5-150       |   40.2     | mm&lt;br /&gt;
    uzk     |      0.1-0.5           |  0.10-0.75      |   0.1      | frac/day&lt;br /&gt;
    pctim   | 0.000001-0.1           |     N/A         |   0.000001 | none&lt;br /&gt;
    adimp   |        0-0.4           |     N/A         |   0.0      | none&lt;br /&gt;
    zperc   |        1-250           |     5-350       |   1.0      | none&lt;br /&gt;
    rexp    |        0-5             |     1-5         |   0.0      | none&lt;br /&gt;
    lztwm   |        1-500           |    10-500       | 250.0      | mm&lt;br /&gt;
    lzfsm   |        1-1000          |     5-400       | 500.0      | mm&lt;br /&gt;
    lzfpm   |        1-1000          |    10-1000      | 500.0      | mm&lt;br /&gt;
    lzsk    |     0.01-0.25          |  0.01-0.35      |   0.01     | frac/day&lt;br /&gt;
    lzpk    |   0.0001-0.25          | 0.001-0.05      |   0.1      | frac/day&lt;br /&gt;
    pfree   |        0-0.6           |   0.0-0.8       |   0.1      | none&lt;br /&gt;
&lt;br /&gt;
Soil input file example:&lt;br /&gt;
soil,comment,uztwm,uzfwm,uzk,pctim,adimp,zperc,rexp,lztwm,lzfsm,lzfpm,lzsk,lzpk,pfree,uztwc_0,uzfwc_0,lztwc_0,lzfsc_0,lzfpc_0,adimc_0&lt;br /&gt;
soil_default,demo purposes,50.1,40.2,0.1,0.000001,0.0,1.0,0.0,250.0,500.0,500.0,0.01,0.1,0.1,0.5,0.5,0.5,0.5,0.5,0.&lt;br /&gt;
&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
The file &amp;quot;rain&amp;quot; consists of a title line and value lines with comma separated values (CSV). The values are a date followed by the value in millimeters. For example,&lt;br /&gt;
&lt;br /&gt;
   Date,Rain (mm)&lt;br /&gt;
   2018-01-14,11.67&lt;br /&gt;
   2018-01-15,17.27&lt;br /&gt;
   2018-01-17,0.73&lt;br /&gt;
        .&lt;br /&gt;
        .&lt;br /&gt;
        .&lt;br /&gt;
&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
The input file &amp;quot;irr&amp;quot; consists of a title line and value lines with comma separated values (CSV). The values are a date followed by the value in millimeters. For example,&lt;br /&gt;
&lt;br /&gt;
    Date,Irrigation (mm)&lt;br /&gt;
    2018-01-10,10.0&lt;br /&gt;
    2018-01-20,10.0&lt;br /&gt;
    2018-01-30,10.0&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
=== Output File ===&lt;br /&gt;
The output file has a title line followed by value lines. All lines are in CSV format.&lt;br /&gt;
&lt;br /&gt;
The title line looks like:&lt;br /&gt;
    Date,U,uztwc,uzfwc,lztwc,lzfsc,lzfpc,adimc,sett,se1,se3,se4,se5,roimp,sdro,ssur,sif,bfp,bfs,bfcc&lt;br /&gt;
&lt;br /&gt;
A value line consists of:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
     Date   - daily time stamp&lt;br /&gt;
     U      - the simulated effective rainfall (“total channel inflow”)&lt;br /&gt;
     uztwc  - upper zone tension water content&lt;br /&gt;
     uzfwc  - upper zone free water content&lt;br /&gt;
     lztwc  - lower zone tension water content&lt;br /&gt;
     lzfsc  - lower zone free secondary water content&lt;br /&gt;
     lzfpc  - lower zone free primary water content&lt;br /&gt;
     adimc  - tension water contents of the additional impervious area&lt;br /&gt;
     sett   - cumulative total evapotranspiration&lt;br /&gt;
     se1    - cumulative evapotranspiration from upper zone tension water&lt;br /&gt;
     se3    - cumulative evapotranspiration from lower zone tension water&lt;br /&gt;
     se4    - cumulative evapotranspiration&lt;br /&gt;
     se5    - cumulative evapotranspiration from riparian zone&lt;br /&gt;
     roimp  - runoff from impervious area&lt;br /&gt;
     sdro   - six hour sum of runoff&lt;br /&gt;
     ssur   - surface runoff&lt;br /&gt;
     sif    - interflow&lt;br /&gt;
     bfp    - primary baseflow&lt;br /&gt;
     bfs    - secondary baseflow&lt;br /&gt;
     bfcc   - channel baseflow (bfp+bfs)&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Some links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=583</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=583"/>
		<updated>2019-01-28T01:43:43Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The first two are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the &amp;quot;Sacramento&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
[FILES]&amp;lt;br&amp;gt;&lt;br /&gt;
loads = /home/agrineer/sma/input/loads.csv &amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sma/input/soil.csv &amp;lt;br&amp;gt;&lt;br /&gt;
output = /home/agrineer/sma/output/output.csv &amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sma/input/rain.csv &amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sma/input/irr.csv &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when the sme.py invokes the SMA module the SMA configuration file is constructed on the fly, based on SME data and configuration input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameter input files in the SME configuration file.&lt;br /&gt;
&lt;br /&gt;
For example, to reference the SMA with parameters in the sme.py, the SME configuration file might have:&lt;br /&gt;
&lt;br /&gt;
[SoilModel]&amp;lt;br&amp;gt;&lt;br /&gt;
model = SMA&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[SMA]&amp;lt;br&amp;gt;&lt;br /&gt;
program = /home/agrineer/sme/sme/sma&amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sme/tmp/soil.csv&amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sme/tmp/rain.csv&amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sme/tmp/irr.csv&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;loads&amp;quot; file (data) would be generated by the WRF model data and ETo calculations and then submitted to the SMA program.&lt;br /&gt;
&lt;br /&gt;
Note that the web SME tool constructs the configuration file for the sme.py program as above. See the SME description [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
All input files are text based with comma separable variables (.csv). These files can be are read by spreadsheets for presentation and general analysis purposes.&lt;br /&gt;
&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
The &amp;quot;loads&amp;quot; input file consists of a title line followed by value lines. Line values are comma separated (CSV) and the values are for date, precipitation, and ETc. Precipitation and ETc values are given in millimeters. For example,&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
  Date,P,E &lt;br /&gt;
  2018-01-02,0.00,1.0348 &lt;br /&gt;
  2018-01-03,0.00,0.8603 &lt;br /&gt;
  2018-01-04,0.00,0.8630 &lt;br /&gt;
  . &lt;br /&gt;
  . &lt;br /&gt;
  .&lt;br /&gt;
&lt;br /&gt;
Currently, comments cannot be placed above the title line.&lt;br /&gt;
Note that the precipitation values normally originate from the WRF model and can be overridden by local data input.&lt;br /&gt;
&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;soil&amp;quot; input file contains comma separated values (CSV) consisting of just a title line and a value line.&lt;br /&gt;
&lt;br /&gt;
The value line has values consisting of:&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
    soil    - given soil name (string)&lt;br /&gt;
&lt;br /&gt;
    comment - make a comment (string)&lt;br /&gt;
&lt;br /&gt;
    uztwm   - upper layer (zone) tension water maximum capacity, mm. &lt;br /&gt;
              The maximum volume of water (normalized to mm) held by the &lt;br /&gt;
              upper zone between field capacity and the wilting point which can &lt;br /&gt;
              be lost by direct evaporation and transpiration from soil. This &lt;br /&gt;
              storage is filled before any water in the upper zone is transferred &lt;br /&gt;
              to other storages. Use field capacity and wilt point water content &lt;br /&gt;
              ratios to determine normalized volume (mm) for some depth. ie. &lt;br /&gt;
              (Ofc - Owp)*depth = uztwm (max et storage capacity).&lt;br /&gt;
&lt;br /&gt;
    uzfwm   - upper layer free water maximum capacity, mm. This storage is the &lt;br /&gt;
              source of water for interflow and the driving force for &lt;br /&gt;
              transferring water to deeper depths.&lt;br /&gt;
&lt;br /&gt;
    uzk     - interflow depletion rate from the upper layer free water storage, &lt;br /&gt;
              uzfwm per day. That is, lateral drainage rate of upper zone &lt;br /&gt;
              free water expressed as a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    pctim   - permanent impervious area fraction of the catchment which &lt;br /&gt;
              produces impervious runoff during low flow conditions.&lt;br /&gt;
&lt;br /&gt;
    adimp   - maximum fraction of an additional impervious area due to &lt;br /&gt;
              saturation. That is, the additional fraction of the catchment &lt;br /&gt;
              which exhibits impervious characteristics when the catchment&#039;s&lt;br /&gt;
              tension water requirements are met.&lt;br /&gt;
&lt;br /&gt;
    perc    - maximum percolation rate coefficient (from upper zone free &lt;br /&gt;
              water into the lower zone).&lt;br /&gt;
&lt;br /&gt;
    rexp    - shape parameter of the percolation curve. An exponent &lt;br /&gt;
              determining the rate of change of the percolation &lt;br /&gt;
              rate with changing lower zone water contents.&lt;br /&gt;
&lt;br /&gt;
    lztwm   - lower layer tension water maximum capacity, mm. Water from &lt;br /&gt;
              this store can only be removed through transpiration.&lt;br /&gt;
&lt;br /&gt;
    lzfsm   - lower layer supplemental free water maximum capacity, mm. &lt;br /&gt;
              The maximum volume from which supplemental baseflow can be drawn.&lt;br /&gt;
&lt;br /&gt;
    lzfpm   - lower layer primary free water maximum capacity, mm. The maximum&lt;br /&gt;
              capacity from which primary base flow can be drawn.&lt;br /&gt;
&lt;br /&gt;
    lzsk    - depletion rate of the lower layer supplemental &lt;br /&gt;
              free water storage, lzfsm per day. That is, lateral drainage rate&lt;br /&gt;
              of lower zone supplemental free water expressed as&lt;br /&gt;
              a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    lzpk    - depletion rate of the lower layer primary free water storage, &lt;br /&gt;
              lzfpm, per day. That is, lateral drainage rate of lower zone &lt;br /&gt;
              primary free water expressed as a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    pfree   - percolation fraction that goes directly to the lower layer free &lt;br /&gt;
              water storages. Direct percolation fraction from upper to &lt;br /&gt;
              lower zone free water (the percentage of percolated &lt;br /&gt;
              water which is available to the lower zone free water &lt;br /&gt;
              before all lower zone tension water deficiencies are satisfied).&lt;br /&gt;
&lt;br /&gt;
    uztwc_0 - initial upper zone tension water content as proportion of ‘uztwm’&lt;br /&gt;
&lt;br /&gt;
    uzfwc_0 - initial upper zone free water content as proportion of ‘uzfwm&#039;&lt;br /&gt;
&lt;br /&gt;
    lztwc_0 - initial lower zone tension water content as proportion of ‘lztwm’&lt;br /&gt;
&lt;br /&gt;
    lzfsc_0 - initial lower zone free water secondary as proportion of ‘lzfsm’&lt;br /&gt;
&lt;br /&gt;
    lzfpc_0 - initial lower zone free water primary as proportion of ‘lzfpm’&lt;br /&gt;
&lt;br /&gt;
    adimc_0 - initial additional impervious flow store, as proportion of ‘uztwm+lztwm’&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Value ranges and default values from different studies:&lt;br /&gt;
&lt;br /&gt;
            | Blasone et. al.(2008)  |   Surrgo (2004) |  default   | units&lt;br /&gt;
    uztwm   |        1-150           |    10-300       |   50.1     | mm&lt;br /&gt;
    uzfwm   |        1-150           |     5-150       |   40.2     | mm&lt;br /&gt;
    uzk     |      0.1-0.5           |  0.10-0.75      |   0.1      | frac/day&lt;br /&gt;
    pctim   | 0.000001-0.1           |     N/A         |   0.000001 | none&lt;br /&gt;
    adimp   |        0-0.4           |     N/A         |   0.0      | none&lt;br /&gt;
    zperc   |        1-250           |     5-350       |   1.0      | none&lt;br /&gt;
    rexp    |        0-5             |     1-5         |   0.0      | none&lt;br /&gt;
    lztwm   |        1-500           |    10-500       | 250.0      | mm&lt;br /&gt;
    lzfsm   |        1-1000          |     5-400       | 500.0      | mm&lt;br /&gt;
    lzfpm   |        1-1000          |    10-1000      | 500.0      | mm&lt;br /&gt;
    lzsk    |     0.01-0.25          |  0.01-0.35      |   0.01     | frac/day&lt;br /&gt;
    lzpk    |   0.0001-0.25          | 0.001-0.05      |   0.1      | frac/day&lt;br /&gt;
    pfree   |        0-0.6           |   0.0-0.8       |   0.1      | none&lt;br /&gt;
&lt;br /&gt;
Soil input file example:&lt;br /&gt;
soil,comment,uztwm,uzfwm,uzk,pctim,adimp,zperc,rexp,lztwm,lzfsm,lzfpm,lzsk,lzpk,pfree,uztwc_0,uzfwc_0,lztwc_0,lzfsc_0,lzfpc_0,adimc_0&lt;br /&gt;
soil_default,demo purposes,50.1,40.2,0.1,0.000001,0.0,1.0,0.0,250.0,500.0,500.0,0.01,0.1,0.1,0.5,0.5,0.5,0.5,0.5,0.&lt;br /&gt;
&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
The file &amp;quot;rain&amp;quot; consists of a title line and value lines with comma separated values (CSV). The values are a date followed by the value in millimeters. For example,&lt;br /&gt;
&lt;br /&gt;
   Date,Rain (mm)&lt;br /&gt;
   2018-01-14,11.67&lt;br /&gt;
   2018-01-15,17.27&lt;br /&gt;
   2018-01-17,0.73&lt;br /&gt;
        .&lt;br /&gt;
        .&lt;br /&gt;
        .&lt;br /&gt;
&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
The input file &amp;quot;irr&amp;quot; consists of a title line and value lines with comma separated values (CSV). The values are a date followed by the value in millimeters. For example,&lt;br /&gt;
&lt;br /&gt;
    Date,Irrigation (mm)&lt;br /&gt;
    2018-01-10,10.0&lt;br /&gt;
    2018-01-20,10.0&lt;br /&gt;
    2018-01-30,10.0&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
=== Output File ===&lt;br /&gt;
The output file has a title line followed by value lines. All lines are in CSV format.&lt;br /&gt;
&lt;br /&gt;
The title line looks like:&lt;br /&gt;
    Date,U,uztwc,uzfwc,lztwc,lzfsc,lzfpc,adimc,sett,se1,se3,se4,se5,roimp,sdro,ssur,sif,bfp,bfs,bfcc&lt;br /&gt;
&lt;br /&gt;
A value line consists of:&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
     Date   - daily time stamp&lt;br /&gt;
     U      - the simulated effective rainfall (“total channel inflow”)&lt;br /&gt;
     uztwc  - upper zone tension water content&lt;br /&gt;
     uzfwc  - upper zone free water content&lt;br /&gt;
     lztwc  - lower zone tension water content&lt;br /&gt;
     lzfsc  - lower zone free secondary water content&lt;br /&gt;
     lzfpc  - lower zone free primary water content&lt;br /&gt;
     adimc  - tension water contents of the additional impervious area&lt;br /&gt;
     sett   - cumulative total evapotranspiration&lt;br /&gt;
     se1    - cumulative evapotranspiration from upper zone tension water&lt;br /&gt;
     se3    - cumulative evapotranspiration from lower zone tension water&lt;br /&gt;
     se4    - cumulative evapotranspiration&lt;br /&gt;
     se5    - cumulative evapotranspiration from riparian zone&lt;br /&gt;
     roimp  - runoff from impervious area&lt;br /&gt;
     sdro   - six hour sum of runoff&lt;br /&gt;
     ssur   - surface runoff&lt;br /&gt;
     sif    - interflow&lt;br /&gt;
     bfp    - primary baseflow&lt;br /&gt;
     bfs    - secondary baseflow&lt;br /&gt;
     bfcc   - channel baseflow (bfp+bfs)&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Some links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=582</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=582"/>
		<updated>2019-01-28T01:31:43Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Soil Attributes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The first two are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the &amp;quot;Sacramento&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
[FILES]&amp;lt;br&amp;gt;&lt;br /&gt;
loads = /home/agrineer/sma/input/loads.csv &amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sma/input/soil.csv &amp;lt;br&amp;gt;&lt;br /&gt;
output = /home/agrineer/sma/output/output.csv &amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sma/input/rain.csv &amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sma/input/irr.csv &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when the sme.py invokes the SMA module the SMA configuration file is constructed on the fly, based on SME data and configuration input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameter input files in the SME configuration file.&lt;br /&gt;
&lt;br /&gt;
For example, to reference the SMA with parameters in the sme.py, the SME configuration file might have:&lt;br /&gt;
&lt;br /&gt;
[SoilModel]&amp;lt;br&amp;gt;&lt;br /&gt;
model = SMA&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[SMA]&amp;lt;br&amp;gt;&lt;br /&gt;
program = /home/agrineer/sme/sme/sma&amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sme/tmp/soil.csv&amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sme/tmp/rain.csv&amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sme/tmp/irr.csv&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;loads&amp;quot; file (data) would be generated by the WRF model data and ETo calculations and then submitted to the SMA program.&lt;br /&gt;
&lt;br /&gt;
Note that the web SME tool constructs the configuration file for the sme.py program as above. See the SME description [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
All input files are text based with comma separable variables (.csv). These files can be are read by spreadsheets for presentation and general analysis purposes.&lt;br /&gt;
&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
The &amp;quot;loads&amp;quot; input file consists of a title line followed by value lines. Line values are comma separated (CSV) and the values are for date, precipitation, and ETc. Precipitation and ETc values are given in millimeters. For example,&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
  Date,P,E &lt;br /&gt;
  2018-01-02,0.00,1.0348 &lt;br /&gt;
  2018-01-03,0.00,0.8603 &lt;br /&gt;
  2018-01-04,0.00,0.8630 &lt;br /&gt;
  . &lt;br /&gt;
  . &lt;br /&gt;
  .&lt;br /&gt;
&lt;br /&gt;
Currently, comments cannot be placed above the title line.&lt;br /&gt;
Note that the precipitation values normally originate from the WRF model and can be overridden by local data input.&lt;br /&gt;
&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;soil&amp;quot; input file contains comma separated values (CSV) consisting of just a title line and a value line.&lt;br /&gt;
&lt;br /&gt;
The value line has values consisting of:&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
    soil    - given soil name (string)&lt;br /&gt;
&lt;br /&gt;
    comment - make a comment (string)&lt;br /&gt;
&lt;br /&gt;
    uztwm   - upper layer (zone) tension water maximum capacity, mm. &lt;br /&gt;
              The maximum volume of water (normalized to mm) held by the &lt;br /&gt;
              upper zone between field capacity and the wilting point which can &lt;br /&gt;
              be lost by direct evaporation and transpiration from soil. This &lt;br /&gt;
              storage is filled before any water in the upper zone is transferred &lt;br /&gt;
              to other storages. Use field capacity and wilt point water content &lt;br /&gt;
              ratios to determine normalized volume (mm) for some depth. ie. &lt;br /&gt;
              (Ofc - Owp)*depth = uztwm (max et storage capacity).&lt;br /&gt;
&lt;br /&gt;
    uzfwm   - upper layer free water maximum capacity, mm. This storage is the &lt;br /&gt;
              source of water for interflow and the driving force for &lt;br /&gt;
              transferring water to deeper depths.&lt;br /&gt;
&lt;br /&gt;
    uzk     - interflow depletion rate from the upper layer free water storage, &lt;br /&gt;
              uzfwm per day. That is, lateral drainage rate of upper zone &lt;br /&gt;
              free water expressed as a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    pctim   - permanent impervious area fraction of the catchment which &lt;br /&gt;
              produces impervious runoff during low flow conditions.&lt;br /&gt;
&lt;br /&gt;
    adimp   - maximum fraction of an additional impervious area due to &lt;br /&gt;
              saturation. That is, the additional fraction of the catchment &lt;br /&gt;
              which exhibits impervious characteristics when the catchment&#039;s&lt;br /&gt;
              tension water requirements are met.&lt;br /&gt;
&lt;br /&gt;
    perc    - maximum percolation rate coefficient (from upper zone free &lt;br /&gt;
              water into the lower zone).&lt;br /&gt;
&lt;br /&gt;
    rexp    - shape parameter of the percolation curve. An exponent &lt;br /&gt;
              determining the rate of change of the percolation &lt;br /&gt;
              rate with changing lower zone water contents.&lt;br /&gt;
&lt;br /&gt;
    lztwm   - lower layer tension water maximum capacity, mm. Water from &lt;br /&gt;
              this store can only be removed through transpiration.&lt;br /&gt;
&lt;br /&gt;
    lzfsm   - lower layer supplemental free water maximum capacity, mm. &lt;br /&gt;
              The maximum volume from which supplemental baseflow can be drawn.&lt;br /&gt;
&lt;br /&gt;
    lzfpm   - lower layer primary free water maximum capacity, mm. The maximum&lt;br /&gt;
              capacity from which primary base flow can be drawn.&lt;br /&gt;
&lt;br /&gt;
    lzsk    - depletion rate of the lower layer supplemental &lt;br /&gt;
              free water storage, lzfsm per day. That is, lateral drainage rate&lt;br /&gt;
              of lower zone supplemental free water expressed as&lt;br /&gt;
              a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    lzpk    - depletion rate of the lower layer primary free water storage, &lt;br /&gt;
              lzfpm, per day. That is, lateral drainage rate of lower zone &lt;br /&gt;
              primary free water expressed as a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    pfree   - percolation fraction that goes directly to the lower layer free &lt;br /&gt;
              water storages. Direct percolation fraction from upper to &lt;br /&gt;
              lower zone free water (the percentage of percolated &lt;br /&gt;
              water which is available to the lower zone free water &lt;br /&gt;
              before all lower zone tension water deficiencies are satisfied).&lt;br /&gt;
&lt;br /&gt;
    uztwc_0 - initial upper zone tension water content as proportion of ‘uztwm’&lt;br /&gt;
&lt;br /&gt;
    uzfwc_0 - initial upper zone free water content as proportion of ‘uzfwm&#039;&lt;br /&gt;
&lt;br /&gt;
    lztwc_0 - initial lower zone tension water content as proportion of ‘lztwm’&lt;br /&gt;
&lt;br /&gt;
    lzfsc_0 - initial lower zone free water secondary as proportion of ‘lzfsm’&lt;br /&gt;
&lt;br /&gt;
    lzfpc_0 - initial lower zone free water primary as proportion of ‘lzfpm’&lt;br /&gt;
&lt;br /&gt;
    adimc_0 - initial additional impervious flow store, as proportion of ‘uztwm+lztwm’&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Value ranges and default values from different studies:&lt;br /&gt;
&lt;br /&gt;
            | Blasone et. al.(2008)  |   Surrgo (2004) |  default   | units&lt;br /&gt;
    uztwm   |        1-150           |    10-300       |   50.1     | mm&lt;br /&gt;
    uzfwm   |        1-150           |     5-150       |   40.2     | mm&lt;br /&gt;
    uzk     |      0.1-0.5           |  0.10-0.75      |   0.1      | frac/day&lt;br /&gt;
    pctim   | 0.000001-0.1           |     N/A         |   0.000001 | none&lt;br /&gt;
    adimp   |        0-0.4           |     N/A         |   0.0      | none&lt;br /&gt;
    zperc   |        1-250           |     5-350       |   1.0      | none&lt;br /&gt;
    rexp    |        0-5             |     1-5         |   0.0      | none&lt;br /&gt;
    lztwm   |        1-500           |    10-500       | 250.0      | mm&lt;br /&gt;
    lzfsm   |        1-1000          |     5-400       | 500.0      | mm&lt;br /&gt;
    lzfpm   |        1-1000          |    10-1000      | 500.0      | mm&lt;br /&gt;
    lzsk    |     0.01-0.25          |  0.01-0.35      |   0.01     | frac/day&lt;br /&gt;
    lzpk    |   0.0001-0.25          | 0.001-0.05      |   0.1      | frac/day&lt;br /&gt;
    pfree   |        0-0.6           |   0.0-0.8       |   0.1      | none&lt;br /&gt;
&lt;br /&gt;
Soil input file example:&lt;br /&gt;
soil,comment,uztwm,uzfwm,uzk,pctim,adimp,zperc,rexp,lztwm,lzfsm,lzfpm,lzsk,lzpk,pfree,uztwc_0,uzfwc_0,lztwc_0,lzfsc_0,lzfpc_0,adimc_0&lt;br /&gt;
soil_default,demo purposes,50.1,40.2,0.1,0.000001,0.0,1.0,0.0,250.0,500.0,500.0,0.01,0.1,0.1,0.5,0.5,0.5,0.5,0.5,0.&lt;br /&gt;
&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
The file &amp;quot;rain&amp;quot; consists of a title line and value lines with comma separated values (CSV). The values are a date followed by the value in millimeters. For example,&lt;br /&gt;
&lt;br /&gt;
   Date,Rain (mm)&lt;br /&gt;
   2018-01-14,11.67&lt;br /&gt;
   2018-01-15,17.27&lt;br /&gt;
   2018-01-17,0.73&lt;br /&gt;
        .&lt;br /&gt;
        .&lt;br /&gt;
        .&lt;br /&gt;
&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
The input file &amp;quot;irr&amp;quot; consists of a title line and value lines with comma separated values (CSV). The values are a date followed by the value in millimeters. For example,&lt;br /&gt;
&lt;br /&gt;
    Date,Irrigation (mm)&lt;br /&gt;
    2018-01-10,10.0&lt;br /&gt;
    2018-01-20,10.0&lt;br /&gt;
    2018-01-30,10.0&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Some links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=581</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=581"/>
		<updated>2019-01-28T01:29:29Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Irrigation Events */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The first two are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the &amp;quot;Sacramento&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
[FILES]&amp;lt;br&amp;gt;&lt;br /&gt;
loads = /home/agrineer/sma/input/loads.csv &amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sma/input/soil.csv &amp;lt;br&amp;gt;&lt;br /&gt;
output = /home/agrineer/sma/output/output.csv &amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sma/input/rain.csv &amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sma/input/irr.csv &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when the sme.py invokes the SMA module the SMA configuration file is constructed on the fly, based on SME data and configuration input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameter input files in the SME configuration file.&lt;br /&gt;
&lt;br /&gt;
For example, to reference the SMA with parameters in the sme.py, the SME configuration file might have:&lt;br /&gt;
&lt;br /&gt;
[SoilModel]&amp;lt;br&amp;gt;&lt;br /&gt;
model = SMA&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[SMA]&amp;lt;br&amp;gt;&lt;br /&gt;
program = /home/agrineer/sme/sme/sma&amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sme/tmp/soil.csv&amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sme/tmp/rain.csv&amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sme/tmp/irr.csv&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;loads&amp;quot; file (data) would be generated by the WRF model data and ETo calculations and then submitted to the SMA program.&lt;br /&gt;
&lt;br /&gt;
Note that the web SME tool constructs the configuration file for the sme.py program as above. See the SME description [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
All input files are text based with comma separable variables (.csv). These files can be are read by spreadsheets for presentation and general analysis purposes.&lt;br /&gt;
&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
The &amp;quot;loads&amp;quot; input file consists of a title line followed by value lines. Line values are comma separated (CSV) and the values are for date, precipitation, and ETc. Precipitation and ETc values are given in millimeters. For example,&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
  Date,P,E &lt;br /&gt;
  2018-01-02,0.00,1.0348 &lt;br /&gt;
  2018-01-03,0.00,0.8603 &lt;br /&gt;
  2018-01-04,0.00,0.8630 &lt;br /&gt;
  . &lt;br /&gt;
  . &lt;br /&gt;
  .&lt;br /&gt;
&lt;br /&gt;
Currently, comments cannot be placed above the title line.&lt;br /&gt;
Note that the precipitation values normally originate from the WRF model and can be overridden by local data input.&lt;br /&gt;
&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
&lt;br /&gt;
Soil input filename containing comma separated values (CSV) consisting of a title line and a value line.&lt;br /&gt;
&lt;br /&gt;
The input file consists of a title line followed by a value line.&lt;br /&gt;
The value line has comma separated values consisting of:&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
    soil    - given soil name (string)&lt;br /&gt;
&lt;br /&gt;
    comment - make a comment (string)&lt;br /&gt;
&lt;br /&gt;
    uztwm   - upper layer (zone) tension water maximum capacity, mm. &lt;br /&gt;
              The maximum volume of water (normalized to mm) held by the &lt;br /&gt;
              upper zone between field capacity and the wilting point which can &lt;br /&gt;
              be lost by direct evaporation and transpiration from soil. This &lt;br /&gt;
              storage is filled before any water in the upper zone is transferred &lt;br /&gt;
              to other storages. Use field capacity and wilt point water content &lt;br /&gt;
              ratios to determine normalized volume (mm) for some depth. ie. &lt;br /&gt;
              (Ofc - Owp)*depth = uztwm (max et storage capacity).&lt;br /&gt;
&lt;br /&gt;
    uzfwm   - upper layer free water maximum capacity, mm. This storage is the &lt;br /&gt;
              source of water for interflow and the driving force for &lt;br /&gt;
              transferring water to deeper depths.&lt;br /&gt;
&lt;br /&gt;
    uzk     - interflow depletion rate from the upper layer free water storage, &lt;br /&gt;
              uzfwm per day. That is, lateral drainage rate of upper zone &lt;br /&gt;
              free water expressed as a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    pctim   - permanent impervious area fraction of the catchment which &lt;br /&gt;
              produces impervious runoff during low flow conditions.&lt;br /&gt;
&lt;br /&gt;
    adimp   - maximum fraction of an additional impervious area due to &lt;br /&gt;
              saturation. That is, the additional fraction of the catchment &lt;br /&gt;
              which exhibits impervious characteristics when the catchment&#039;s&lt;br /&gt;
              tension water requirements are met.&lt;br /&gt;
&lt;br /&gt;
    perc    - maximum percolation rate coefficient (from upper zone free &lt;br /&gt;
              water into the lower zone).&lt;br /&gt;
&lt;br /&gt;
    rexp    - shape parameter of the percolation curve. An exponent &lt;br /&gt;
              determining the rate of change of the percolation &lt;br /&gt;
              rate with changing lower zone water contents.&lt;br /&gt;
&lt;br /&gt;
    lztwm   - lower layer tension water maximum capacity, mm. Water from &lt;br /&gt;
              this store can only be removed through transpiration.&lt;br /&gt;
&lt;br /&gt;
    lzfsm   - lower layer supplemental free water maximum capacity, mm. &lt;br /&gt;
              The maximum volume from which supplemental baseflow can be drawn.&lt;br /&gt;
&lt;br /&gt;
    lzfpm   - lower layer primary free water maximum capacity, mm. The maximum&lt;br /&gt;
              capacity from which primary base flow can be drawn.&lt;br /&gt;
&lt;br /&gt;
    lzsk    - depletion rate of the lower layer supplemental &lt;br /&gt;
              free water storage, lzfsm per day. That is, lateral drainage rate&lt;br /&gt;
              of lower zone supplemental free water expressed as&lt;br /&gt;
              a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    lzpk    - depletion rate of the lower layer primary free water storage, &lt;br /&gt;
              lzfpm, per day. That is, lateral drainage rate of lower zone &lt;br /&gt;
              primary free water expressed as a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    pfree   - percolation fraction that goes directly to the lower layer free &lt;br /&gt;
              water storages. Direct percolation fraction from upper to &lt;br /&gt;
              lower zone free water (the percentage of percolated &lt;br /&gt;
              water which is available to the lower zone free water &lt;br /&gt;
              before all lower zone tension water deficiencies are satisfied).&lt;br /&gt;
&lt;br /&gt;
    uztwc_0 - initial upper zone tension water content as proportion of ‘uztwm’&lt;br /&gt;
&lt;br /&gt;
    uzfwc_0 - initial upper zone free water content as proportion of ‘uzfwm&#039;&lt;br /&gt;
&lt;br /&gt;
    lztwc_0 - initial lower zone tension water content as proportion of ‘lztwm’&lt;br /&gt;
&lt;br /&gt;
    lzfsc_0 - initial lower zone free water secondary as proportion of ‘lzfsm’&lt;br /&gt;
&lt;br /&gt;
    lzfpc_0 - initial lower zone free water primary as proportion of ‘lzfpm’&lt;br /&gt;
&lt;br /&gt;
    adimc_0 - initial additional impervious flow store, as proportion of ‘uztwm+lztwm’&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Value ranges and default values from different studies:&lt;br /&gt;
&lt;br /&gt;
            | Blasone et. al.(2008)  |   Surrgo (2004) |  default   | units&lt;br /&gt;
    uztwm   |        1-150           |    10-300       |   50.1     | mm&lt;br /&gt;
    uzfwm   |        1-150           |     5-150       |   40.2     | mm&lt;br /&gt;
    uzk     |      0.1-0.5           |  0.10-0.75      |   0.1      | frac/day&lt;br /&gt;
    pctim   | 0.000001-0.1           |     N/A         |   0.000001 | none&lt;br /&gt;
    adimp   |        0-0.4           |     N/A         |   0.0      | none&lt;br /&gt;
    zperc   |        1-250           |     5-350       |   1.0      | none&lt;br /&gt;
    rexp    |        0-5             |     1-5         |   0.0      | none&lt;br /&gt;
    lztwm   |        1-500           |    10-500       | 250.0      | mm&lt;br /&gt;
    lzfsm   |        1-1000          |     5-400       | 500.0      | mm&lt;br /&gt;
    lzfpm   |        1-1000          |    10-1000      | 500.0      | mm&lt;br /&gt;
    lzsk    |     0.01-0.25          |  0.01-0.35      |   0.01     | frac/day&lt;br /&gt;
    lzpk    |   0.0001-0.25          | 0.001-0.05      |   0.1      | frac/day&lt;br /&gt;
    pfree   |        0-0.6           |   0.0-0.8       |   0.1      | none&lt;br /&gt;
&lt;br /&gt;
Soil input file example:&lt;br /&gt;
soil,comment,uztwm,uzfwm,uzk,pctim,adimp,zperc,rexp,lztwm,lzfsm,lzfpm,lzsk,lzpk,pfree,uztwc_0,uzfwc_0,lztwc_0,lzfsc_0,lzfpc_0,adimc_0&lt;br /&gt;
soil_default,demo purposes,50.1,40.2,0.1,0.000001,0.0,1.0,0.0,250.0,500.0,500.0,0.01,0.1,0.1,0.5,0.5,0.5,0.5,0.5,0.&lt;br /&gt;
&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
The file &amp;quot;rain&amp;quot; consists of a title line and value lines with comma separated values (CSV). The values are a date followed by the value in millimeters. For example,&lt;br /&gt;
&lt;br /&gt;
   Date,Rain (mm)&lt;br /&gt;
   2018-01-14,11.67&lt;br /&gt;
   2018-01-15,17.27&lt;br /&gt;
   2018-01-17,0.73&lt;br /&gt;
        .&lt;br /&gt;
        .&lt;br /&gt;
        .&lt;br /&gt;
&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
The input file &amp;quot;irr&amp;quot; consists of a title line and value lines with comma separated values (CSV). The values are a date followed by the value in millimeters. For example,&lt;br /&gt;
&lt;br /&gt;
    Date,Irrigation (mm)&lt;br /&gt;
    2018-01-10,10.0&lt;br /&gt;
    2018-01-20,10.0&lt;br /&gt;
    2018-01-30,10.0&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
    .&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Some links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=580</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=580"/>
		<updated>2019-01-28T01:18:27Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Local Rain Events */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The first two are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the &amp;quot;Sacramento&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
[FILES]&amp;lt;br&amp;gt;&lt;br /&gt;
loads = /home/agrineer/sma/input/loads.csv &amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sma/input/soil.csv &amp;lt;br&amp;gt;&lt;br /&gt;
output = /home/agrineer/sma/output/output.csv &amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sma/input/rain.csv &amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sma/input/irr.csv &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when the sme.py invokes the SMA module the SMA configuration file is constructed on the fly, based on SME data and configuration input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameter input files in the SME configuration file.&lt;br /&gt;
&lt;br /&gt;
For example, to reference the SMA with parameters in the sme.py, the SME configuration file might have:&lt;br /&gt;
&lt;br /&gt;
[SoilModel]&amp;lt;br&amp;gt;&lt;br /&gt;
model = SMA&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[SMA]&amp;lt;br&amp;gt;&lt;br /&gt;
program = /home/agrineer/sme/sme/sma&amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sme/tmp/soil.csv&amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sme/tmp/rain.csv&amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sme/tmp/irr.csv&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;loads&amp;quot; file (data) would be generated by the WRF model data and ETo calculations and then submitted to the SMA program.&lt;br /&gt;
&lt;br /&gt;
Note that the web SME tool constructs the configuration file for the sme.py program as above. See the SME description [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
All input files are text based with comma separable variables (.csv). These files can be are read by spreadsheets for presentation and general analysis purposes.&lt;br /&gt;
&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
The &amp;quot;loads&amp;quot; input file consists of a title line followed by value lines. Line values are comma separated (CSV) and the values are for date, precipitation, and ETc. Precipitation and ETc values are given in millimeters. For example,&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
  Date,P,E &lt;br /&gt;
  2018-01-02,0.00,1.0348 &lt;br /&gt;
  2018-01-03,0.00,0.8603 &lt;br /&gt;
  2018-01-04,0.00,0.8630 &lt;br /&gt;
  . &lt;br /&gt;
  . &lt;br /&gt;
  .&lt;br /&gt;
&lt;br /&gt;
Currently, comments cannot be placed above the title line.&lt;br /&gt;
Note that the precipitation values normally originate from the WRF model and can be overridden by local data input.&lt;br /&gt;
&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
&lt;br /&gt;
Soil input filename containing comma separated values (CSV) consisting of a title line and a value line.&lt;br /&gt;
&lt;br /&gt;
The input file consists of a title line followed by a value line.&lt;br /&gt;
The value line has comma separated values consisting of:&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
    soil    - given soil name (string)&lt;br /&gt;
&lt;br /&gt;
    comment - make a comment (string)&lt;br /&gt;
&lt;br /&gt;
    uztwm   - upper layer (zone) tension water maximum capacity, mm. &lt;br /&gt;
              The maximum volume of water (normalized to mm) held by the &lt;br /&gt;
              upper zone between field capacity and the wilting point which can &lt;br /&gt;
              be lost by direct evaporation and transpiration from soil. This &lt;br /&gt;
              storage is filled before any water in the upper zone is transferred &lt;br /&gt;
              to other storages. Use field capacity and wilt point water content &lt;br /&gt;
              ratios to determine normalized volume (mm) for some depth. ie. &lt;br /&gt;
              (Ofc - Owp)*depth = uztwm (max et storage capacity).&lt;br /&gt;
&lt;br /&gt;
    uzfwm   - upper layer free water maximum capacity, mm. This storage is the &lt;br /&gt;
              source of water for interflow and the driving force for &lt;br /&gt;
              transferring water to deeper depths.&lt;br /&gt;
&lt;br /&gt;
    uzk     - interflow depletion rate from the upper layer free water storage, &lt;br /&gt;
              uzfwm per day. That is, lateral drainage rate of upper zone &lt;br /&gt;
              free water expressed as a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    pctim   - permanent impervious area fraction of the catchment which &lt;br /&gt;
              produces impervious runoff during low flow conditions.&lt;br /&gt;
&lt;br /&gt;
    adimp   - maximum fraction of an additional impervious area due to &lt;br /&gt;
              saturation. That is, the additional fraction of the catchment &lt;br /&gt;
              which exhibits impervious characteristics when the catchment&#039;s&lt;br /&gt;
              tension water requirements are met.&lt;br /&gt;
&lt;br /&gt;
    perc    - maximum percolation rate coefficient (from upper zone free &lt;br /&gt;
              water into the lower zone).&lt;br /&gt;
&lt;br /&gt;
    rexp    - shape parameter of the percolation curve. An exponent &lt;br /&gt;
              determining the rate of change of the percolation &lt;br /&gt;
              rate with changing lower zone water contents.&lt;br /&gt;
&lt;br /&gt;
    lztwm   - lower layer tension water maximum capacity, mm. Water from &lt;br /&gt;
              this store can only be removed through transpiration.&lt;br /&gt;
&lt;br /&gt;
    lzfsm   - lower layer supplemental free water maximum capacity, mm. &lt;br /&gt;
              The maximum volume from which supplemental baseflow can be drawn.&lt;br /&gt;
&lt;br /&gt;
    lzfpm   - lower layer primary free water maximum capacity, mm. The maximum&lt;br /&gt;
              capacity from which primary base flow can be drawn.&lt;br /&gt;
&lt;br /&gt;
    lzsk    - depletion rate of the lower layer supplemental &lt;br /&gt;
              free water storage, lzfsm per day. That is, lateral drainage rate&lt;br /&gt;
              of lower zone supplemental free water expressed as&lt;br /&gt;
              a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    lzpk    - depletion rate of the lower layer primary free water storage, &lt;br /&gt;
              lzfpm, per day. That is, lateral drainage rate of lower zone &lt;br /&gt;
              primary free water expressed as a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    pfree   - percolation fraction that goes directly to the lower layer free &lt;br /&gt;
              water storages. Direct percolation fraction from upper to &lt;br /&gt;
              lower zone free water (the percentage of percolated &lt;br /&gt;
              water which is available to the lower zone free water &lt;br /&gt;
              before all lower zone tension water deficiencies are satisfied).&lt;br /&gt;
&lt;br /&gt;
    uztwc_0 - initial upper zone tension water content as proportion of ‘uztwm’&lt;br /&gt;
&lt;br /&gt;
    uzfwc_0 - initial upper zone free water content as proportion of ‘uzfwm&#039;&lt;br /&gt;
&lt;br /&gt;
    lztwc_0 - initial lower zone tension water content as proportion of ‘lztwm’&lt;br /&gt;
&lt;br /&gt;
    lzfsc_0 - initial lower zone free water secondary as proportion of ‘lzfsm’&lt;br /&gt;
&lt;br /&gt;
    lzfpc_0 - initial lower zone free water primary as proportion of ‘lzfpm’&lt;br /&gt;
&lt;br /&gt;
    adimc_0 - initial additional impervious flow store, as proportion of ‘uztwm+lztwm’&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Value ranges and default values from different studies:&lt;br /&gt;
&lt;br /&gt;
            | Blasone et. al.(2008)  |   Surrgo (2004) |  default   | units&lt;br /&gt;
    uztwm   |        1-150           |    10-300       |   50.1     | mm&lt;br /&gt;
    uzfwm   |        1-150           |     5-150       |   40.2     | mm&lt;br /&gt;
    uzk     |      0.1-0.5           |  0.10-0.75      |   0.1      | frac/day&lt;br /&gt;
    pctim   | 0.000001-0.1           |     N/A         |   0.000001 | none&lt;br /&gt;
    adimp   |        0-0.4           |     N/A         |   0.0      | none&lt;br /&gt;
    zperc   |        1-250           |     5-350       |   1.0      | none&lt;br /&gt;
    rexp    |        0-5             |     1-5         |   0.0      | none&lt;br /&gt;
    lztwm   |        1-500           |    10-500       | 250.0      | mm&lt;br /&gt;
    lzfsm   |        1-1000          |     5-400       | 500.0      | mm&lt;br /&gt;
    lzfpm   |        1-1000          |    10-1000      | 500.0      | mm&lt;br /&gt;
    lzsk    |     0.01-0.25          |  0.01-0.35      |   0.01     | frac/day&lt;br /&gt;
    lzpk    |   0.0001-0.25          | 0.001-0.05      |   0.1      | frac/day&lt;br /&gt;
    pfree   |        0-0.6           |   0.0-0.8       |   0.1      | none&lt;br /&gt;
&lt;br /&gt;
Soil input file example:&lt;br /&gt;
soil,comment,uztwm,uzfwm,uzk,pctim,adimp,zperc,rexp,lztwm,lzfsm,lzfpm,lzsk,lzpk,pfree,uztwc_0,uzfwc_0,lztwc_0,lzfsc_0,lzfpc_0,adimc_0&lt;br /&gt;
soil_default,demo purposes,50.1,40.2,0.1,0.000001,0.0,1.0,0.0,250.0,500.0,500.0,0.01,0.1,0.1,0.5,0.5,0.5,0.5,0.5,0.&lt;br /&gt;
&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
The file &amp;quot;rain&amp;quot; consists of a title line and value lines with comma separated values (CSV). The values are a date followed by the value in millimeters. For example,&lt;br /&gt;
&lt;br /&gt;
   Date,Rain (mm)&lt;br /&gt;
   2018-01-14,11.67&lt;br /&gt;
   2018-01-15,17.27&lt;br /&gt;
   2018-01-17,0.73&lt;br /&gt;
        .&lt;br /&gt;
        .&lt;br /&gt;
        .&lt;br /&gt;
&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
&lt;br /&gt;
  - read_loads()&lt;br /&gt;
  - read_soils()&lt;br /&gt;
  - replace_precip()&lt;br /&gt;
  - add_irrigations()&lt;br /&gt;
 &lt;br /&gt;
  Output file documention can be found in the main() routine.&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Some links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=579</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=579"/>
		<updated>2019-01-28T01:05:35Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Soil Attributes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The first two are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the &amp;quot;Sacramento&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
[FILES]&amp;lt;br&amp;gt;&lt;br /&gt;
loads = /home/agrineer/sma/input/loads.csv &amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sma/input/soil.csv &amp;lt;br&amp;gt;&lt;br /&gt;
output = /home/agrineer/sma/output/output.csv &amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sma/input/rain.csv &amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sma/input/irr.csv &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when the sme.py invokes the SMA module the SMA configuration file is constructed on the fly, based on SME data and configuration input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameter input files in the SME configuration file.&lt;br /&gt;
&lt;br /&gt;
For example, to reference the SMA with parameters in the sme.py, the SME configuration file might have:&lt;br /&gt;
&lt;br /&gt;
[SoilModel]&amp;lt;br&amp;gt;&lt;br /&gt;
model = SMA&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[SMA]&amp;lt;br&amp;gt;&lt;br /&gt;
program = /home/agrineer/sme/sme/sma&amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sme/tmp/soil.csv&amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sme/tmp/rain.csv&amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sme/tmp/irr.csv&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;loads&amp;quot; file (data) would be generated by the WRF model data and ETo calculations and then submitted to the SMA program.&lt;br /&gt;
&lt;br /&gt;
Note that the web SME tool constructs the configuration file for the sme.py program as above. See the SME description [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
All input files are text based with comma separable variables (.csv). These files can be are read by spreadsheets for presentation and general analysis purposes.&lt;br /&gt;
&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
The &amp;quot;loads&amp;quot; input file consists of a title line followed by value lines. Line values are comma separated (CSV) and the values are for date, precipitation, and ETc. Precipitation and ETc values are given in millimeters. For example,&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
  Date,P,E &lt;br /&gt;
  2018-01-02,0.00,1.0348 &lt;br /&gt;
  2018-01-03,0.00,0.8603 &lt;br /&gt;
  2018-01-04,0.00,0.8630 &lt;br /&gt;
  . &lt;br /&gt;
  . &lt;br /&gt;
  .&lt;br /&gt;
&lt;br /&gt;
Currently, comments cannot be placed above the title line.&lt;br /&gt;
Note that the precipitation values normally originate from the WRF model and can be overridden by local data input.&lt;br /&gt;
&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
&lt;br /&gt;
Soil input filename containing comma separated values (CSV) consisting of a title line and a value line.&lt;br /&gt;
&lt;br /&gt;
The input file consists of a title line followed by a value line.&lt;br /&gt;
The value line has comma separated values consisting of:&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
    soil    - given soil name (string)&lt;br /&gt;
&lt;br /&gt;
    comment - make a comment (string)&lt;br /&gt;
&lt;br /&gt;
    uztwm   - upper layer (zone) tension water maximum capacity, mm. &lt;br /&gt;
              The maximum volume of water (normalized to mm) held by the &lt;br /&gt;
              upper zone between field capacity and the wilting point which can &lt;br /&gt;
              be lost by direct evaporation and transpiration from soil. This &lt;br /&gt;
              storage is filled before any water in the upper zone is transferred &lt;br /&gt;
              to other storages. Use field capacity and wilt point water content &lt;br /&gt;
              ratios to determine normalized volume (mm) for some depth. ie. &lt;br /&gt;
              (Ofc - Owp)*depth = uztwm (max et storage capacity).&lt;br /&gt;
&lt;br /&gt;
    uzfwm   - upper layer free water maximum capacity, mm. This storage is the &lt;br /&gt;
              source of water for interflow and the driving force for &lt;br /&gt;
              transferring water to deeper depths.&lt;br /&gt;
&lt;br /&gt;
    uzk     - interflow depletion rate from the upper layer free water storage, &lt;br /&gt;
              uzfwm per day. That is, lateral drainage rate of upper zone &lt;br /&gt;
              free water expressed as a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    pctim   - permanent impervious area fraction of the catchment which &lt;br /&gt;
              produces impervious runoff during low flow conditions.&lt;br /&gt;
&lt;br /&gt;
    adimp   - maximum fraction of an additional impervious area due to &lt;br /&gt;
              saturation. That is, the additional fraction of the catchment &lt;br /&gt;
              which exhibits impervious characteristics when the catchment&#039;s&lt;br /&gt;
              tension water requirements are met.&lt;br /&gt;
&lt;br /&gt;
    perc    - maximum percolation rate coefficient (from upper zone free &lt;br /&gt;
              water into the lower zone).&lt;br /&gt;
&lt;br /&gt;
    rexp    - shape parameter of the percolation curve. An exponent &lt;br /&gt;
              determining the rate of change of the percolation &lt;br /&gt;
              rate with changing lower zone water contents.&lt;br /&gt;
&lt;br /&gt;
    lztwm   - lower layer tension water maximum capacity, mm. Water from &lt;br /&gt;
              this store can only be removed through transpiration.&lt;br /&gt;
&lt;br /&gt;
    lzfsm   - lower layer supplemental free water maximum capacity, mm. &lt;br /&gt;
              The maximum volume from which supplemental baseflow can be drawn.&lt;br /&gt;
&lt;br /&gt;
    lzfpm   - lower layer primary free water maximum capacity, mm. The maximum&lt;br /&gt;
              capacity from which primary base flow can be drawn.&lt;br /&gt;
&lt;br /&gt;
    lzsk    - depletion rate of the lower layer supplemental &lt;br /&gt;
              free water storage, lzfsm per day. That is, lateral drainage rate&lt;br /&gt;
              of lower zone supplemental free water expressed as&lt;br /&gt;
              a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    lzpk    - depletion rate of the lower layer primary free water storage, &lt;br /&gt;
              lzfpm, per day. That is, lateral drainage rate of lower zone &lt;br /&gt;
              primary free water expressed as a fraction of contents per day.&lt;br /&gt;
&lt;br /&gt;
    pfree   - percolation fraction that goes directly to the lower layer free &lt;br /&gt;
              water storages. Direct percolation fraction from upper to &lt;br /&gt;
              lower zone free water (the percentage of percolated &lt;br /&gt;
              water which is available to the lower zone free water &lt;br /&gt;
              before all lower zone tension water deficiencies are satisfied).&lt;br /&gt;
&lt;br /&gt;
    uztwc_0 - initial upper zone tension water content as proportion of ‘uztwm’&lt;br /&gt;
&lt;br /&gt;
    uzfwc_0 - initial upper zone free water content as proportion of ‘uzfwm&#039;&lt;br /&gt;
&lt;br /&gt;
    lztwc_0 - initial lower zone tension water content as proportion of ‘lztwm’&lt;br /&gt;
&lt;br /&gt;
    lzfsc_0 - initial lower zone free water secondary as proportion of ‘lzfsm’&lt;br /&gt;
&lt;br /&gt;
    lzfpc_0 - initial lower zone free water primary as proportion of ‘lzfpm’&lt;br /&gt;
&lt;br /&gt;
    adimc_0 - initial additional impervious flow store, as proportion of ‘uztwm+lztwm’&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Value ranges and default values from different studies:&lt;br /&gt;
&lt;br /&gt;
            | Blasone et. al.(2008)  |   Surrgo (2004) |  default   | units&lt;br /&gt;
    uztwm   |        1-150           |    10-300       |   50.1     | mm&lt;br /&gt;
    uzfwm   |        1-150           |     5-150       |   40.2     | mm&lt;br /&gt;
    uzk     |      0.1-0.5           |  0.10-0.75      |   0.1      | frac/day&lt;br /&gt;
    pctim   | 0.000001-0.1           |     N/A         |   0.000001 | none&lt;br /&gt;
    adimp   |        0-0.4           |     N/A         |   0.0      | none&lt;br /&gt;
    zperc   |        1-250           |     5-350       |   1.0      | none&lt;br /&gt;
    rexp    |        0-5             |     1-5         |   0.0      | none&lt;br /&gt;
    lztwm   |        1-500           |    10-500       | 250.0      | mm&lt;br /&gt;
    lzfsm   |        1-1000          |     5-400       | 500.0      | mm&lt;br /&gt;
    lzfpm   |        1-1000          |    10-1000      | 500.0      | mm&lt;br /&gt;
    lzsk    |     0.01-0.25          |  0.01-0.35      |   0.01     | frac/day&lt;br /&gt;
    lzpk    |   0.0001-0.25          | 0.001-0.05      |   0.1      | frac/day&lt;br /&gt;
    pfree   |        0-0.6           |   0.0-0.8       |   0.1      | none&lt;br /&gt;
&lt;br /&gt;
Soil input file example:&lt;br /&gt;
soil,comment,uztwm,uzfwm,uzk,pctim,adimp,zperc,rexp,lztwm,lzfsm,lzfpm,lzsk,lzpk,pfree,uztwc_0,uzfwc_0,lztwc_0,lzfsc_0,lzfpc_0,adimc_0&lt;br /&gt;
soil_default,demo purposes,50.1,40.2,0.1,0.000001,0.0,1.0,0.0,250.0,500.0,500.0,0.01,0.1,0.1,0.5,0.5,0.5,0.5,0.5,0.&lt;br /&gt;
&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
&lt;br /&gt;
  - read_loads()&lt;br /&gt;
  - read_soils()&lt;br /&gt;
  - replace_precip()&lt;br /&gt;
  - add_irrigations()&lt;br /&gt;
 &lt;br /&gt;
  Output file documention can be found in the main() routine.&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Some links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=578</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=578"/>
		<updated>2019-01-27T22:56:46Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Atmospheric Loads */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The first two are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the &amp;quot;Sacramento&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
[FILES]&amp;lt;br&amp;gt;&lt;br /&gt;
loads = /home/agrineer/sma/input/loads.csv &amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sma/input/soil.csv &amp;lt;br&amp;gt;&lt;br /&gt;
output = /home/agrineer/sma/output/output.csv &amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sma/input/rain.csv &amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sma/input/irr.csv &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when the sme.py invokes the SMA module the SMA configuration file is constructed on the fly, based on SME data and configuration input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameter input files in the SME configuration file.&lt;br /&gt;
&lt;br /&gt;
For example, to reference the SMA with parameters in the sme.py, the SME configuration file might have:&lt;br /&gt;
&lt;br /&gt;
[SoilModel]&amp;lt;br&amp;gt;&lt;br /&gt;
model = SMA&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[SMA]&amp;lt;br&amp;gt;&lt;br /&gt;
program = /home/agrineer/sme/sme/sma&amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sme/tmp/soil.csv&amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sme/tmp/rain.csv&amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sme/tmp/irr.csv&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;loads&amp;quot; file (data) would be generated by the WRF model data and ETo calculations and then submitted to the SMA program.&lt;br /&gt;
&lt;br /&gt;
Note that the web SME tool constructs the configuration file for the sme.py program as above. See the SME description [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
All input files are text based with comma separable variables (.csv). These files can be are read by spreadsheets for presentation and general analysis purposes.&lt;br /&gt;
&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
The &amp;quot;loads&amp;quot; input file consists of a title line followed by value lines. Line values are comma separated (CSV) and the values are for date, precipitation, and ETc. Precipitation and ETc values are given in millimeters. For example,&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
  Date,P,E &lt;br /&gt;
  2018-01-02,0.00,1.0348 &lt;br /&gt;
  2018-01-03,0.00,0.8603 &lt;br /&gt;
  2018-01-04,0.00,0.8630 &lt;br /&gt;
  . &lt;br /&gt;
  . &lt;br /&gt;
  .&lt;br /&gt;
&lt;br /&gt;
Currently, comments cannot be placed above the title line.&lt;br /&gt;
Note that the precipitation values normally originate from the WRF model and can be overridden by local data input.&lt;br /&gt;
&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
&lt;br /&gt;
  - read_loads()&lt;br /&gt;
  - read_soils()&lt;br /&gt;
  - replace_precip()&lt;br /&gt;
  - add_irrigations()&lt;br /&gt;
 &lt;br /&gt;
  Output file documention can be found in the main() routine.&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Some links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=577</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=577"/>
		<updated>2019-01-27T22:55:44Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Atmospheric Loads */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The first two are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the &amp;quot;Sacramento&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
[FILES]&amp;lt;br&amp;gt;&lt;br /&gt;
loads = /home/agrineer/sma/input/loads.csv &amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sma/input/soil.csv &amp;lt;br&amp;gt;&lt;br /&gt;
output = /home/agrineer/sma/output/output.csv &amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sma/input/rain.csv &amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sma/input/irr.csv &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when the sme.py invokes the SMA module the SMA configuration file is constructed on the fly, based on SME data and configuration input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameter input files in the SME configuration file.&lt;br /&gt;
&lt;br /&gt;
For example, to reference the SMA with parameters in the sme.py, the SME configuration file might have:&lt;br /&gt;
&lt;br /&gt;
[SoilModel]&amp;lt;br&amp;gt;&lt;br /&gt;
model = SMA&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[SMA]&amp;lt;br&amp;gt;&lt;br /&gt;
program = /home/agrineer/sme/sme/sma&amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sme/tmp/soil.csv&amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sme/tmp/rain.csv&amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sme/tmp/irr.csv&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;loads&amp;quot; file (data) would be generated by the WRF model data and ETo calculations and then submitted to the SMA program.&lt;br /&gt;
&lt;br /&gt;
Note that the web SME tool constructs the configuration file for the sme.py program as above. See the SME description [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
All input files are text based with comma separable variables (.csv). These files can be are read by spreadsheets for presentation and general analysis purposes.&lt;br /&gt;
&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
The &amp;quot;loads&amp;quot; input file consists of a title line followed by value lines. Line values are comma separated (CSV) and the values are for date, precipitation, and ETc. Precipitation and ETc values are given in millimeters. For example,&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
  Date,P,E &lt;br /&gt;
  2018-01-02,0.00,1.0348 &lt;br /&gt;
  2018-01-03,0.00,0.8603 &lt;br /&gt;
  2018-01-04,0.00,0.8630 &lt;br /&gt;
  . &lt;br /&gt;
  . &lt;br /&gt;
  .&lt;br /&gt;
&lt;br /&gt;
Comments can be placed above the title line.&lt;br /&gt;
Note that the precipitation values normally originate from the WRF model and can be overridden by local data input.&lt;br /&gt;
&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
&lt;br /&gt;
  - read_loads()&lt;br /&gt;
  - read_soils()&lt;br /&gt;
  - replace_precip()&lt;br /&gt;
  - add_irrigations()&lt;br /&gt;
 &lt;br /&gt;
  Output file documention can be found in the main() routine.&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Some links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=576</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=576"/>
		<updated>2019-01-27T22:22:01Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Atmospheric Loads */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The first two are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the &amp;quot;Sacramento&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
[FILES]&amp;lt;br&amp;gt;&lt;br /&gt;
loads = /home/agrineer/sma/input/loads.csv &amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sma/input/soil.csv &amp;lt;br&amp;gt;&lt;br /&gt;
output = /home/agrineer/sma/output/output.csv &amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sma/input/rain.csv &amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sma/input/irr.csv &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when the sme.py invokes the SMA module the SMA configuration file is constructed on the fly, based on SME data and configuration input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameter input files in the SME configuration file.&lt;br /&gt;
&lt;br /&gt;
For example, to reference the SMA with parameters in the sme.py, the SME configuration file might have:&lt;br /&gt;
&lt;br /&gt;
[SoilModel]&amp;lt;br&amp;gt;&lt;br /&gt;
model = SMA&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[SMA]&amp;lt;br&amp;gt;&lt;br /&gt;
program = /home/agrineer/sme/sme/sma&amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sme/tmp/soil.csv&amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sme/tmp/rain.csv&amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sme/tmp/irr.csv&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;loads&amp;quot; file (data) would be generated by the WRF model data and ETo calculations and then submitted to the SMA program.&lt;br /&gt;
&lt;br /&gt;
Note that the web SME tool constructs the configuration file for the sme.py program as above. See the SME description [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
All input files are text based with comma separable variables (.csv). These files can be are read by spreadsheets for presentation and general analysis purposes.&lt;br /&gt;
&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
The &amp;quot;loads&amp;quot; input file consists of a title line followed by value lines. Line values are comma separated (CSV) and the values are for date, precipitation, and ETc. Precipitation and ETc values are given in millimeters. For example,&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
  Date,P,E &lt;br /&gt;
  2018-01-02,0.00,1.0348 &lt;br /&gt;
  2018-01-03,0.00,0.8603 &lt;br /&gt;
  2018-01-04,0.00,0.8630 &lt;br /&gt;
  . &lt;br /&gt;
  . &lt;br /&gt;
  .&lt;br /&gt;
&lt;br /&gt;
Note that the precipitation values normally originate from the WRF model and can be overridden by local data input.&lt;br /&gt;
&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
&lt;br /&gt;
  - read_loads()&lt;br /&gt;
  - read_soils()&lt;br /&gt;
  - replace_precip()&lt;br /&gt;
  - add_irrigations()&lt;br /&gt;
 &lt;br /&gt;
  Output file documention can be found in the main() routine.&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Some links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=575</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=575"/>
		<updated>2019-01-27T22:21:29Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Atmospheric Loads */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The first two are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the &amp;quot;Sacramento&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
[FILES]&amp;lt;br&amp;gt;&lt;br /&gt;
loads = /home/agrineer/sma/input/loads.csv &amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sma/input/soil.csv &amp;lt;br&amp;gt;&lt;br /&gt;
output = /home/agrineer/sma/output/output.csv &amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sma/input/rain.csv &amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sma/input/irr.csv &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when the sme.py invokes the SMA module the SMA configuration file is constructed on the fly, based on SME data and configuration input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameter input files in the SME configuration file.&lt;br /&gt;
&lt;br /&gt;
For example, to reference the SMA with parameters in the sme.py, the SME configuration file might have:&lt;br /&gt;
&lt;br /&gt;
[SoilModel]&amp;lt;br&amp;gt;&lt;br /&gt;
model = SMA&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[SMA]&amp;lt;br&amp;gt;&lt;br /&gt;
program = /home/agrineer/sme/sme/sma&amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sme/tmp/soil.csv&amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sme/tmp/rain.csv&amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sme/tmp/irr.csv&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;loads&amp;quot; file (data) would be generated by the WRF model data and ETo calculations and then submitted to the SMA program.&lt;br /&gt;
&lt;br /&gt;
Note that the web SME tool constructs the configuration file for the sme.py program as above. See the SME description [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
All input files are text based with comma separable variables (.csv). These files can be are read by spreadsheets for presentation and general analysis purposes.&lt;br /&gt;
&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
The &amp;quot;loads&amp;quot; input file consists of a title line followed by value lines. Line values are comma separated (CSV) and the values are for date, precipitation, and ETc. Precipitation and ETc values are given in millimeters. For example,&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
  Date,P,E &lt;br /&gt;
  2018-01-02,0.00,1.0348 &lt;br /&gt;
  2018-01-03,0.00,0.8603 &lt;br /&gt;
  2018-01-04,0.00,0.8630 &lt;br /&gt;
  . &lt;br /&gt;
  . &lt;br /&gt;
  .&lt;br /&gt;
&lt;br /&gt;
Note that the precipitation values can originate from the WRF model and can be overridden by local data input.&lt;br /&gt;
&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
&lt;br /&gt;
  - read_loads()&lt;br /&gt;
  - read_soils()&lt;br /&gt;
  - replace_precip()&lt;br /&gt;
  - add_irrigations()&lt;br /&gt;
 &lt;br /&gt;
  Output file documention can be found in the main() routine.&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Some links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=574</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=574"/>
		<updated>2019-01-27T22:18:37Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Atmospheric Loads */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The first two are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the &amp;quot;Sacramento&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
[FILES]&amp;lt;br&amp;gt;&lt;br /&gt;
loads = /home/agrineer/sma/input/loads.csv &amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sma/input/soil.csv &amp;lt;br&amp;gt;&lt;br /&gt;
output = /home/agrineer/sma/output/output.csv &amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sma/input/rain.csv &amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sma/input/irr.csv &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when the sme.py invokes the SMA module the SMA configuration file is constructed on the fly, based on SME data and configuration input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameter input files in the SME configuration file.&lt;br /&gt;
&lt;br /&gt;
For example, to reference the SMA with parameters in the sme.py, the SME configuration file might have:&lt;br /&gt;
&lt;br /&gt;
[SoilModel]&amp;lt;br&amp;gt;&lt;br /&gt;
model = SMA&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[SMA]&amp;lt;br&amp;gt;&lt;br /&gt;
program = /home/agrineer/sme/sme/sma&amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sme/tmp/soil.csv&amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sme/tmp/rain.csv&amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sme/tmp/irr.csv&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;loads&amp;quot; file (data) would be generated by the WRF model data and ETo calculations and then submitted to the SMA program.&lt;br /&gt;
&lt;br /&gt;
Note that the web SME tool constructs the configuration file for the sme.py program as above. See the SME description [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
All input files are text based with comma separable variables (.csv). These files can be are read by spreadsheets for presentation and general analysis purposes.&lt;br /&gt;
&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
The &amp;quot;loads&amp;quot; input file consists of a title line followed by value lines. Line values are comma separated (CSV) and the values are for date, precipitation, and ETc. Precipitation (rain+irrigation) and ETc values are given in millimeters. For example,&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
  Date,P,E &lt;br /&gt;
  2018-01-02,0.00,1.0348 &lt;br /&gt;
  2018-01-03,0.00,0.8603 &lt;br /&gt;
  2018-01-04,0.00,0.8630 &lt;br /&gt;
  . &lt;br /&gt;
  . &lt;br /&gt;
  .&lt;br /&gt;
&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
&lt;br /&gt;
  - read_loads()&lt;br /&gt;
  - read_soils()&lt;br /&gt;
  - replace_precip()&lt;br /&gt;
  - add_irrigations()&lt;br /&gt;
 &lt;br /&gt;
  Output file documention can be found in the main() routine.&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Some links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=573</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=573"/>
		<updated>2019-01-27T22:17:51Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Paper References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The first two are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the &amp;quot;Sacramento&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
[FILES]&amp;lt;br&amp;gt;&lt;br /&gt;
loads = /home/agrineer/sma/input/loads.csv &amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sma/input/soil.csv &amp;lt;br&amp;gt;&lt;br /&gt;
output = /home/agrineer/sma/output/output.csv &amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sma/input/rain.csv &amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sma/input/irr.csv &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when the sme.py invokes the SMA module the SMA configuration file is constructed on the fly, based on SME data and configuration input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameter input files in the SME configuration file.&lt;br /&gt;
&lt;br /&gt;
For example, to reference the SMA with parameters in the sme.py, the SME configuration file might have:&lt;br /&gt;
&lt;br /&gt;
[SoilModel]&amp;lt;br&amp;gt;&lt;br /&gt;
model = SMA&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[SMA]&amp;lt;br&amp;gt;&lt;br /&gt;
program = /home/agrineer/sme/sme/sma&amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sme/tmp/soil.csv&amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sme/tmp/rain.csv&amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sme/tmp/irr.csv&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;loads&amp;quot; file (data) would be generated by the WRF model data and ETo calculations and then submitted to the SMA program.&lt;br /&gt;
&lt;br /&gt;
Note that the web SME tool constructs the configuration file for the sme.py program as above. See the SME description [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
All input files are text based with comma separable variables (.csv). These files can be are read by spreadsheets for presentation and general analysis purposes.&lt;br /&gt;
&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
This input file consists of a title line followed by value lines. Line values are comma separated (CSV) and the values are for date, precipitation, and ETc. Precipitation (rain+irrigation) and ETc values are given in millimeters. For example,&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
  Date,P,E &lt;br /&gt;
  2018-01-02,0.00,1.0348 &lt;br /&gt;
  2018-01-03,0.00,0.8603 &lt;br /&gt;
  2018-01-04,0.00,0.8630 &lt;br /&gt;
  . &lt;br /&gt;
  . &lt;br /&gt;
  . &lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
&lt;br /&gt;
  - read_loads()&lt;br /&gt;
  - read_soils()&lt;br /&gt;
  - replace_precip()&lt;br /&gt;
  - add_irrigations()&lt;br /&gt;
 &lt;br /&gt;
  Output file documention can be found in the main() routine.&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Some links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=572</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=572"/>
		<updated>2019-01-27T22:06:57Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Input file format and variable description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The first two are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the &amp;quot;Sacramento&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
[FILES]&amp;lt;br&amp;gt;&lt;br /&gt;
loads = /home/agrineer/sma/input/loads.csv &amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sma/input/soil.csv &amp;lt;br&amp;gt;&lt;br /&gt;
output = /home/agrineer/sma/output/output.csv &amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sma/input/rain.csv &amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sma/input/irr.csv &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when the sme.py invokes the SMA module the SMA configuration file is constructed on the fly, based on SME data and configuration input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameter input files in the SME configuration file.&lt;br /&gt;
&lt;br /&gt;
For example, to reference the SMA with parameters in the sme.py, the SME configuration file might have:&lt;br /&gt;
&lt;br /&gt;
[SoilModel]&amp;lt;br&amp;gt;&lt;br /&gt;
model = SMA&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[SMA]&amp;lt;br&amp;gt;&lt;br /&gt;
program = /home/agrineer/sme/sme/sma&amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sme/tmp/soil.csv&amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sme/tmp/rain.csv&amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sme/tmp/irr.csv&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;loads&amp;quot; file (data) would be generated by the WRF model data and ETo calculations and then submitted to the SMA program.&lt;br /&gt;
&lt;br /&gt;
Note that the web SME tool constructs the configuration file for the sme.py program as above. See the SME description [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
All input files are text based with comma separable variables (.csv). These files can be are read by spreadsheets for presentation and general analysis purposes.&lt;br /&gt;
&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
This input file consists of a title line followed by value lines. Line values are comma separated (CSV) and the values are for date, precipitation, and ETc. Precipitation (rain+irrigation) and ETc values are given in millimeters. For example,&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
  Date,P,E &lt;br /&gt;
  2018-01-02,0.00,1.0348 &lt;br /&gt;
  2018-01-03,0.00,0.8603 &lt;br /&gt;
  2018-01-04,0.00,0.8630 &lt;br /&gt;
  . &lt;br /&gt;
  . &lt;br /&gt;
  . &lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
&lt;br /&gt;
  - read_loads()&lt;br /&gt;
  - read_soils()&lt;br /&gt;
  - replace_precip()&lt;br /&gt;
  - add_irrigations()&lt;br /&gt;
 &lt;br /&gt;
  Output file documention can be found in the main() routine.&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=571</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=571"/>
		<updated>2019-01-27T21:50:01Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The first two are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the &amp;quot;Sacramento&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
[FILES]&amp;lt;br&amp;gt;&lt;br /&gt;
loads = /home/agrineer/sma/input/loads.csv &amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sma/input/soil.csv &amp;lt;br&amp;gt;&lt;br /&gt;
output = /home/agrineer/sma/output/output.csv &amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sma/input/rain.csv &amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sma/input/irr.csv &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when the sme.py invokes the SMA module the SMA configuration file is constructed on the fly, based on SME data and configuration input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameter input files in the SME configuration file.&lt;br /&gt;
&lt;br /&gt;
For example, to reference the SMA with parameters in the sme.py, the SME configuration file might have:&lt;br /&gt;
&lt;br /&gt;
[SoilModel]&amp;lt;br&amp;gt;&lt;br /&gt;
model = SMA&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[SMA]&amp;lt;br&amp;gt;&lt;br /&gt;
program = /home/agrineer/sme/sme/sma&amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sme/tmp/soil.csv&amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sme/tmp/rain.csv&amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sme/tmp/irr.csv&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;loads&amp;quot; file (data) would be generated by the WRF model data and ETo calculations and then submitted to the SMA program.&lt;br /&gt;
&lt;br /&gt;
Note that the web SME tool constructs the configuration file for the sme.py program as above. See the SME description [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
&lt;br /&gt;
  - read_loads()&lt;br /&gt;
  - read_soils()&lt;br /&gt;
  - replace_precip()&lt;br /&gt;
  - add_irrigations()&lt;br /&gt;
 &lt;br /&gt;
  Output file documention can be found in the main() routine.&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=570</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=570"/>
		<updated>2019-01-27T21:48:46Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The first two are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the &amp;quot;Sacramento&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
[FILES]&amp;lt;br&amp;gt;&lt;br /&gt;
loads = /home/agrineer/sma/input/loads.csv &amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sma/input/soil.csv &amp;lt;br&amp;gt;&lt;br /&gt;
output = /home/agrineer/sma/output/output.csv &amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sma/input/rain.csv &amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sma/input/irr.csv &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when the sme.py invokes the SMA module the SMA configuration file is constructed on the fly, based on SME data and configuration input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameters in the SME configuration file.&lt;br /&gt;
&lt;br /&gt;
For example, to reference the SMA with parameters in the sme.py, the SME configuration file might have:&lt;br /&gt;
&lt;br /&gt;
[SoilModel]&amp;lt;br&amp;gt;&lt;br /&gt;
model = SMA&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[SMA]&amp;lt;br&amp;gt;&lt;br /&gt;
program = /home/agrineer/sme/sme/sma&amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sme/tmp/soil.csv&amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sme/tmp/rain.csv&amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sme/tmp/irr.csv&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;loads&amp;quot; file (data) would be generated by the WRF model data and ETo calculations and then submitted to the SMA program.&lt;br /&gt;
&lt;br /&gt;
Note that the web SME tool constructs the configuration file for the sme.py program as above. See the SME description [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
&lt;br /&gt;
  - read_loads()&lt;br /&gt;
  - read_soils()&lt;br /&gt;
  - replace_precip()&lt;br /&gt;
  - add_irrigations()&lt;br /&gt;
 &lt;br /&gt;
  Output file documention can be found in the main() routine.&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=SME_FAQ&amp;diff=569</id>
		<title>SME FAQ</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=SME_FAQ&amp;diff=569"/>
		<updated>2019-01-27T21:43:34Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* I am an agricultural professor. How can I use the SME? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Frequently Asked Questions for the Soil Moisture Estimator&lt;br /&gt;
== I am a county extension agent. How can I use the SME to help the farmers in my county? ==&lt;br /&gt;
&lt;br /&gt;
Ideally, an extension office would have a catalogue of working crop coefficients and soil attributes for local farms. &lt;br /&gt;
The farmer would use the SME with these input files, along with irrigation events, to monitor a crop&#039;s water usage throughout the growing season.&lt;br /&gt;
&lt;br /&gt;
Presently, we are in the initial stages of exercising the SME in the field and so we ask extension agents to:&lt;br /&gt;
&lt;br /&gt;
- get familiar with the SME tool. Learn how to construct input files and how to use the output files (eg. import into spreadsheets).&lt;br /&gt;
&lt;br /&gt;
- get local rain data and compare with the WRF model rain data. We are interested in compiling wide-scale data for analysis. Sharing comparison data with us would help in model adjustments. &lt;br /&gt;
&lt;br /&gt;
- compile a set of input files of local crop cultivars and associated coefficients.  See this link.(not yet active)&lt;br /&gt;
&lt;br /&gt;
- show farmers how to derive soil attributes used in the soil model. See this link.(not yet active)&lt;br /&gt;
&lt;br /&gt;
- ask farmers with soil moisture sensors to use the SME and share their experience. We actively seek the participation of farmer-scientists for feedback.&lt;br /&gt;
&lt;br /&gt;
Assuming a set of working input files, a useful exercise for farmers is to review the past growing season using different irrigation schedules to see how the soil responds. Crops can also be changed to see what their water usage would have been. See the question below.&lt;br /&gt;
&lt;br /&gt;
== I am a irrigation specialist at a large farm. How can I use the SME ? ==&lt;br /&gt;
&lt;br /&gt;
The purpose of the SME is to provide a working estimate of water usage for different crops and soils. This allows for general monitoring of soil moisture and to apply irrigations as needed to avoid plant stress. &lt;br /&gt;
&lt;br /&gt;
Because the SME can be run historically, it is possible for the irrigation specialist to run &amp;quot;what if&amp;quot; scenarios. &lt;br /&gt;
For example,&lt;br /&gt;
&lt;br /&gt;
- What if the crop was different, how much water would that crop have used in our soil? &lt;br /&gt;
&lt;br /&gt;
- What if I irrigated small amounts more often or large amounts less often? Is there a sweet spot between the two?&lt;br /&gt;
&lt;br /&gt;
- What is the optimal irrigation amount to give available water to roots and not drain excessively beyond the root zone? &lt;br /&gt;
&lt;br /&gt;
The SME, with working parameters, can be used to address and give insight to the above questions.&lt;br /&gt;
&lt;br /&gt;
== I am an agricultural professor. How can I use the SME? ==&lt;br /&gt;
Here are some ways to use the SME: &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
- show your students the website tools and indicate that source code is available for review and improvements.&lt;br /&gt;
&lt;br /&gt;
- incorporate the tools into classroom lectures/exercises/labs for critique. We would appreciate feedback on usage.&lt;br /&gt;
&lt;br /&gt;
- suggest projects/studies to students regarding comparison with data (soil moisture, ETo, ETc, precipitation, etc.) from research stations currently covered geographically. &lt;br /&gt;
&lt;br /&gt;
- generate WRF data for areas of interest (sectors). See below on generating data.&lt;br /&gt;
&lt;br /&gt;
- consider implementing other backend soil moisture models for research and comparison purposes.&lt;br /&gt;
&lt;br /&gt;
== I am an agricultural student with programming skills. How can I use the SME? ==&lt;br /&gt;
Here are some ways to use the SME: &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- download and install the code from our [https://gitlab.com.agrineer repository] and exercise the command line versions of GDC and SME.  Learn the processing stream on a local platform to get familiar with the model. You do not need to generate data as it can be downloaded. Linux navigation skills are required. &lt;br /&gt;
&lt;br /&gt;
- inspect, in detail, parts of the model code that are of interest to you and look for improvements. For example, look at the [https://gitlab.com/agrineer/eto ETo] code and improve on relative humidity calculations, or you could implement crop coefficients using smooth curves, instead of discrete steps. There are many aspects of the implementation stream that are interesting and improvable. This type of explore gives a student an in depth understanding of modelling. Python/NumPy programming skills are required.&lt;br /&gt;
&lt;br /&gt;
- compile and compare aspects of predicted and sensed data for local areas, eg. How close is historical WRF modelled rain to measured rain in your pixel (area)? Many components can be compared that would be available with regular weather sensors, such as temperatures, relative humidity and wind speed.&lt;br /&gt;
&lt;br /&gt;
- graduate endeavours could include long term studies to compare sensed soil moisture to different SME outputs with various parameters, ie.crop coefficients, soil descriptions, etc.&lt;br /&gt;
&lt;br /&gt;
- consider implementing other backend soil moisture models for research and comparison purposes.&lt;br /&gt;
&lt;br /&gt;
- become the administrator for data contribution for a sector. See below.&lt;br /&gt;
&lt;br /&gt;
== I do not see a sector defined that I am interested in. Can I generate data for that sector? ==&lt;br /&gt;
&lt;br /&gt;
Yes.&lt;br /&gt;
&lt;br /&gt;
We currently cover only half of the western US and invite data contributions from third parties. We have released a Docker file package for container implementation of the data generation, where necessary code is automatically downloaded and bundled for use. All software is free. This requires a Docker friendly platform, with multi-core CPU, and of course somebody to maintain it (eg. check that data gets delivered, etc.). We have tested the container on a Linux platform, but not yet on Macs or Windows. The computer does not need to be dedicated to generate the data, as only ~4hrs is used per sector per day. Docker claims it should work on Mac and Windows.&lt;br /&gt;
&lt;br /&gt;
== How do I setup the input files for the SME tool? ==&lt;br /&gt;
== Can I download the input and output files from an SME run? ==&lt;br /&gt;
Yes. Click on the &amp;quot;Download&amp;quot; checkbox next to the &amp;quot;Apply&amp;quot; button. You will be asked where to download the zipped file containing all input and output files.&lt;br /&gt;
== Where can I find crop coefficients? ==&lt;br /&gt;
== Your model is historically based using WRF in hindcast mode. Can the SME run in forecast mode? ==&lt;br /&gt;
Yes, and it would be useful in deciding near future irrigation scheduling for harvest, market, and efficiency purposes.&lt;br /&gt;
&lt;br /&gt;
It would only require a small modification to the GFS ingestion. All other aspects would remain the same. The forecast implementation requires WRF data generation into the future for some interested amount of time. So, instead of using reanalyzed GFS files the model would use predicted forecast GFS files. &lt;br /&gt;
&lt;br /&gt;
It would also be possible to merge both hindcast and forecast data for an SME run. So, data contributions could be based on either hindcast (yesterday and before) and/or some number of days into future, including today. Daily forecast files would incrementally be replaced with the hindcast, reanalyzed, version. However, the addition of future days would dramatically increase the need for data contributions. For example, if we wanted to predict seven days into the future it would take 8 data contributions per sector per day: 1 hindcast + 7 future days, as opposed to just 1 hindcast contributor per sector per day. Implementing this &amp;quot;merged&amp;quot; version is possible with enough data contributors.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=SME_FAQ&amp;diff=568</id>
		<title>SME FAQ</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=SME_FAQ&amp;diff=568"/>
		<updated>2019-01-27T21:43:10Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* I am an agricultural student with programming skills. How can I use the SME? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Frequently Asked Questions for the Soil Moisture Estimator&lt;br /&gt;
== I am a county extension agent. How can I use the SME to help the farmers in my county? ==&lt;br /&gt;
&lt;br /&gt;
Ideally, an extension office would have a catalogue of working crop coefficients and soil attributes for local farms. &lt;br /&gt;
The farmer would use the SME with these input files, along with irrigation events, to monitor a crop&#039;s water usage throughout the growing season.&lt;br /&gt;
&lt;br /&gt;
Presently, we are in the initial stages of exercising the SME in the field and so we ask extension agents to:&lt;br /&gt;
&lt;br /&gt;
- get familiar with the SME tool. Learn how to construct input files and how to use the output files (eg. import into spreadsheets).&lt;br /&gt;
&lt;br /&gt;
- get local rain data and compare with the WRF model rain data. We are interested in compiling wide-scale data for analysis. Sharing comparison data with us would help in model adjustments. &lt;br /&gt;
&lt;br /&gt;
- compile a set of input files of local crop cultivars and associated coefficients.  See this link.(not yet active)&lt;br /&gt;
&lt;br /&gt;
- show farmers how to derive soil attributes used in the soil model. See this link.(not yet active)&lt;br /&gt;
&lt;br /&gt;
- ask farmers with soil moisture sensors to use the SME and share their experience. We actively seek the participation of farmer-scientists for feedback.&lt;br /&gt;
&lt;br /&gt;
Assuming a set of working input files, a useful exercise for farmers is to review the past growing season using different irrigation schedules to see how the soil responds. Crops can also be changed to see what their water usage would have been. See the question below.&lt;br /&gt;
&lt;br /&gt;
== I am a irrigation specialist at a large farm. How can I use the SME ? ==&lt;br /&gt;
&lt;br /&gt;
The purpose of the SME is to provide a working estimate of water usage for different crops and soils. This allows for general monitoring of soil moisture and to apply irrigations as needed to avoid plant stress. &lt;br /&gt;
&lt;br /&gt;
Because the SME can be run historically, it is possible for the irrigation specialist to run &amp;quot;what if&amp;quot; scenarios. &lt;br /&gt;
For example,&lt;br /&gt;
&lt;br /&gt;
- What if the crop was different, how much water would that crop have used in our soil? &lt;br /&gt;
&lt;br /&gt;
- What if I irrigated small amounts more often or large amounts less often? Is there a sweet spot between the two?&lt;br /&gt;
&lt;br /&gt;
- What is the optimal irrigation amount to give available water to roots and not drain excessively beyond the root zone? &lt;br /&gt;
&lt;br /&gt;
The SME, with working parameters, can be used to address and give insight to the above questions.&lt;br /&gt;
&lt;br /&gt;
== I am an agricultural professor. How can I use the SME? ==&lt;br /&gt;
Here are some ways to use the SME: &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
- show your students the website tools and indicate that source code is available for review and improvements.&lt;br /&gt;
&lt;br /&gt;
- incorporate the tools into classroom lectures/exercises/labs for critique. We would appreciate feedback on usage.&lt;br /&gt;
&lt;br /&gt;
- suggest projects/studies to students regarding comparison with data (soil moisture, ETo, ETc, precipitation, etc.) from research stations currently covered geographically. &lt;br /&gt;
&lt;br /&gt;
- generate WRF data for areas of interest (sectors). See below on generating data.&lt;br /&gt;
&lt;br /&gt;
- consider implementing other backend soil moisture models for research and comparison purposes&lt;br /&gt;
&lt;br /&gt;
== I am an agricultural student with programming skills. How can I use the SME? ==&lt;br /&gt;
Here are some ways to use the SME: &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- download and install the code from our [https://gitlab.com.agrineer repository] and exercise the command line versions of GDC and SME.  Learn the processing stream on a local platform to get familiar with the model. You do not need to generate data as it can be downloaded. Linux navigation skills are required. &lt;br /&gt;
&lt;br /&gt;
- inspect, in detail, parts of the model code that are of interest to you and look for improvements. For example, look at the [https://gitlab.com/agrineer/eto ETo] code and improve on relative humidity calculations, or you could implement crop coefficients using smooth curves, instead of discrete steps. There are many aspects of the implementation stream that are interesting and improvable. This type of explore gives a student an in depth understanding of modelling. Python/NumPy programming skills are required.&lt;br /&gt;
&lt;br /&gt;
- compile and compare aspects of predicted and sensed data for local areas, eg. How close is historical WRF modelled rain to measured rain in your pixel (area)? Many components can be compared that would be available with regular weather sensors, such as temperatures, relative humidity and wind speed.&lt;br /&gt;
&lt;br /&gt;
- graduate endeavours could include long term studies to compare sensed soil moisture to different SME outputs with various parameters, ie.crop coefficients, soil descriptions, etc.&lt;br /&gt;
&lt;br /&gt;
- consider implementing other backend soil moisture models for research and comparison purposes.&lt;br /&gt;
&lt;br /&gt;
- become the administrator for data contribution for a sector. See below.&lt;br /&gt;
&lt;br /&gt;
== I do not see a sector defined that I am interested in. Can I generate data for that sector? ==&lt;br /&gt;
&lt;br /&gt;
Yes.&lt;br /&gt;
&lt;br /&gt;
We currently cover only half of the western US and invite data contributions from third parties. We have released a Docker file package for container implementation of the data generation, where necessary code is automatically downloaded and bundled for use. All software is free. This requires a Docker friendly platform, with multi-core CPU, and of course somebody to maintain it (eg. check that data gets delivered, etc.). We have tested the container on a Linux platform, but not yet on Macs or Windows. The computer does not need to be dedicated to generate the data, as only ~4hrs is used per sector per day. Docker claims it should work on Mac and Windows.&lt;br /&gt;
&lt;br /&gt;
== How do I setup the input files for the SME tool? ==&lt;br /&gt;
== Can I download the input and output files from an SME run? ==&lt;br /&gt;
Yes. Click on the &amp;quot;Download&amp;quot; checkbox next to the &amp;quot;Apply&amp;quot; button. You will be asked where to download the zipped file containing all input and output files.&lt;br /&gt;
== Where can I find crop coefficients? ==&lt;br /&gt;
== Your model is historically based using WRF in hindcast mode. Can the SME run in forecast mode? ==&lt;br /&gt;
Yes, and it would be useful in deciding near future irrigation scheduling for harvest, market, and efficiency purposes.&lt;br /&gt;
&lt;br /&gt;
It would only require a small modification to the GFS ingestion. All other aspects would remain the same. The forecast implementation requires WRF data generation into the future for some interested amount of time. So, instead of using reanalyzed GFS files the model would use predicted forecast GFS files. &lt;br /&gt;
&lt;br /&gt;
It would also be possible to merge both hindcast and forecast data for an SME run. So, data contributions could be based on either hindcast (yesterday and before) and/or some number of days into future, including today. Daily forecast files would incrementally be replaced with the hindcast, reanalyzed, version. However, the addition of future days would dramatically increase the need for data contributions. For example, if we wanted to predict seven days into the future it would take 8 data contributions per sector per day: 1 hindcast + 7 future days, as opposed to just 1 hindcast contributor per sector per day. Implementing this &amp;quot;merged&amp;quot; version is possible with enough data contributors.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=SME_FAQ&amp;diff=567</id>
		<title>SME FAQ</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=SME_FAQ&amp;diff=567"/>
		<updated>2019-01-27T21:42:41Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* I am an agricultural professor. How can I use the SME? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Frequently Asked Questions for the Soil Moisture Estimator&lt;br /&gt;
== I am a county extension agent. How can I use the SME to help the farmers in my county? ==&lt;br /&gt;
&lt;br /&gt;
Ideally, an extension office would have a catalogue of working crop coefficients and soil attributes for local farms. &lt;br /&gt;
The farmer would use the SME with these input files, along with irrigation events, to monitor a crop&#039;s water usage throughout the growing season.&lt;br /&gt;
&lt;br /&gt;
Presently, we are in the initial stages of exercising the SME in the field and so we ask extension agents to:&lt;br /&gt;
&lt;br /&gt;
- get familiar with the SME tool. Learn how to construct input files and how to use the output files (eg. import into spreadsheets).&lt;br /&gt;
&lt;br /&gt;
- get local rain data and compare with the WRF model rain data. We are interested in compiling wide-scale data for analysis. Sharing comparison data with us would help in model adjustments. &lt;br /&gt;
&lt;br /&gt;
- compile a set of input files of local crop cultivars and associated coefficients.  See this link.(not yet active)&lt;br /&gt;
&lt;br /&gt;
- show farmers how to derive soil attributes used in the soil model. See this link.(not yet active)&lt;br /&gt;
&lt;br /&gt;
- ask farmers with soil moisture sensors to use the SME and share their experience. We actively seek the participation of farmer-scientists for feedback.&lt;br /&gt;
&lt;br /&gt;
Assuming a set of working input files, a useful exercise for farmers is to review the past growing season using different irrigation schedules to see how the soil responds. Crops can also be changed to see what their water usage would have been. See the question below.&lt;br /&gt;
&lt;br /&gt;
== I am a irrigation specialist at a large farm. How can I use the SME ? ==&lt;br /&gt;
&lt;br /&gt;
The purpose of the SME is to provide a working estimate of water usage for different crops and soils. This allows for general monitoring of soil moisture and to apply irrigations as needed to avoid plant stress. &lt;br /&gt;
&lt;br /&gt;
Because the SME can be run historically, it is possible for the irrigation specialist to run &amp;quot;what if&amp;quot; scenarios. &lt;br /&gt;
For example,&lt;br /&gt;
&lt;br /&gt;
- What if the crop was different, how much water would that crop have used in our soil? &lt;br /&gt;
&lt;br /&gt;
- What if I irrigated small amounts more often or large amounts less often? Is there a sweet spot between the two?&lt;br /&gt;
&lt;br /&gt;
- What is the optimal irrigation amount to give available water to roots and not drain excessively beyond the root zone? &lt;br /&gt;
&lt;br /&gt;
The SME, with working parameters, can be used to address and give insight to the above questions.&lt;br /&gt;
&lt;br /&gt;
== I am an agricultural professor. How can I use the SME? ==&lt;br /&gt;
Here are some ways to use the SME: &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
- show your students the website tools and indicate that source code is available for review and improvements.&lt;br /&gt;
&lt;br /&gt;
- incorporate the tools into classroom lectures/exercises/labs for critique. We would appreciate feedback on usage.&lt;br /&gt;
&lt;br /&gt;
- suggest projects/studies to students regarding comparison with data (soil moisture, ETo, ETc, precipitation, etc.) from research stations currently covered geographically. &lt;br /&gt;
&lt;br /&gt;
- generate WRF data for areas of interest (sectors). See below on generating data.&lt;br /&gt;
&lt;br /&gt;
- consider implementing other backend soil moisture models for research and comparison purposes&lt;br /&gt;
&lt;br /&gt;
== I am an agricultural student with programming skills. How can I use the SME? ==&lt;br /&gt;
Here are some ways to use the SME: &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- download and install the code from our [https://gitlab.com.agrineer repository] and exercise the command line versions of GDC and SME.  Learn the processing stream on a local platform to get familiar with the model. You do not need to generate data as it can be downloaded. Linux navigation skills are required. &lt;br /&gt;
&lt;br /&gt;
- inspect, in detail, parts of the model code that are of interest to you and look for improvements. For example, look at the [https://gitlab.com/agrineer/eto ETo] code and improve on relative humidity calculations, or you could implement crop coefficients using smooth curves, instead of discrete steps. There are many aspects of the implementation stream that are interesting and improvable. This type of explore gives a student an in depth understanding of modelling. Python/NumPy programming skills are required.&lt;br /&gt;
&lt;br /&gt;
- compile and compare aspects of predicted and sensed data for local areas, eg. How close is historical WRF modelled rain to measured rain in your pixel (area)? Many components can be compared that would be available with regular weather sensors, such as temperatures, relative humidity and wind speed.&lt;br /&gt;
&lt;br /&gt;
- graduate endeavours could include long term studies to compare sensed soil moisture to different SME outputs with various parameters, ie.crop coefficients, soil descriptions, etc.&lt;br /&gt;
&lt;br /&gt;
- become the administrator for data contribution for a sector. See below.&lt;br /&gt;
&lt;br /&gt;
== I do not see a sector defined that I am interested in. Can I generate data for that sector? ==&lt;br /&gt;
&lt;br /&gt;
Yes.&lt;br /&gt;
&lt;br /&gt;
We currently cover only half of the western US and invite data contributions from third parties. We have released a Docker file package for container implementation of the data generation, where necessary code is automatically downloaded and bundled for use. All software is free. This requires a Docker friendly platform, with multi-core CPU, and of course somebody to maintain it (eg. check that data gets delivered, etc.). We have tested the container on a Linux platform, but not yet on Macs or Windows. The computer does not need to be dedicated to generate the data, as only ~4hrs is used per sector per day. Docker claims it should work on Mac and Windows.&lt;br /&gt;
&lt;br /&gt;
== How do I setup the input files for the SME tool? ==&lt;br /&gt;
== Can I download the input and output files from an SME run? ==&lt;br /&gt;
Yes. Click on the &amp;quot;Download&amp;quot; checkbox next to the &amp;quot;Apply&amp;quot; button. You will be asked where to download the zipped file containing all input and output files.&lt;br /&gt;
== Where can I find crop coefficients? ==&lt;br /&gt;
== Your model is historically based using WRF in hindcast mode. Can the SME run in forecast mode? ==&lt;br /&gt;
Yes, and it would be useful in deciding near future irrigation scheduling for harvest, market, and efficiency purposes.&lt;br /&gt;
&lt;br /&gt;
It would only require a small modification to the GFS ingestion. All other aspects would remain the same. The forecast implementation requires WRF data generation into the future for some interested amount of time. So, instead of using reanalyzed GFS files the model would use predicted forecast GFS files. &lt;br /&gt;
&lt;br /&gt;
It would also be possible to merge both hindcast and forecast data for an SME run. So, data contributions could be based on either hindcast (yesterday and before) and/or some number of days into future, including today. Daily forecast files would incrementally be replaced with the hindcast, reanalyzed, version. However, the addition of future days would dramatically increase the need for data contributions. For example, if we wanted to predict seven days into the future it would take 8 data contributions per sector per day: 1 hindcast + 7 future days, as opposed to just 1 hindcast contributor per sector per day. Implementing this &amp;quot;merged&amp;quot; version is possible with enough data contributors.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=566</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=566"/>
		<updated>2019-01-27T21:34:29Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* SMA Module Files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The first two are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the &amp;quot;Sacramento&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
[FILES]&amp;lt;br&amp;gt;&lt;br /&gt;
loads = /home/agrineer/sma/input/loads.csv &amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sma/input/soil.csv &amp;lt;br&amp;gt;&lt;br /&gt;
output = /home/agrineer/sma/output/output.csv &amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sma/input/rain.csv &amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sma/input/irr.csv &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when the sme.py uses the SMA module the SMA configuration file is constructed on the fly, based on SME data and configuration input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameters in the SME configuration file.&lt;br /&gt;
&lt;br /&gt;
For example, to reference the SMA with parameters in the sme.py, the SME configuration file might have:&lt;br /&gt;
&lt;br /&gt;
[SoilModel]&amp;lt;br&amp;gt;&lt;br /&gt;
model = SMA&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[SMA]&amp;lt;br&amp;gt;&lt;br /&gt;
program = /home/agrineer/sme/sme/sma&amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sme/tmp/soil.csv&amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sme/tmp/rain.csv&amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sme/tmp/irr.csv&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;loads&amp;quot; file (data) would be generated by the WRF model data and ETo calculations and then submitted to the SMA program.&lt;br /&gt;
&lt;br /&gt;
Note that the web SME tool constructs the configuration file for the sme.py program as above. See the SME description [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
&lt;br /&gt;
  - read_loads()&lt;br /&gt;
  - read_soils()&lt;br /&gt;
  - replace_precip()&lt;br /&gt;
  - add_irrigations()&lt;br /&gt;
 &lt;br /&gt;
  Output file documention can be found in the main() routine.&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=565</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=565"/>
		<updated>2019-01-27T21:33:50Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&lt;br /&gt;
The first two are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the &amp;quot;Sacramento&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
[FILES]&amp;lt;br&amp;gt;&lt;br /&gt;
loads = /home/agrineer/sma/input/loads.csv &amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sma/input/soil.csv &amp;lt;br&amp;gt;&lt;br /&gt;
output = /home/agrineer/sma/output/output.csv &amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sma/input/rain.csv &amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sma/input/irr.csv &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when the sme.py uses the SMA module the SMA configuration file is constructed on the fly, based on SME data and configuration input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameters in the SME configuration file.&lt;br /&gt;
&lt;br /&gt;
For example, to reference the SMA with parameters in the sme.py, the SME configuration file might have:&lt;br /&gt;
&lt;br /&gt;
[SoilModel]&amp;lt;br&amp;gt;&lt;br /&gt;
model = SMA&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[SMA]&amp;lt;br&amp;gt;&lt;br /&gt;
program = /home/agrineer/sme/sme/sma&amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sme/tmp/soil.csv&amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sme/tmp/rain.csv&amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sme/tmp/irr.csv&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;loads&amp;quot; file (data) would be generated by the WRF model data and ETo calculations and then submitted to the SMA program.&lt;br /&gt;
&lt;br /&gt;
Note that the web SME tool constructs the configuration file for the sme.py program as above. See the SME description [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
&lt;br /&gt;
  - read_loads()&lt;br /&gt;
  - read_soils()&lt;br /&gt;
  - replace_precip()&lt;br /&gt;
  - add_irrigations()&lt;br /&gt;
 &lt;br /&gt;
  Output file documention can be found in the main() routine.&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=564</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=564"/>
		<updated>2019-01-27T21:24:21Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* SMA Module Files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&lt;br /&gt;
The first two are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the &amp;quot;Sacramento&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
[FILES]&amp;lt;br&amp;gt;&lt;br /&gt;
loads = /home/agrineer/sma/input/loads.csv &amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sma/input/soil.csv &amp;lt;br&amp;gt;&lt;br /&gt;
output = /home/agrineer/sma/output/output.csv &amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sma/input/rain.csv &amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sma/input/irr.csv &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when used with the SME the SMA configuration file is constructed on the fly, based on SME data and input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameters in the SME configuration file.&lt;br /&gt;
&lt;br /&gt;
For example, to reference the SMA with parameters in the sme.py, the SME configuration file might have:&lt;br /&gt;
&lt;br /&gt;
[SoilModel]&amp;lt;br&amp;gt;&lt;br /&gt;
model = SMA&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[SMA]&amp;lt;br&amp;gt;&lt;br /&gt;
program = /home/agrineer/sme/sme/sma&amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sme/tmp/soil.csv&amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sme/tmp/rain.csv&amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sme/tmp/irr.csv&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;loads&amp;quot; file (data) would be generated by the WRF model and ETo calculations and then submitted to the SMA program.&lt;br /&gt;
&lt;br /&gt;
Note that the web SME tool would construct the configuration file for the sme.py program as above. See SME description [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
&lt;br /&gt;
  - read_loads()&lt;br /&gt;
  - read_soils()&lt;br /&gt;
  - replace_precip()&lt;br /&gt;
  - add_irrigations()&lt;br /&gt;
 &lt;br /&gt;
  Output file documention can be found in the main() routine.&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=563</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=563"/>
		<updated>2019-01-27T21:23:50Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&lt;br /&gt;
The first two below are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the &amp;quot;Sacramento&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
[FILES]&amp;lt;br&amp;gt;&lt;br /&gt;
loads = /home/agrineer/sma/input/loads.csv &amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sma/input/soil.csv &amp;lt;br&amp;gt;&lt;br /&gt;
output = /home/agrineer/sma/output/output.csv &amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sma/input/rain.csv &amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sma/input/irr.csv &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when used with the SME the SMA configuration file is constructed on the fly, based on SME data and input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameters in the SME configuration file.&lt;br /&gt;
&lt;br /&gt;
For example, to reference the SMA with parameters in the sme.py, the SME configuration file might have:&lt;br /&gt;
&lt;br /&gt;
[SoilModel]&amp;lt;br&amp;gt;&lt;br /&gt;
model = SMA&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[SMA]&amp;lt;br&amp;gt;&lt;br /&gt;
program = /home/agrineer/sme/sme/sma&amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sme/tmp/soil.csv&amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sme/tmp/rain.csv&amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sme/tmp/irr.csv&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;loads&amp;quot; file (data) would be generated by the WRF model and ETo calculations and then submitted to the SMA program.&lt;br /&gt;
&lt;br /&gt;
Note that the web SME tool would construct the configuration file for the sme.py program as above. See SME description [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
&lt;br /&gt;
  - read_loads()&lt;br /&gt;
  - read_soils()&lt;br /&gt;
  - replace_precip()&lt;br /&gt;
  - add_irrigations()&lt;br /&gt;
 &lt;br /&gt;
  Output file documention can be found in the main() routine.&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=562</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=562"/>
		<updated>2019-01-27T21:21:17Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&lt;br /&gt;
The first two below are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the &amp;quot;Sacramento&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
[FILES]&amp;lt;br&amp;gt;&lt;br /&gt;
loads = /home/agrineer/sma/input/loads.csv &amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sma/input/soil.csv &amp;lt;br&amp;gt;&lt;br /&gt;
output = /home/agrineer/sma/output/output.csv &amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sma/input/rain.csv &amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sma/input/irr.csv &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when used with the SME the SMA configuration file is constructed on the fly, based on SME data and input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameters in the SME configuration file.&lt;br /&gt;
&lt;br /&gt;
For example, to reference the SMA with parameters in the sme.py, the SME configuration file might have:&lt;br /&gt;
&lt;br /&gt;
[SoilModel]&amp;lt;br&amp;gt;&lt;br /&gt;
model = SMA&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[SMA]&amp;lt;br&amp;gt;&lt;br /&gt;
program = /home/agrineer/sme/sme/sma&amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sme/tmp/soil.csv&amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sme/tmp/rain.csv&amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sme/tmp/irr.csv&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the web SME tool would construct the configuration file for the sme.py program as above. See SME description [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
&lt;br /&gt;
  - read_loads()&lt;br /&gt;
  - read_soils()&lt;br /&gt;
  - replace_precip()&lt;br /&gt;
  - add_irrigations()&lt;br /&gt;
 &lt;br /&gt;
  Output file documention can be found in the main() routine.&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=561</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=561"/>
		<updated>2019-01-27T21:17:07Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&lt;br /&gt;
The first two below are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the &amp;quot;Sacramento&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
[FILES]&amp;lt;br&amp;gt;&lt;br /&gt;
loads = /home/agrineer/sma/input/loads.csv &amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sma/input/soil.csv &amp;lt;br&amp;gt;&lt;br /&gt;
output = /home/agrineer/sma/output/output.csv &amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sma/input/rain.csv &amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sma/input/irr.csv &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when used with the SME the SMA configuration file is constructed on the fly, based on SME data and input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameters in the SME configuration file.&lt;br /&gt;
&lt;br /&gt;
For example, to reference the SMA with parameters in the sme.py, the SME configuration file might have:&lt;br /&gt;
&lt;br /&gt;
[SoilModel]&amp;lt;br&amp;gt;&lt;br /&gt;
model = SMA&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[SMA]&amp;lt;br&amp;gt;&lt;br /&gt;
program = /home/agrineer/sme/sme/sma&amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sme/tmp/soil.csv&amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sme/tmp/rain.csv&amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sme/tmp/irr.csv&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See SME description [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
&lt;br /&gt;
  - read_loads()&lt;br /&gt;
  - read_soils()&lt;br /&gt;
  - replace_precip()&lt;br /&gt;
  - add_irrigations()&lt;br /&gt;
 &lt;br /&gt;
  Output file documention can be found in the main() routine.&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=560</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=560"/>
		<updated>2019-01-27T21:15:31Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&lt;br /&gt;
The first two below are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the &amp;quot;Sacramento&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
[FILES]&amp;lt;br&amp;gt;&lt;br /&gt;
loads = /home/agrineer/sma/input/loads.csv &amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sma/input/soil.csv &amp;lt;br&amp;gt;&lt;br /&gt;
output = /home/agrineer/sma/output/output.csv &amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sma/input/rain.csv &amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sma/input/irr.csv &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when used with the SME the SMA configuration file is constructed on the fly, based on SME data and input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameters in the SME configuration file.&lt;br /&gt;
&lt;br /&gt;
For example, to reference the SMA with parameters in the sme.py, the SME configuration file might have:&lt;br /&gt;
&lt;br /&gt;
[SoilModel]&amp;lt;br&amp;gt;&lt;br /&gt;
model = SMA&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[SMA]&amp;lt;br&amp;gt;&lt;br /&gt;
program = /home/agrineer/sme/sme/sma&lt;br /&gt;
soil = /home/agrineer/sme/tmp/soil.csv&lt;br /&gt;
rain = /home/agrineer/sme/tmp/rain.csv&lt;br /&gt;
irr = /home/agrineer/sme/tmp/irr.csv&lt;br /&gt;
&lt;br /&gt;
See SME description [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
&lt;br /&gt;
  - read_loads()&lt;br /&gt;
  - read_soils()&lt;br /&gt;
  - replace_precip()&lt;br /&gt;
  - add_irrigations()&lt;br /&gt;
 &lt;br /&gt;
  Output file documention can be found in the main() routine.&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=559</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=559"/>
		<updated>2019-01-27T21:14:58Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&lt;br /&gt;
The first two below are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the Sacramento directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
[FILES]&amp;lt;br&amp;gt;&lt;br /&gt;
loads = /home/agrineer/sma/input/loads.csv &amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sma/input/soil.csv &amp;lt;br&amp;gt;&lt;br /&gt;
output = /home/agrineer/sma/output/output.csv &amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sma/input/rain.csv &amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sma/input/irr.csv &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when used with the SME the SMA configuration file is constructed on the fly, based on SME data and input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameters in the SME configuration file.&lt;br /&gt;
&lt;br /&gt;
For example, to reference the SMA with parameters in the sme.py, the SME configuration file might have:&lt;br /&gt;
&lt;br /&gt;
[SoilModel]&amp;lt;br&amp;gt;&lt;br /&gt;
model = SMA&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[SMA]&amp;lt;br&amp;gt;&lt;br /&gt;
program = /home/agrineer/sme/sme/sma&lt;br /&gt;
soil = /home/agrineer/sme/tmp/soil.csv&lt;br /&gt;
rain = /home/agrineer/sme/tmp/rain.csv&lt;br /&gt;
irr = /home/agrineer/sme/tmp/irr.csv&lt;br /&gt;
&lt;br /&gt;
See SME description [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
&lt;br /&gt;
  - read_loads()&lt;br /&gt;
  - read_soils()&lt;br /&gt;
  - replace_precip()&lt;br /&gt;
  - add_irrigations()&lt;br /&gt;
 &lt;br /&gt;
  Output file documention can be found in the main() routine.&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=558</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=558"/>
		<updated>2019-01-27T20:52:56Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&lt;br /&gt;
The first two below are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the Sacramento directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
[FILES]&amp;lt;br&amp;gt;&lt;br /&gt;
loads = /home/agrineer/sma/input/loads.csv &amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sma/input/soil.csv &amp;lt;br&amp;gt;&lt;br /&gt;
output = /home/agrineer/sma/input/output.csv &amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sma/input/rain.csv &amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sma/input/irr.csv &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when used with the SME the configuration file is constructed on the fly, based on SME data and input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameters in the SME configuration file. To reference the SMA with parameters the sme.py configuration file would have:&lt;br /&gt;
&lt;br /&gt;
[SoilModel]&lt;br /&gt;
model = SMA&lt;br /&gt;
&lt;br /&gt;
[SMA]&lt;br /&gt;
program = /home/agrineer/agrineer.org/sme/sme/sma&lt;br /&gt;
soil = /home/agrineer/agrineer.org/sme/tmp/SME_5c4df8edb401c/soil.csv&lt;br /&gt;
rain = /home/agrineer/agrineer.org/sme/tmp/SME_5c4df8edb401c/rain.csv&lt;br /&gt;
irr = /home/agrineer/agrineer.org/sme/tmp/SME_5c4df8edb401c/irr.csv&lt;br /&gt;
&lt;br /&gt;
See [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
&lt;br /&gt;
  - read_loads()&lt;br /&gt;
  - read_soils()&lt;br /&gt;
  - replace_precip()&lt;br /&gt;
  - add_irrigations()&lt;br /&gt;
 &lt;br /&gt;
  Output file documention can be found in the main() routine.&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=557</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=557"/>
		<updated>2019-01-27T20:49:43Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* SMA Module Files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&lt;br /&gt;
The first two below are interface contributions:&lt;br /&gt;
  * ini.c - reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  * sma.c - interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  * sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  * fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs above were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model came from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the Sacramento directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
[FILES]&amp;lt;br&amp;gt;&lt;br /&gt;
loads = /home/agrineer/sma/input/loads.csv &amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sma/input/soil.csv &amp;lt;br&amp;gt;&lt;br /&gt;
output = /home/agrineer/sma/input/output.csv &amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sma/input/rain.csv &amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sma/input/irr.csv &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when used with the SME the configuration file is constructed on the fly, based on SME data and input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameters in the SME configuration file. See [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
&lt;br /&gt;
  - read_loads()&lt;br /&gt;
  - read_soils()&lt;br /&gt;
  - replace_precip()&lt;br /&gt;
  - add_irrigations()&lt;br /&gt;
 &lt;br /&gt;
  Output file documention can be found in the main() routine.&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=556</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=556"/>
		<updated>2019-01-27T20:46:00Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&lt;br /&gt;
The first two below are interface contributions:&lt;br /&gt;
  - ini.c reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  - sma.c interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  - sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  - fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model come from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the Sacramento directory.&lt;br /&gt;
&lt;br /&gt;
The main sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
[FILES]&amp;lt;br&amp;gt;&lt;br /&gt;
loads = /home/agrineer/sma/input/loads.csv &amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sma/input/soil.csv &amp;lt;br&amp;gt;&lt;br /&gt;
output = /home/agrineer/sma/input/output.csv &amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sma/input/rain.csv &amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sma/input/irr.csv &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when used with the SME the configuration file is constructed on the fly, based on SME data and input files. Since the SMA is a backend module the SME, the user must specify the soil model and its parameters in the SME configuration file. See [https://gitlab.com/agrineer/sme here] for more detail.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
&lt;br /&gt;
  - read_loads()&lt;br /&gt;
  - read_soils()&lt;br /&gt;
  - replace_precip()&lt;br /&gt;
  - add_irrigations()&lt;br /&gt;
 &lt;br /&gt;
  Output file documention can be found in the main() routine.&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=555</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=555"/>
		<updated>2019-01-27T20:41:17Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&lt;br /&gt;
The first two below are interface contributions:&lt;br /&gt;
  - ini.c reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  - sma.c interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  - sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  - fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model come from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project which can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the Sacramento directory.&lt;br /&gt;
&lt;br /&gt;
The sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
[FILES]&amp;lt;br&amp;gt;&lt;br /&gt;
loads = /home/agrineer/sma/input/loads.csv &amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sma/input/soil.csv &amp;lt;br&amp;gt;&lt;br /&gt;
output = /home/agrineer/sma/input/output.csv &amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sma/input/rain.csv &amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sma/input/irr.csv &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when used with the SME the configuration file is constructed on the fly.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
&lt;br /&gt;
  - read_loads()&lt;br /&gt;
  - read_soils()&lt;br /&gt;
  - replace_precip()&lt;br /&gt;
  - add_irrigations()&lt;br /&gt;
 &lt;br /&gt;
  Output file documention can be found in the main() routine.&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=554</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=554"/>
		<updated>2019-01-27T20:40:56Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&lt;br /&gt;
The first two below are interface contributions:&lt;br /&gt;
  - ini.c reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  - sma.c interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  - sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  - fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model come from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project and can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the Sacramento directory.&lt;br /&gt;
&lt;br /&gt;
The sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the &amp;quot;makefile&amp;quot; to your preference.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
[FILES]&amp;lt;br&amp;gt;&lt;br /&gt;
loads = /home/agrineer/sma/input/loads.csv &amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sma/input/soil.csv &amp;lt;br&amp;gt;&lt;br /&gt;
output = /home/agrineer/sma/input/output.csv &amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sma/input/rain.csv &amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sma/input/irr.csv &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when used with the SME the configuration file is constructed on the fly.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
&lt;br /&gt;
  - read_loads()&lt;br /&gt;
  - read_soils()&lt;br /&gt;
  - replace_precip()&lt;br /&gt;
  - add_irrigations()&lt;br /&gt;
 &lt;br /&gt;
  Output file documention can be found in the main() routine.&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=553</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=553"/>
		<updated>2019-01-27T20:38:42Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: /* SMA Module Files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&lt;br /&gt;
The first two below are interface contributions:&lt;br /&gt;
  - ini.c reads ini style input variables, from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  - sma.c interfaces between the SME and the SMA model, from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  - sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  - fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model come from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project and can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the Sacramento directory.&lt;br /&gt;
&lt;br /&gt;
The sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. The executable is moved to its parent directory for use.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
[FILES]&amp;lt;br&amp;gt;&lt;br /&gt;
loads = /home/agrineer/sma/input/loads.csv &amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sma/input/soil.csv &amp;lt;br&amp;gt;&lt;br /&gt;
output = /home/agrineer/sma/input/output.csv &amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sma/input/rain.csv &amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sma/input/irr.csv &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when used with the SME the configuration file is constructed on the fly.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
&lt;br /&gt;
  - read_loads()&lt;br /&gt;
  - read_soils()&lt;br /&gt;
  - replace_precip()&lt;br /&gt;
  - add_irrigations()&lt;br /&gt;
 &lt;br /&gt;
  Output file documention can be found in the main() routine.&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=552</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=552"/>
		<updated>2019-01-27T20:35:27Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the [https://www.agrineer.org/wiki/index.php?title=Soil_Moisture_Estimator Soil Moisture Estimator] tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&lt;br /&gt;
The first two below are interface contributions:&lt;br /&gt;
  - ini.c reads ini style input variables from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  - sma.c interfaces between the SME and the SMA model from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  - sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  - fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model come from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project and can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the Sacramento directory.&lt;br /&gt;
&lt;br /&gt;
The sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. The executable is moved to its parent directory for use.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
[FILES]&amp;lt;br&amp;gt;&lt;br /&gt;
loads = /home/agrineer/sma/input/loads.csv &amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sma/input/soil.csv &amp;lt;br&amp;gt;&lt;br /&gt;
output = /home/agrineer/sma/input/output.csv &amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sma/input/rain.csv &amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sma/input/irr.csv &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when used with the SME the configuration file is constructed on the fly.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
&lt;br /&gt;
  - read_loads()&lt;br /&gt;
  - read_soils()&lt;br /&gt;
  - replace_precip()&lt;br /&gt;
  - add_irrigations()&lt;br /&gt;
 &lt;br /&gt;
  Output file documention can be found in the main() routine.&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
	<entry>
		<id>https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=551</id>
		<title>Sacramento SMA</title>
		<link rel="alternate" type="text/html" href="https://www.agrineer.org/wiki/index.php?title=Sacramento_SMA&amp;diff=551"/>
		<updated>2019-01-27T20:34:10Z</updated>

		<summary type="html">&lt;p&gt;Agrineer: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The SMA project/module provides a back-end soil moisture model for the Soil Moisture Estimator tool and implements a custom  C interface to the National Weather Service-University of Arizona Sacramento Soil Moisture Accounting (SMA) model.&lt;br /&gt;
&lt;br /&gt;
== SMA Module Files ==&lt;br /&gt;
There are four C programs which make up the module.&amp;lt;br&amp;gt;&lt;br /&gt;
The first two below are interface contributions:&lt;br /&gt;
  - ini.c reads ini style input variables from [https://github.com/benhoyt/inih Ben Hoyt]&lt;br /&gt;
  - sma.c interfaces between the SME and the SMA model from Agrineer&lt;br /&gt;
&lt;br /&gt;
The next two implement the actual model:&lt;br /&gt;
  - sacramento_state.c (a version of sac_sma.c)&lt;br /&gt;
  - fland1.c &lt;br /&gt;
&lt;br /&gt;
and were originally part of the MOSCEM package developed at University of Arizona by Yuqiong Liu and others. Permission to use and distribute these files was granted by Professor Hoshin Gupta (University of Arizona) on 2009-08-28.&lt;br /&gt;
&lt;br /&gt;
The last two programs were originally downloaded from Google&#039;s cached copy of http://info.science.uva.nl/ibed/research/Research_Fields/cbpg/software/code/moscem.0.tar.gz 2009-08-20 by Felix Andrews.&lt;br /&gt;
&lt;br /&gt;
For an R language version go to [http://hydromad.catchment.org Hydromad]. Many descriptive phrases and source code on the model come from Hydromad.&lt;br /&gt;
 &lt;br /&gt;
The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews &amp;lt;felix@nfrac.org&amp;gt; 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.&lt;br /&gt;
&lt;br /&gt;
The program fland1.c executes the SAC-SMA operation for one time period. It was initially written in FORTRAN by Eric Anderson-HRL in April 1979. In 1993-94 Patrice O. Yapo rewrote the program in the C language. The transition from FORTRAN to C explains why the C programs use parameters by reference, an artifact from FORTRAN.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The SMA module is part of the SME project and can be downloaded from [https://gitlab.com/agrineer/sme here]. The SMA module is in the Sacramento directory.&lt;br /&gt;
&lt;br /&gt;
The sma.c program can be run standalone. To create the sma executable, type &amp;quot;make&amp;quot; in the Sacramento directory. The executable is moved to its parent directory for use.&lt;br /&gt;
 &lt;br /&gt;
Usage: &lt;br /&gt;
  sma -c config_file&lt;br /&gt;
&lt;br /&gt;
  Where the configuration file holds &amp;quot;ini&amp;quot; parameters for:&amp;lt;br&amp;gt;&lt;br /&gt;
  loads - Filepath to atmospheric loads (precip and et) data, described below.&lt;br /&gt;
  soil - Filepath to soil attribute data, described below.&lt;br /&gt;
  output - Filepath to output report, described below.&lt;br /&gt;
  rain - Optional filepath for local rain input data. Overrides climate model rain data.&lt;br /&gt;
  irr - Optional filepath for irrigation events. Events count as precipitation.&lt;br /&gt;
  &lt;br /&gt;
An example configuration file:&lt;br /&gt;
&lt;br /&gt;
[FILES]&amp;lt;br&amp;gt;&lt;br /&gt;
loads = /home/agrineer/sma/input/loads.csv &amp;lt;br&amp;gt;&lt;br /&gt;
soil = /home/agrineer/sma/input/soil.csv &amp;lt;br&amp;gt;&lt;br /&gt;
output = /home/agrineer/sma/input/output.csv &amp;lt;br&amp;gt;&lt;br /&gt;
rain = /home/agrineer/sma/input/rain.csv &amp;lt;br&amp;gt;&lt;br /&gt;
irr = /home/agrineer/sma/input/irr.csv &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when used with the SME the configuration file is constructed on the fly.&lt;br /&gt;
&lt;br /&gt;
==Input file format and variable description ==&lt;br /&gt;
=== Atmospheric Loads ===&lt;br /&gt;
=== Soil Attributes ===&lt;br /&gt;
=== Local Rain Events ===&lt;br /&gt;
=== Irrigation Events ===&lt;br /&gt;
&lt;br /&gt;
  - read_loads()&lt;br /&gt;
  - read_soils()&lt;br /&gt;
  - replace_precip()&lt;br /&gt;
  - add_irrigations()&lt;br /&gt;
 &lt;br /&gt;
  Output file documention can be found in the main() routine.&lt;br /&gt;
&lt;br /&gt;
== Paper References ==&lt;br /&gt;
Links describing the Sacramento Soil Moisture Accounting model:&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/calb/calibration1102/calb_report_section7-8.pdf calb_report7-8.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://water.engr.psu.edu/wagener/PublicationsPDFs/EMS2009%20Bai%20et%20al.pdf EMS2009 Bai et al]&lt;br /&gt;
&lt;br /&gt;
[http://hydromad.catchment.org/downloads/hydromad_paper.pdf hydromadPaper.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://orbit.dtu.dk/files/9729153/MR2007_305.pdf MR2007_305.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://eventos.abrh.org.br/icfm6/proceedings/papers/PAP014820.pdf PAP014820.pdf]&lt;br /&gt;
&lt;br /&gt;
[http://www.nws.noaa.gov/oh/hrl/modelcalibration/3.%20%20A%20priori%20model%20parameters/SSURGO%20data%202004.pdf SSURGO_data_2004.pdf]&lt;br /&gt;
&lt;br /&gt;
Plus many more by searching for &amp;quot;Sacramento Soil Moisture Accounting&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Agrineer</name></author>
	</entry>
</feed>