Skip to content

Commit 9ae72a0

Browse files
authored
edits to user guide to include scaling_factor and aggregate (#74)
1 parent ebb37e7 commit 9ae72a0

File tree

1 file changed

+76
-38
lines changed

1 file changed

+76
-38
lines changed

docs/user_guide.rst

+76-38
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Follow the install notes in the README.md file.
3434
A configuration file can be used to define a HazImp simulation. The
3535
configuration file is described using yaml, a data serialisation
3636
format. HazImp can also be used by another Python application, by
37-
passing the configuration infomation in as a dictionary.
37+
passing the configuration information in as a dictionary.
3838

3939
For example, to run a wind example do::
4040

@@ -50,7 +50,7 @@ HazImp can also be ran in parallel, using mpirun. For example::
5050
5151

5252
There are a suite of HazImp tests to test the install and code during
53-
software developemnt. To run these, in the root HazImp directory
53+
software developement. To run these, in the root HazImp directory
5454
do;::
5555

5656
./all_tests
@@ -110,13 +110,15 @@ The first line is a comment, so this is ignored.
110110
The rest of the file can be understood by the following key value pairs;
111111

112112
*template*
113-
The type of :ref:`template` to use. This example describes the *wind_nc* template.
113+
The type of template to use. This example describes the *wind_nc* template.
114+
See `docs/templates.rst`
114115

115116
*vulnerability*
116117
This loads the vulnerability models for calculating the level of damage.
117118

118119
*filename*
119-
The name of the vulnerability model file to load
120+
The name of the vulnerability model file to load. This is an xml
121+
file produced using `hazimp_preprocessing/curve_data/create_vuln_xml.py`
120122

121123
*vulnerability_set*
122124
A vulnerability file may contain multiple sets (the
@@ -154,13 +156,13 @@ called ``WIND_VULNERABILITY_FUNCTION_ID`` which describe the vulnerability
154156
functions to be used. It must also have a column called "WIND_VULNERABILITY_SET"
155157
which describes the vulnerability set to use (see below for more details).
156158

157-
*load_wind*
158-
This loads the hazard data. It can have up to three subsections;
159+
*hazard_raster*
160+
This loads the hazard data.
159161

160162
*file_list*
161163
A list of raster wind hazard files (one or more). The file format can be
162164
ascii grid, geotiff or netcdf (or potentially any raster format
163-
recognised by GDAL, but these are all that have ben tested to date).
165+
recognised by GDAL, but these are all that have been tested to date).
164166

165167
*file_format*
166168
This specifies the data format - specifically used for netcdf, where the
@@ -170,43 +172,34 @@ which describes the vulnerability set to use (see below for more details).
170172
For use when the file format is 'nc'. This specifies the name of the
171173
variable in the netcdf file that contains the hazard data.
172174

173-
The values in the file must represent
174-
``0.2s gust at 10m height m/s``, since that is the axis of the HazImp wind
175-
vulnerability curves.
176-
177-
*vulnerability*
178-
*filename*
179-
The path to a correctly formatted vulnerability curve file. This is an xml
180-
file produced using `hazimp_preprocessing/curve_data/create_vuln_xml.py`
181-
182-
*vulnerability_set*
183-
This defines the suite of vulnerability curves to use. A vulnerability file
184-
may contain a large number of different vulnerability functions that can be
185-
applied to the same exposure assets. This option defines which set to use
186-
from that vulnearbility file. The vulnerability set is used to calculate the
187-
``structural_loss_ratio`` given the ``0.2s gust at 10m height m/s``.
188-
189-
*vulnerability_method*
190-
Whether to use the mean loss ratio ("mean") or to vary around the mean with
191-
standard normal distribution ("normal"), based on the mean value plus a
192-
coefficient of variation (CoV). CoV values must be included in the vulnerability
193-
curve file, in the form of alpha and beta values (sample mean and standard deviation)
175+
*scaling_factor*
176+
For use when the hazard units do not match the units of the vulnerability
177+
function. e.g. hazard units are in cm, vulnerability function is in m
178+
scaling factor is 0.01.
194179

180+
*exposure_permutation*
181+
*groupby*
182+
The exposure attribute that will be used to conduct the permutation
183+
within. It is strongly recommended to use the same attribute as
184+
used for aggregation.
185+
186+
*iterations*
187+
The number of iterations of the permutation conducted.
195188

196189
*calc_struct_loss*
197-
This will multiply the replacement value and the ``structural``
190+
This will multiply the replacement value by the ``structural`` value
198191
to get the ``structural_loss``.
199192

200193
*replacement_value_label*
201194
The title of the exposure data column that has the replacement values.
202195

203196
*save*
204-
The file where the results will be saved. All the results to calculate the
197+
The file where the unit level results will be saved. All the results to calculate the
205198
damage due to the wind hazard are saved to file. The above example saves to
206199
a csv file, since the file name ends in *.csv*. This has the disadvantage
207200
of averaging data from multiple wind hazards. The information can also be
208201
saved as numpy arrays. This can be done by using the *.npz* extension.
209-
This data can be accessed using Python scripts and is not averaged.
202+
These data can be accessed using Python scripts and are not averaged.
210203

211204
Output
212205
~~~~~~
@@ -231,9 +224,9 @@ value of the asset. This will appear in the output file under the attribute
231224
Aggregation
232225
~~~~~~~~~~~
233226

234-
*aggregation*
235-
This determines the way HazImp will aggregate results
236-
227+
*aggregation*
228+
This determines the way HazImp will aggregate the results (table output)
229+
237230
*groupby*
238231
The exposure attribute that will be used to aggregate
239232
results. It is strongly recommended to use the same attribute as
@@ -251,21 +244,66 @@ Aggregation
251244
structural_loss: [mean, sum]
252245
REPLACEMENT_VALUE: [mean, sum]
253246

254-
255247
*save_agg*
256248
The file where the aggregated results will be saved. This will save data to
257249
a csv-format file::
258250

259251
- save_agg: olwyn_agg.csv
260252

261-
This option has only been implemented in the ``wind_nc`` and ``wind_v5``
262-
templates at this time (June 2020).
253+
*categorise*
254+
Categorisation of the structural loss ratio to damage state
255+
See `docs/categorise.rst` for examples
256+
257+
*field_name*
258+
The name of the created categorical field
259+
260+
*bins*
261+
Monotonically increasing array of bin edges, including the rightmost
262+
edge, allowing for non-uniform bin widths. There must be
263+
(number of labels) + 1 values, and range from 0.0 to 1.0.
264+
265+
*labels*
266+
Specifies the labels for the bins
267+
268+
*aggregate*
269+
This determines the way HazImp will aggregate results (spatial output)
270+
271+
*boundaries*
272+
Name of geospatial dataset that contains geographical boundaries
273+
to use for aggregation. file format options *.shp*, *.json*, *.geojson*, *.gpkg*
274+
275+
*boundarycode*
276+
Field name in the boundaries geospatial dataset
277+
278+
*impactcode*
279+
field name in the dataframe to aggregate
280+
281+
*filename*
282+
destination file name for the aggregated spatial output
283+
file format options *.shp*, *.json*, *.geojson*, *.gpkg*
284+
285+
*categories*
286+
Boolean option (True or False) to add columns for the number of buildings
287+
in each damage state defined in the 'Damage state' attribute. This
288+
requires that a 'categorise` job has been included in the pipeline,
289+
which in turn requires the bins and labels to be defined in the job
290+
configuration file.
291+
292+
*fields*
293+
A dictionary with column names from the dataframe with lists of
294+
aggregation functions to apply to the columns
295+
For example:
296+
297+
- Fields:
298+
structural: [mean]
299+
structural_upper: [mean]
300+
'Damage state': [size]
263301

264302

265303
Flood Template - Structural Damage
266304
----------------------------------
267305

268-
The structural damage flood template is very similar to the the wind template.
306+
The structural damage flood template is very similar to the wind template.
269307
This is an example structural damage flood template;::
270308

271309
# python ../../hazimp/hazimp.py -c list_flood_v2.yaml

0 commit comments

Comments
 (0)