-
Notifications
You must be signed in to change notification settings - Fork 10
How to develop in go‐consequences
Step by Step description of how to estimate the direct and indirect loss using the go-consequences for flooding events using the National Structure Inventory.
Step 1: Download and Install Docker Desktop
- Using the link, download and install the docker desktop on your computer Docker
Step 2: Download and Install Visual Studio Code
- Using the link, download and install the Visual Studio code on your computer Visual Studio Code
Step 3: Download the Go-Consequence code from GitHub
- Download the zip file of the go-consequences repository from GitHub from this link. Go-Consequence Package
- Save in the directory and unzip
Step 4: Open Docker Desktop
- Open the Docker Desktop application Note: You don't need to do anything else with docker. Vscode uses docker to host the container that is defined in go consequences. So it is a dependency; we are leveraging docker in vs code. Docker needs to be running, which it is now.
IMPORTANT NOTE: All operations below are now in Visual Studio Code
Step 5: Install the Remote Development extension
- Click the Extensions tab on the left of VS code and search for "Remote Development."
- Install the package
Step 6: Open a remote window
- Open a remote window using the "greater and lesser" arrow on the bottom left of the screen as shown in Figure below:
- A dialog box opens, and click the "open folder in a container" option
- Navigate to the directory where the go-consequence master file is unzipped from Step 3.
- There will be a prompt to install the Go language support and all tools. Install the tools
- You will see the directory opened on the explorer panel in VS code application.
Step 8: Running a simple test to verify the setup is correct
- Drop your grid in the sub-directory called data
- The grid is the resultant depth raster from the HEC-RAS analysis
- Depth raster should be projected to WGS 84 or EPSG 4326. A state plane projection will not work since National Structure Inventory (NSI) data is in EPSG 4326.
- Go to the compute subdirectory and open the simulation_test.go file from the explorer panel.
- Change line 38 to represent your depth grid file relative path
- The path should be the remote container path (NOT your computer desktop path)
Step 9: Running the code and output results
- Run the script using the Run button
- The following dialog will be shown in the terminal if the program runs correctly.
- The NSI dataset is extracted from the cloud (There is no need to download NSI dataset)
- The output is saved as a geo package (gpkg) file in the data folder with an extension ".gpkg."
Step 10: Reading the results
- Read the results by importing the gpkg file to ArcGIS Pro or ArcMap.
- Load the main.nsi_result under the gpkg. It will show all the NSI datasets on a map.
- Column "depth" is the depth of water by structure
- Structure damage and content damage are the loss by structure – Direct Loss
Step 11: Simulation of Indirect Loss
- Use the function in line 47, "Test_StreamAbstract_FIPS_ECAM"
- Change the file path in line 49 to the depth grid as in Step 8
- Use the correct FIPS code in line 53 (highlighted in yello
- StreamAbstractByFIPS_WithECAM("48201", dfr, nsp, w)
- The reading results are similar to Direct Loss as in Steps 9 and 10.
Note: Ecam is a computable general equilibrium model, which has been shown to estimate losses below a 5% shock poorly. Effectively what ecam does at losses below 5% is optimize the economy because all economies generally are suboptimal. HAZUS is a better option for indirect loss below 5%.