コード例 #1
0
 def test_array_conversion(self):
     """
     Tests the simple array conversion
     """
     # Setup two
     expected_dset1 = np.zeros([3, 3])
     expected_dset2 = np.ones([3, 3])
     output_dict = hdf_arrays_to_dict(self.group)
     assert isinstance(output_dict, dict)
     self.assertIn("DSET1", output_dict)
     self.assertIn("DSET2", output_dict)
     np.testing.assert_array_almost_equal(output_dict["DSET1"],
                                          expected_dset1)
     np.testing.assert_array_almost_equal(output_dict["DSET2"],
                                          expected_dset2)
コード例 #2
0
 def test_array_conversion(self):
     """
     Tests the simple array conversion
     """
     # Setup two
     expected_dset1 = np.zeros([3, 3])
     expected_dset2 = np.ones([3, 3])
     output_dict = hdf_arrays_to_dict(self.group)
     assert isinstance(output_dict, dict)
     self.assertIn("DSET1", output_dict)
     self.assertIn("DSET2", output_dict)
     np.testing.assert_array_almost_equal(output_dict["DSET1"],
                                          expected_dset1)
     np.testing.assert_array_almost_equal(output_dict["DSET2"],
                                          expected_dset2)
コード例 #3
0
ファイル: nga_east.py プロジェクト: systems-earth/oq-engine
 def init(self, fle):
     """
     Executes the preprocessing steps at the instantiation stage to read in
     the tables from hdf5 and hold them in memory.
     """
     self.distance_type = fle["Distances"].attrs["metric"]
     self.REQUIRES_DISTANCES = set([self.distance_type])
     # Load in magnitude
     self.m_w = fle["Mw"][:]
     # Load in distances
     self.distances = fle["Distances"][:]
     # Load intensity measure types and levels
     self.imls = hdf_arrays_to_dict(fle["IMLs"])
     self.DEFINED_FOR_INTENSITY_MEASURE_TYPES = set(self._supported_imts())
     if "SA" in self.imls.keys() and "T" not in self.imls:
         raise ValueError("Spectral Acceleration must be accompanied by "
                          "periods")
     # Get the standard deviations
     if "Amplification" in fle:
         self._setup_amplification(fle)