Skip to main content

Distributed snow modeling for water resources

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smrf-dev-0.11.7.tar.gz (10.1 MB view details)

Uploaded Source

Built Distributions

smrf_dev-0.11.7-cp39-cp39-manylinux2014_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.9

smrf_dev-0.11.7-cp39-cp39-macosx_10_9_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

smrf_dev-0.11.7-cp38-cp38-manylinux2014_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.8

smrf_dev-0.11.7-cp38-cp38-macosx_10_9_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

smrf_dev-0.11.7-cp37-cp37m-manylinux2014_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.7m

smrf_dev-0.11.7-cp37-cp37m-macosx_10_9_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

smrf_dev-0.11.7-cp36-cp36m-manylinux2014_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.6m

smrf_dev-0.11.7-cp36-cp36m-macosx_10_9_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.6m macOS 10.9+ x86-64

File details

Details for the file smrf-dev-0.11.7.tar.gz.

File metadata

  • Download URL: smrf-dev-0.11.7.tar.gz
  • Upload date:
  • Size: 10.1 MB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for smrf-dev-0.11.7.tar.gz
Algorithm Hash digest
SHA256 c4028d1dae970f0efa2cf75d01aecc6f0fc0ad6eb595c8c02ab109367f2a1c23
MD5 1a4fdcf8f665e8d24fbac366f96e3ef9
BLAKE2b-256 c7c755f692f7e4a0b0c586bb5f0fde8ae0476bff8b8cf80f46f3ae4f64347063

See more details on using hashes here.

File details

Details for the file smrf_dev-0.11.7-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

  • Download URL: smrf_dev-0.11.7-cp39-cp39-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 4.2 MB
  • Tags: CPython 3.9
  • Uploaded using 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

File hashes

Hashes for smrf_dev-0.11.7-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1231d65985106c5787da8b148e1917a00a53d5a5d894b50a821c5bcd005ce2b3
MD5 e5de7b6098b999ea98542c9b3a3a8fa3
BLAKE2b-256 71cf22a496855f5b64e25418b12acda91dc28f6f1a5608fc4a9179d1612b090b

See more details on using hashes here.

File details

Details for the file smrf_dev-0.11.7-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: smrf_dev-0.11.7-cp39-cp39-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 3.9 MB
  • Tags: CPython 3.9, macOS 10.9+ x86-64
  • Uploaded using 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

File hashes

Hashes for smrf_dev-0.11.7-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4879d8f0ec4df40944a47e6893c8e9621c30faf0b6ae65ff2c265b18ff42be3b
MD5 a1d3e055eb1cd803731d62c51a7bd94c
BLAKE2b-256 0cc680114cb8cc845974b585f77efb204c7d64c516b4a36a83e5fa180263a918

See more details on using hashes here.

File details

Details for the file smrf_dev-0.11.7-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

  • Download URL: smrf_dev-0.11.7-cp38-cp38-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 4.2 MB
  • Tags: CPython 3.8
  • Uploaded using 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

File hashes

Hashes for smrf_dev-0.11.7-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 56bf6b5aab034250fc2b39fe013ba6425474bb78e34c976ebb8187c30f20be63
MD5 644823c80fc02f17c41a8e76a4e87699
BLAKE2b-256 5f5c69f2fef4d22d1eab7660d2f657ef0682cb8c81c5bd6d70e307c601c0e65d

See more details on using hashes here.

File details

Details for the file smrf_dev-0.11.7-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: smrf_dev-0.11.7-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 4.0 MB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using 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

File hashes

Hashes for smrf_dev-0.11.7-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1edf148de125ca2ab0a0d9ec577688566dddd08fe3ea0bb56b9243b3c066a9ea
MD5 6b59d1b399a84c47549e2d7cc66b2835
BLAKE2b-256 8dd1346a3f564fd9a7a980fa80d67f1dd7c601893ee257d619482e15d4de823e

See more details on using hashes here.

File details

Details for the file smrf_dev-0.11.7-cp37-cp37m-manylinux2014_x86_64.whl.

File metadata

  • Download URL: smrf_dev-0.11.7-cp37-cp37m-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 4.2 MB
  • Tags: CPython 3.7m
  • Uploaded using 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

File hashes

Hashes for smrf_dev-0.11.7-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8802be1194dee60baaf0584ef6b740a1f641f7d3867e09024baa61ac31a42574
MD5 6166e0ca4612d205c4abb074672680e0
BLAKE2b-256 6b461179075c58ca8aa9ce5d7084ceaad33c0ec606b4f570943648cdc789ff8a

See more details on using hashes here.

File details

Details for the file smrf_dev-0.11.7-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: smrf_dev-0.11.7-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 3.9 MB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using 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

File hashes

Hashes for smrf_dev-0.11.7-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d4e3fc7d917dcf28124ea73177eaa16896d9923d24c6244055e4d22bcb193cb8
MD5 300d2bef3e074416572af795c8b01161
BLAKE2b-256 11f8f9c27c598f340d8ad4ba08b96234c87365e429febbc8f49e9d96834b337b

See more details on using hashes here.

File details

Details for the file smrf_dev-0.11.7-cp36-cp36m-manylinux2014_x86_64.whl.

File metadata

  • Download URL: smrf_dev-0.11.7-cp36-cp36m-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 4.2 MB
  • Tags: CPython 3.6m
  • Uploaded using 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

File hashes

Hashes for smrf_dev-0.11.7-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 63794aff21d1e55243c6e8cdcf32bb31cf00b131185938da52f08e1bc4f4c297
MD5 1ad235abe26b9eccfb61f5e3bc50b197
BLAKE2b-256 a1d1018e750a42a25e633358bc253f3a0b81edb7216d240e862f37166a3da2d9

See more details on using hashes here.

File details

Details for the file smrf_dev-0.11.7-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: smrf_dev-0.11.7-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 3.9 MB
  • Tags: CPython 3.6m, macOS 10.9+ x86-64
  • Uploaded using 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

File hashes

Hashes for smrf_dev-0.11.7-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a6dd34c85ff84b8ff03a3ba754f42d5fe81af1ae8662349dc493d5a041cfea8d
MD5 98e6729be3ba7952981660e281ed827f
BLAKE2b-256 ceb248fafaceb0e2c02df13dc09018ee31b31930d696d323aca2e62002a02034

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page