Running wrfhydropy through docker

The first example shows running wrfhydropy from the cheyenne machine. This is similar to being on a linux envionment where model compilation is not a problem.

For developers on laptops and non-linux use cases, the docker used as shown here. The prerequisites are * Docker installed * Local version of wrf_hydro_py repository * Local version of wrf_hydro_nwm_public repository

On the host machine:

docker pull wrfhydro/dev:conda
docker run -it -p 8899:8888 \
    -v /Users/jamesmcc/WRF_Hydro/wrf_hydro_nwm_public:/wrf_hydro_nwm_public \
    -v /Users/jamesmcc/WRF_Hydro/wrf_hydro_py:/wrf_hydro_py \
    wrfhydro/dev:conda

You will need to customize the paths to wrf_hydro_py and wrf_hydro_nwm_public on the host side of the volume mounts. Leaving the docker side of the volume mounts will streamline the code below. Note that we are using different ports on host:docker.

The above command will enter you into the docker image. In docker, first let’s install the mounted wrfhydropy (this install will be lost when docker is exited but the source modifications will remain in the mounted drive - so it’s just annoying to reinstall):

cd /wrf_hydro_py
python setup.py develop

then, to start jupyter lab, execute:

cd doc/examples
jupyter-lab --ip 0.0.0.0 --no-browser --allow-root

This will start the jupyter lab in docker, it will print a URL with a token embedded, like this (dont use this one):

http://(ac61502766bc or 127.0.0.1):8888/?token=a824b4cdb345e944d3754f1d5a97d2aedb4b003b2e76e625

To connect to jupyter lab on the host, transform the above URL to the following:

http://localhost:8899/?token=a824b4cdb345e944d3754f1d5a97d2aedb4b003b2e76e625

(keeping the token the same) and paste it in the browser on your local machine. Note that the port on the local host is not the port indicated by jupyter lab, it’s the one we selected in docker.

Finally, select the wrfhydropy example notebook you want to run!