Example #1
0
def _load_expected_results():
    """Return a list of tuples in the form (shapes.Site, value)."""

    results = []

    with open(helpers.smoketest_file(
        "HazardMapTest/expected_results/meanHazardMap0.1.dat")) as f:

        for result in f:
            lon, lat, value = result.split()
            site = shapes.Site(float(lon), float(lat))
            results.append((site, float(value)))

    return results
Example #2
0
def _load_expected_results():
    """Return a list of tuples in the form (shapes.Site, value)."""

    results = []

    with open(
            helpers.smoketest_file(
                "HazardMapTest/expected_results/meanHazardMap0.1.dat")) as f:

        for result in f:
            lon, lat, value = result.split()
            site = shapes.Site(float(lon), float(lat))
            results.append((site, float(value)))

    return results
Example #3
0
    def setUp(self):
        self.expected_results = _load_expected_results()
        kvs.flush()

        self.engine = job.Job.from_file(
            helpers.smoketest_file("HazardMapTest/config.gem"))
Example #4
0
    def setUp(self):
        self.expected_results = _load_expected_results()
        kvs.flush()

        self.engine = job.Job.from_file(
            helpers.smoketest_file("HazardMapTest/config.gem"))
import math
import numpy
import unittest
import json

from utils import helpers

from openquake import java
from openquake import kvs
from openquake import job
from openquake import flags
from openquake import shapes

from openquake.hazard import deterministic as det

DETERMINISTIC_SMOKE_TEST = helpers.smoketest_file("deterministic/config.gem")
NUMBER_OF_CALC_KEY = "NUMBER_OF_GROUND_MOTION_FIELDS_CALCULATIONS"


def compute_ground_motion_field(self, random_generator):
    """Stubbed version of the method that computes the ground motion
    field calling java stuff."""

    hashmap = java.jclass("HashMap")()

    for site in self.sites_for_region():
        location = java.jclass("Location")(site.latitude, site.longitude)
        site = java.jclass("Site")(location)
        hashmap.put(site, 0.5)

    return hashmap
Example #6
0
import math
import numpy
import unittest
import json

from utils import helpers

from openquake import java
from openquake import kvs
from openquake import job
from openquake import flags
from openquake import shapes

from openquake.hazard import deterministic as det

DETERMINISTIC_SMOKE_TEST = helpers.smoketest_file("deterministic/config.gem")
NUMBER_OF_CALC_KEY = "NUMBER_OF_GROUND_MOTION_FIELDS_CALCULATIONS"


def compute_ground_motion_field(self, random_generator):
    """Stubbed version of the method that computes the ground motion
    field calling java stuff."""

    hashmap = java.jclass("HashMap")()

    for site in self.sites_for_region():
        location = java.jclass("Location")(site.latitude, site.longitude)
        site = java.jclass("Site")(location)
        hashmap.put(site, 0.5)

    return hashmap