Skip to main content

Distributed snow modeling for water resources

Project description

Spatial Modeling for Resources Framework

GitHub version DOI DOI Docker Build Status Docker Automated build Build Status Coverage Status

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.

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
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>

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.3.tar.gz (9.9 MB view hashes)

Uploaded Source

Built Distributions

smrf_dev-0.11.3-cp38-cp38-manylinux2014_x86_64.whl (4.1 MB view hashes)

Uploaded CPython 3.8

smrf_dev-0.11.3-cp38-cp38-macosx_10_9_x86_64.whl (4.0 MB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

smrf_dev-0.11.3-cp37-cp37m-manylinux2014_x86_64.whl (4.1 MB view hashes)

Uploaded CPython 3.7m

smrf_dev-0.11.3-cp37-cp37m-macosx_10_9_x86_64.whl (4.0 MB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

smrf_dev-0.11.3-cp36-cp36m-manylinux2014_x86_64.whl (4.1 MB view hashes)

Uploaded CPython 3.6m

smrf_dev-0.11.3-cp36-cp36m-macosx_10_9_x86_64.whl (4.0 MB view hashes)

Uploaded CPython 3.6m macOS 10.9+ x86-64

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