Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multi fault rupture format #6715

Closed
mmpagani opened this issue Apr 23, 2021 · 11 comments
Closed

multi fault rupture format #6715

mmpagani opened this issue Apr 23, 2021 · 11 comments
Assignees
Milestone

Comments

@mmpagani
Copy link
Member

mmpagani commented Apr 23, 2021

This is needed to better support models produced by GI or SHERIFS. In order to move forward we need to define a format for the input. What I suggest at the moment, is to define this source typology using two files. In one file that we could call fault_sections.xml we store the geometry of the fault sections with their ID.

For example:

<?xml version='1.0' encoding='utf-8'?>
<nrml xmlns:gml="http://www.opengis.net/gml"
    xmlns="http://openquake.org/xmlns/nrml/0.5">
    <faultSections name="Dummy" id="fs1">
        <section name="Dummy Section" id="s1">
			<kiteSurface>
			<profile>
				<gml:LineString><gml:posList>
					10.0 45.0 0.0 10.0 45.5 10.0
				</gml:posList></gml:LineString>
			</profile>
			<profile>
				<gml:LineString><gml:posList>
					10.5 45.0 0.0 10.5 45.5 10.0
				</gml:posList></gml:LineString>
			</profile>
			</kiteSurface>
        </section>
    </faultSections>
</nrml>

The corresponding source model should look like this:

<?xml version='1.0' encoding='utf-8'?>
<nrml xmlns:gml="http://www.opengis.net/gml"
    xmlns="http://openquake.org/xmlns/nrml/0.5">

  	<sourceModel name="Hazard Model" investigation_time="1.0">
		<sourceGroup name="group 1" rup_interdep="indep"
            src_interdep="indep" tectonicRegion="Active Shallow Crust">
                <multiFaultSource id="1" name="Test1" tectonicRegion="Active Shallow Crust" 
                        faultSectionFname="./sections_kite.xml">
			        <multiPlanesRupture probs_occur="0.93144767 0.06855233">
			            <magnitude>4.7</magnitude>
			            <sectionIndexes indexes="s1"/>
			            <hypocenter depth="5.0" lat="45.0" lon="10.0"/>
			            <rake>90</rake>
			        </multiPlanesRupture>
			        <multiPlanesRupture probs_occur="0.93144767 0.06855233">
			            <magnitude>6.0</magnitude>
			            <sectionIndexes indexes="s1,s2"/>
			            <rake>-90</rake>
			        </multiPlanesRupture>
		    </multiFaultSource>
	       </sourceGroup>
    </sourceModel>
</nrml>
@tomchartier
Copy link
Contributor

Concerning SHERIFS, this would work fine and simplify significantly the source model file which contains very redundant information at the moment.

@micheles
Copy link
Contributor

micheles commented May 11, 2021

Adding a new source typology is hard and tricky. Several changes are needed. Let me document here the steps:

  1. add a new source class in hazardlib/source (plus test)
  2. add an XML reader in sourceconverter.py (plus test)
  3. add an XML writer in sourcewriter.py (plus test)
  4. add a new source code (like code=b'F') and make sure ruptures can be read (i.e. add a scenario from ruptures test)
  5. add a test that ruptures can be exported
  6. add a test for oq zip in commands_test
  7. add both classical and event based tests
  8. add tests of conversion source -> csv, geopackage
  9. add a test for QGIS rupture extraction (i.e. get_surface_boundaries_3d must return a valid polygon)
  10. add an __iter__ method so that the source is splittable, and also make split_by_mag works
  11. make sure src.get_mags works

The best approach is to add the source class plus the input and output files of the classical test and leave all the rest to @micheles !

@micheles
Copy link
Contributor

micheles commented May 11, 2021

I would prefer to keep everything in a single file, i.e.

<?xml version='1.0' encoding='utf-8'?>
<nrml xmlns:gml="http://www.opengis.net/gml"
      xmlns="http://openquake.org/xmlns/nrml/0.5">
  <sourceModel name="Hazard Model" investigation_time="1.0">
    <sourceGroup name="group 1" rup_interdep="indep"
                 src_interdep="indep" tectonicRegion="Active Shallow Crust">
      <multiFaultSource id="1" name="Test1">
        <faultSections>
          <section>
	    <kiteSurface>
	      <profile>
		<gml:LineString><gml:posList>
		  10.0 45.0 0.0 10.0 45.5 10.0
		</gml:posList></gml:LineString>
	      </profile>
	      <profile>
		<gml:LineString><gml:posList>
		  10.5 45.0 0.0 10.5 45.5 10.0
		</gml:posList></gml:LineString>
	      </profile>
	    </kiteSurface>
          </section>
        </faultSections>
	<multiPlanesRupture probs_occur="0.93144767 0.06855233">
	  <magnitude>4.7</magnitude>
	  <sectionIndexes indexes="s1"/>
	  <hypocenter depth="5.0" lat="45.0" lon="10.0"/>
	  <rake>90</rake>
	</multiPlanesRupture>
	<multiPlanesRupture probs_occur="0.93144767 0.06855233">
	  <magnitude>6.0</magnitude>
	  <sectionIndexes indexes="s1,s2"/>
	  <rake>-90</rake>
	</multiPlanesRupture>
      </multiFaultSource>
    </sourceGroup>
  </sourceModel>
</nrml>

@mmpagani
Copy link
Member Author

mmpagani commented May 11, 2021

mmm, why not defining two files one with ruptures <NAME>.xml and one with sections that must follow this syntax <NAME>_sections.xml ?

@micheles
Copy link
Contributor

micheles commented May 11, 2021

That would work for me too. The tricky thing is that different files are read by different cores, so the core reading the ruptures will not have knowledge about the sections :-(

@tomchartier
Copy link
Contributor

I like the option of having the sections geometry in a different file. This way, the same file can be use for different sources models (for example, exploring different hypotheses for the multifault ruptures)

@mmpagani
Copy link
Member Author

That would work for me too. The tricky thing is that different files are read by different cores, so the core reading the ruptures will not have knowledge about the sections :-(

I do not think this is a problem since we check the consistency between sections and ruptures only when we instantiate the multi fault source.

@mmpagani
Copy link
Member Author

mmpagani commented May 11, 2021

I like the option of having the sections geometry in a different file. This way, the same file can be use for different sources models (for example, exploring different hypotheses for the multifault ruptures)

I see your point Thomas. In this case my solution doesn't work and we need something different.

@micheles
Copy link
Contributor

That would work for me too. The tricky thing is that different files are read by different cores, so the core reading the ruptures will not have knowledge about the sections :-(

I do not think this is a problem since we check the consistency between sections and ruptures only when we instantiate the multi fault source.

Unfortunately the sources are instantiated too early and we will have to change that. What Thomas wants can be done but requires a bit of work.

@micheles
Copy link
Contributor

micheles commented May 12, 2021

After sleeping on it, it turns we need a new concept, a geometryModel like this:

<nrml xmlns:gml="http://www.opengis.net/gml"
      xmlns="http://openquake.org/xmlns/nrml/0.5">
  <geometryModel name="fault_sections">
    <section name="central" id="s1">
      <kiteSurface>
	<profile>
	  <gml:LineString><gml:posList>
	    10.5 45.0 0.0 10.5 45.5 10.0
	  </gml:posList></gml:LineString>
	</profile>
	<profile>
	  <gml:LineString><gml:posList>
	    10.0 45.0 0.0 10.0 45.5 10.0
	  </gml:posList></gml:LineString>
	</profile>
      </kiteSurface>
    </section>
    <section name="west" id="s2">
      <kiteSurface>
	<profile>
	  <gml:LineString><gml:posList>
	    10.0 45.0 0.0 9.5 45.5 10.0
	  </gml:posList></gml:LineString>
	</profile>
	<profile>
	  <gml:LineString><gml:posList>
	    9.5 45.0 0.0 9.5 45.5 10.0
	  </gml:posList></gml:LineString>
	</profile>
      </kiteSurface>
    </section>    
</geometryModel>
</nrml>

First the engine has to read all the geometryModel files and all the sourceModel files by instantiating the MultiFaultSources with empty sections (this happens in parallel); then it can populate the sections by looking at the complete geometryModel.
The section IDs must be unique across geometryModels.

@micheles
Copy link
Contributor

micheles commented May 18, 2021

We still have the issue of kitesurface.get_surface_boundaries_3d returning an invalid polygon, presumably because it should be a MULTIPOLYGON. This affects extract_rupture_info in the engine and therefore the QGIS visualization. We will need to change MultiFaultSource.wkt and KiteSurface.wkt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants