GithubHelp home page GithubHelp logo

eq-fault-geom's People

Contributors

andy22b avatar chrisbc avatar dependabot[bot] avatar robinpringle avatar sapikara avatar willic3 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

elenamanea

eq-fault-geom's Issues

Add fault polygons to opensha XML for crustal

As SRM Team

we want include fault trace polygons for each fault in the opensha XML

so that we can start to include distributed seismicity in opensha

Out of scope - the third layer for feature-based polygons

done when:

  • talk to Russ & Matt re report (below) to confirm the rules. Kiran & I think the first 2 (Trace buffer + Surface Projection) will be a good start
  • apply these rules to generate CFM (latest) fault trace polygons into opensha XML format

CFM XML extracts need stable fault integer IDs

As SRM Team

When we extract data fom CFM for opensha , we want a stable integer ID to identify the XML fault sections,

so that our downstream tests in GNSScience/nshm-nz-opensha are not disrupted by minor changes e.g filtering out the TVZ faults.

CFM 2D geometry convert to VTK for crustal faults

SRM Team

we want to use paraview and other VTK compatible visualising tools

so that we can explore fault geometries as defined in the CFM crustal 2D datasets where each fault section is expected to be a rectangular plane with an upper depth of 0km.

NB VTK has many file representations. For this we want legacy (non-XML) in ASCII mode so it's human readable. eg file header like this one ....

# vtk DataFile Version 4.2
vtk output
ASCII

See also

Done when

  • Q: VTK has many option to describe 3D surfaces. What is most appropriate for this feature? e.g pairs
    of triangles will be easily handles by ipyvolume, and flat quadrilaterals are eaily converted to these.
  • add a script to extract geometry from the 2D CFM (shapefiles) and export as VTK (legacy, ASCII)
  • script should extract one VTK file per fault section

Down-sample CFM tsurf to Stirling surfaces (crustal)

As NSHM NZ opensha users

we want to extract fault sections from CFM for NZ crustal faults

so that we can perform SHA usng opensha/open-quake and similar

NB now we do this from the CFM shapefile which includes surface fault traces, dip and depth values. This should produce simliar results but wit the 3D t2urf data as input.

setup-tools & requirements

As python user, I want the package to be installable using setup-tools/pip for ease of use:

  • determine best-practice guidelines to follow (setup.py standard pythonic approach)
  • pip, virtualenv
  • requirements.txt (pip freeze)
  • run tests (w nosetests)
  • update README.md with getting started

are there opportunities for unifying / deduping shared functions

IN our team code review last week (ref #37) we identified that there may be some duplicated code in places where we manipulate and transform geometries etc.

This ticket is for Charles & Andy who are the main authors of these functions to do a more detailed review over these modules to see if there's some simplification of the codebase available.

If so, we can create specific issues for the code refactoring task(s)

Feature: CFM 1.0 fault models with scaled aveLowerDepth attribute

SRM team needs new opensha Fault Model XML from CFM with the following requirements

  • use v1.0 of CFM (previously used CFM 0.9)
  • set aveLowerDepth attribute from the CFM Depth_Dfc instead of Depth_D90 field, and applying a scalar...
    • one version is scaled by 0.8
    • one version is scaled by 0.66
  • As per previous runs, one version including for ALL NZ fault and one with the low rate TVZ faults removed (however this is done).

Done Criteria

There should be a total of four new XML fault models named:

  • cfm_1_0_dfc0_66_all.xml
  • cfm_1_0_dfc0_66_no_tvz.xml
  • cfm_1_0_dfc0_80_all.xml
  • cfm_1_0_dfc0_80_no_tvz.xml

NameError: name 'vtk_suffix' is not defined

using create_stirling_vtk produces exception

NameError                                 Traceback (most recent call last)
<ipython-input-5-f7049921745c> in <module>
     11 for i, fault in sorted_wgs.iterrows():
     12     nztm_geometry_i = faults.iloc[i].geometry
---> 13     cv.create_stirling_vtk(fault, section_id=i, nztm_geometry=nztm_geometry_i)

~/anaconda3/envs/ipyvolume/lib/python3.8/site-packages/eq_fault_geom/geomio/cfm_shp_to_vtk.py in create_stirling_vtk(fault_info, section_id, nztm_geometry)
    176         file_name = "".join(file_list)
    177     file_path = Path(file_name)
--> 178     output_file = Path.joinpath(output_path, file_path).with_suffix(vtk_suffix)
    179     meshio.write(output_file, mesh, file_format="vtk", binary=False)
    180 

NameError: name 'vtk_suffix' is not defined

CFM => opensha shouldn't produce longitudes < 0

We we have just discovered the opensha rupture building chokes on Longitudes < 0 if they result in a 3D surface crossing the dateline.

The two new Kermadec trench sections in CFM 0.9 both fail because of this. e.g.

@voj has tested and can avoid this if we simply add 360 to any longitudes less than 0 (and there are many like this).

Our eq-fault_geom scripts should do this so we don't need to modify the upstream project.

Convert CFM shapefile crustal to opensha XML

As SRM team we want to extract relevant data from shapefile and write it in a format that OpenSHA can read.

  • Read in CFM source parameters from shapefile
  • Implement checks of parameters.
  • Write script to write out data in XML format.

convert cfm_shape_to_*.py to first class CLI modules

from review #37

/eq_fault_geom/faultmeshio/cfm_shape_to_*.py are command scripts

these should:

  • be migrated to the CLI folder
  • use optparse package (or similar) to implement a simple Command Line Interface for the user
  • remove any any hard-coded paths or files in the script
  • have a simple --help option telling the user how to use it.

New CFM -> XML constraint: check that aveLowerDepth > aveUpperDepth

Testing CFM XML in opensha has revealed this input raises an error in opensha

<i124 sectionId="124" sectionName="Fiordland" aveLongTermSlipRate="9.0" slipRateStDev="5.5" aveDip="25.0" aveRake="90.0" aveUpperDepth="0.0" aveLowerDepth="0.0" aseismicSlipFactor="0.0" couplingCoeff="1.0" dipDirection="131.5" parentSectionId="-1" connector="false">

In these cases the CFM XML extract should skip these elements and issue a warning message so the user know that data is missing.

NB to workaround this I've set a positive value for aveLowerDepth.

@sapikara pls add test coverage for this case

CFM export - need option to filter out faults within a polygon region (e.g. TVZ)

As SRM Team,

We want to exclude the Taupo Volcanic Zone (TVZ) faults from opensha data sets

So that we can assess their impact on rupture set size

Done when:

  • NB region polygon is easily defined (e.g. a WKT string)
  • fault traces whose points are entirely within the region are excluded from output dataset
  • provide a CLI interface allowing for option parsing for
    • input path
    • output path
    • exclude region spec(s) as WKT string
    • anything else ?

Feature: CFM 1.0 fault models with extra domain fields

SRM team needs new opensha Fault Model XML from CFM with the following requirements

  • use v1.0 of CFM
  • set aveLowerDepth attribute from the CFM Depth_Dfc
  • set new domainNo and domainName fields from CFM on each fault element
  • As per previous runs, one version including for ALL NZ fault and one with the low rate TVZ faults removed (however this is done).

Done Criteria

There should be a total of two new XML fault models named:

  • cfm_1_0_domain_all.xml
  • cfm_1_0_domain_no_tvz.xml

convert run_cfm_param_checks.py to a first class CLI module

/eq_fault_geom/geomio/run_cfm_param_checks.py needs to

  • be moved into ../cli package
  • use optparse package (or similar) to implement a simple Command Line Interface for the user
  • remove any any hard-coded paths or files in the script
  • provide a --help option telling the user how to use it.

review notes

package trawl....

  • /testing (deprecate bye bye!
  • /data add a README .... this is not 'real world' data folks
  • /apps to migrate into eq-fault-geom/cli
  • /eq_fault_geom/faultmeshio
    • init.py - check use of *** / setup style variable here.
    • cfm_shape_to_*.py are CLI modules for above
    • tsurf.py extends meshio to add tsurf support read/write
  • eq_fault_geom/faultmeshops/trace_to_mesh.py convertng CFM shapefile to tri or quad fault surfaces (juptyter viz)
  • /eq_fault_geom/geomio/
    • array_operations.py utils for GMT and GeoTiff (the grids)
    • buffer_example.py eg for chris
    • cfm_faults.py the CFM => opensha XML module
    • manipulate_interface_geom.sh builds the GeoTIFF of hikurangi from the GMT grid file
    • read_cfm_shp.py can be killed
    • run_cfm_param_checks.py to be migrated into ../cli (CLI for cfm_fault.py)
  • /eq_fault_geom/geomops/rupture_set/ Chris hikurangi rupture generation demo
    • subduction_interface buld hikurangi csv tiles from rhe GeoTiff

Check that crustal data export excludes subduction geometries

@andy22b I found the CFM XML contains the following elements which look supspiciously like subduction data.

Can you help us figure out if they're considered Crustal or not? & If NOT, then we need a feature that can filter these out.

Hikurangi

(eq-fault-geom) chrisbc@tryharder-ubuntu:~/DEV/GNS/eq-fault-geom/src$>grep Hikurangi NZ_CFM_V0.3_crustal_opensha.xml
    <i152 sectionId="152" sectionName="Hikurangi Hawke Bay" aveLongTermSlipRate="44.0" slipRateStDev="3.0" aveDip="0.0" aveRake="90.0" aveUpperDepth="0.0" aveLowerDepth="20.0" aseismicSlipFactor="0.0" couplingCoeff="1.0" dipDirection="296.8" parentSectionId="-1" connector="false">
      <FaultTrace name="Hikurangi Hawke Bay">
    <i153 sectionId="153" sectionName="Hikurangi Raukumara" aveLongTermSlipRate="54.0" slipRateStDev="6.0" aveDip="0.0" aveRake="90.0" aveUpperDepth="0.0" aveLowerDepth="20.0" aseismicSlipFactor="0.0" couplingCoeff="1.0" dipDirection="301.4" parentSectionId="-1" connector="false">
      <FaultTrace name="Hikurangi Raukumara">
    <i154 sectionId="154" sectionName="Hikurangi Wellington" aveLongTermSlipRate="25.0" slipRateStDev="5.0" aveDip="0.0" aveRake="90.0" aveUpperDepth="0.0" aveLowerDepth="30.0" aseismicSlipFactor="0.0" couplingCoeff="1.0" dipDirection="336.4" parentSectionId="-1" connector="false">
      <FaultTrace name="Hikurangi Wellington">

Puysegur

(eq-fault-geom) chrisbc@tryharder-ubuntu:~/DEV/GNS/eq-fault-geom/src$ grep Puys NZ_CFM_V0.3_crustal_opensha.xml 
    <i431 sectionId="431" sectionName="Puysegur" aveLongTermSlipRate="27.0" slipRateStDev="9.0" aveDip="20.0" aveRake="115.0" aveUpperDepth="0.0" aveLowerDepth="15.0" aseismicSlipFactor="0.0" couplingCoeff="1.0" dipDirection="101.3" parentSectionId="-1" connector="false">
      <FaultTrace name="Puysegur">
    <i432 sectionId="432" sectionName="Puysegur Ridge" aveLongTermSlipRate="14.0" slipRateStDev="14.0" aveDip="85.0" aveRake="180.0" aveUpperDepth="0.0" aveLowerDepth="12.0" aseismicSlipFactor="0.0" couplingCoeff="1.0" dipDirection="107.8" parentSectionId="-1" connector="false">
      <FaultTrace name="Puysegur Ridge">

Prepare new CFM version for opensha

So we can move ahead with new analysis

Done when:

  • identify latest version (is it 0.9 or 1.0??)
  • Update TVZ exclusion rules as per Russ Van Dissum advice
  • check name of slipRateStdDev in XML (note the two ds)
  • produce a new crustal XML (complete)
  • produce a new crustal XML (Sans TVZ)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.