Post-Fire Simulation

Create a run directory

In [1]:
%%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

Modify land cover type

Review the land cover types in MPTABLE TBL file:

In [2]:
%%bash
cd ~/wrf-hydro-training/output/free_lesson_fire/run_fire
cat MPTABLE.TBL | head -n 40
&noahmp_usgs_veg_categories
 VEG_DATASET_DESCRIPTION = "USGS"
 NVEG = 27
/
&noahmp_usgs_parameters
 ! NVEG = 27
 !  1: Urban and Built-Up Land
 !  2: Dryland Cropland and Pasture
 !  3: Irrigated Cropland and Pasture
 !  4: Mixed Dryland/Irrigated Cropland and Pasture
 !  5: Cropland/Grassland Mosaic
 !  6: Cropland/Woodland Mosaic
 !  7: Grassland
 !  8: Shrubland
 !  9: Mixed Shrubland/Grassland
 ! 10: Savanna
 ! 11: Deciduous Broadleaf Forest
 ! 12: Deciduous Needleleaf Forest
 ! 13: Evergreen Broadleaf Forest
 ! 14: Evergreen Needleleaf Forest
 ! 15: Mixed Forest
 ! 16: Water Bodies
 ! 17: Herbaceous Wetland
 ! 18: Wooded Wetland
 ! 19: Barren or Sparsely Vegetated
 ! 20: Herbaceous Tundra
 ! 21: Wooded Tundra
 ! 22: Mixed Tundra
 ! 23: Bare Ground Tundra
 ! 24: Snow or Ice
 ! 25: Playa
 ! 26: Lava
 ! 27: White Sand

 ISURBAN   = 1
 ISWATER   = 16
 ISBARREN  = 19
 ISICE     = 24
 EBLFOREST = 13

Need to modify variables in two files:

In [3]:
%%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
  19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
  19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
  19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
  19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
  19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
  19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
  19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
  19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
  19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19 ;
}
In [4]:
%%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
  19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
  19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
  19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
  19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
  19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
  19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
  19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
  19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
  19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19 ;
}

Run the model:

In [5]:
%%bash
cd ~/wrf-hydro-training/output/free_lesson_fire/run_fire
mpirun -np 2 ./wrf_hydro.exe >> run.log 2>&1

Plot the hydrograph:

In [6]:
# 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()

Modify overland roughness parameter

Run ONE of these or the other (NOT both!):

In [7]:
%%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
    0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 
    0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 
    0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 
    0.1, 0.1, 0.1,
  0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 
    0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 
    0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 
    0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 
    0.1, 0.1, 0.1 ;
}
In [ ]:
%%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:

In [8]:
%%bash
cd ~/wrf-hydro-training/output/free_lesson_fire/run_fire
mpirun -np 2 ./wrf_hydro.exe >> run.log 2>&1

Plot the hydrograph:

In [9]:
# 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()

Modify infiltration parameter

In [10]:
%%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
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ;
}

Run the model:

In [11]:
%%bash
cd ~/wrf-hydro-training/output/free_lesson_fire/run_fire
mpirun -np 2 ./wrf_hydro.exe >> run.log 2>&1

Plot the hydrograph:

In [12]:
# 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()
In [ ]: