Difference between revisions of "Sacramento SMA"

From Agrineer.org Wiki
Jump to: navigation, search
(Paper References)
(Atmospheric Loads)
Line 66: Line 66:
  
 
=== Atmospheric Loads ===
 
=== Atmospheric Loads ===
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,<br><br>
+
The "loads" 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,<br><br>
 
   Date,P,E  
 
   Date,P,E  
 
   2018-01-02,0.00,1.0348  
 
   2018-01-02,0.00,1.0348  
Line 73: Line 73:
 
   .  
 
   .  
 
   .  
 
   .  
   .  
+
   .
 +
 
 
=== Soil Attributes ===
 
=== Soil Attributes ===
 
=== Local Rain Events ===
 
=== Local Rain Events ===

Revision as of 15:18, 27 January 2019

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.

SMA Module Files

There are four C programs which make up the module.

The first two are interface contributions:

 * ini.c - reads ini style input variables, from Ben Hoyt
 * sma.c - interfaces between the SME and the SMA model, from Agrineer

The next two implement the actual model:

 * sacramento_state.c (a version of sac_sma.c)
 * fland1.c 

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.

The last two programs above were originally downloaded from Google'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.

For an R language version go to Hydromad. Many descriptive phrases and source code on the model came from Hydromad.

The program sacramento_state.c (sac_sma.c) was based on code from the MOSCEM project and simplified by Felix Andrews <felix@nfrac.org> 2010-02-01. Adapted to return state by Joseph Guillaume 2013-10-24.

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.

Implementation

The SMA module is part of the SME project which can be downloaded from here. The SMA module is in the "Sacramento" directory.

The main sma.c program can be run standalone. To create the sma executable, type "make" in the Sacramento directory. By default the executable is moved to its parent directory for use by sme.py. Modify the "makefile" to your preference.

Usage:

 sma -c config_file
 Where the configuration file holds "ini" parameters for:
loads - Filepath to atmospheric loads (precip and et) data, described below. soil - Filepath to soil attribute data, described below. output - Filepath to output report, described below. rain - Optional filepath for local rain input data. Overrides climate model rain data. irr - Optional filepath for irrigation events. Events count as precipitation.

An example configuration file:

[FILES]
loads = /home/agrineer/sma/input/loads.csv
soil = /home/agrineer/sma/input/soil.csv
output = /home/agrineer/sma/output/output.csv
rain = /home/agrineer/sma/input/rain.csv
irr = /home/agrineer/sma/input/irr.csv

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.

For example, to reference the SMA with parameters in the sme.py, the SME configuration file might have:

[SoilModel]
model = SMA

[SMA]
program = /home/agrineer/sme/sme/sma
soil = /home/agrineer/sme/tmp/soil.csv
rain = /home/agrineer/sme/tmp/rain.csv
irr = /home/agrineer/sme/tmp/irr.csv

The "loads" file (data) would be generated by the WRF model data and ETo calculations and then submitted to the SMA program.

Note that the web SME tool constructs the configuration file for the sme.py program as above. See the SME description here for more detail.

Input file format and variable description

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.

Atmospheric Loads

The "loads" 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,

 Date,P,E 
 2018-01-02,0.00,1.0348 
 2018-01-03,0.00,0.8603 
 2018-01-04,0.00,0.8630 
 . 
 . 
 .

Soil Attributes

Local Rain Events

Irrigation Events

 - read_loads()
 - read_soils()
 - replace_precip()
 - add_irrigations()

 Output file documention can be found in the main() routine.

Paper References

Some links describing the Sacramento Soil Moisture Accounting model:

calb_report7-8.pdf

EMS2009 Bai et al

hydromadPaper.pdf

MR2007_305.pdf

PAP014820.pdf

SSURGO_data_2004.pdf

Plus many more by searching for "Sacramento Soil Moisture Accounting".