def test(self): tmpdir = tempfile.mkdtemp() path = os.path.join(tmpdir, 'vf.xml') with open(path, 'w') as f: f.write('''\ <?xml version="1.0"?> <nrml xmlns="http://openquake.org/xmlns/nrml/0.4" xmlns:gml="http://www.opengis.net/gml"> <vulnerabilityModel> <discreteVulnerabilitySet vulnerabilitySetID="vm1" assetCategory="buildings" lossCategory="Economic_loss"> <IML IMT="PGA">0.01 0.040408163 0.070816327 0.10122449 0.131632653 0.162040816 0.19244898 0.222857143 0.253265306 0.283673469 0.314081633 0.344489796 0.374897959 0.405306122 0.435714286 0.466122449 0.496530612 0.526938776 0.557346939 0.587755102 0.618163265 0.648571429 0.678979592 0.709387755 0.739795918 0.770204082 0.800612245 0.831020408 0.861428571 0.891836735 0.922244898 0.952653061 0.983061224 1.013469388 1.043877551 1.074285714 1.104693878 1.135102041 1.165510204 1.195918367 1.226326531 1.256734694 1.287142857 1.31755102 1.347959184 1.378367347 1.40877551 1.439183673 1.469591837 1.5 </IML> <discreteVulnerability vulnerabilityFunctionID="A-SPSB-1" probabilisticDistribution="LN"> <lossRatio>0 0.000409057 0.018800826 0.196366309 0.709345589 0.991351187 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1</lossRatio> <coefficientsVariation>0 0.000509057 0.022010677 0.186110985 0.241286071 0.010269671 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </coefficientsVariation> </discreteVulnerability> </discreteVulnerabilitySet> </vulnerabilityModel> </nrml>''') upgrade_nrml(tmpdir, False, False) shutil.rmtree(tmpdir)
def test(self): tmpdir = tempfile.mkdtemp() path = os.path.join(tmpdir, 'vf.xml') with open(path, 'w') as f: f.write('''\ <?xml version="1.0"?> <nrml xmlns="http://openquake.org/xmlns/nrml/0.4" xmlns:gml="http://www.opengis.net/gml"> <vulnerabilityModel> <discreteVulnerabilitySet vulnerabilitySetID="vm1" assetCategory="buildings" lossCategory="Economic_loss"> <IML IMT="PGA">0.01 0.040408163 0.070816327 0.10122449 0.131632653 0.162040816 0.19244898 0.222857143 0.253265306 0.283673469 0.314081633 0.344489796 0.374897959 0.405306122 0.435714286 0.466122449 0.496530612 0.526938776 0.557346939 0.587755102 0.618163265 0.648571429 0.678979592 0.709387755 0.739795918 0.770204082 0.800612245 0.831020408 0.861428571 0.891836735 0.922244898 0.952653061 0.983061224 1.013469388 1.043877551 1.074285714 1.104693878 1.135102041 1.165510204 1.195918367 1.226326531 1.256734694 1.287142857 1.31755102 1.347959184 1.378367347 1.40877551 1.439183673 1.469591837 1.5 </IML> <discreteVulnerability vulnerabilityFunctionID="A-SPSB-1" probabilisticDistribution="LN"> <lossRatio>0 0.000409057 0.018800826 0.196366309 0.709345589 0.991351187 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1</lossRatio> <coefficientsVariation>0 0.000509057 0.022010677 0.186110985 0.241286071 0.010269671 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </coefficientsVariation> </discreteVulnerability> </discreteVulnerabilitySet> </vulnerabilityModel> </nrml>''') upgrade_nrml(tmpdir, False, False) shutil.rmtree(tmpdir)