Skip to main content

Spatial Modeling for Resources Framework

Stable version Pypi version DOI DOI Coverage Status Maintainability

Spatial Modeling for Resources Framework (SMRF) was developed by Dr. Scott Havens at the USDA Agricultural Research Service (ARS) in Boise, ID. SMRF was designed to increase the flexibility of taking measured weather data and distributing the point measurements across a watershed. SMRF was developed to be used as an operational or research framework, where ease of use, efficiency, and ability to run in near real time are high priorities.

Read the full documentation for SMRF including up to date installation instructions.

Which version to use?

Stable

The stable version of SMRF is currently v0.9. The code can be downloaded from the releases or can be found on the release-0.9 branch.

Best for:

  • Applying the model in near real time
  • Researchers wanting a ready to use model
  • Those wanting the most stable and tested code

Experimental

:warning: Use at your own risk! While this contains the latest code, it is not guaranteed to work with the whole modeling framework.

The latest code on master contains all the latest development to SMRF. However, this must be used with caution as it can be under active development, may change at any time and is not guaranteed to work with the rest of the modeling framework at that moment. Once the code has been fully tested within the modeling framework, a new release will be created to signal a move to a stable version.

Best for:

  • Those planning on developing with SMRF
  • Model simulations require features only found in the latest code
  • Okay with the possibility that SMRF doesn't work with the rest of the modeling system

Installation

python3 -m pip install smrf-dev

To install SMRF locally on Linux of MacOSX, first clone the repository and build into a virtual environment. This requires gcc <= 9.0. The general steps are as follows and will test the SMRF installation by running the tests.

Clone from the repository

git clone https://github.com/USDA-ARS-NWRC/smrf.git

And install the requirements, SMRF and run the tests.

python3 -m pip install -r requirements_dev.txt .[tests]
python3 setup.py install

To optionally verify the installation, run the unit tests

python3 -m unittest -v

For Windows, the install method is using Docker.

System dependencies

If using SMRF with gridded weather data from GRIB files, you will need the system dependancy for eccodes which is a GRIB file reader.

Topo setup

The topo provides SMRF with the following static layers:

  1. Digital elevation model
  2. Vegetation type
  3. Vegetation height
  4. Vegetation extinction coefficient
  5. Vegetation optical transmissivity
  6. Basin mask (optional)

All these layers are stored in a netCDF file, typically referred to the topo.nc file.

While the topo.nc file can be generated manually, a great option is to use basin_setup which creates a topo file that is compatible with SMRF and AWSM.

Input data

Input meterological data for SMRF requires the following variables:

  • Air temperature
  • Vapor pressure
  • Precipitation
  • Wind speed and direction
  • Cloud factor (percentage between 0 and 1 of incoming solar obstructed by clouds)

The data can be supplied through the following formats:

  • CSV files
  • Weather Research and Forecasting (WRF) outputs
  • High Resolution Rapid Refresh (HRRR)
  • Generic netCDF

Running SMRF

There are two ways to run SMRF, first is through the run_smrf command or through the SMRF API. If SMRF is being used as input to a snow or hydrology model, we recommend to use run_smrf as it will generate all the input required. See the full documentation for more details.

run_smrf <config_file>

Docker

SMRF is also built into a docker image to make it easy to install on any operating system. The docker images are built automatically from the Github repository and include the latest code base or stable release images.

The SMRF docker image has a folder meant to mount data inside the docker image at /data.

docker run -v <path to data>:/data usdaarsnwrc/smrf run_smrf <path to config>

The <path to data> should be the path to where the configuration file, data and topo are on the host machine. This will also be the location to where the SMRF output will go.

NOTE: The paths in the configuration file must be adjusted for being inside the docker image. For example, in the command above the path to the config will be inside the docker image. This would be /data/config.ini and not the path on the host machine.

In a way that ARS uses this, we keep the config, topo and data on one location as the files are fairly small. The output then is put in another location as it file size can be much larger. To facilitate this, mount the input and output data separately and modify the configuration paths.

docker run -v <input>:/data/input -v <output>:/data/output usdaarsnwrc/smrf run_smrf <path to config>

Development

Tests

SMRF relies on class level and integration type testing. On the class level, tests cover expected structure and ensure proper attribute types. Example: tests/data/test_gridded_input.py

The integration tests ensure that changes to the code base do not trigger unexpected changes to the model output. Example: tests/test_full_smrf.py

All required data for integration tests is stored under: tests/basins/ with two sample areas.

Metadata

Release files for smrf-dev 0.11.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smrf-dev 0.11.7
File Size Uploaded
smrf-dev-0.11.7.tar.gz 10.1 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for smrf-dev 0.11.7
File
smrf_dev-0.11.7-cp39-cp39-manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details
smrf_dev-0.11.7-cp39-cp39-macosx_10_9_x86_64.whl CPython 3.9 CPython 3.9 macOS 10.9+ x86-64 Details
smrf_dev-0.11.7-cp38-cp38-manylinux2014_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details
smrf_dev-0.11.7-cp38-cp38-macosx_10_9_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.9+ x86-64 Details
smrf_dev-0.11.7-cp37-cp37m-manylinux2014_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 Details
smrf_dev-0.11.7-cp37-cp37m-macosx_10_9_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.9+ x86-64 Details
smrf_dev-0.11.7-cp36-cp36m-manylinux2014_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ x86-64 Details
smrf_dev-0.11.7-cp36-cp36m-macosx_10_9_x86_64.whl CPython 3.6 CPython 3.6 pymalloc macOS 10.9+ x86-64 Details

Total release size: 42.5 MB

Release files / smrf-dev-0.11.7.tar.gz

Download URL smrf-dev-0.11.7.tar.gz
Size 10.1 MB
Tags Source
SHA-256 checksum
How to use checksums
c4028d1dae970f0efa2cf75d01aecc6f0fc0ad6eb595c8c02ab109367f2a1c23
BLAKE2b-256 checksum
How to use checksums
c7c755f692f7e4a0b0c586bb5f0fde8ae0476bff8b8cf80f46f3ae4f64347063
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

Release files / smrf_dev-0.11.7-cp39-cp39-manylinux2014_x86_64.whl

Download URL smrf_dev-0.11.7-cp39-cp39-manylinux2014_x86_64.whl
Size 4.2 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
1231d65985106c5787da8b148e1917a00a53d5a5d894b50a821c5bcd005ce2b3
BLAKE2b-256 checksum
How to use checksums
71cf22a496855f5b64e25418b12acda91dc28f6f1a5608fc4a9179d1612b090b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

Release files / smrf_dev-0.11.7-cp39-cp39-macosx_10_9_x86_64.whl

Download URL smrf_dev-0.11.7-cp39-cp39-macosx_10_9_x86_64.whl
Size 3.9 MB
Tags CPython 3.9 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
4879d8f0ec4df40944a47e6893c8e9621c30faf0b6ae65ff2c265b18ff42be3b
BLAKE2b-256 checksum
How to use checksums
0cc680114cb8cc845974b585f77efb204c7d64c516b4a36a83e5fa180263a918
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

Release files / smrf_dev-0.11.7-cp38-cp38-manylinux2014_x86_64.whl

Download URL smrf_dev-0.11.7-cp38-cp38-manylinux2014_x86_64.whl
Size 4.2 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
56bf6b5aab034250fc2b39fe013ba6425474bb78e34c976ebb8187c30f20be63
BLAKE2b-256 checksum
How to use checksums
5f5c69f2fef4d22d1eab7660d2f657ef0682cb8c81c5bd6d70e307c601c0e65d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

Release files / smrf_dev-0.11.7-cp38-cp38-macosx_10_9_x86_64.whl

Download URL smrf_dev-0.11.7-cp38-cp38-macosx_10_9_x86_64.whl
Size 4.0 MB
Tags CPython 3.8 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
1edf148de125ca2ab0a0d9ec577688566dddd08fe3ea0bb56b9243b3c066a9ea
BLAKE2b-256 checksum
How to use checksums
8dd1346a3f564fd9a7a980fa80d67f1dd7c601893ee257d619482e15d4de823e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

Release files / smrf_dev-0.11.7-cp37-cp37m-manylinux2014_x86_64.whl

Download URL smrf_dev-0.11.7-cp37-cp37m-manylinux2014_x86_64.whl
Size 4.2 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
8802be1194dee60baaf0584ef6b740a1f641f7d3867e09024baa61ac31a42574
BLAKE2b-256 checksum
How to use checksums
6b461179075c58ca8aa9ce5d7084ceaad33c0ec606b4f570943648cdc789ff8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

Release files / smrf_dev-0.11.7-cp37-cp37m-macosx_10_9_x86_64.whl

Download URL smrf_dev-0.11.7-cp37-cp37m-macosx_10_9_x86_64.whl
Size 3.9 MB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
d4e3fc7d917dcf28124ea73177eaa16896d9923d24c6244055e4d22bcb193cb8
BLAKE2b-256 checksum
How to use checksums
11f8f9c27c598f340d8ad4ba08b96234c87365e429febbc8f49e9d96834b337b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

Release files / smrf_dev-0.11.7-cp36-cp36m-manylinux2014_x86_64.whl

Download URL smrf_dev-0.11.7-cp36-cp36m-manylinux2014_x86_64.whl
Size 4.2 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
63794aff21d1e55243c6e8cdcf32bb31cf00b131185938da52f08e1bc4f4c297
BLAKE2b-256 checksum
How to use checksums
a1d1018e750a42a25e633358bc253f3a0b81edb7216d240e862f37166a3da2d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

Release files / smrf_dev-0.11.7-cp36-cp36m-macosx_10_9_x86_64.whl

Download URL smrf_dev-0.11.7-cp36-cp36m-macosx_10_9_x86_64.whl
Size 3.9 MB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
a6dd34c85ff84b8ff03a3ba754f42d5fe81af1ae8662349dc493d5a041cfea8d
BLAKE2b-256 checksum
How to use checksums
ceb248fafaceb0e2c02df13dc09018ee31b31930d696d323aca2e62002a02034
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page