DJS
DJS is an open-source python library for adjusting parameters and completing concurrent WRF-Hydro/National Water Model simulations. It provides tools that simplify model usage and executions that are operable across operating systems. The framework consists of two main pieces:
- Perturbation Engine for scaling and stochastically generating model parameter sets.
- Job Scheduler for spawning and managing concurrent model simulations.
Most users should utilize DJS's click command line interface to access and use the perturbation engine and job scheduler. The CLI takes yaml input files that tell the perturbation engine and job scheduler what files to work on and how to work on them. See the example and docs for greater detail.
Installation
Note, if you just want to vary model parameters, you can skip to package installation.
Docker
Prior to the package installation, first install Docker. Windows and macOS users should install Docker Desktop, Linux users should install Docker Developer Tools.
macOS users with homebrew installed can install Docker as such.
brew cask install docker
Pull the NWM/WRF-Hydro Docker Images
Pull the docker images from docker hub, so DJS can use them to run models. View all available images on Docker Hub.
# For NWM version 2.0
docker pull aaraney/nwm-djs:2.0
# For NWM version 1.2
docker pull aaraney/nwm-djs:1.2
# For WRF-Hydro
docker pull aaraney/wrf-hydro:5.1.1
docker pull aaraney/wrf-hydro:5.1.0
docker pull aaraney/wrf-hydro:5.0.3
Package Installation
DJS requires Python 3.5 or higher and is available using pip. It's recommend to install DJS into a virtual environment or a conda environment as a best practice. Personally, I think conda is a little easier, but admittedly a little more bloated.
To create a virtual environment run the following in terminal
python3 -m venv djs-env
# If on Mac or Linux
source djs-env/bin/activate
# If on Windows
. \djs-env\Scripts\activate
To create an environment using conda do the following in terminal. You can install miniconda here.
conda create --name djs python=3.8
conda activate djs
Install DJS using pip
pip install --upgrade djs
Example case
Files for this example NCAR Pocono, PA test case can be downloaded and extracted for recreation purposes.
In this example, a set of varied model parameter files will be created and used to run NWM version 2.0 simulations.
Create varied parameter files
Let's take a look inside pe_setup.yml before varying the parameters. Documentation on the perturbation engine yaml setup file can be found by running djs perturbation-engine --help or in the docs.
# Perturbation Engine setup yml file
primary/DOMAIN/Route_Link.nc:
- nCC:
scalar: '* 1.3'
output: 'nCC_route_link.nc'
primary/DOMAIN/soil_properties.nc:
- mfsno:
uniform: True
output: 'mfsno_soil_properties.nc'
primary/DOMAIN/Fulldom_hires.nc:
- OVROUGHRTFAC:
scalar: '- 0.2'
output: 'OVROUGHRTFAC_fulldom_hires.nc'
- multi_group:
output: 'RETDEPRTFAC_OVROUGHRTFAC_fulldom_hires.nc'
OVROUGHRTFAC:
norm: False
scalar: '- 0.3'
RETDEPRTFAC:
scalar: '- 0.05'
For those following along navigate to the location you extracted the pocono_test_case.zip using the terminal/command prompt.
Create a varied parameter set is as simple as running:
djs perturbation-engine pe_setup.yml
Varied parameter files should now exist in the pocono_test_case directory.
Run NWM Simulations
First, ensure that Docker is running. Next, let's take a peak at the Job Scheduler setup files. Documentation on the perturbation engine yaml setup file can be found by running djs job-scheduler --help or in the docs.
# Job Scheduler setup yml file
primary: 'primary'
alternative-files:
-
- 'nCC_route_link.nc'
- 'mfsno_soil_properties.nc'
- 'OVROUGHRTFAC_fulldom_hires.nc'
- 'RETDEPRTFAC_OVROUGHRTFAC_fulldom_hires.nc'
image: 'aaraney/nwm-djs:2.0'
max-jobs: 2
cpus: '0-2'
mpi-np: 2
To start the simulations run:
djs job-scheduler js_setup.yml
Notice above that 'nCC_route_link.nc' and 'mfsno_soil_properties.nc' are nested within a list, this tells the job scheduler to use both files within the same simulation. Whereas the other files will have their own simulations.
New directories starting with the prefix rep- should appear in the pocono_test_case directory. These directories hold each of the model simulations.
Contributors: Austin Raney, Iman Maghami, Yenchia Feng
Metadata
Release files for djs 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| djs-1.0.0.tar.gz | 19.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| djs-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.6 kB
Release files / djs-1.0.0.tar.gz
| Download URL | djs-1.0.0.tar.gz |
|---|---|
| Size | 19.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
76c4b404824794a12b2fcf127c01fd15343b9b374fcf8e718ea69844d873ff6f
|
|
BLAKE2b-256 checksum How to use checksums |
d79a36fea7f23e3a52b3bae84cd807dc263c81dae20992cbda8fb47a7501775f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5
|
Release files / djs-1.0.0-py3-none-any.whl
| Download URL | djs-1.0.0-py3-none-any.whl |
|---|---|
| Size | 22.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b7da2f6a653f245c6bc5869b7ef2074024b6995c609d8a2357e2134069495e8c
|
|
BLAKE2b-256 checksum How to use checksums |
312267ea4ba8df597120373e8f5acc1a206cddaab6ae4fc6e831228aed89667d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5
|
Security for djs 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.