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

Aggregation by tag #2943

Merged
merged 42 commits into from Jul 20, 2017
Merged

Aggregation by tag #2943

merged 42 commits into from Jul 20, 2017

Conversation

micheles
Copy link
Contributor

@micheles micheles commented Jul 3, 2017

I am extending the aggregation by taxonomy to an aggregation by generic tag. The tag must not conflict with the taxonomy; except that, it can be any ASCII string up to 60 characters. If the string has spaces inside, it is split and considered as a set of tags, i.e. we multi-tag support for free, provided the tags are disjoint.

From @CatalinaYepes or @raoanirudh I need some example exposure with tags (i.e. CRESTA codes or kinds of residential buildings). We could update one of the existing demos or create a new one.

Right now the exported results are mixing together taxonomies and tags; we may want to change that in the future.

Here is a complete run: https://ci.openquake.org/job/zdevel_oq-engine/2560/

@micheles micheles added this to the Engine 2.6.0 milestone Jul 3, 2017
@raoanirudh
Copy link
Member

raoanirudh commented Jul 5, 2017

Here's an example exposure model with two tags per asset separated by pipes, which should work with the master cases in https://github.com/gem/oq-risk-tests

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

<exposureModel id="exp1" category="buildings">
  <description>multiple assets em w/ insurance</description>
  <conversions>
    <area type="per_asset" unit="SQM" />
    <costTypes>
      <costType name="structural" type="per_asset" unit="USD" />
      <costType name="nonstructural" type="per_asset" unit="USD" />
      <costType name="contents" type="per_asset" unit="USD" />
      <costType name="business_interruption" type="per_asset" unit="USD/month" />
    </costTypes>
  </conversions>
  
  <assets>
    <asset id="a1" number="1" area="100" taxonomy="tax1" tag="L1-01|L2-011" >
      <location lon="-122.000" lat="38.113" />
      <costs>
        <cost type="structural" value="10000" deductible="0.1" insuranceLimit="0.8" />
        <cost type="nonstructural" value="15000" deductible="0.1" insuranceLimit="0.8" />
        <cost type="contents" value="5000" deductible="0.1" insuranceLimit="0.8" />
        <cost type="business_interruption" value="2000" deductible="0.1" insuranceLimit="0.8" />
      </costs>
      <occupancies>
        <occupancy occupants="2" period="day" />
        <occupancy occupants="4" period="transit" />
        <occupancy occupants="6" period="night" />
      </occupancies>
    </asset>
    
    <asset id="a2" number="1" area="100" taxonomy="tax2" tag="L1-01|L2-012">
      <location lon="-122.114" lat="38.113" />
      <costs>
        <cost type="structural" value="10000" deductible="0.1" insuranceLimit="0.8" />
        <cost type="nonstructural" value="15000" deductible="0.1" insuranceLimit="0.8" />
        <cost type="contents" value="5000" deductible="0.1" insuranceLimit="0.8" />
        <cost type="business_interruption" value="2000" deductible="0.1" insuranceLimit="0.8" />
      </costs>
      <occupancies>
        <occupancy occupants="2" period="day" />
        <occupancy occupants="4" period="transit" />
        <occupancy occupants="6" period="night" />
      </occupancies>
    </asset>
    
    <asset id="a3" number="1" area="100" taxonomy="tax1" tag="L1-02|L2-021">
      <location lon="-122.570" lat="38.113" />
      <costs>
        <cost type="structural" value="10000" deductible="0.1" insuranceLimit="0.8" />
        <cost type="nonstructural" value="15000" deductible="0.1" insuranceLimit="0.8" />
        <cost type="contents" value="5000" deductible="0.1" insuranceLimit="0.8" />
        <cost type="business_interruption" value="2000" deductible="0.1" insuranceLimit="0.8" />
      </costs>
      <occupancies>
        <occupancy occupants="2" period="day" />
        <occupancy occupants="4" period="transit" />
        <occupancy occupants="6" period="night" />
      </occupancies>
    </asset>
    
    <asset id="a4" number="1" area="100" taxonomy="tax3" tag="L1-02|L2-022">
      <location lon="-122.000" lat="38.000" />
      <costs>
        <cost type="structural" value="10000" deductible="0.1" insuranceLimit="0.8" />
        <cost type="nonstructural" value="15000" deductible="0.1" insuranceLimit="0.8" />
        <cost type="contents" value="5000" deductible="0.1" insuranceLimit="0.8" />
        <cost type="business_interruption" value="2000" deductible="0.1" insuranceLimit="0.8" />
      </costs>
      <occupancies>
        <occupancy occupants="2" period="day" />
        <occupancy occupants="4" period="transit" />
        <occupancy occupants="6" period="night" />
      </occupancies>
    </asset>
    
    <asset id="a5" number="1" area="100" taxonomy="tax1" tag="L1-02|L2-023">
      <location lon="-122.000" lat="37.910" />
      <costs>
        <cost type="structural" value="10000" deductible="0.1" insuranceLimit="0.8" />
        <cost type="nonstructural" value="15000" deductible="0.1" insuranceLimit="0.8" />
        <cost type="contents" value="5000" deductible="0.1" insuranceLimit="0.8" />
        <cost type="business_interruption" value="2000" deductible="0.1" insuranceLimit="0.8" />
      </costs>
      <occupancies>
        <occupancy occupants="2" period="day" />
        <occupancy occupants="4" period="transit" />
        <occupancy occupants="6" period="night" />
      </occupancies>
    </asset>
    
    <asset id="a6" number="1" area="100" taxonomy="tax2" tag="L1-03|L2-031">
      <location lon="-122.000" lat="38.225" />
      <costs>
        <cost type="structural" value="10000" deductible="0.1" insuranceLimit="0.8" />
        <cost type="nonstructural" value="15000" deductible="0.1" insuranceLimit="0.8" />
        <cost type="contents" value="5000" deductible="0.1" insuranceLimit="0.8" />
        <cost type="business_interruption" value="2000" deductible="0.1" insuranceLimit="0.8" />
      </costs>
      <occupancies>
        <occupancy occupants="2" period="day" />
        <occupancy occupants="4" period="transit" />
        <occupancy occupants="6" period="night" />
      </occupancies>
    </asset>
    
    <asset id="a7" number="1" area="100" taxonomy="tax1" tag="L1-03|L2-032">
      <location lon="-121.886" lat="38.113" />
      <costs>
        <cost type="structural" value="10000" deductible="0.1" insuranceLimit="0.8" />
        <cost type="nonstructural" value="15000" deductible="0.1" insuranceLimit="0.8" />
        <cost type="contents" value="5000" deductible="0.1" insuranceLimit="0.8" />
        <cost type="business_interruption" value="2000" deductible="0.1" insuranceLimit="0.8" />
      </costs>
      <occupancies>
        <occupancy occupants="2" period="day" />
        <occupancy occupants="4" period="transit" />
        <occupancy occupants="6" period="night" />
      </occupancies>
    </asset>
    
  </assets>
</exposureModel>

</nrml>

@micheles micheles requested a review from ptormene July 20, 2017 08:45
@ptormene
Copy link
Member

Please rename all files containing taxon with tag

structural,LS1_stdv,6.673240E+02
structural,LS2_mean,1.800857E+03
structural,LS2_stdv,8.811050E+02
structural,no_damage_mean,3.394311E+03
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check if it's right that these numbers are changing

@micheles micheles merged commit 8496605 into master Jul 20, 2017
@micheles micheles deleted the asset-tag branch July 20, 2017 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants