Skip to main content

Distributed snow modeling for water resources

Project description

Spatial Modeling for Resources Framework

Stable version Pypi version DOI DOI Build Status 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
  • MySQL database
  • 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.7rc3.tar.gz (10.1 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded CPython 3.9

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

Uploaded CPython 3.9macOS 10.9+ x86-64

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

Uploaded CPython 3.8

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

Uploaded CPython 3.8macOS 10.9+ x86-64

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

Uploaded CPython 3.7m

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

Uploaded CPython 3.7mmacOS 10.9+ x86-64

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

Uploaded CPython 3.6m

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

Uploaded CPython 3.6mmacOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: smrf-dev-0.11.7rc3.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.4

File hashes

Hashes for smrf-dev-0.11.7rc3.tar.gz
Algorithm Hash digest
SHA256 ba0c26a8a9ee28b062cd40e8fee34964291e2ecab6f5f4f0639b123e9a36bf00
MD5 ad10533ba1139c07484f43a4fefd9e87
BLAKE2b-256 7f2ad5eca7d8c2dc4aeaf6fb5acb280cd8d5593530c6c3014667e879b5511551

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smrf_dev-0.11.7rc3-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.4

File hashes

Hashes for smrf_dev-0.11.7rc3-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f38021e0c68eca1c62d45a0f86659557ada251e5ed7f94e2a3ecf9814f468084
MD5 ee327282d812d2f6195824e20410c567
BLAKE2b-256 b75321862fdc0e5e506129f354552ea74085a91d66bee2bd69139d1189adbb52

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smrf_dev-0.11.7rc3-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.4

File hashes

Hashes for smrf_dev-0.11.7rc3-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 10d0009dc4c1a2982c810df2aac8e58256c239ff19fc0675611bf6eab2faf05a
MD5 5fe7286d6932f2c16e2ce8ba379ad67a
BLAKE2b-256 611493815755df428c6a03f64f6a4156de7e236c94e80e2d03bd04b1bac1db5e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smrf_dev-0.11.7rc3-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.4

File hashes

Hashes for smrf_dev-0.11.7rc3-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d1aabc4552da2767c0433e778bb397f052b13eca4e80571fd23e47842bcda4ff
MD5 075acd3464c4eec2da3295a458c9ad66
BLAKE2b-256 6bbd121042e46c10f1c987292d3b510c9a5181b1f1c8659acdf30b766c64305e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smrf_dev-0.11.7rc3-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 3.9 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.4

File hashes

Hashes for smrf_dev-0.11.7rc3-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f309dff5f2b470ea391c7689080154547cf30ccf557a058efb1210112e7c8ed3
MD5 ce4abef8bed42a5f7f1e9f01b7782117
BLAKE2b-256 0c9b0322d5e5f5dad5a6fd6d830649278364b5287e9ba23721be9d81cb82800c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smrf_dev-0.11.7rc3-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.4

File hashes

Hashes for smrf_dev-0.11.7rc3-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 71dc13dfc86280c8631c2fc1b046ba95e16a7cb016a83615a4eb986e805b1272
MD5 eaf1cb26cf613c90bacff2f80bc1a016
BLAKE2b-256 5a959438d6c819ac42d38f66ce0f274c086b6d5faeabaecd63d22ab8553fcd48

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smrf_dev-0.11.7rc3-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.4

File hashes

Hashes for smrf_dev-0.11.7rc3-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3d98b7a85292f4da9ee494efc472d4c8dcb7976fa06a4581770ae8074abcfb43
MD5 ba143fc4d5b2cf8d68e6d92b45f213c4
BLAKE2b-256 700146a9ce944b7e8bfef9198bd92c9f3564e228ade1c4b41d189abe553d996a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smrf_dev-0.11.7rc3-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.4

File hashes

Hashes for smrf_dev-0.11.7rc3-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 de85338acff36610a253ac16d29504a5bf607b48bfdccf6044d24d15e7c8ccbd
MD5 e755879b6e4e67532092dc117e90665a
BLAKE2b-256 c49a1b9a4a5ffc4c414aa87d3466038a469629200a5f79e90c25e511dd489fb7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smrf_dev-0.11.7rc3-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.4

File hashes

Hashes for smrf_dev-0.11.7rc3-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d79ae9b875996b757207af327dcc12b081deb6de16beed5f75f4ee7732397ee6
MD5 6acee212c33031b5d7e7fd6a47ca1133
BLAKE2b-256 6f36002b32f2857f1abb0068c3a5aca365d2e60abc53cfba34f93ca81952803a

See more details on using hashes here.

Supported by

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