Add a conversion tool to produce NRML files from a set of .csv + .mdata files
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Natural hazards' Risk Markup Language (NRML) |
Fix Committed
|
High
|
Michele Simionato |
Bug Description
Editing XML files directly is a pain. The plan is to develop some desktop tools to generate the files needed for the engine starting from pre-existing .CSV files. This is possible if the user supplements the .CSV file with a .mdata file containing the additional info needed to generate the NRML file.
For instance, an exposure CSV file for population could be the following:
$ cat exposure_pop.csv
id,taxonomy,
asset_01,
asset_02,
If we supplement it with the following file
$ cat exposure_pop.mdata
<?xml version="1.0" encoding="utf-8"?>
<exposureModel
category=
id="my_
taxonomySource=
>
<description>
Sample population
</description>
<assets />
</exposureModel>
it is possible to generate a NRML files where the node <assets> is filled with the data from the CSV. The mechanism must work iteratively (i.e. do not keep the entire tree in memory). Moreover, it must be able to collect groups of CSV files. This is needed for vulnerability and fragility models, where there is a .CSV file for each set of functions, and all the sets belong to the same model. A simple idea is to use a common prefix. For instance the two pairs
vulnerability
vulnerability
vulnerability
vulnerability
can describe two vulnerability sets belonging to the same vulnerability model. The tool must be able to convert the four files into a single file named vulnerability-
Changed in oq-nrmllib: | |
assignee: | nobody → Michele Simionato (michele-simionato) |
importance: | Undecided → High |
status: | New → In Progress |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
Changed in oq-nrmllib: | |
status: | In Progress → Fix Committed |
https:/ /github. com/gem/ oq-nrmllib/ pull/110