%%bash
# Make a new directory for our baseline simulation
mkdir -p ~/wrf-hydro-training/output/free_lesson_fire/run_fire
# Copy our model files to the simulation directory
cp ~/wrf-hydro-training/wrf_hydro_nwm_public/trunk/NDHMS/Run/*.TBL \
~/wrf-hydro-training/output/free_lesson_fire/run_fire
cp ~/wrf-hydro-training/wrf_hydro_nwm_public/trunk/NDHMS/Run/wrf_hydro.exe \
~/wrf-hydro-training/output/free_lesson_fire/run_fire
# Create symbolic links to large domain files
cp -as $HOME/wrf-hydro-training/example_case/FORCING \
~/wrf-hydro-training/output/free_lesson_fire/run_fire
cp -as $HOME/wrf-hydro-training/example_case/Gridded_no_lakes/RESTART \
~/wrf-hydro-training/output/free_lesson_fire/run_fire
# Copy the domain/parameter files so we can modify them
cp -r $HOME/wrf-hydro-training/example_case/Gridded_no_lakes/DOMAIN \
~/wrf-hydro-training/output/free_lesson_fire/run_fire
# Copy namelist files
cp ~/wrf-hydro-training/example_case/Gridded_no_lakes/namelist.hrldas \
~/wrf-hydro-training/output/free_lesson_fire/run_fire
cp ~/wrf-hydro-training/example_case/Gridded_no_lakes/hydro.namelist \
~/wrf-hydro-training/output/free_lesson_fire/run_fire
Review the land cover types in MPTABLE TBL file:
%%bash
cd ~/wrf-hydro-training/output/free_lesson_fire/run_fire
cat MPTABLE.TBL | head -n 40
Need to modify variables in two files:
%%bash
cd ~/wrf-hydro-training/output/free_lesson_fire/run_fire/DOMAIN
ncap2 -O -s "IVGTYP=IVGTYP*0.0+19" wrfinput_d01.nc wrfinput_d01.nc
ncdump -v IVGTYP wrfinput_d01.nc | tail -n 10
%%bash
cd ~/wrf-hydro-training/output/free_lesson_fire/run_fire/DOMAIN
ncap2 -O -s "LU_INDEX=LU_INDEX*0.0+19" geo_em.d01.nc geo_em.d01.nc
ncdump -v LU_INDEX geo_em.d01.nc | tail -n 10
Run the model:
%%bash
cd ~/wrf-hydro-training/output/free_lesson_fire/run_fire
mpirun -np 2 ./wrf_hydro.exe >> run.log 2>&1
Plot the hydrograph:
# Load the xarray package
%matplotlib inline
import xarray as xr
import matplotlib.pyplot as plt
import pandas as pd
from pandas.plotting import register_matplotlib_converters
register_matplotlib_converters()
chanobs_baseline = xr.open_mfdataset('/home/docker/wrf-hydro-training/output/lesson5/run_gridded_baseline/*CHANOBS*',
combine='by_coords')
chanobs_fire = xr.open_mfdataset('/home/docker/wrf-hydro-training/output/free_lesson_fire/run_fire/*CHANOBS*',
combine='by_coords')
fig, axes = plt.subplots(ncols=1,figsize=(12, 6))
plt.suptitle('Hydrographs for fire simulation',fontsize=24)
chanobs_baseline.sel(feature_id = 2).streamflow.plot(label='Baseline',
color='black',
linestyle='--')
chanobs_fire.sel(feature_id = 2).streamflow.plot(label='Fire',
color='red',
linestyle='-')
plt.ylim(0,70)
plt.legend()
plt.show()
Run ONE of these or the other (NOT both!):
%%bash
cd ~/wrf-hydro-training/output/free_lesson_fire/run_fire/DOMAIN
ncap2 -O -s "OVROUGHRTFAC=OVROUGHRTFAC*0.0+0.1" Fulldom_hires.nc Fulldom_hires.nc
ncdump -v OVROUGHRTFAC Fulldom_hires.nc | tail -n 10
%%bash
cd ~/wrf-hydro-training/output/free_lesson_fire/run_fire/DOMAIN
ncap2 -O -s "OV_ROUGH2D=OV_ROUGH2D*0.0+0.025" hydro2dtbl.nc hydro2dtbl.nc
ncdump -v OV_ROUGH2D hydro2dtbl.nc | tail -n 10
Run the model:
%%bash
cd ~/wrf-hydro-training/output/free_lesson_fire/run_fire
mpirun -np 2 ./wrf_hydro.exe >> run.log 2>&1
Plot the hydrograph:
# Load the xarray package
%matplotlib inline
import xarray as xr
import matplotlib.pyplot as plt
import pandas as pd
from pandas.plotting import register_matplotlib_converters
register_matplotlib_converters()
chanobs_baseline = xr.open_mfdataset('/home/docker/wrf-hydro-training/output/lesson5/run_gridded_baseline/*CHANOBS*',
combine='by_coords')
chanobs_fire = xr.open_mfdataset('/home/docker/wrf-hydro-training/output/free_lesson_fire/run_fire/*CHANOBS*',
combine='by_coords')
fig, axes = plt.subplots(ncols=1,figsize=(12, 6))
plt.suptitle('Hydrographs for fire simulation',fontsize=24)
chanobs_baseline.sel(feature_id = 2).streamflow.plot(label='Baseline',
color='black',
linestyle='--')
chanobs_fire.sel(feature_id = 2).streamflow.plot(label='Fire',
color='red',
linestyle='-')
plt.ylim(0,70)
plt.legend()
plt.show()
%%bash
cd ~/wrf-hydro-training/output/free_lesson_fire/run_fire/DOMAIN
ncap2 -O -s "refkdt=refkdt*0.0+1.0" soil_properties.nc soil_properties.nc
ncdump -v refkdt soil_properties.nc | tail -n 10
Run the model:
%%bash
cd ~/wrf-hydro-training/output/free_lesson_fire/run_fire
mpirun -np 2 ./wrf_hydro.exe >> run.log 2>&1
Plot the hydrograph:
# Load the xarray package
%matplotlib inline
import xarray as xr
import matplotlib.pyplot as plt
import pandas as pd
from pandas.plotting import register_matplotlib_converters
register_matplotlib_converters()
chanobs_baseline = xr.open_mfdataset('/home/docker/wrf-hydro-training/output/lesson5/run_gridded_baseline/*CHANOBS*',
combine='by_coords')
chanobs_fire = xr.open_mfdataset('/home/docker/wrf-hydro-training/output/free_lesson_fire/run_fire/*CHANOBS*',
combine='by_coords')
fig, axes = plt.subplots(ncols=1,figsize=(12, 6))
plt.suptitle('Hydrographs for fire simulation',fontsize=24)
chanobs_baseline.sel(feature_id = 2).streamflow.plot(label='Baseline',
color='black',
linestyle='--')
chanobs_fire.sel(feature_id = 2).streamflow.plot(label='Fire',
color='red',
linestyle='-')
plt.ylim(0,100)
plt.legend()
plt.show()