IslandSkagitTHA_2019

2019 Modeling work for WA EMD, covering parts of Island and Skagit Counties, including La Conner, WA.

Big files

Some of the directories containing big files are not included in the git repository but can be downloaded from the tar file found at http://depts.washington.edu/ptha/IslandSkagitTHA_2019/ and then moved to the appopriate location. These include:

Directory structure

Within Runs there are directories for each fgmax location, and within each of these there are subdirectories for each event: SFL, CSZ_L1, and AK.

Topography files:

The topo/topofiles directory contains topo files and also .kml and .png files that show the areas covered by each.

topo/merge_PS_PT_overlap.py was used to merge parts of Puget Sound (PS) and Port Townsend (PT) DEMs together with an overlap DEM provided by Kelly Carignan at NCEI into a single 1/3" DEM covering the study region:

This DEM is referred to as PTPSm-DEM in the report. A .nc version of this file (netCDF) is used by some of the Python scripts and Jupyter notebooks for plotting purposes. This can be created from the .asc file using the script topo/convert_PTPS_merged_asc2nc.py.

WA_EMD_2018/topo/coarsen_PS_PT_SJdF.py was previously used to coarsen the PS and PT DEM (and also the Strait of Juan de Fuca DEM) from 1/3" to 2" and those topo files were taken from 2018,

Outside of the Strait and Puget Sound, 1 arcsecond etopo1 topography was used. A single etopo1 topofile should have sufficed, but because the Alaska work was done later, two different files were used for different sources:

But a new, smaller version, can instead be used for all runs:

This file was obtained from the NCEI thredds server using the script topo/fetch_etopo1.py.

fgmax points

The study region was first split into a set of polygons defined as Ruled Rectangles.

fgmax points were selected to be all points in the corresponding polygon with DEM elevation lower than 15 m (including all water points in polygon),

The params.py file in each run directory has a pointer to such a file.

wet_masks

Masks are used to specify any points that must be forced to be dry initially even if the topo elevation is below MHW.

Setting up a run

The location directory

A directory for an fgmax location (study region) has a name like SW_Whidbey. This directory contains a subdirectory for each event, such as SFL, and also a subdirectory input_files with the files needed to run the code.

These files must be created by running the script input_files/make_input_files.py. This Python script was generated from the Jupyter notebook make_input_files.ipynb in the location directory, so alternativey you can run the notebook and then move the .data files generated to the input_files subdirectory.

Notes:

The files generated include (e.g., for location SW_Whidbey):

These files are created by the Jupyter notebook make_input_files.ipynb, or by a Python script input_files/make_input_files.py created from this notebook (see below). Several figures (and png files) are also created. These are made in the main directory and then moved to input_files for safe keeping.

The event directory

Within an event directory, such as SW_Whidbey/SFL, there are the following files:

Important parameters to modify for a new loc/event

If copying these files to a new directory to create a different event at this location, the following parameters in params.py are particularly important to modify:

Post processing

Some other parameters in params.py are only used in post-processing, see comments in this file.

After running GeoClaw, the results are in _output by default. This contains time frame results at the times listed in the fort.t* files, and also the fgmax results, in the files:

These files list only the fgmax points, one per line.

The files can be post-processed using:

The .png files created by process_fgmax (if save_figs == True) will be copied into _plots/_other_figures/ so that they will be linked properly from _plots/_PlotIndex.html if you also run make plots to create the time frame plots and index in _plots. You can make plots either before or after process_fgmax is run.

After producing the .nc file and .png files of the figures you might want to move them (and also _plots) into a directory with a name like SW_Whidbey_SFL_results_DATE for safe keeping.

To turn a notebook into a python script

To turn a notebook (e.g. process_fgmax.ipynb) into a python script that can be used to process the data without opening the notebook, do the following:

jupyter nbconvert --to python process_fgmax.ipynb

python process_fgmax.py

For make_input_files.py you can also do this:

`jupyter nbconvert --to python --TagRemovePreprocessor.enabled=True --TagRemovePreprocessor.remove_cell_tags="['hide-py']" make_input_files.ipynb`

This will suppress cells tagged hide-py and remove the cells that make plots, only producing the input files themselves. (Also removes the magic command.)

This will only work if jupyter nbconvert --version shows version >= 5.3.0.

Move the resulting make_input_files.py to input_files if you want to be able to run this script and make the files in place, useful when running on a remote cluster.

To turn a notebook into an html file

To turn a notebook (e.g. process_fgmax.ipynb) into an html file showing for archiving or sharing, do the following:

Note that the --execute flag will cause it to execute the notebook before converting. If the output is already in the notebook or you want to create an html file of the input cells alone, leave this out.

If a cell times out, you can add the argument --ExecutePreprocessor.timeout=-1 for unlimited timeout.

To install and run on a new machine

See the detailed instructions in README_install.txt.

To run on CU cluster

Our production runs were done on the University of Colorado hpc cluster using time provided by CSDMS.

The main code repository was stored on the permanent home directory, but each Makefile also specifies a scratch directory where the output was directed.

Some notes on the workflow there:

Within the repository:

`git pull  # get recent changes`

In location directory:

if input_data does not yet exist submit job to create:

`sbatch ~/make_input_data.sbatch`

In event directory:

modify Makefile to set SCRATCH properly

submit job to run geoclaw:

`sbatch ~/run_geoclaw12.sbatch  # using 12 threads`

If doing a restart, use full path to scratch directory for checkpt file.

In scratch directory:

_plots should now exist with time frame plots. If not, sbatch ~/make_plots.sbatch will only make plots

Copy params.py to SCRATCH directory, and copy location's input_files directory to the parent of the SCRATCH directory.

To make fgmax plots in _plots/_other_figures, and results .nc file:

`sbatch ~/process.sbatch`

Also copy _output/timing.* to _plots/_timing_figures Copy .nc file to _plots if you want to download that too.

Copy fgmax and gauge output out of scratch directory for safe keeping:

`python $WA19P/new_code/copy_output.py`

On laptop:

Use cp_output_cu.sh to copy _plots directory down.

Results to display

Somewhat out of date since webpage was reorganized.

Use Runs/cp_plots.py to copy most results results from each fgmax region to results_plots. Before running this, make sure _plots in each directory has the most recent results (or is a symbolic link to the most recent results).

Update results_plots/index.html if necessary.

Run results_plots/collect_kmlfiles.py to collect all the kml files and required png files from each _plots/_other_figures directory into a single results_plots/kmlfiles directory. Tar and gzip this directory to make kmlfiles.tar.gz and then

`scp kmlfiles.tar.gz ptha@homer.u.washington.edu:public_html/WA_EMD_2019/results/`

Use Runs/all_gauges to collect final gauge results from all runs. Note that this includes all gauges included in the run, even if it is not to be used because a different run has better results for this gauge.

To collect desired gauge plots from appropriate region:

`python results_plots/Gauges/make_gauge_html.py`

This reads the region mapping from info/gauges_regions.csv and the most recent gauge png/csv/nc files from Runs/all_gauges and puts them all in results_plots/Gauges.
It also creates the index results_plots/Gauges/index.html.

`rsync -avz Gauges/ ptha@homer.u.washington.edu:public_html/WA_EMD_2019/results/results_plots/Gauges/`

Tar and gzip results_plots/Gauges to make Gauges.tar.gz and then

`scp Gauges.tar.gz ptha@homer.u.washington.edu:public_html/WA_EMD_2019/results/`