diff --git a/training/Dockerfile b/training/Dockerfile index 5fc2619..2299031 100644 --- a/training/Dockerfile +++ b/training/Dockerfile @@ -10,14 +10,30 @@ USER root RUN rm -r /home/docker/runTimeScripts +################################## +# Geospatial #Get create_wrfinput.r RUN mkdir /home/docker/wrf-hydro-training RUN chmod -R 777 /home/docker/wrf-hydro-training COPY ./create_wrfinput.R /home/docker/wrf-hydro-training/wrf_hydro_model_tools/create_wrfinput.R -#Get the entrypoint script to download the code release, start jupyter, etc -COPY ./entrypoint.sh /. -RUN chmod 777 /entrypoint.sh +#Bring in NLDAS data +RUN wget https://ral.ucar.edu/sites/default/files/public/ESMFregrid_NLDAS.tar_.gz \ + && tar -xf ESMFregrid_NLDAS.tar_.gz \ + && mv NLDAS /home/docker/wrf-hydro-training/regridding \ + && rm ESMFregrid_NLDAS.tar_.gz + +#Get NLDAS forcing for regridding exercise +COPY ./nldas_forcing.tar.gz /home/docker/wrf-hydro-training/regridding/data/nldas_forcing.tar.gz + +# install NCL +RUN wget https://www.earthsystemgrid.org/dataset/ncl.640.dap/file/ncl_ncarg-6.4.0-Debian8.6_64bit_gnu492.tar.gz \ + && mkdir /usr/local/ncl-6.4.0 \ + && tar -xzf ncl_ncarg-6.4.0-Debian8.6_64bit_gnu492.tar.gz -C /usr/local/ncl-6.4.0 \ + && rm ncl_ncarg-6.4.0-Debian8.6_64bit_gnu492.tar.gz + +ENV NCARG_ROOT=/usr/local/ncl-6.4.0 +ENV PATH=$NCARG_ROOT/bin:$PATH ############################ ## Python @@ -49,6 +65,11 @@ RUN wget http://cirrus.ucsd.edu/~pierce/ncdf/ncdf4_1.13.tar.gz \ RUN Rscript -e 'install.packages(c("optparse"), repos="https://cran.rstudio.com")' ############################ +#Get the entrypoint script to download the code release, start jupyter, etc +COPY ./entrypoint.sh /. +RUN chmod 777 /entrypoint.sh + +RUN chmod -R 777 /home/docker/wrf-hydro-training/ USER docker WORKDIR /home/docker diff --git a/training/build.sh b/training/build.sh old mode 100644 new mode 100755 index cbdd678..a41eef1 --- a/training/build.sh +++ b/training/build.sh @@ -1,5 +1,5 @@ -docker build "$@" -t wrfhydro/training:latest . +docker build "$@" -t wrfhydro/training:v5.0.0 . exit $? \ No newline at end of file diff --git a/training/create_wrfinput.R b/training/create_wrfinput.R old mode 100644 new mode 100755 index c194ee2..4b22fb5 --- a/training/create_wrfinput.R +++ b/training/create_wrfinput.R @@ -1,3 +1,5 @@ +#!/usr/bin/env Rscript + ############################################################ # R script to create wrfinput file from geogrid. # Usage: Rscript create_Wrfinput.R @@ -6,7 +8,6 @@ # https://github.com/NCAR/hrldas-release/blob/release/HRLDAS/HRLDAS_forcing/lib/module_geo_em.F # from M. Barlage. ############################################################ -#!/usr/bin/env Rscript library(optparse) library(ncdf4) @@ -15,13 +16,14 @@ option_list = list( help="Path to input geogrid file", metavar="character"), make_option(c("--outfile"), type="character", default="wrfinput_d01.nc", help="output file name [default= %default]", metavar="character"), - make_option(c("--filltyp"), type="integer", default=3, help="Soil type to use as a fill value in case conflicts between soil water and land cover water cells. -If the script encounters a cell that is classified as land in the land use field (LU_INDEX) but is classified as a water soil type, it will replace the soil type with the value you - specify below. Ideally there are not very many of these, so you can simply choose the most - common soil type in your domain. Alternatively, you can set to a bad value (e.g., -8888) - to see how many of these conflicts there are. If you do this DO NOT RUN THE MODEL WITH THESE - BAD VALUES. Instead, fix them manually with a neighbor fill or similar fill algorithm.", - metavar="character"), + make_option(c("--filltyp"), type="integer", default=3, help="Soil type to use as a fill value in case + conflicts between soil water and land cover water cells. If the script encounters a cell + that is classified as land in the land use field (LU_INDEX) but is classified as a water + soil type, it will replace the soil type with the value you specify. Ideally there are + not very many of these, so you can simply choose the most common soil type in your domain. + Alternatively, you can set to a bad value (e.g., -8888) to see how many of these conflicts + there are. If you do this DO NOT RUN THE MODEL WITH THESE BAD VALUES. Instead, fix them + manually with a neighbor fill or similar fill algorithm. [default= %default]", metavar="character"), make_option(c("--laimo"), type="integer", default=8, help="output file name [default= %default]", metavar="character"), make_option(c("--missfloat"), type="numeric", default=(-1.e+36), diff --git a/training/entrypoint.sh b/training/entrypoint.sh index 04fa28d..755931b 100644 --- a/training/entrypoint.sh +++ b/training/entrypoint.sh @@ -33,15 +33,17 @@ rm *testcase*.tar.gz mv /home/docker/example_case /home/docker/wrf-hydro-training/example_case echo "Retrieved the test case for release: $version" -#echo -#echo -e "\e[0;49;32m-----------------------------------\e[0m" -#echo -e "\e[7;49;32mRetrieving WRF-Hydro model tools\e[0m" +echo +echo -e "\e[0;49;32m-----------------------------------\e[0m" +echo -e "\e[7;49;32mRetrieving WRF-Hydro training\e[0m" -#release=$(curl -s https://api.github.com/repos/NCAR/wrf_hydro_model_tools/releases/latest) -#version=$(echo "$release" | grep "tag_name" | cut -d : -f 2,3 | tr -d \") -#version=$(echo $version | tr "," " ") -#git clone --branch $version https://github.com/NCAR/wrf_hydro_model_tools -#mv /home/docker/wrf_hydro_model_tools /home/docker/wrf-hydro-training/wrf_hydro_model_tools +release=$(curl -s https://api.github.com/repos/NCAR/wrf_hydro_model_tools/releases/latest) +version=$(echo "$release" | grep "tag_name" | cut -d : -f 2,3 | tr -d \") +version=$(echo $version | tr "," " ") +#git clone --branch $version https://github.com/NCAR/wrf_hydro_training +git clone https://github.com/NCAR/wrf_hydro_training +mv /home/docker/wrf_hydro_training/lessons /home/docker/wrf-hydro-training/lessons +rm -rf /home/docker/wrf_hydro_training/ echo echo -e "\e[0;49;32m-----------------------------------\e[0m" @@ -51,9 +53,9 @@ echo "Open your browser to the following address to access notebooks" echo -e "\033[33;5;7mlocalhost:8888\033[0m" echo echo -e "The password to login is:" -echo -e "\033[33;5;7mnwmtraining\033[0m" +echo -e "\033[33;5;7mwrfhydrotraining\033[0m" echo -echo "Type ctrl-C then y to shut down container." +echo "Press ctrl-C then type 'y' then press return to shut down container." echo "NOTE ALL WORK WILL BE LOST UNLESS copied out of the container" jupyter notebook --ip 0.0.0.0 --no-browser &> /dev/null diff --git a/training/jupyter_notebook_config.py b/training/jupyter_notebook_config.py index 6b10848..4726058 100644 --- a/training/jupyter_notebook_config.py +++ b/training/jupyter_notebook_config.py @@ -226,7 +226,8 @@ # from notebook.auth import passwd; passwd() # # The string should be of the form type:salt:hashed-password. -c.NotebookApp.password = u'sha1:c4afd8e6cea6:3f096975b1040bd61db881a171834d092b3925df' +c.NotebookApp.password = u'sha1:a06bfa1e94d2:5e84b748cebc4d1f32adaba98699a32f059f83ca' + ## Forces users to use a password for the Notebook server. This is useful in a # multi user environment, for instance when everybody in the LAN can access each