Skip to content

Commit

Permalink
fixing complete git mangle with large file addition
Browse files Browse the repository at this point in the history
  • Loading branch information
jmills-ncar committed Jun 7, 2018
1 parent 8591006 commit 9179ac2
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 27 deletions.
12 changes: 10 additions & 2 deletions training/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,20 @@ 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

#Bring in NLDAS data
#get regridding scripts
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
#COPY ./nldas_forcing.tar.gz /home/docker/wrf-hydro-training/regridding/data/nldas_forcing.tar.gz

COPY ./gdrive_download.py gdrive_download.py
RUN chmod 777 gdrive_download.py


RUN python gdrive_download.py --file_id 1PrDTA-hMFNqQrDag1Dm7tX1rT1gQ_25e --dest_file /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 \
Expand Down Expand Up @@ -74,5 +80,7 @@ RUN chmod -R 777 /home/docker/wrf-hydro-training/
USER docker
WORKDIR /home/docker

#Make a temp directory needed for matplotlib

ENTRYPOINT ["/entrypoint.sh"]
CMD ["interactive"]
27 changes: 23 additions & 4 deletions wps/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ RUN chmod -R 777 /home/docker/WRF_WPS

############################
## Python
WORKDIR /

#Fetch latest miniconda and install
RUN wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh \
&& bash Miniconda3-latest-Linux-x86_64.sh -b -p /home/docker/miniconda3 \
Expand All @@ -69,6 +71,7 @@ RUN pip install wrf-python Image

############################
# Setup stuff for geogrid script
COPY ./namelist.wps_orig /home/docker/WRF_WPS/utilities/namelist.wps_orig

RUN mkdir -p /home/docker/WRF_WPS/WPS/utilities/ \
&& mv /home/docker/WRF_WPS/WPS/namelist.wps \
Expand All @@ -77,10 +80,22 @@ RUN mkdir -p /home/docker/WRF_WPS/WPS/utilities/ \
COPY make_geogrid.py /home/docker/WRF_WPS/utilities/make_geogrid.py
COPY wrf_hydro_namelist.wps /home/docker/WRF_WPS/utilities/

COPY geog_conus.tar.gz .
RUN tar -xf geog_conus.tar.gz && \
mv geog_conus /home/docker/WRF_WPS/utilities/geog_conus && \
rm geog_conus.tar.gz
# Get geog data from google drive
## Get download script
COPY gdrive_download.py /gdrive_download.py
RUN chmod 777 /gdrive_download.py

RUN python gdrive_download.py --file_id 1EICBJ8-pRpkox27Bnq3mrBAqyZQsV662 --dest_file geog_conus.tar.gz \
&& tar -xf geog_conus.tar.gz \
&& mv geog_conus /home/docker/WRF_WPS/utilities/geog_conus \
&& rm geog_conus.tar.gz

RUN chmod -R 777 /home/docker/WRF_WPS/utilities/geog_conus

#COPY geog_conus.tar.gz .
#RUN tar -xf geog_conus.tar.gz && \
# mv geog_conus /home/docker/WRF_WPS/utilities/geog_conus && \
# rm geog_conus.tar.gz

RUN mv /home/docker/WRF_WPS/utilities/geog_conus/GEOGRID.TBL.ARW.wrf_hydro_training \
/home/docker/WRF_WPS/WPS/geogrid/GEOGRID.TBL.ARW
Expand All @@ -90,6 +105,10 @@ RUN mv /home/docker/WRF_WPS/utilities/geog_conus/GEOGRID.TBL.ARW.wrf_hydro_train
####################################
USER docker
WORKDIR /home/docker

RUN mkdir /home/docker/tmp/ \
&& chmod 777 -R /home/docker/tmp/

#ENV NETCDF=/usr/local

ENTRYPOINT ["python", "/home/docker/WRF_WPS/utilities/make_geogrid.py"]
3 changes: 1 addition & 2 deletions wps/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash

docker build "$@" -t wrfhydro/wps .
docker build "$@" --no-cache -t wrfhydro/wps .

exit $?
42 changes: 42 additions & 0 deletions wps/make_geogrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,21 @@
import shutil
import os
import time
<<<<<<< HEAD
=======
import matplotlib.pyplot as plt
>>>>>>> c407c2cdd5c461832ff07b5e679470f4ceae81f0
import cartopy.io.img_tiles as cimgt
from wrf import (projection, latlonutils)
import math

<<<<<<< HEAD
#Setup matlob lib to not use any xwindows backend
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
=======
>>>>>>> c407c2cdd5c461832ff07b5e679470f4ceae81f0
# Functions
def build_projparams(ref_lat=0.0, ref_lon=0.0, dx=1000.0, dy=1000.0,
map_proj='lambert', truelat1=0.0, truelat2=0.0,
Expand Down Expand Up @@ -249,11 +259,19 @@ def main():
default='false',
help="Only create a plot of the domain. Geogrid will not be created if "
"plot_only = true, only a plot of the domain will be created.")
<<<<<<< HEAD
#parser.add_argument("--display",
# dest="display",
# default='false',
# help="Display the image in python. Warning may cause issues in a terminal"
# "session.")
=======
parser.add_argument("--display",
dest="display",
default='false',
help="Display the image in python. Warning may cause issues in a terminal"
"session.")
>>>>>>> c407c2cdd5c461832ff07b5e679470f4ceae81f0

# parser.add_argument("--orig_nml_path",
# dest="new_nml_path",
Expand All @@ -269,13 +287,24 @@ def main():
args = parser.parse_args()

patch_nml_path = pathlib.Path(args.namelist_path)
<<<<<<< HEAD
output_dir = args.output_dir
plot_only = args.plot_only
#display = args.display
display = 'false'

# orig_nml_path = args.orig_nml_path
# new_nml_path = args.new_nml_path
orig_nml_path = pathlib.Path('/home/docker/WRF_WPS/utilities/namelist.wps_orig')
=======
output_dir = pathlib.Path(args.output_dir)
plot_only = args.plot_only
display = args.display

# orig_nml_path = args.orig_nml_path
# new_nml_path = args.new_nml_path
orig_nml_path = pathlib.Path('/home/docker/WRF_WPS/WPS/namelist.wps_orig')
>>>>>>> c407c2cdd5c461832ff07b5e679470f4ceae81f0
new_nml_path = pathlib.Path('/home/docker/WRF_WPS/WPS/namelist.wps')

if display.lower() == 'true':
Expand All @@ -285,12 +314,20 @@ def main():

if plot_only.lower() == 'true':
plot_from_wps(patch_nml_path=str(patch_nml_path),
<<<<<<< HEAD
figFilename=output_dir + '/domain.png',
=======
figFilename=str(output_dir) + '/domain.png',
>>>>>>> c407c2cdd5c461832ff07b5e679470f4ceae81f0
display=display)
else:
print('Plotting domain')
plot_from_wps(patch_nml_path=str(patch_nml_path),
<<<<<<< HEAD
figFilename=output_dir + '/domain.png',
=======
figFilename=str(output_dir) + '/domain.png',
>>>>>>> c407c2cdd5c461832ff07b5e679470f4ceae81f0
display=display)

print('Generating geogrid file')
Expand All @@ -304,8 +341,13 @@ def main():
subprocess.run(['./geogrid.exe'],
cwd=new_nml_path.parent)

<<<<<<< HEAD
shutil.copy(str(new_nml_path.parent / 'geo_em.d01.nc'),
output_dir + '/geo_em.d01.nc')
=======
shutil.move(str(new_nml_path.parent / 'geo_em.d01.nc'),
str(pathlib.Path(output_dir) / 'geo_em.d01.nc'))
>>>>>>> c407c2cdd5c461832ff07b5e679470f4ceae81f0


if __name__ == '__main__':
Expand Down
20 changes: 1 addition & 19 deletions wps/wrf_hydro_namelist.wps
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
&share

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Specify the number of domains
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

max_dom = 1,

/

&geogrid

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Expand Down Expand Up @@ -39,13 +29,5 @@
map_proj = 'lambert',
truelat1 = 30.0,
truelat2 = 60.0,
stand_lon = -97.00,

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Define the data sources and data path
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

geog_data_res = 'default',
geog_data_path = '/home/docker/WRF_WPS/utilities/geog_conus'

stand_lon = -97.00
/

0 comments on commit 9179ac2

Please sign in to comment.