The following procedure explains how to get SMRT running on your personal computer.
Step 1. Install Python and dependencies
SMRT is developed with the highest stable version of Python but also work with python 2.7 series and 3.4 or higher. Anaconda is the recommended distribution to get Python as it contains numerous packages needed for scientific computations and analysis. This is an open source distribution available for Linux, Windows and MacOS. Alternatively, you can install Python with the main package manager of your system (e.g. apt-get on Debian/Ubuntu, rpm on Fedora, homebrew on MacOS, ...) or visit https://wwww.python.org/ for more information.
Using pip, it is similar:
To download and keep up-to-date SMRT, it is recommended to use the version control software Git that can be installed using the package manager of your system. Here are some instructions for installing git. This simple guide to using git may also be helpful but the two needed commands are given below.
Step 2. Get SMRT code
SMRT code is hosted on github. To get the code clone the repository with:
Alternatively, download directly the code with the large green button on github.
Please note the Licence (LGPL) and disclaimer as this governs what you are allowed to do with SMRT! To get ready for using SMRT, you must install the required external packages.
Because SMRT is not formally installed in your system, it is necessary to inform Python where the code is. Under Linux, this is done by using the following command (in every terminal or better to put in ~/.bashrc file)
where /the/full/path/to/smrt is the SMRT top directory, i.e. the directory that contains README.md, requirements.txt, etc.
Step 3. A first example
This simple script sets up a simple, one-layer snowpack with exponential microstructure. The Improved Born Approximation (IBA) and Discrete Ordinates Radiative Transfer model (DORT) are used to simulate the AMSR-E 37V channel:
from smrt import make_snowpack, make_model, sensor_list # prepare inputs thickness =  corr_length = [5e-5] temperature =  density =  # create the snowpack snowpack = make_snowpack(thickness=thickness, microstructure_model="exponential", density=density, temperature=temperature, corr_length=corr_length) # create the sensor radiometer = sensor_list.amsre('37V') # create the model m = make_model("iba", "dort") # run the model result = m.run(radiometer, snowpack) # outputs print(result.TbV())
Copy this code into a new file called "first-smrt.py" somewhere on your filesystem (generally NOT in the smrt directory) and execute the code with the python command or by clicking on the file depending on your system:
If you get an ImportError, it is likely that python does not find the smrt directory. Check that $PYTHONPATH is properly set.
The result of this computation should be 268.04 K. To adapt this to multiple layers, extend the size of the snowpack parameter arrays (e.g. below should give a brightness temperature of 228.45 K if used in place of the snowpack above)
- Layer numbers are from the top to the bottom i.e. first in the list is the top.
- SI units are always used: metres, Kelvin, kilograms, Hertz.
- Different parameters are needed for each microstructure model. See documentation for details
Last Recommendations: Staying up to date
If you have cloned SMRT with git, you don't need to use clone again to get the last version, just move to the smrt directory and execute:
We recommend to always get the latest version as we constantly correct bugs and improve the code. See git documentation how to revert to a past version.