id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
200 | gem/oq-engine | openquake/hazardlib/scalerel/wc1994.py | WC1994.get_std_dev_area | def get_std_dev_area(self, mag, rake):
"""
Standard deviation for WC1994. Magnitude is ignored.
"""
assert rake is None or -180 <= rake <= 180
if rake is None:
# their "All" case
return 0.24
elif (-45 <= rake <= 45) or (rake >= 135) or (rake <= -13... | python | def get_std_dev_area(self, mag, rake):
"""
Standard deviation for WC1994. Magnitude is ignored.
"""
assert rake is None or -180 <= rake <= 180
if rake is None:
# their "All" case
return 0.24
elif (-45 <= rake <= 45) or (rake >= 135) or (rake <= -13... | [
"def",
"get_std_dev_area",
"(",
"self",
",",
"mag",
",",
"rake",
")",
":",
"assert",
"rake",
"is",
"None",
"or",
"-",
"180",
"<=",
"rake",
"<=",
"180",
"if",
"rake",
"is",
"None",
":",
"# their \"All\" case",
"return",
"0.24",
"elif",
"(",
"-",
"45",
... | Standard deviation for WC1994. Magnitude is ignored. | [
"Standard",
"deviation",
"for",
"WC1994",
".",
"Magnitude",
"is",
"ignored",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/scalerel/wc1994.py#L54-L70 |
201 | gem/oq-engine | openquake/hazardlib/scalerel/wc1994.py | WC1994.get_std_dev_mag | def get_std_dev_mag(self, rake):
"""
Standard deviation on the magnitude for the WC1994 area relation.
"""
assert rake is None or -180 <= rake <= 180
if rake is None:
# their "All" case
return 0.24
elif (-45 <= rake <= 45) or (rake >= 135) or (rake... | python | def get_std_dev_mag(self, rake):
"""
Standard deviation on the magnitude for the WC1994 area relation.
"""
assert rake is None or -180 <= rake <= 180
if rake is None:
# their "All" case
return 0.24
elif (-45 <= rake <= 45) or (rake >= 135) or (rake... | [
"def",
"get_std_dev_mag",
"(",
"self",
",",
"rake",
")",
":",
"assert",
"rake",
"is",
"None",
"or",
"-",
"180",
"<=",
"rake",
"<=",
"180",
"if",
"rake",
"is",
"None",
":",
"# their \"All\" case",
"return",
"0.24",
"elif",
"(",
"-",
"45",
"<=",
"rake",
... | Standard deviation on the magnitude for the WC1994 area relation. | [
"Standard",
"deviation",
"on",
"the",
"magnitude",
"for",
"the",
"WC1994",
"area",
"relation",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/scalerel/wc1994.py#L72-L88 |
202 | gem/oq-engine | openquake/hazardlib/gsim/mgmpe/generic_gmpe_avgsa.py | GenericGmpeAvgSA.set_parameters | def set_parameters(self):
"""
Combines the parameters of the GMPE provided at the construction
level with the ones assigned to the average GMPE.
"""
for key in dir(self):
if key.startswith('REQUIRES_'):
setattr(self, key, getattr(self.gmpe, key))
... | python | def set_parameters(self):
"""
Combines the parameters of the GMPE provided at the construction
level with the ones assigned to the average GMPE.
"""
for key in dir(self):
if key.startswith('REQUIRES_'):
setattr(self, key, getattr(self.gmpe, key))
... | [
"def",
"set_parameters",
"(",
"self",
")",
":",
"for",
"key",
"in",
"dir",
"(",
"self",
")",
":",
"if",
"key",
".",
"startswith",
"(",
"'REQUIRES_'",
")",
":",
"setattr",
"(",
"self",
",",
"key",
",",
"getattr",
"(",
"self",
".",
"gmpe",
",",
"key"... | Combines the parameters of the GMPE provided at the construction
level with the ones assigned to the average GMPE. | [
"Combines",
"the",
"parameters",
"of",
"the",
"GMPE",
"provided",
"at",
"the",
"construction",
"level",
"with",
"the",
"ones",
"assigned",
"to",
"the",
"average",
"GMPE",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/mgmpe/generic_gmpe_avgsa.py#L87-L97 |
203 | gem/oq-engine | openquake/hazardlib/geo/mesh.py | Mesh.from_points_list | def from_points_list(cls, points):
"""
Create a mesh object from a collection of points.
:param point:
List of :class:`~openquake.hazardlib.geo.point.Point` objects.
:returns:
An instance of :class:`Mesh` with one-dimensional arrays
of coordinates fro... | python | def from_points_list(cls, points):
"""
Create a mesh object from a collection of points.
:param point:
List of :class:`~openquake.hazardlib.geo.point.Point` objects.
:returns:
An instance of :class:`Mesh` with one-dimensional arrays
of coordinates fro... | [
"def",
"from_points_list",
"(",
"cls",
",",
"points",
")",
":",
"lons",
"=",
"numpy",
".",
"zeros",
"(",
"len",
"(",
"points",
")",
",",
"dtype",
"=",
"float",
")",
"lats",
"=",
"lons",
".",
"copy",
"(",
")",
"depths",
"=",
"lons",
".",
"copy",
"... | Create a mesh object from a collection of points.
:param point:
List of :class:`~openquake.hazardlib.geo.point.Point` objects.
:returns:
An instance of :class:`Mesh` with one-dimensional arrays
of coordinates from ``points``. | [
"Create",
"a",
"mesh",
"object",
"from",
"a",
"collection",
"of",
"points",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/mesh.py#L134-L154 |
204 | gem/oq-engine | openquake/hazardlib/geo/mesh.py | Mesh.get_min_distance | def get_min_distance(self, mesh):
"""
Compute and return the minimum distance from the mesh to each point
in another mesh.
:returns:
numpy array of distances in km of shape (self.size, mesh.size)
Method doesn't make any assumptions on arrangement of the points
... | python | def get_min_distance(self, mesh):
"""
Compute and return the minimum distance from the mesh to each point
in another mesh.
:returns:
numpy array of distances in km of shape (self.size, mesh.size)
Method doesn't make any assumptions on arrangement of the points
... | [
"def",
"get_min_distance",
"(",
"self",
",",
"mesh",
")",
":",
"return",
"cdist",
"(",
"self",
".",
"xyz",
",",
"mesh",
".",
"xyz",
")",
".",
"min",
"(",
"axis",
"=",
"0",
")"
] | Compute and return the minimum distance from the mesh to each point
in another mesh.
:returns:
numpy array of distances in km of shape (self.size, mesh.size)
Method doesn't make any assumptions on arrangement of the points
in either mesh and instead calculates the distance ... | [
"Compute",
"and",
"return",
"the",
"minimum",
"distance",
"from",
"the",
"mesh",
"to",
"each",
"point",
"in",
"another",
"mesh",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/mesh.py#L236-L249 |
205 | gem/oq-engine | openquake/hazardlib/geo/mesh.py | Mesh.get_closest_points | def get_closest_points(self, mesh):
"""
Find closest point of this mesh for each point in the other mesh
:returns:
:class:`Mesh` object of the same shape as `mesh` with closest
points from this one at respective indices.
"""
min_idx = cdist(self.xyz, mesh... | python | def get_closest_points(self, mesh):
"""
Find closest point of this mesh for each point in the other mesh
:returns:
:class:`Mesh` object of the same shape as `mesh` with closest
points from this one at respective indices.
"""
min_idx = cdist(self.xyz, mesh... | [
"def",
"get_closest_points",
"(",
"self",
",",
"mesh",
")",
":",
"min_idx",
"=",
"cdist",
"(",
"self",
".",
"xyz",
",",
"mesh",
".",
"xyz",
")",
".",
"argmin",
"(",
"axis",
"=",
"0",
")",
"# lose shape",
"if",
"hasattr",
"(",
"mesh",
",",
"'shape'",
... | Find closest point of this mesh for each point in the other mesh
:returns:
:class:`Mesh` object of the same shape as `mesh` with closest
points from this one at respective indices. | [
"Find",
"closest",
"point",
"of",
"this",
"mesh",
"for",
"each",
"point",
"in",
"the",
"other",
"mesh"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/mesh.py#L251-L265 |
206 | gem/oq-engine | openquake/hazardlib/geo/mesh.py | Mesh.get_distance_matrix | def get_distance_matrix(self):
"""
Compute and return distances between each pairs of points in the mesh.
This method requires that the coordinate arrays are one-dimensional.
NB: the depth of the points is ignored
.. warning::
Because of its quadratic space and time... | python | def get_distance_matrix(self):
"""
Compute and return distances between each pairs of points in the mesh.
This method requires that the coordinate arrays are one-dimensional.
NB: the depth of the points is ignored
.. warning::
Because of its quadratic space and time... | [
"def",
"get_distance_matrix",
"(",
"self",
")",
":",
"assert",
"self",
".",
"lons",
".",
"ndim",
"==",
"1",
"distances",
"=",
"geodetic",
".",
"geodetic_distance",
"(",
"self",
".",
"lons",
".",
"reshape",
"(",
"self",
".",
"lons",
".",
"shape",
"+",
"... | Compute and return distances between each pairs of points in the mesh.
This method requires that the coordinate arrays are one-dimensional.
NB: the depth of the points is ignored
.. warning::
Because of its quadratic space and time complexity this method
is safe to use ... | [
"Compute",
"and",
"return",
"distances",
"between",
"each",
"pairs",
"of",
"points",
"in",
"the",
"mesh",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/mesh.py#L267-L295 |
207 | gem/oq-engine | openquake/hazardlib/geo/mesh.py | Mesh._get_proj_convex_hull | def _get_proj_convex_hull(self):
"""
Create a projection centered in the center of this mesh and define
a convex polygon in that projection, enveloping all the points
of the mesh.
:returns:
Tuple of two items: projection function and shapely 2d polygon.
N... | python | def _get_proj_convex_hull(self):
"""
Create a projection centered in the center of this mesh and define
a convex polygon in that projection, enveloping all the points
of the mesh.
:returns:
Tuple of two items: projection function and shapely 2d polygon.
N... | [
"def",
"_get_proj_convex_hull",
"(",
"self",
")",
":",
"# create a projection centered in the center of points collection",
"proj",
"=",
"geo_utils",
".",
"OrthographicProjection",
"(",
"*",
"geo_utils",
".",
"get_spherical_bounding_box",
"(",
"self",
".",
"lons",
",",
"s... | Create a projection centered in the center of this mesh and define
a convex polygon in that projection, enveloping all the points
of the mesh.
:returns:
Tuple of two items: projection function and shapely 2d polygon.
Note that the result geometry can be line or point dep... | [
"Create",
"a",
"projection",
"centered",
"in",
"the",
"center",
"of",
"this",
"mesh",
"and",
"define",
"a",
"convex",
"polygon",
"in",
"that",
"projection",
"enveloping",
"all",
"the",
"points",
"of",
"the",
"mesh",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/mesh.py#L297-L317 |
208 | gem/oq-engine | openquake/hazardlib/geo/mesh.py | Mesh.get_joyner_boore_distance | def get_joyner_boore_distance(self, mesh):
"""
Compute and return Joyner-Boore distance to each point of ``mesh``.
Point's depth is ignored.
See
:meth:`openquake.hazardlib.geo.surface.base.BaseSurface.get_joyner_boore_distance`
for definition of this distance.
:... | python | def get_joyner_boore_distance(self, mesh):
"""
Compute and return Joyner-Boore distance to each point of ``mesh``.
Point's depth is ignored.
See
:meth:`openquake.hazardlib.geo.surface.base.BaseSurface.get_joyner_boore_distance`
for definition of this distance.
:... | [
"def",
"get_joyner_boore_distance",
"(",
"self",
",",
"mesh",
")",
":",
"# we perform a hybrid calculation (geodetic mesh-to-mesh distance",
"# and distance on the projection plane for close points). first,",
"# we find the closest geodetic distance for each point of target",
"# mesh to this o... | Compute and return Joyner-Boore distance to each point of ``mesh``.
Point's depth is ignored.
See
:meth:`openquake.hazardlib.geo.surface.base.BaseSurface.get_joyner_boore_distance`
for definition of this distance.
:returns:
numpy array of distances in km of the same... | [
"Compute",
"and",
"return",
"Joyner",
"-",
"Boore",
"distance",
"to",
"each",
"point",
"of",
"mesh",
".",
"Point",
"s",
"depth",
"is",
"ignored",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/mesh.py#L319-L393 |
209 | gem/oq-engine | openquake/hazardlib/geo/mesh.py | Mesh.get_convex_hull | def get_convex_hull(self):
"""
Get a convex polygon object that contains projections of all the points
of the mesh.
:returns:
Instance of :class:`openquake.hazardlib.geo.polygon.Polygon` that
is a convex hull around all the points in this mesh. If the
... | python | def get_convex_hull(self):
"""
Get a convex polygon object that contains projections of all the points
of the mesh.
:returns:
Instance of :class:`openquake.hazardlib.geo.polygon.Polygon` that
is a convex hull around all the points in this mesh. If the
... | [
"def",
"get_convex_hull",
"(",
"self",
")",
":",
"proj",
",",
"polygon2d",
"=",
"self",
".",
"_get_proj_convex_hull",
"(",
")",
"# if mesh had only one point, the convex hull is a point. if there",
"# were two, it is a line string. we need to return a convex polygon",
"# object, so... | Get a convex polygon object that contains projections of all the points
of the mesh.
:returns:
Instance of :class:`openquake.hazardlib.geo.polygon.Polygon` that
is a convex hull around all the points in this mesh. If the
original mesh had only one point, the resultin... | [
"Get",
"a",
"convex",
"polygon",
"object",
"that",
"contains",
"projections",
"of",
"all",
"the",
"points",
"of",
"the",
"mesh",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/mesh.py#L457-L480 |
210 | gem/oq-engine | openquake/hazardlib/geo/mesh.py | RectangularMesh.from_points_list | def from_points_list(cls, points):
"""
Create a rectangular mesh object from a list of lists of points.
Lists in a list are supposed to have the same length.
:param point:
List of lists of :class:`~openquake.hazardlib.geo.point.Point`
objects.
"""
... | python | def from_points_list(cls, points):
"""
Create a rectangular mesh object from a list of lists of points.
Lists in a list are supposed to have the same length.
:param point:
List of lists of :class:`~openquake.hazardlib.geo.point.Point`
objects.
"""
... | [
"def",
"from_points_list",
"(",
"cls",
",",
"points",
")",
":",
"assert",
"points",
"is",
"not",
"None",
"and",
"len",
"(",
"points",
")",
">",
"0",
"and",
"len",
"(",
"points",
"[",
"0",
"]",
")",
">",
"0",
",",
"'list of at least one non-empty list of ... | Create a rectangular mesh object from a list of lists of points.
Lists in a list are supposed to have the same length.
:param point:
List of lists of :class:`~openquake.hazardlib.geo.point.Point`
objects. | [
"Create",
"a",
"rectangular",
"mesh",
"object",
"from",
"a",
"list",
"of",
"lists",
"of",
"points",
".",
"Lists",
"in",
"a",
"list",
"are",
"supposed",
"to",
"have",
"the",
"same",
"length",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/mesh.py#L497-L521 |
211 | gem/oq-engine | openquake/hazardlib/geo/mesh.py | RectangularMesh.get_middle_point | def get_middle_point(self):
"""
Return the middle point of the mesh.
:returns:
An instance of :class:`~openquake.hazardlib.geo.point.Point`.
The middle point is taken from the middle row and a middle column
of the mesh if there are odd number of both. Otherwise the ... | python | def get_middle_point(self):
"""
Return the middle point of the mesh.
:returns:
An instance of :class:`~openquake.hazardlib.geo.point.Point`.
The middle point is taken from the middle row and a middle column
of the mesh if there are odd number of both. Otherwise the ... | [
"def",
"get_middle_point",
"(",
"self",
")",
":",
"num_rows",
",",
"num_cols",
"=",
"self",
".",
"lons",
".",
"shape",
"mid_row",
"=",
"num_rows",
"//",
"2",
"depth",
"=",
"0",
"if",
"num_rows",
"&",
"1",
"==",
"1",
":",
"# there are odd number of rows",
... | Return the middle point of the mesh.
:returns:
An instance of :class:`~openquake.hazardlib.geo.point.Point`.
The middle point is taken from the middle row and a middle column
of the mesh if there are odd number of both. Otherwise the geometric
mean point of two or four midd... | [
"Return",
"the",
"middle",
"point",
"of",
"the",
"mesh",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/mesh.py#L523-L566 |
212 | gem/oq-engine | openquake/hazardlib/geo/mesh.py | RectangularMesh.get_cell_dimensions | def get_cell_dimensions(self):
"""
Calculate centroid, width, length and area of each mesh cell.
:returns:
Tuple of four elements, each being 2d numpy array.
Each array has both dimensions less by one the dimensions
of the mesh, since they represent cells, no... | python | def get_cell_dimensions(self):
"""
Calculate centroid, width, length and area of each mesh cell.
:returns:
Tuple of four elements, each being 2d numpy array.
Each array has both dimensions less by one the dimensions
of the mesh, since they represent cells, no... | [
"def",
"get_cell_dimensions",
"(",
"self",
")",
":",
"points",
",",
"along_azimuth",
",",
"updip",
",",
"diag",
"=",
"self",
".",
"triangulate",
"(",
")",
"top",
"=",
"along_azimuth",
"[",
":",
"-",
"1",
"]",
"left",
"=",
"updip",
"[",
":",
",",
":",... | Calculate centroid, width, length and area of each mesh cell.
:returns:
Tuple of four elements, each being 2d numpy array.
Each array has both dimensions less by one the dimensions
of the mesh, since they represent cells, not vertices.
Arrays contain the followin... | [
"Calculate",
"centroid",
"width",
"length",
"and",
"area",
"of",
"each",
"mesh",
"cell",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/mesh.py#L704-L746 |
213 | gem/oq-engine | openquake/hazardlib/geo/mesh.py | RectangularMesh.triangulate | def triangulate(self):
"""
Convert mesh points to vectors in Cartesian space.
:returns:
Tuple of four elements, each being 2d numpy array of 3d vectors
(the same structure and shape as the mesh itself). Those arrays
are:
#. points vectors,
... | python | def triangulate(self):
"""
Convert mesh points to vectors in Cartesian space.
:returns:
Tuple of four elements, each being 2d numpy array of 3d vectors
(the same structure and shape as the mesh itself). Those arrays
are:
#. points vectors,
... | [
"def",
"triangulate",
"(",
"self",
")",
":",
"points",
"=",
"geo_utils",
".",
"spherical_to_cartesian",
"(",
"self",
".",
"lons",
",",
"self",
".",
"lats",
",",
"self",
".",
"depths",
")",
"# triangulate the mesh by defining vectors of triangles edges:",
"# →",
"a... | Convert mesh points to vectors in Cartesian space.
:returns:
Tuple of four elements, each being 2d numpy array of 3d vectors
(the same structure and shape as the mesh itself). Those arrays
are:
#. points vectors,
#. vectors directed from each point (... | [
"Convert",
"mesh",
"points",
"to",
"vectors",
"in",
"Cartesian",
"space",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/mesh.py#L748-L778 |
214 | gem/oq-engine | openquake/hmtk/seismicity/smoothing/kernels/isotropic_gaussian.py | IsotropicGaussian.smooth_data | def smooth_data(self, data, config, is_3d=False):
'''
Applies the smoothing kernel to the data
:param np.ndarray data:
Raw earthquake count in the form [Longitude, Latitude, Depth,
Count]
:param dict config:
Configuration parameters must contain:
... | python | def smooth_data(self, data, config, is_3d=False):
'''
Applies the smoothing kernel to the data
:param np.ndarray data:
Raw earthquake count in the form [Longitude, Latitude, Depth,
Count]
:param dict config:
Configuration parameters must contain:
... | [
"def",
"smooth_data",
"(",
"self",
",",
"data",
",",
"config",
",",
"is_3d",
"=",
"False",
")",
":",
"max_dist",
"=",
"config",
"[",
"'Length_Limit'",
"]",
"*",
"config",
"[",
"'BandWidth'",
"]",
"smoothed_value",
"=",
"np",
".",
"zeros",
"(",
"len",
"... | Applies the smoothing kernel to the data
:param np.ndarray data:
Raw earthquake count in the form [Longitude, Latitude, Depth,
Count]
:param dict config:
Configuration parameters must contain:
* BandWidth: The bandwidth of the kernel (in km) (float)
... | [
"Applies",
"the",
"smoothing",
"kernel",
"to",
"the",
"data"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hmtk/seismicity/smoothing/kernels/isotropic_gaussian.py#L69-L99 |
215 | gem/oq-engine | openquake/commands/purge.py | purge_one | def purge_one(calc_id, user):
"""
Remove one calculation ID from the database and remove its datastore
"""
filename = os.path.join(datadir, 'calc_%s.hdf5' % calc_id)
err = dbcmd('del_calc', calc_id, user)
if err:
print(err)
elif os.path.exists(filename): # not removed yet
os... | python | def purge_one(calc_id, user):
"""
Remove one calculation ID from the database and remove its datastore
"""
filename = os.path.join(datadir, 'calc_%s.hdf5' % calc_id)
err = dbcmd('del_calc', calc_id, user)
if err:
print(err)
elif os.path.exists(filename): # not removed yet
os... | [
"def",
"purge_one",
"(",
"calc_id",
",",
"user",
")",
":",
"filename",
"=",
"os",
".",
"path",
".",
"join",
"(",
"datadir",
",",
"'calc_%s.hdf5'",
"%",
"calc_id",
")",
"err",
"=",
"dbcmd",
"(",
"'del_calc'",
",",
"calc_id",
",",
"user",
")",
"if",
"e... | Remove one calculation ID from the database and remove its datastore | [
"Remove",
"one",
"calculation",
"ID",
"from",
"the",
"database",
"and",
"remove",
"its",
"datastore"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/commands/purge.py#L28-L38 |
216 | gem/oq-engine | openquake/commands/purge.py | purge_all | def purge_all(user=None, fast=False):
"""
Remove all calculations of the given user
"""
user = user or getpass.getuser()
if os.path.exists(datadir):
if fast:
shutil.rmtree(datadir)
print('Removed %s' % datadir)
else:
for fname in os.listdir(datadir... | python | def purge_all(user=None, fast=False):
"""
Remove all calculations of the given user
"""
user = user or getpass.getuser()
if os.path.exists(datadir):
if fast:
shutil.rmtree(datadir)
print('Removed %s' % datadir)
else:
for fname in os.listdir(datadir... | [
"def",
"purge_all",
"(",
"user",
"=",
"None",
",",
"fast",
"=",
"False",
")",
":",
"user",
"=",
"user",
"or",
"getpass",
".",
"getuser",
"(",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"datadir",
")",
":",
"if",
"fast",
":",
"shutil",
".",... | Remove all calculations of the given user | [
"Remove",
"all",
"calculations",
"of",
"the",
"given",
"user"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/commands/purge.py#L42-L56 |
217 | gem/oq-engine | openquake/commands/purge.py | purge | def purge(calc_id):
"""
Remove the given calculation. If you want to remove all calculations,
use oq reset.
"""
if calc_id < 0:
try:
calc_id = datastore.get_calc_ids(datadir)[calc_id]
except IndexError:
print('Calculation %d not found' % calc_id)
r... | python | def purge(calc_id):
"""
Remove the given calculation. If you want to remove all calculations,
use oq reset.
"""
if calc_id < 0:
try:
calc_id = datastore.get_calc_ids(datadir)[calc_id]
except IndexError:
print('Calculation %d not found' % calc_id)
r... | [
"def",
"purge",
"(",
"calc_id",
")",
":",
"if",
"calc_id",
"<",
"0",
":",
"try",
":",
"calc_id",
"=",
"datastore",
".",
"get_calc_ids",
"(",
"datadir",
")",
"[",
"calc_id",
"]",
"except",
"IndexError",
":",
"print",
"(",
"'Calculation %d not found'",
"%",
... | Remove the given calculation. If you want to remove all calculations,
use oq reset. | [
"Remove",
"the",
"given",
"calculation",
".",
"If",
"you",
"want",
"to",
"remove",
"all",
"calculations",
"use",
"oq",
"reset",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/commands/purge.py#L60-L71 |
218 | gem/oq-engine | openquake/hmtk/plotting/patch.py | PolygonPatch | def PolygonPatch(polygon, **kwargs):
"""Constructs a matplotlib patch from a geometric object
The `polygon` may be a Shapely or GeoJSON-like object possibly with holes.
The `kwargs` are those supported by the matplotlib.patches.Polygon class
constructor. Returns an instance of matplotlib.patches.PathPa... | python | def PolygonPatch(polygon, **kwargs):
"""Constructs a matplotlib patch from a geometric object
The `polygon` may be a Shapely or GeoJSON-like object possibly with holes.
The `kwargs` are those supported by the matplotlib.patches.Polygon class
constructor. Returns an instance of matplotlib.patches.PathPa... | [
"def",
"PolygonPatch",
"(",
"polygon",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"coding",
"(",
"ob",
")",
":",
"# The codes will be all \"LINETO\" commands, except for \"MOVETO\"s at the",
"# beginning of each subpath",
"n",
"=",
"len",
"(",
"getattr",
"(",
"ob",
"... | Constructs a matplotlib patch from a geometric object
The `polygon` may be a Shapely or GeoJSON-like object possibly with holes.
The `kwargs` are those supported by the matplotlib.patches.Polygon class
constructor. Returns an instance of matplotlib.patches.PathPatch.
Example (using Shapely Point and a... | [
"Constructs",
"a",
"matplotlib",
"patch",
"from",
"a",
"geometric",
"object"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hmtk/plotting/patch.py#L43-L93 |
219 | gem/oq-engine | openquake/hazardlib/gsim/kotha_2019.py | KothaEtAl2019.retreive_sigma_mu_data | def retreive_sigma_mu_data(self):
"""
For the general form of the GMPE this retrieves the sigma mu
values from the hdf5 file using the "general" model, i.e. sigma mu
factors that are independent of the choice of region or depth
"""
fle = h5py.File(os.path.join(BASE_PATH,
... | python | def retreive_sigma_mu_data(self):
"""
For the general form of the GMPE this retrieves the sigma mu
values from the hdf5 file using the "general" model, i.e. sigma mu
factors that are independent of the choice of region or depth
"""
fle = h5py.File(os.path.join(BASE_PATH,
... | [
"def",
"retreive_sigma_mu_data",
"(",
"self",
")",
":",
"fle",
"=",
"h5py",
".",
"File",
"(",
"os",
".",
"path",
".",
"join",
"(",
"BASE_PATH",
",",
"\"KothaEtAl2019_SigmaMu_Fixed.hdf5\"",
")",
",",
"\"r\"",
")",
"self",
".",
"mags",
"=",
"fle",
"[",
"\"... | For the general form of the GMPE this retrieves the sigma mu
values from the hdf5 file using the "general" model, i.e. sigma mu
factors that are independent of the choice of region or depth | [
"For",
"the",
"general",
"form",
"of",
"the",
"GMPE",
"this",
"retrieves",
"the",
"sigma",
"mu",
"values",
"from",
"the",
"hdf5",
"file",
"using",
"the",
"general",
"model",
"i",
".",
"e",
".",
"sigma",
"mu",
"factors",
"that",
"are",
"independent",
"of"... | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/kotha_2019.py#L129-L143 |
220 | gem/oq-engine | openquake/hazardlib/gsim/kotha_2019.py | KothaEtAl2019.get_magnitude_scaling | def get_magnitude_scaling(self, C, mag):
"""
Returns the magnitude scaling term
"""
d_m = mag - self.CONSTANTS["Mh"]
if mag < self.CONSTANTS["Mh"]:
return C["e1"] + C["b1"] * d_m + C["b2"] * (d_m ** 2.0)
else:
return C["e1"] + C["b3"] * d_m | python | def get_magnitude_scaling(self, C, mag):
"""
Returns the magnitude scaling term
"""
d_m = mag - self.CONSTANTS["Mh"]
if mag < self.CONSTANTS["Mh"]:
return C["e1"] + C["b1"] * d_m + C["b2"] * (d_m ** 2.0)
else:
return C["e1"] + C["b3"] * d_m | [
"def",
"get_magnitude_scaling",
"(",
"self",
",",
"C",
",",
"mag",
")",
":",
"d_m",
"=",
"mag",
"-",
"self",
".",
"CONSTANTS",
"[",
"\"Mh\"",
"]",
"if",
"mag",
"<",
"self",
".",
"CONSTANTS",
"[",
"\"Mh\"",
"]",
":",
"return",
"C",
"[",
"\"e1\"",
"]... | Returns the magnitude scaling term | [
"Returns",
"the",
"magnitude",
"scaling",
"term"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/kotha_2019.py#L174-L182 |
221 | gem/oq-engine | openquake/hazardlib/gsim/kotha_2019.py | KothaEtAl2019.get_distance_term | def get_distance_term(self, C, rup, rjb, imt):
"""
Returns the distance attenuation factor
"""
h = self._get_h(C, rup.hypo_depth)
rval = np.sqrt(rjb ** 2. + h ** 2.)
c3 = self.get_distance_coefficients(C, imt)
f_r = (C["c1"] + C["c2"] * (rup.mag - self.CONSTANTS[... | python | def get_distance_term(self, C, rup, rjb, imt):
"""
Returns the distance attenuation factor
"""
h = self._get_h(C, rup.hypo_depth)
rval = np.sqrt(rjb ** 2. + h ** 2.)
c3 = self.get_distance_coefficients(C, imt)
f_r = (C["c1"] + C["c2"] * (rup.mag - self.CONSTANTS[... | [
"def",
"get_distance_term",
"(",
"self",
",",
"C",
",",
"rup",
",",
"rjb",
",",
"imt",
")",
":",
"h",
"=",
"self",
".",
"_get_h",
"(",
"C",
",",
"rup",
".",
"hypo_depth",
")",
"rval",
"=",
"np",
".",
"sqrt",
"(",
"rjb",
"**",
"2.",
"+",
"h",
... | Returns the distance attenuation factor | [
"Returns",
"the",
"distance",
"attenuation",
"factor"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/kotha_2019.py#L184-L195 |
222 | gem/oq-engine | openquake/hazardlib/gsim/kotha_2019.py | KothaEtAl2019.get_distance_coefficients | def get_distance_coefficients(self, C, imt):
"""
Returns the c3 term
"""
c3 = self.c3[imt]["c3"] if self.c3 else C["c3"]
return c3 | python | def get_distance_coefficients(self, C, imt):
"""
Returns the c3 term
"""
c3 = self.c3[imt]["c3"] if self.c3 else C["c3"]
return c3 | [
"def",
"get_distance_coefficients",
"(",
"self",
",",
"C",
",",
"imt",
")",
":",
"c3",
"=",
"self",
".",
"c3",
"[",
"imt",
"]",
"[",
"\"c3\"",
"]",
"if",
"self",
".",
"c3",
"else",
"C",
"[",
"\"c3\"",
"]",
"return",
"c3"
] | Returns the c3 term | [
"Returns",
"the",
"c3",
"term"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/kotha_2019.py#L208-L213 |
223 | gem/oq-engine | openquake/hazardlib/gsim/kotha_2019.py | KothaEtAl2019.get_sigma_mu_adjustment | def get_sigma_mu_adjustment(self, C, imt, rup, dists):
"""
Returns the sigma mu adjustment factor
"""
if imt.name in "PGA PGV":
# PGA and PGV are 2D arrays of dimension [nmags, ndists]
sigma_mu = getattr(self, imt.name.lower())
if rup.mag <= self.mags[... | python | def get_sigma_mu_adjustment(self, C, imt, rup, dists):
"""
Returns the sigma mu adjustment factor
"""
if imt.name in "PGA PGV":
# PGA and PGV are 2D arrays of dimension [nmags, ndists]
sigma_mu = getattr(self, imt.name.lower())
if rup.mag <= self.mags[... | [
"def",
"get_sigma_mu_adjustment",
"(",
"self",
",",
"C",
",",
"imt",
",",
"rup",
",",
"dists",
")",
":",
"if",
"imt",
".",
"name",
"in",
"\"PGA PGV\"",
":",
"# PGA and PGV are 2D arrays of dimension [nmags, ndists]",
"sigma_mu",
"=",
"getattr",
"(",
"self",
",",... | Returns the sigma mu adjustment factor | [
"Returns",
"the",
"sigma",
"mu",
"adjustment",
"factor"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/kotha_2019.py#L221-L258 |
224 | gem/oq-engine | openquake/hazardlib/gsim/kotha_2019.py | KothaEtAl2019SERA.get_site_amplification | def get_site_amplification(self, C, sites):
"""
Returns the linear site amplification term depending on whether the
Vs30 is observed of inferred
"""
ampl = np.zeros(sites.vs30.shape)
# For observed vs30 sites
ampl[sites.vs30measured] = (C["d0_obs"] + C["d1_obs"] *... | python | def get_site_amplification(self, C, sites):
"""
Returns the linear site amplification term depending on whether the
Vs30 is observed of inferred
"""
ampl = np.zeros(sites.vs30.shape)
# For observed vs30 sites
ampl[sites.vs30measured] = (C["d0_obs"] + C["d1_obs"] *... | [
"def",
"get_site_amplification",
"(",
"self",
",",
"C",
",",
"sites",
")",
":",
"ampl",
"=",
"np",
".",
"zeros",
"(",
"sites",
".",
"vs30",
".",
"shape",
")",
"# For observed vs30 sites",
"ampl",
"[",
"sites",
".",
"vs30measured",
"]",
"=",
"(",
"C",
"... | Returns the linear site amplification term depending on whether the
Vs30 is observed of inferred | [
"Returns",
"the",
"linear",
"site",
"amplification",
"term",
"depending",
"on",
"whether",
"the",
"Vs30",
"is",
"observed",
"of",
"inferred"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/kotha_2019.py#L332-L344 |
225 | gem/oq-engine | openquake/hazardlib/gsim/kotha_2019.py | KothaEtAl2019SERA.get_stddevs | def get_stddevs(self, C, stddev_shape, stddev_types, sites):
"""
Returns the standard deviations, with different site standard
deviation for inferred vs. observed vs30 sites.
"""
stddevs = []
tau = C["tau_event"]
sigma_s = np.zeros(sites.vs30measured.shape, dtype=... | python | def get_stddevs(self, C, stddev_shape, stddev_types, sites):
"""
Returns the standard deviations, with different site standard
deviation for inferred vs. observed vs30 sites.
"""
stddevs = []
tau = C["tau_event"]
sigma_s = np.zeros(sites.vs30measured.shape, dtype=... | [
"def",
"get_stddevs",
"(",
"self",
",",
"C",
",",
"stddev_shape",
",",
"stddev_types",
",",
"sites",
")",
":",
"stddevs",
"=",
"[",
"]",
"tau",
"=",
"C",
"[",
"\"tau_event\"",
"]",
"sigma_s",
"=",
"np",
".",
"zeros",
"(",
"sites",
".",
"vs30measured",
... | Returns the standard deviations, with different site standard
deviation for inferred vs. observed vs30 sites. | [
"Returns",
"the",
"standard",
"deviations",
"with",
"different",
"site",
"standard",
"deviation",
"for",
"inferred",
"vs",
".",
"observed",
"vs30",
"sites",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/kotha_2019.py#L346-L366 |
226 | gem/oq-engine | openquake/hazardlib/geo/geodetic.py | geodetic_distance | def geodetic_distance(lons1, lats1, lons2, lats2, diameter=2*EARTH_RADIUS):
"""
Calculate the geodetic distance between two points or two collections
of points.
Parameters are coordinates in decimal degrees. They could be scalar
float numbers or numpy arrays, in which case they should "broadcast
... | python | def geodetic_distance(lons1, lats1, lons2, lats2, diameter=2*EARTH_RADIUS):
"""
Calculate the geodetic distance between two points or two collections
of points.
Parameters are coordinates in decimal degrees. They could be scalar
float numbers or numpy arrays, in which case they should "broadcast
... | [
"def",
"geodetic_distance",
"(",
"lons1",
",",
"lats1",
",",
"lons2",
",",
"lats2",
",",
"diameter",
"=",
"2",
"*",
"EARTH_RADIUS",
")",
":",
"lons1",
",",
"lats1",
",",
"lons2",
",",
"lats2",
"=",
"_prepare_coords",
"(",
"lons1",
",",
"lats1",
",",
"l... | Calculate the geodetic distance between two points or two collections
of points.
Parameters are coordinates in decimal degrees. They could be scalar
float numbers or numpy arrays, in which case they should "broadcast
together".
Implements http://williams.best.vwh.net/avform.htm#Dist
:returns:... | [
"Calculate",
"the",
"geodetic",
"distance",
"between",
"two",
"points",
"or",
"two",
"collections",
"of",
"points",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/geodetic.py#L34-L54 |
227 | gem/oq-engine | openquake/hazardlib/geo/geodetic.py | azimuth | def azimuth(lons1, lats1, lons2, lats2):
"""
Calculate the azimuth between two points or two collections of points.
Parameters are the same as for :func:`geodetic_distance`.
Implements an "alternative formula" from
http://williams.best.vwh.net/avform.htm#Crs
:returns:
Azimuth as an an... | python | def azimuth(lons1, lats1, lons2, lats2):
"""
Calculate the azimuth between two points or two collections of points.
Parameters are the same as for :func:`geodetic_distance`.
Implements an "alternative formula" from
http://williams.best.vwh.net/avform.htm#Crs
:returns:
Azimuth as an an... | [
"def",
"azimuth",
"(",
"lons1",
",",
"lats1",
",",
"lons2",
",",
"lats2",
")",
":",
"lons1",
",",
"lats1",
",",
"lons2",
",",
"lats2",
"=",
"_prepare_coords",
"(",
"lons1",
",",
"lats1",
",",
"lons2",
",",
"lats2",
")",
"cos_lat2",
"=",
"numpy",
".",... | Calculate the azimuth between two points or two collections of points.
Parameters are the same as for :func:`geodetic_distance`.
Implements an "alternative formula" from
http://williams.best.vwh.net/avform.htm#Crs
:returns:
Azimuth as an angle between direction to north from first point and
... | [
"Calculate",
"the",
"azimuth",
"between",
"two",
"points",
"or",
"two",
"collections",
"of",
"points",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/geodetic.py#L57-L77 |
228 | gem/oq-engine | openquake/hazardlib/geo/geodetic.py | min_distance_to_segment | def min_distance_to_segment(seglons, seglats, lons, lats):
"""
This function computes the shortest distance to a segment in a 2D reference
system.
:parameter seglons:
A list or an array of floats specifying the longitude values of the two
vertexes delimiting the segment.
:parameter ... | python | def min_distance_to_segment(seglons, seglats, lons, lats):
"""
This function computes the shortest distance to a segment in a 2D reference
system.
:parameter seglons:
A list or an array of floats specifying the longitude values of the two
vertexes delimiting the segment.
:parameter ... | [
"def",
"min_distance_to_segment",
"(",
"seglons",
",",
"seglats",
",",
"lons",
",",
"lats",
")",
":",
"# Check the size of the seglons, seglats arrays",
"assert",
"len",
"(",
"seglons",
")",
"==",
"len",
"(",
"seglats",
")",
"==",
"2",
"# Compute the azimuth of the ... | This function computes the shortest distance to a segment in a 2D reference
system.
:parameter seglons:
A list or an array of floats specifying the longitude values of the two
vertexes delimiting the segment.
:parameter seglats:
A list or an array of floats specifying the latitude v... | [
"This",
"function",
"computes",
"the",
"shortest",
"distance",
"to",
"a",
"segment",
"in",
"a",
"2D",
"reference",
"system",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/geodetic.py#L99-L174 |
229 | gem/oq-engine | openquake/hazardlib/geo/geodetic.py | min_geodetic_distance | def min_geodetic_distance(a, b):
"""
Compute the minimum distance between first mesh and each point
of the second mesh when both are defined on the earth surface.
:param a: a pair of (lons, lats) or an array of cartesian coordinates
:param b: a pair of (lons, lats) or an array of cartesian coordina... | python | def min_geodetic_distance(a, b):
"""
Compute the minimum distance between first mesh and each point
of the second mesh when both are defined on the earth surface.
:param a: a pair of (lons, lats) or an array of cartesian coordinates
:param b: a pair of (lons, lats) or an array of cartesian coordina... | [
"def",
"min_geodetic_distance",
"(",
"a",
",",
"b",
")",
":",
"if",
"isinstance",
"(",
"a",
",",
"tuple",
")",
":",
"a",
"=",
"spherical_to_cartesian",
"(",
"a",
"[",
"0",
"]",
".",
"flatten",
"(",
")",
",",
"a",
"[",
"1",
"]",
".",
"flatten",
"(... | Compute the minimum distance between first mesh and each point
of the second mesh when both are defined on the earth surface.
:param a: a pair of (lons, lats) or an array of cartesian coordinates
:param b: a pair of (lons, lats) or an array of cartesian coordinates | [
"Compute",
"the",
"minimum",
"distance",
"between",
"first",
"mesh",
"and",
"each",
"point",
"of",
"the",
"second",
"mesh",
"when",
"both",
"are",
"defined",
"on",
"the",
"earth",
"surface",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/geodetic.py#L224-L236 |
230 | gem/oq-engine | openquake/hazardlib/geo/geodetic.py | intervals_between | def intervals_between(lon1, lat1, depth1, lon2, lat2, depth2, length):
"""
Find a list of points between two given ones that lie on the same
great circle arc and are equally spaced by ``length`` km.
:param float lon1, lat1, depth1:
Coordinates of a point to start placing intervals from. The fir... | python | def intervals_between(lon1, lat1, depth1, lon2, lat2, depth2, length):
"""
Find a list of points between two given ones that lie on the same
great circle arc and are equally spaced by ``length`` km.
:param float lon1, lat1, depth1:
Coordinates of a point to start placing intervals from. The fir... | [
"def",
"intervals_between",
"(",
"lon1",
",",
"lat1",
",",
"depth1",
",",
"lon2",
",",
"lat2",
",",
"depth2",
",",
"length",
")",
":",
"assert",
"length",
">",
"0",
"hdist",
"=",
"geodetic_distance",
"(",
"lon1",
",",
"lat1",
",",
"lon2",
",",
"lat2",
... | Find a list of points between two given ones that lie on the same
great circle arc and are equally spaced by ``length`` km.
:param float lon1, lat1, depth1:
Coordinates of a point to start placing intervals from. The first
point in the resulting list has these coordinates.
:param float lon2... | [
"Find",
"a",
"list",
"of",
"points",
"between",
"two",
"given",
"ones",
"that",
"lie",
"on",
"the",
"same",
"great",
"circle",
"arc",
"and",
"are",
"equally",
"spaced",
"by",
"length",
"km",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/geodetic.py#L259-L302 |
231 | gem/oq-engine | openquake/hazardlib/geo/geodetic.py | npoints_between | def npoints_between(lon1, lat1, depth1, lon2, lat2, depth2, npoints):
"""
Find a list of specified number of points between two given ones that are
equally spaced along the great circle arc connecting given points.
:param float lon1, lat1, depth1:
Coordinates of a point to start from. The first... | python | def npoints_between(lon1, lat1, depth1, lon2, lat2, depth2, npoints):
"""
Find a list of specified number of points between two given ones that are
equally spaced along the great circle arc connecting given points.
:param float lon1, lat1, depth1:
Coordinates of a point to start from. The first... | [
"def",
"npoints_between",
"(",
"lon1",
",",
"lat1",
",",
"depth1",
",",
"lon2",
",",
"lat2",
",",
"depth2",
",",
"npoints",
")",
":",
"hdist",
"=",
"geodetic_distance",
"(",
"lon1",
",",
"lat1",
",",
"lon2",
",",
"lat2",
")",
"vdist",
"=",
"depth2",
... | Find a list of specified number of points between two given ones that are
equally spaced along the great circle arc connecting given points.
:param float lon1, lat1, depth1:
Coordinates of a point to start from. The first point in a resulting
list has these coordinates.
:param float lon2, l... | [
"Find",
"a",
"list",
"of",
"specified",
"number",
"of",
"points",
"between",
"two",
"given",
"ones",
"that",
"are",
"equally",
"spaced",
"along",
"the",
"great",
"circle",
"arc",
"connecting",
"given",
"points",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/geodetic.py#L305-L336 |
232 | gem/oq-engine | openquake/hazardlib/geo/geodetic.py | npoints_towards | def npoints_towards(lon, lat, depth, azimuth, hdist, vdist, npoints):
"""
Find a list of specified number of points starting from a given one
along a great circle arc with a given azimuth measured in a given point.
:param float lon, lat, depth:
Coordinates of a point to start from. The first po... | python | def npoints_towards(lon, lat, depth, azimuth, hdist, vdist, npoints):
"""
Find a list of specified number of points starting from a given one
along a great circle arc with a given azimuth measured in a given point.
:param float lon, lat, depth:
Coordinates of a point to start from. The first po... | [
"def",
"npoints_towards",
"(",
"lon",
",",
"lat",
",",
"depth",
",",
"azimuth",
",",
"hdist",
",",
"vdist",
",",
"npoints",
")",
":",
"assert",
"npoints",
">",
"1",
"rlon",
",",
"rlat",
"=",
"numpy",
".",
"radians",
"(",
"lon",
")",
",",
"numpy",
"... | Find a list of specified number of points starting from a given one
along a great circle arc with a given azimuth measured in a given point.
:param float lon, lat, depth:
Coordinates of a point to start from. The first point in a resulting
list has these coordinates.
:param azimuth:
... | [
"Find",
"a",
"list",
"of",
"specified",
"number",
"of",
"points",
"starting",
"from",
"a",
"given",
"one",
"along",
"a",
"great",
"circle",
"arc",
"with",
"a",
"given",
"azimuth",
"measured",
"in",
"a",
"given",
"point",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/geodetic.py#L339-L393 |
233 | gem/oq-engine | openquake/hazardlib/geo/geodetic.py | _prepare_coords | def _prepare_coords(lons1, lats1, lons2, lats2):
"""
Convert two pairs of spherical coordinates in decimal degrees
to numpy arrays of radians. Makes sure that respective coordinates
in pairs have the same shape.
"""
lons1 = numpy.radians(lons1)
lats1 = numpy.radians(lats1)
assert lons1.s... | python | def _prepare_coords(lons1, lats1, lons2, lats2):
"""
Convert two pairs of spherical coordinates in decimal degrees
to numpy arrays of radians. Makes sure that respective coordinates
in pairs have the same shape.
"""
lons1 = numpy.radians(lons1)
lats1 = numpy.radians(lats1)
assert lons1.s... | [
"def",
"_prepare_coords",
"(",
"lons1",
",",
"lats1",
",",
"lons2",
",",
"lats2",
")",
":",
"lons1",
"=",
"numpy",
".",
"radians",
"(",
"lons1",
")",
"lats1",
"=",
"numpy",
".",
"radians",
"(",
"lats1",
")",
"assert",
"lons1",
".",
"shape",
"==",
"la... | Convert two pairs of spherical coordinates in decimal degrees
to numpy arrays of radians. Makes sure that respective coordinates
in pairs have the same shape. | [
"Convert",
"two",
"pairs",
"of",
"spherical",
"coordinates",
"in",
"decimal",
"degrees",
"to",
"numpy",
"arrays",
"of",
"radians",
".",
"Makes",
"sure",
"that",
"respective",
"coordinates",
"in",
"pairs",
"have",
"the",
"same",
"shape",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/geodetic.py#L528-L540 |
234 | gem/oq-engine | openquake/hmtk/sources/simple_fault_source.py | mtkSimpleFaultSource.select_catalogue | def select_catalogue(self, selector, distance,
distance_metric='joyner-boore', upper_eq_depth=None,
lower_eq_depth=None):
'''
Selects earthquakes within a distance of the fault
:param selector:
Populated instance of :class:
... | python | def select_catalogue(self, selector, distance,
distance_metric='joyner-boore', upper_eq_depth=None,
lower_eq_depth=None):
'''
Selects earthquakes within a distance of the fault
:param selector:
Populated instance of :class:
... | [
"def",
"select_catalogue",
"(",
"self",
",",
"selector",
",",
"distance",
",",
"distance_metric",
"=",
"'joyner-boore'",
",",
"upper_eq_depth",
"=",
"None",
",",
"lower_eq_depth",
"=",
"None",
")",
":",
"if",
"selector",
".",
"catalogue",
".",
"get_number_events... | Selects earthquakes within a distance of the fault
:param selector:
Populated instance of :class:
`openquake.hmtk.seismicity.selector.CatalogueSelector`
:param distance:
Distance from point (km) for selection
:param str distance_metric
Choice of... | [
"Selects",
"earthquakes",
"within",
"a",
"distance",
"of",
"the",
"fault"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hmtk/sources/simple_fault_source.py#L191-L237 |
235 | gem/oq-engine | openquake/hmtk/plotting/faults/geology_mfd_plot.py | plot_recurrence_models | def plot_recurrence_models(
configs, area, slip, msr, rake,
shear_modulus=30.0, disp_length_ratio=1.25E-5, msr_sigma=0.,
figure_size=(8, 6), filename=None, filetype='png', dpi=300, ax=None):
"""
Plots a set of recurrence models
:param list configs:
List of configuration dict... | python | def plot_recurrence_models(
configs, area, slip, msr, rake,
shear_modulus=30.0, disp_length_ratio=1.25E-5, msr_sigma=0.,
figure_size=(8, 6), filename=None, filetype='png', dpi=300, ax=None):
"""
Plots a set of recurrence models
:param list configs:
List of configuration dict... | [
"def",
"plot_recurrence_models",
"(",
"configs",
",",
"area",
",",
"slip",
",",
"msr",
",",
"rake",
",",
"shear_modulus",
"=",
"30.0",
",",
"disp_length_ratio",
"=",
"1.25E-5",
",",
"msr_sigma",
"=",
"0.",
",",
"figure_size",
"=",
"(",
"8",
",",
"6",
")"... | Plots a set of recurrence models
:param list configs:
List of configuration dictionaries | [
"Plots",
"a",
"set",
"of",
"recurrence",
"models"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hmtk/plotting/faults/geology_mfd_plot.py#L69-L105 |
236 | gem/oq-engine | openquake/hazardlib/sourcewriter.py | build_area_source_geometry | def build_area_source_geometry(area_source):
"""
Returns the area source geometry as a Node
:param area_source:
Area source model as an instance of the :class:
`openquake.hazardlib.source.area.AreaSource`
:returns:
Instance of :class:`openquake.baselib.node.Node`
"""
geo... | python | def build_area_source_geometry(area_source):
"""
Returns the area source geometry as a Node
:param area_source:
Area source model as an instance of the :class:
`openquake.hazardlib.source.area.AreaSource`
:returns:
Instance of :class:`openquake.baselib.node.Node`
"""
geo... | [
"def",
"build_area_source_geometry",
"(",
"area_source",
")",
":",
"geom",
"=",
"[",
"]",
"for",
"lon_lat",
"in",
"zip",
"(",
"area_source",
".",
"polygon",
".",
"lons",
",",
"area_source",
".",
"polygon",
".",
"lats",
")",
":",
"geom",
".",
"extend",
"(... | Returns the area source geometry as a Node
:param area_source:
Area source model as an instance of the :class:
`openquake.hazardlib.source.area.AreaSource`
:returns:
Instance of :class:`openquake.baselib.node.Node` | [
"Returns",
"the",
"area",
"source",
"geometry",
"as",
"a",
"Node"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/sourcewriter.py#L35-L58 |
237 | gem/oq-engine | openquake/hazardlib/sourcewriter.py | build_point_source_geometry | def build_point_source_geometry(point_source):
"""
Returns the poing source geometry as a Node
:param point_source:
Point source model as an instance of the :class:
`openquake.hazardlib.source.point.PointSource`
:returns:
Instance of :class:`openquake.baselib.node.Node`
"""
... | python | def build_point_source_geometry(point_source):
"""
Returns the poing source geometry as a Node
:param point_source:
Point source model as an instance of the :class:
`openquake.hazardlib.source.point.PointSource`
:returns:
Instance of :class:`openquake.baselib.node.Node`
"""
... | [
"def",
"build_point_source_geometry",
"(",
"point_source",
")",
":",
"xy",
"=",
"point_source",
".",
"location",
".",
"x",
",",
"point_source",
".",
"location",
".",
"y",
"pos_node",
"=",
"Node",
"(",
"\"gml:pos\"",
",",
"text",
"=",
"xy",
")",
"point_node",... | Returns the poing source geometry as a Node
:param point_source:
Point source model as an instance of the :class:
`openquake.hazardlib.source.point.PointSource`
:returns:
Instance of :class:`openquake.baselib.node.Node` | [
"Returns",
"the",
"poing",
"source",
"geometry",
"as",
"a",
"Node"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/sourcewriter.py#L61-L80 |
238 | gem/oq-engine | openquake/hazardlib/sourcewriter.py | build_linestring_node | def build_linestring_node(line, with_depth=False):
"""
Parses a line to a Node class
:param line:
Line as instance of :class:`openquake.hazardlib.geo.line.Line`
:param bool with_depth:
Include the depth values (True) or not (False):
:returns:
Instance of :class:`openquake.ba... | python | def build_linestring_node(line, with_depth=False):
"""
Parses a line to a Node class
:param line:
Line as instance of :class:`openquake.hazardlib.geo.line.Line`
:param bool with_depth:
Include the depth values (True) or not (False):
:returns:
Instance of :class:`openquake.ba... | [
"def",
"build_linestring_node",
"(",
"line",
",",
"with_depth",
"=",
"False",
")",
":",
"geom",
"=",
"[",
"]",
"for",
"p",
"in",
"line",
".",
"points",
":",
"if",
"with_depth",
":",
"geom",
".",
"extend",
"(",
"(",
"p",
".",
"x",
",",
"p",
".",
"... | Parses a line to a Node class
:param line:
Line as instance of :class:`openquake.hazardlib.geo.line.Line`
:param bool with_depth:
Include the depth values (True) or not (False):
:returns:
Instance of :class:`openquake.baselib.node.Node` | [
"Parses",
"a",
"line",
"to",
"a",
"Node",
"class"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/sourcewriter.py#L83-L101 |
239 | gem/oq-engine | openquake/hazardlib/sourcewriter.py | build_simple_fault_geometry | def build_simple_fault_geometry(fault_source):
"""
Returns the simple fault source geometry as a Node
:param fault_source:
Simple fault source model as an instance of the :class:
`openquake.hazardlib.source.simple_fault.SimpleFaultSource`
:returns:
Instance of :class:`openquake.... | python | def build_simple_fault_geometry(fault_source):
"""
Returns the simple fault source geometry as a Node
:param fault_source:
Simple fault source model as an instance of the :class:
`openquake.hazardlib.source.simple_fault.SimpleFaultSource`
:returns:
Instance of :class:`openquake.... | [
"def",
"build_simple_fault_geometry",
"(",
"fault_source",
")",
":",
"linestring_node",
"=",
"build_linestring_node",
"(",
"fault_source",
".",
"fault_trace",
",",
"with_depth",
"=",
"False",
")",
"dip_node",
"=",
"Node",
"(",
"\"dip\"",
",",
"text",
"=",
"fault_s... | Returns the simple fault source geometry as a Node
:param fault_source:
Simple fault source model as an instance of the :class:
`openquake.hazardlib.source.simple_fault.SimpleFaultSource`
:returns:
Instance of :class:`openquake.baselib.node.Node` | [
"Returns",
"the",
"simple",
"fault",
"source",
"geometry",
"as",
"a",
"Node"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/sourcewriter.py#L104-L123 |
240 | gem/oq-engine | openquake/hazardlib/sourcewriter.py | build_complex_fault_geometry | def build_complex_fault_geometry(fault_source):
"""
Returns the complex fault source geometry as a Node
:param fault_source:
Complex fault source model as an instance of the :class:
`openquake.hazardlib.source.complex_fault.ComplexFaultSource`
:returns:
Instance of :class:`openq... | python | def build_complex_fault_geometry(fault_source):
"""
Returns the complex fault source geometry as a Node
:param fault_source:
Complex fault source model as an instance of the :class:
`openquake.hazardlib.source.complex_fault.ComplexFaultSource`
:returns:
Instance of :class:`openq... | [
"def",
"build_complex_fault_geometry",
"(",
"fault_source",
")",
":",
"num_edges",
"=",
"len",
"(",
"fault_source",
".",
"edges",
")",
"edge_nodes",
"=",
"[",
"]",
"for",
"iloc",
",",
"edge",
"in",
"enumerate",
"(",
"fault_source",
".",
"edges",
")",
":",
... | Returns the complex fault source geometry as a Node
:param fault_source:
Complex fault source model as an instance of the :class:
`openquake.hazardlib.source.complex_fault.ComplexFaultSource`
:returns:
Instance of :class:`openquake.baselib.node.Node` | [
"Returns",
"the",
"complex",
"fault",
"source",
"geometry",
"as",
"a",
"Node"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/sourcewriter.py#L126-L152 |
241 | gem/oq-engine | openquake/hazardlib/sourcewriter.py | build_evenly_discretised_mfd | def build_evenly_discretised_mfd(mfd):
"""
Returns the evenly discretized MFD as a Node
:param mfd:
MFD as instance of :class:
`openquake.hazardlib.mfd.evenly_discretized.EvenlyDiscretizedMFD`
:returns:
Instance of :class:`openquake.baselib.node.Node`
"""
occur_rates = N... | python | def build_evenly_discretised_mfd(mfd):
"""
Returns the evenly discretized MFD as a Node
:param mfd:
MFD as instance of :class:
`openquake.hazardlib.mfd.evenly_discretized.EvenlyDiscretizedMFD`
:returns:
Instance of :class:`openquake.baselib.node.Node`
"""
occur_rates = N... | [
"def",
"build_evenly_discretised_mfd",
"(",
"mfd",
")",
":",
"occur_rates",
"=",
"Node",
"(",
"\"occurRates\"",
",",
"text",
"=",
"mfd",
".",
"occurrence_rates",
")",
"return",
"Node",
"(",
"\"incrementalMFD\"",
",",
"{",
"\"binWidth\"",
":",
"mfd",
".",
"bin_... | Returns the evenly discretized MFD as a Node
:param mfd:
MFD as instance of :class:
`openquake.hazardlib.mfd.evenly_discretized.EvenlyDiscretizedMFD`
:returns:
Instance of :class:`openquake.baselib.node.Node` | [
"Returns",
"the",
"evenly",
"discretized",
"MFD",
"as",
"a",
"Node"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/sourcewriter.py#L156-L169 |
242 | gem/oq-engine | openquake/hazardlib/sourcewriter.py | build_truncated_gr_mfd | def build_truncated_gr_mfd(mfd):
"""
Parses the truncated Gutenberg Richter MFD as a Node
:param mfd:
MFD as instance of :class:
`openquake.hazardlib.mfd.truncated_gr.TruncatedGRMFD`
:returns:
Instance of :class:`openquake.baselib.node.Node`
"""
return Node("truncGutenbe... | python | def build_truncated_gr_mfd(mfd):
"""
Parses the truncated Gutenberg Richter MFD as a Node
:param mfd:
MFD as instance of :class:
`openquake.hazardlib.mfd.truncated_gr.TruncatedGRMFD`
:returns:
Instance of :class:`openquake.baselib.node.Node`
"""
return Node("truncGutenbe... | [
"def",
"build_truncated_gr_mfd",
"(",
"mfd",
")",
":",
"return",
"Node",
"(",
"\"truncGutenbergRichterMFD\"",
",",
"{",
"\"aValue\"",
":",
"mfd",
".",
"a_val",
",",
"\"bValue\"",
":",
"mfd",
".",
"b_val",
",",
"\"minMag\"",
":",
"mfd",
".",
"min_mag",
",",
... | Parses the truncated Gutenberg Richter MFD as a Node
:param mfd:
MFD as instance of :class:
`openquake.hazardlib.mfd.truncated_gr.TruncatedGRMFD`
:returns:
Instance of :class:`openquake.baselib.node.Node` | [
"Parses",
"the",
"truncated",
"Gutenberg",
"Richter",
"MFD",
"as",
"a",
"Node"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/sourcewriter.py#L173-L185 |
243 | gem/oq-engine | openquake/hazardlib/sourcewriter.py | build_arbitrary_mfd | def build_arbitrary_mfd(mfd):
"""
Parses the arbitrary MFD as a Node
:param mfd:
MFD as instance of :class:
`openquake.hazardlib.mfd.arbitrary.ArbitraryMFD`
:returns:
Instance of :class:`openquake.baselib.node.Node`
"""
magnitudes = Node("magnitudes", text=mfd.magnitudes... | python | def build_arbitrary_mfd(mfd):
"""
Parses the arbitrary MFD as a Node
:param mfd:
MFD as instance of :class:
`openquake.hazardlib.mfd.arbitrary.ArbitraryMFD`
:returns:
Instance of :class:`openquake.baselib.node.Node`
"""
magnitudes = Node("magnitudes", text=mfd.magnitudes... | [
"def",
"build_arbitrary_mfd",
"(",
"mfd",
")",
":",
"magnitudes",
"=",
"Node",
"(",
"\"magnitudes\"",
",",
"text",
"=",
"mfd",
".",
"magnitudes",
")",
"occur_rates",
"=",
"Node",
"(",
"\"occurRates\"",
",",
"text",
"=",
"mfd",
".",
"occurrence_rates",
")",
... | Parses the arbitrary MFD as a Node
:param mfd:
MFD as instance of :class:
`openquake.hazardlib.mfd.arbitrary.ArbitraryMFD`
:returns:
Instance of :class:`openquake.baselib.node.Node` | [
"Parses",
"the",
"arbitrary",
"MFD",
"as",
"a",
"Node"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/sourcewriter.py#L189-L201 |
244 | gem/oq-engine | openquake/hazardlib/sourcewriter.py | build_youngs_coppersmith_mfd | def build_youngs_coppersmith_mfd(mfd):
"""
Parses the Youngs & Coppersmith MFD as a node. Note that the MFD does
not hold the total moment rate, but only the characteristic rate. Therefore
the node is written to the characteristic rate version regardless of
whether or not it was originally created f... | python | def build_youngs_coppersmith_mfd(mfd):
"""
Parses the Youngs & Coppersmith MFD as a node. Note that the MFD does
not hold the total moment rate, but only the characteristic rate. Therefore
the node is written to the characteristic rate version regardless of
whether or not it was originally created f... | [
"def",
"build_youngs_coppersmith_mfd",
"(",
"mfd",
")",
":",
"return",
"Node",
"(",
"\"YoungsCoppersmithMFD\"",
",",
"{",
"\"minMag\"",
":",
"mfd",
".",
"min_mag",
",",
"\"bValue\"",
":",
"mfd",
".",
"b_val",
",",
"\"characteristicMag\"",
":",
"mfd",
".",
"cha... | Parses the Youngs & Coppersmith MFD as a node. Note that the MFD does
not hold the total moment rate, but only the characteristic rate. Therefore
the node is written to the characteristic rate version regardless of
whether or not it was originally created from total moment rate
:param mfd:
MFD ... | [
"Parses",
"the",
"Youngs",
"&",
"Coppersmith",
"MFD",
"as",
"a",
"node",
".",
"Note",
"that",
"the",
"MFD",
"does",
"not",
"hold",
"the",
"total",
"moment",
"rate",
"but",
"only",
"the",
"characteristic",
"rate",
".",
"Therefore",
"the",
"node",
"is",
"w... | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/sourcewriter.py#L205-L223 |
245 | gem/oq-engine | openquake/hazardlib/sourcewriter.py | build_multi_mfd | def build_multi_mfd(mfd):
"""
Parses the MultiMFD as a Node
:param mfd:
MFD as instance of :class:
`openquake.hazardlib.mfd.multi_mfd.MultiMFD`
:returns:
Instance of :class:`openquake.baselib.node.Node`
"""
node = Node("multiMFD", dict(kind=mfd.kind, size=mfd.size))
... | python | def build_multi_mfd(mfd):
"""
Parses the MultiMFD as a Node
:param mfd:
MFD as instance of :class:
`openquake.hazardlib.mfd.multi_mfd.MultiMFD`
:returns:
Instance of :class:`openquake.baselib.node.Node`
"""
node = Node("multiMFD", dict(kind=mfd.kind, size=mfd.size))
... | [
"def",
"build_multi_mfd",
"(",
"mfd",
")",
":",
"node",
"=",
"Node",
"(",
"\"multiMFD\"",
",",
"dict",
"(",
"kind",
"=",
"mfd",
".",
"kind",
",",
"size",
"=",
"mfd",
".",
"size",
")",
")",
"for",
"name",
"in",
"sorted",
"(",
"mfd",
".",
"kwargs",
... | Parses the MultiMFD as a Node
:param mfd:
MFD as instance of :class:
`openquake.hazardlib.mfd.multi_mfd.MultiMFD`
:returns:
Instance of :class:`openquake.baselib.node.Node` | [
"Parses",
"the",
"MultiMFD",
"as",
"a",
"Node"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/sourcewriter.py#L227-L249 |
246 | gem/oq-engine | openquake/hazardlib/sourcewriter.py | build_nodal_plane_dist | def build_nodal_plane_dist(npd):
"""
Returns the nodal plane distribution as a Node instance
:param npd:
Nodal plane distribution as instance of :class:
`openquake.hazardlib.pmf.PMF`
:returns:
Instance of :class:`openquake.baselib.node.Node`
"""
npds = []
for prob, n... | python | def build_nodal_plane_dist(npd):
"""
Returns the nodal plane distribution as a Node instance
:param npd:
Nodal plane distribution as instance of :class:
`openquake.hazardlib.pmf.PMF`
:returns:
Instance of :class:`openquake.baselib.node.Node`
"""
npds = []
for prob, n... | [
"def",
"build_nodal_plane_dist",
"(",
"npd",
")",
":",
"npds",
"=",
"[",
"]",
"for",
"prob",
",",
"npd",
"in",
"npd",
".",
"data",
":",
"nodal_plane",
"=",
"Node",
"(",
"\"nodalPlane\"",
",",
"{",
"\"dip\"",
":",
"npd",
".",
"dip",
",",
"\"probability\... | Returns the nodal plane distribution as a Node instance
:param npd:
Nodal plane distribution as instance of :class:
`openquake.hazardlib.pmf.PMF`
:returns:
Instance of :class:`openquake.baselib.node.Node` | [
"Returns",
"the",
"nodal",
"plane",
"distribution",
"as",
"a",
"Node",
"instance"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/sourcewriter.py#L252-L268 |
247 | gem/oq-engine | openquake/hazardlib/sourcewriter.py | build_hypo_depth_dist | def build_hypo_depth_dist(hdd):
"""
Returns the hypocentral depth distribution as a Node instance
:param hdd:
Hypocentral depth distribution as an instance of :class:
`openquake.hzardlib.pmf.PMF`
:returns:
Instance of :class:`openquake.baselib.node.Node`
"""
hdds = []
... | python | def build_hypo_depth_dist(hdd):
"""
Returns the hypocentral depth distribution as a Node instance
:param hdd:
Hypocentral depth distribution as an instance of :class:
`openquake.hzardlib.pmf.PMF`
:returns:
Instance of :class:`openquake.baselib.node.Node`
"""
hdds = []
... | [
"def",
"build_hypo_depth_dist",
"(",
"hdd",
")",
":",
"hdds",
"=",
"[",
"]",
"for",
"(",
"prob",
",",
"depth",
")",
"in",
"hdd",
".",
"data",
":",
"hdds",
".",
"append",
"(",
"Node",
"(",
"\"hypoDepth\"",
",",
"{",
"\"depth\"",
":",
"depth",
",",
"... | Returns the hypocentral depth distribution as a Node instance
:param hdd:
Hypocentral depth distribution as an instance of :class:
`openquake.hzardlib.pmf.PMF`
:returns:
Instance of :class:`openquake.baselib.node.Node` | [
"Returns",
"the",
"hypocentral",
"depth",
"distribution",
"as",
"a",
"Node",
"instance"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/sourcewriter.py#L271-L285 |
248 | gem/oq-engine | openquake/hazardlib/sourcewriter.py | get_distributed_seismicity_source_nodes | def get_distributed_seismicity_source_nodes(source):
"""
Returns list of nodes of attributes common to all distributed seismicity
source classes
:param source:
Seismic source as instance of :class:
`openquake.hazardlib.source.area.AreaSource` or :class:
`openquake.hazardlib.sour... | python | def get_distributed_seismicity_source_nodes(source):
"""
Returns list of nodes of attributes common to all distributed seismicity
source classes
:param source:
Seismic source as instance of :class:
`openquake.hazardlib.source.area.AreaSource` or :class:
`openquake.hazardlib.sour... | [
"def",
"get_distributed_seismicity_source_nodes",
"(",
"source",
")",
":",
"source_nodes",
"=",
"[",
"]",
"# parse msr",
"source_nodes",
".",
"append",
"(",
"Node",
"(",
"\"magScaleRel\"",
",",
"text",
"=",
"source",
".",
"magnitude_scaling_relationship",
".",
"__c... | Returns list of nodes of attributes common to all distributed seismicity
source classes
:param source:
Seismic source as instance of :class:
`openquake.hazardlib.source.area.AreaSource` or :class:
`openquake.hazardlib.source.point.PointSource`
:returns:
List of instances of ... | [
"Returns",
"list",
"of",
"nodes",
"of",
"attributes",
"common",
"to",
"all",
"distributed",
"seismicity",
"source",
"classes"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/sourcewriter.py#L288-L316 |
249 | gem/oq-engine | openquake/hazardlib/sourcewriter.py | get_fault_source_nodes | def get_fault_source_nodes(source):
"""
Returns list of nodes of attributes common to all fault source classes
:param source:
Fault source as instance of :class:
`openquake.hazardlib.source.simple_fault.SimpleFaultSource` or :class:
`openquake.hazardlib.source.complex_fault.ComplexF... | python | def get_fault_source_nodes(source):
"""
Returns list of nodes of attributes common to all fault source classes
:param source:
Fault source as instance of :class:
`openquake.hazardlib.source.simple_fault.SimpleFaultSource` or :class:
`openquake.hazardlib.source.complex_fault.ComplexF... | [
"def",
"get_fault_source_nodes",
"(",
"source",
")",
":",
"source_nodes",
"=",
"[",
"]",
"# parse msr",
"source_nodes",
".",
"append",
"(",
"Node",
"(",
"\"magScaleRel\"",
",",
"text",
"=",
"source",
".",
"magnitude_scaling_relationship",
".",
"__class__",
".",
... | Returns list of nodes of attributes common to all fault source classes
:param source:
Fault source as instance of :class:
`openquake.hazardlib.source.simple_fault.SimpleFaultSource` or :class:
`openquake.hazardlib.source.complex_fault.ComplexFaultSource`
:returns:
List of instan... | [
"Returns",
"list",
"of",
"nodes",
"of",
"attributes",
"common",
"to",
"all",
"fault",
"source",
"classes"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/sourcewriter.py#L348-L376 |
250 | gem/oq-engine | openquake/hazardlib/sourcewriter.py | get_source_attributes | def get_source_attributes(source):
"""
Retreives a dictionary of source attributes from the source class
:param source:
Seismic source as instance of :class:
`openquake.hazardlib.source.base.BaseSeismicSource`
:returns:
Dictionary of source attributes
"""
attrs = {"id": ... | python | def get_source_attributes(source):
"""
Retreives a dictionary of source attributes from the source class
:param source:
Seismic source as instance of :class:
`openquake.hazardlib.source.base.BaseSeismicSource`
:returns:
Dictionary of source attributes
"""
attrs = {"id": ... | [
"def",
"get_source_attributes",
"(",
"source",
")",
":",
"attrs",
"=",
"{",
"\"id\"",
":",
"source",
".",
"source_id",
",",
"\"name\"",
":",
"source",
".",
"name",
",",
"\"tectonicRegion\"",
":",
"source",
".",
"tectonic_region_type",
"}",
"if",
"isinstance",
... | Retreives a dictionary of source attributes from the source class
:param source:
Seismic source as instance of :class:
`openquake.hazardlib.source.base.BaseSeismicSource`
:returns:
Dictionary of source attributes | [
"Retreives",
"a",
"dictionary",
"of",
"source",
"attributes",
"from",
"the",
"source",
"class"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/sourcewriter.py#L379-L399 |
251 | gem/oq-engine | openquake/hazardlib/sourcewriter.py | build_area_source_node | def build_area_source_node(area_source):
"""
Parses an area source to a Node class
:param area_source:
Area source as instance of :class:
`openquake.hazardlib.source.area.AreaSource`
:returns:
Instance of :class:`openquake.baselib.node.Node`
"""
# parse geometry
sour... | python | def build_area_source_node(area_source):
"""
Parses an area source to a Node class
:param area_source:
Area source as instance of :class:
`openquake.hazardlib.source.area.AreaSource`
:returns:
Instance of :class:`openquake.baselib.node.Node`
"""
# parse geometry
sour... | [
"def",
"build_area_source_node",
"(",
"area_source",
")",
":",
"# parse geometry",
"source_nodes",
"=",
"[",
"build_area_source_geometry",
"(",
"area_source",
")",
"]",
"# parse common distributed attributes",
"source_nodes",
".",
"extend",
"(",
"get_distributed_seismicity_so... | Parses an area source to a Node class
:param area_source:
Area source as instance of :class:
`openquake.hazardlib.source.area.AreaSource`
:returns:
Instance of :class:`openquake.baselib.node.Node` | [
"Parses",
"an",
"area",
"source",
"to",
"a",
"Node",
"class"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/sourcewriter.py#L403-L418 |
252 | gem/oq-engine | openquake/hazardlib/sourcewriter.py | build_simple_fault_source_node | def build_simple_fault_source_node(fault_source):
"""
Parses a simple fault source to a Node class
:param fault_source:
Simple fault source as instance of :class:
`openquake.hazardlib.source.simple_fault.SimpleFaultSource`
:returns:
Instance of :class:`openquake.baselib.node.Nod... | python | def build_simple_fault_source_node(fault_source):
"""
Parses a simple fault source to a Node class
:param fault_source:
Simple fault source as instance of :class:
`openquake.hazardlib.source.simple_fault.SimpleFaultSource`
:returns:
Instance of :class:`openquake.baselib.node.Nod... | [
"def",
"build_simple_fault_source_node",
"(",
"fault_source",
")",
":",
"# Parse geometry",
"source_nodes",
"=",
"[",
"build_simple_fault_geometry",
"(",
"fault_source",
")",
"]",
"# Parse common fault source attributes",
"source_nodes",
".",
"extend",
"(",
"get_fault_source_... | Parses a simple fault source to a Node class
:param fault_source:
Simple fault source as instance of :class:
`openquake.hazardlib.source.simple_fault.SimpleFaultSource`
:returns:
Instance of :class:`openquake.baselib.node.Node` | [
"Parses",
"a",
"simple",
"fault",
"source",
"to",
"a",
"Node",
"class"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/sourcewriter.py#L524-L540 |
253 | gem/oq-engine | openquake/hazardlib/sourcewriter.py | build_complex_fault_source_node | def build_complex_fault_source_node(fault_source):
"""
Parses a complex fault source to a Node class
:param fault_source:
Simple fault source as instance of :class:
`openquake.hazardlib.source.complex_fault.ComplexFaultSource`
:returns:
Instance of :class:`openquake.baselib.node... | python | def build_complex_fault_source_node(fault_source):
"""
Parses a complex fault source to a Node class
:param fault_source:
Simple fault source as instance of :class:
`openquake.hazardlib.source.complex_fault.ComplexFaultSource`
:returns:
Instance of :class:`openquake.baselib.node... | [
"def",
"build_complex_fault_source_node",
"(",
"fault_source",
")",
":",
"# Parse geometry",
"source_nodes",
"=",
"[",
"build_complex_fault_geometry",
"(",
"fault_source",
")",
"]",
"# Parse common fault source attributes",
"source_nodes",
".",
"extend",
"(",
"get_fault_sourc... | Parses a complex fault source to a Node class
:param fault_source:
Simple fault source as instance of :class:
`openquake.hazardlib.source.complex_fault.ComplexFaultSource`
:returns:
Instance of :class:`openquake.baselib.node.Node` | [
"Parses",
"a",
"complex",
"fault",
"source",
"to",
"a",
"Node",
"class"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/sourcewriter.py#L544-L560 |
254 | gem/oq-engine | openquake/hazardlib/sourcewriter.py | write_source_model | def write_source_model(dest, sources_or_groups, name=None,
investigation_time=None):
"""
Writes a source model to XML.
:param dest:
Destination path
:param sources_or_groups:
Source model in different formats
:param name:
Name of the source model (if m... | python | def write_source_model(dest, sources_or_groups, name=None,
investigation_time=None):
"""
Writes a source model to XML.
:param dest:
Destination path
:param sources_or_groups:
Source model in different formats
:param name:
Name of the source model (if m... | [
"def",
"write_source_model",
"(",
"dest",
",",
"sources_or_groups",
",",
"name",
"=",
"None",
",",
"investigation_time",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"sources_or_groups",
",",
"nrml",
".",
"SourceModel",
")",
":",
"with",
"open",
"(",
"des... | Writes a source model to XML.
:param dest:
Destination path
:param sources_or_groups:
Source model in different formats
:param name:
Name of the source model (if missing, extracted from the filename) | [
"Writes",
"a",
"source",
"model",
"to",
"XML",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/sourcewriter.py#L610-L641 |
255 | gem/oq-engine | openquake/hazardlib/gsim/sharma_2009.py | SharmaEtAl2009._get_stddevs | def _get_stddevs(self, coeffs, stddev_types, num_sites):
"""
Return total sigma as reported in Table 2, p. 1202.
"""
stddevs = []
for stddev_type in stddev_types:
assert stddev_type in self.DEFINED_FOR_STANDARD_DEVIATION_TYPES
stddevs.append(coeffs['sigma'... | python | def _get_stddevs(self, coeffs, stddev_types, num_sites):
"""
Return total sigma as reported in Table 2, p. 1202.
"""
stddevs = []
for stddev_type in stddev_types:
assert stddev_type in self.DEFINED_FOR_STANDARD_DEVIATION_TYPES
stddevs.append(coeffs['sigma'... | [
"def",
"_get_stddevs",
"(",
"self",
",",
"coeffs",
",",
"stddev_types",
",",
"num_sites",
")",
":",
"stddevs",
"=",
"[",
"]",
"for",
"stddev_type",
"in",
"stddev_types",
":",
"assert",
"stddev_type",
"in",
"self",
".",
"DEFINED_FOR_STANDARD_DEVIATION_TYPES",
"st... | Return total sigma as reported in Table 2, p. 1202. | [
"Return",
"total",
"sigma",
"as",
"reported",
"in",
"Table",
"2",
"p",
".",
"1202",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/sharma_2009.py#L121-L129 |
256 | gem/oq-engine | openquake/hazardlib/gsim/sharma_2009.py | SharmaEtAl2009.get_fault_type_dummy_variables | def get_fault_type_dummy_variables(self, rup):
"""
Fault-type classification dummy variable based on rup.rake.
"``H`` is 1 for a strike-slip mechanism and 0 for a reverse mechanism"
(p. 1201).
Note:
UserWarning is raised if mechanism is determined to be normal
... | python | def get_fault_type_dummy_variables(self, rup):
"""
Fault-type classification dummy variable based on rup.rake.
"``H`` is 1 for a strike-slip mechanism and 0 for a reverse mechanism"
(p. 1201).
Note:
UserWarning is raised if mechanism is determined to be normal
... | [
"def",
"get_fault_type_dummy_variables",
"(",
"self",
",",
"rup",
")",
":",
"# normal faulting",
"is_normal",
"=",
"np",
".",
"array",
"(",
"self",
".",
"RAKE_THRESH",
"<",
"-",
"rup",
".",
"rake",
"<",
"(",
"180.",
"-",
"self",
".",
"RAKE_THRESH",
")",
... | Fault-type classification dummy variable based on rup.rake.
"``H`` is 1 for a strike-slip mechanism and 0 for a reverse mechanism"
(p. 1201).
Note:
UserWarning is raised if mechanism is determined to be normal
faulting, since as summarized in Table 2 on p. 1197 the data... | [
"Fault",
"-",
"type",
"classification",
"dummy",
"variable",
"based",
"on",
"rup",
".",
"rake",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/sharma_2009.py#L176-L208 |
257 | gem/oq-engine | openquake/hmtk/parsers/strain/strain_csv_parser.py | ReadStrainCsv.read_data | def read_data(self, scaling_factor=1E-9, strain_headers=None):
'''
Reads the data from the csv file
:param float scaling_factor:
Scaling factor used for all strain values (default 1E-9 for
nanostrain)
:param list strain_headers:
List of the variables... | python | def read_data(self, scaling_factor=1E-9, strain_headers=None):
'''
Reads the data from the csv file
:param float scaling_factor:
Scaling factor used for all strain values (default 1E-9 for
nanostrain)
:param list strain_headers:
List of the variables... | [
"def",
"read_data",
"(",
"self",
",",
"scaling_factor",
"=",
"1E-9",
",",
"strain_headers",
"=",
"None",
")",
":",
"if",
"strain_headers",
":",
"self",
".",
"strain",
".",
"data_variables",
"=",
"strain_headers",
"else",
":",
"self",
".",
"strain",
".",
"d... | Reads the data from the csv file
:param float scaling_factor:
Scaling factor used for all strain values (default 1E-9 for
nanostrain)
:param list strain_headers:
List of the variables in the file that correspond to strain
parameters
:returns:
... | [
"Reads",
"the",
"data",
"from",
"the",
"csv",
"file"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hmtk/parsers/strain/strain_csv_parser.py#L82-L132 |
258 | gem/oq-engine | openquake/hmtk/parsers/strain/strain_csv_parser.py | ReadStrainCsv._check_invalid_longitudes | def _check_invalid_longitudes(self):
'''
Checks to ensure that all longitudes are in the range -180. to 180
'''
idlon = self.strain.data['longitude'] > 180.
if np.any(idlon):
self.strain.data['longitude'][idlon] = \
self.strain.data['longitude'][idlon]... | python | def _check_invalid_longitudes(self):
'''
Checks to ensure that all longitudes are in the range -180. to 180
'''
idlon = self.strain.data['longitude'] > 180.
if np.any(idlon):
self.strain.data['longitude'][idlon] = \
self.strain.data['longitude'][idlon]... | [
"def",
"_check_invalid_longitudes",
"(",
"self",
")",
":",
"idlon",
"=",
"self",
".",
"strain",
".",
"data",
"[",
"'longitude'",
"]",
">",
"180.",
"if",
"np",
".",
"any",
"(",
"idlon",
")",
":",
"self",
".",
"strain",
".",
"data",
"[",
"'longitude'",
... | Checks to ensure that all longitudes are in the range -180. to 180 | [
"Checks",
"to",
"ensure",
"that",
"all",
"longitudes",
"are",
"in",
"the",
"range",
"-",
"180",
".",
"to",
"180"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hmtk/parsers/strain/strain_csv_parser.py#L134-L141 |
259 | gem/oq-engine | openquake/hmtk/parsers/strain/strain_csv_parser.py | WriteStrainCsv.write_file | def write_file(self, strain, scaling_factor=1E-9):
'''
Main writer function for the csv file
:param strain:
Instance of :class: openquake.hmtk.strain.geodetic_strain.GeodeticStrain
:param float scaling_factor:
Scaling factor used for all strain values (default 1E... | python | def write_file(self, strain, scaling_factor=1E-9):
'''
Main writer function for the csv file
:param strain:
Instance of :class: openquake.hmtk.strain.geodetic_strain.GeodeticStrain
:param float scaling_factor:
Scaling factor used for all strain values (default 1E... | [
"def",
"write_file",
"(",
"self",
",",
"strain",
",",
"scaling_factor",
"=",
"1E-9",
")",
":",
"if",
"not",
"isinstance",
"(",
"strain",
",",
"GeodeticStrain",
")",
":",
"raise",
"ValueError",
"(",
"'Strain data must be instance of GeodeticStrain'",
")",
"for",
... | Main writer function for the csv file
:param strain:
Instance of :class: openquake.hmtk.strain.geodetic_strain.GeodeticStrain
:param float scaling_factor:
Scaling factor used for all strain values (default 1E-9 for
nanostrain) | [
"Main",
"writer",
"function",
"for",
"the",
"csv",
"file"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hmtk/parsers/strain/strain_csv_parser.py#L160-L196 |
260 | gem/oq-engine | openquake/hmtk/parsers/strain/strain_csv_parser.py | WriteStrainCsv.slice_rates_to_data | def slice_rates_to_data(self, strain):
'''
For the strain data, checks to see if seismicity rates have been
calculated. If so, each column in the array is sliced and stored as a
single vector in the strain.data dictionary with the corresponding
magnitude as a key.
:param... | python | def slice_rates_to_data(self, strain):
'''
For the strain data, checks to see if seismicity rates have been
calculated. If so, each column in the array is sliced and stored as a
single vector in the strain.data dictionary with the corresponding
magnitude as a key.
:param... | [
"def",
"slice_rates_to_data",
"(",
"self",
",",
"strain",
")",
":",
"output_variables",
"=",
"list",
"(",
"strain",
".",
"data",
")",
"cond",
"=",
"(",
"isinstance",
"(",
"strain",
".",
"target_magnitudes",
",",
"np",
".",
"ndarray",
")",
"or",
"isinstance... | For the strain data, checks to see if seismicity rates have been
calculated. If so, each column in the array is sliced and stored as a
single vector in the strain.data dictionary with the corresponding
magnitude as a key.
:param strain:
Instance of :class: openquake.hmtk.str... | [
"For",
"the",
"strain",
"data",
"checks",
"to",
"see",
"if",
"seismicity",
"rates",
"have",
"been",
"calculated",
".",
"If",
"so",
"each",
"column",
"in",
"the",
"array",
"is",
"sliced",
"and",
"stored",
"as",
"a",
"single",
"vector",
"in",
"the",
"strai... | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hmtk/parsers/strain/strain_csv_parser.py#L198-L228 |
261 | gem/oq-engine | openquake/baselib/__init__.py | read | def read(*paths, **validators):
"""
Load the configuration, make each section available in a separate dict.
The configuration location can specified via an environment variable:
- OQ_CONFIG_FILE
In the absence of this environment variable the following paths will be
used:
- sys.prefi... | python | def read(*paths, **validators):
"""
Load the configuration, make each section available in a separate dict.
The configuration location can specified via an environment variable:
- OQ_CONFIG_FILE
In the absence of this environment variable the following paths will be
used:
- sys.prefi... | [
"def",
"read",
"(",
"*",
"paths",
",",
"*",
"*",
"validators",
")",
":",
"paths",
"=",
"config",
".",
"paths",
"+",
"list",
"(",
"paths",
")",
"parser",
"=",
"configparser",
".",
"ConfigParser",
"(",
")",
"found",
"=",
"parser",
".",
"read",
"(",
"... | Load the configuration, make each section available in a separate dict.
The configuration location can specified via an environment variable:
- OQ_CONFIG_FILE
In the absence of this environment variable the following paths will be
used:
- sys.prefix + /openquake.cfg when in a virtualenv
... | [
"Load",
"the",
"configuration",
"make",
"each",
"section",
"available",
"in",
"a",
"separate",
"dict",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/baselib/__init__.py#L56-L84 |
262 | gem/oq-engine | openquake/baselib/__init__.py | boolean | def boolean(flag):
"""
Convert string in boolean
"""
s = flag.lower()
if s in ('1', 'yes', 'true'):
return True
elif s in ('0', 'no', 'false'):
return False
raise ValueError('Unknown flag %r' % s) | python | def boolean(flag):
"""
Convert string in boolean
"""
s = flag.lower()
if s in ('1', 'yes', 'true'):
return True
elif s in ('0', 'no', 'false'):
return False
raise ValueError('Unknown flag %r' % s) | [
"def",
"boolean",
"(",
"flag",
")",
":",
"s",
"=",
"flag",
".",
"lower",
"(",
")",
"if",
"s",
"in",
"(",
"'1'",
",",
"'yes'",
",",
"'true'",
")",
":",
"return",
"True",
"elif",
"s",
"in",
"(",
"'0'",
",",
"'no'",
",",
"'false'",
")",
":",
"re... | Convert string in boolean | [
"Convert",
"string",
"in",
"boolean"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/baselib/__init__.py#L90-L99 |
263 | gem/oq-engine | openquake/hazardlib/gsim/atkinson_boore_2006.py | AtkinsonBoore2006._get_mean | def _get_mean(self, vs30, mag, rrup, imt, scale_fac):
"""
Compute and return mean
"""
C_HR, C_BC, C_SR, SC = self._extract_coeffs(imt)
rrup = self._clip_distances(rrup)
f0 = self._compute_f0_factor(rrup)
f1 = self._compute_f1_factor(rrup)
f2 = self._comp... | python | def _get_mean(self, vs30, mag, rrup, imt, scale_fac):
"""
Compute and return mean
"""
C_HR, C_BC, C_SR, SC = self._extract_coeffs(imt)
rrup = self._clip_distances(rrup)
f0 = self._compute_f0_factor(rrup)
f1 = self._compute_f1_factor(rrup)
f2 = self._comp... | [
"def",
"_get_mean",
"(",
"self",
",",
"vs30",
",",
"mag",
",",
"rrup",
",",
"imt",
",",
"scale_fac",
")",
":",
"C_HR",
",",
"C_BC",
",",
"C_SR",
",",
"SC",
"=",
"self",
".",
"_extract_coeffs",
"(",
"imt",
")",
"rrup",
"=",
"self",
".",
"_clip_dista... | Compute and return mean | [
"Compute",
"and",
"return",
"mean"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/atkinson_boore_2006.py#L109-L142 |
264 | gem/oq-engine | openquake/hazardlib/gsim/atkinson_boore_2006.py | AtkinsonBoore2006._get_pga_bc | def _get_pga_bc(self, f0, f1, f2, SC, mag, rrup, vs30, scale_fac):
"""
Compute and return PGA on BC boundary
"""
pga_bc = np.zeros_like(vs30)
self._compute_mean(self.COEFFS_BC[PGA()], f0, f1, f2, SC, mag,
rrup, vs30 < 2000.0, pga_bc, scale_fac)
... | python | def _get_pga_bc(self, f0, f1, f2, SC, mag, rrup, vs30, scale_fac):
"""
Compute and return PGA on BC boundary
"""
pga_bc = np.zeros_like(vs30)
self._compute_mean(self.COEFFS_BC[PGA()], f0, f1, f2, SC, mag,
rrup, vs30 < 2000.0, pga_bc, scale_fac)
... | [
"def",
"_get_pga_bc",
"(",
"self",
",",
"f0",
",",
"f1",
",",
"f2",
",",
"SC",
",",
"mag",
",",
"rrup",
",",
"vs30",
",",
"scale_fac",
")",
":",
"pga_bc",
"=",
"np",
".",
"zeros_like",
"(",
"vs30",
")",
"self",
".",
"_compute_mean",
"(",
"self",
... | Compute and return PGA on BC boundary | [
"Compute",
"and",
"return",
"PGA",
"on",
"BC",
"boundary"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/atkinson_boore_2006.py#L144-L152 |
265 | gem/oq-engine | openquake/hazardlib/gsim/atkinson_boore_2006.py | AtkinsonBoore2006._extract_coeffs | def _extract_coeffs(self, imt):
"""
Extract dictionaries of coefficients specific to required
intensity measure type.
"""
C_HR = self.COEFFS_HARD_ROCK[imt]
C_BC = self.COEFFS_BC[imt]
C_SR = self.COEFFS_SOIL_RESPONSE[imt]
SC = self.COEFFS_STRESS[imt]
... | python | def _extract_coeffs(self, imt):
"""
Extract dictionaries of coefficients specific to required
intensity measure type.
"""
C_HR = self.COEFFS_HARD_ROCK[imt]
C_BC = self.COEFFS_BC[imt]
C_SR = self.COEFFS_SOIL_RESPONSE[imt]
SC = self.COEFFS_STRESS[imt]
... | [
"def",
"_extract_coeffs",
"(",
"self",
",",
"imt",
")",
":",
"C_HR",
"=",
"self",
".",
"COEFFS_HARD_ROCK",
"[",
"imt",
"]",
"C_BC",
"=",
"self",
".",
"COEFFS_BC",
"[",
"imt",
"]",
"C_SR",
"=",
"self",
".",
"COEFFS_SOIL_RESPONSE",
"[",
"imt",
"]",
"SC",... | Extract dictionaries of coefficients specific to required
intensity measure type. | [
"Extract",
"dictionaries",
"of",
"coefficients",
"specific",
"to",
"required",
"intensity",
"measure",
"type",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/atkinson_boore_2006.py#L154-L164 |
266 | gem/oq-engine | openquake/calculators/getters.py | PmapGetter.init | def init(self):
"""
Read the poes and set the .data attribute with the hazard curves
"""
if hasattr(self, 'data'): # already initialized
return
if isinstance(self.dstore, str):
self.dstore = hdf5.File(self.dstore, 'r')
else:
self.dstor... | python | def init(self):
"""
Read the poes and set the .data attribute with the hazard curves
"""
if hasattr(self, 'data'): # already initialized
return
if isinstance(self.dstore, str):
self.dstore = hdf5.File(self.dstore, 'r')
else:
self.dstor... | [
"def",
"init",
"(",
"self",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'data'",
")",
":",
"# already initialized",
"return",
"if",
"isinstance",
"(",
"self",
".",
"dstore",
",",
"str",
")",
":",
"self",
".",
"dstore",
"=",
"hdf5",
".",
"File",
"("... | Read the poes and set the .data attribute with the hazard curves | [
"Read",
"the",
"poes",
"and",
"set",
"the",
".",
"data",
"attribute",
"with",
"the",
"hazard",
"curves"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/calculators/getters.py#L66-L91 |
267 | gem/oq-engine | openquake/calculators/getters.py | PmapGetter.get_mean | def get_mean(self, grp=None):
"""
Compute the mean curve as a ProbabilityMap
:param grp:
if not None must be a string of the form "grp-XX"; in that case
returns the mean considering only the contribution for group XX
"""
self.init()
if len(self.we... | python | def get_mean(self, grp=None):
"""
Compute the mean curve as a ProbabilityMap
:param grp:
if not None must be a string of the form "grp-XX"; in that case
returns the mean considering only the contribution for group XX
"""
self.init()
if len(self.we... | [
"def",
"get_mean",
"(",
"self",
",",
"grp",
"=",
"None",
")",
":",
"self",
".",
"init",
"(",
")",
"if",
"len",
"(",
"self",
".",
"weights",
")",
"==",
"1",
":",
"# one realization",
"# the standard deviation is zero",
"pmap",
"=",
"self",
".",
"get",
"... | Compute the mean curve as a ProbabilityMap
:param grp:
if not None must be a string of the form "grp-XX"; in that case
returns the mean considering only the contribution for group XX | [
"Compute",
"the",
"mean",
"curve",
"as",
"a",
"ProbabilityMap"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/calculators/getters.py#L189-L212 |
268 | gem/oq-engine | openquake/calculators/getters.py | GmfGetter.init | def init(self):
"""
Initialize the computers. Should be called on the workers
"""
if hasattr(self, 'computers'): # init already called
return
with hdf5.File(self.rupgetter.filename, 'r') as parent:
self.weights = parent['weights'].value
self.compu... | python | def init(self):
"""
Initialize the computers. Should be called on the workers
"""
if hasattr(self, 'computers'): # init already called
return
with hdf5.File(self.rupgetter.filename, 'r') as parent:
self.weights = parent['weights'].value
self.compu... | [
"def",
"init",
"(",
"self",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'computers'",
")",
":",
"# init already called",
"return",
"with",
"hdf5",
".",
"File",
"(",
"self",
".",
"rupgetter",
".",
"filename",
",",
"'r'",
")",
"as",
"parent",
":",
"sel... | Initialize the computers. Should be called on the workers | [
"Initialize",
"the",
"computers",
".",
"Should",
"be",
"called",
"on",
"the",
"workers"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/calculators/getters.py#L306-L326 |
269 | gem/oq-engine | openquake/hazardlib/gsim/skarlatoudis_2013.py | SkarlatoudisEtAlSSlab2013._compute_forearc_backarc_term | def _compute_forearc_backarc_term(self, C, sites, dists, rup):
"""
Compute back-arc term of Equation 3
"""
# flag 1 (R < 335 & R >= 205)
flag1 = np.zeros(len(dists.rhypo))
ind1 = np.logical_and((dists.rhypo < 335), (dists.rhypo >= 205))
flag1[ind1] = 1.0
... | python | def _compute_forearc_backarc_term(self, C, sites, dists, rup):
"""
Compute back-arc term of Equation 3
"""
# flag 1 (R < 335 & R >= 205)
flag1 = np.zeros(len(dists.rhypo))
ind1 = np.logical_and((dists.rhypo < 335), (dists.rhypo >= 205))
flag1[ind1] = 1.0
... | [
"def",
"_compute_forearc_backarc_term",
"(",
"self",
",",
"C",
",",
"sites",
",",
"dists",
",",
"rup",
")",
":",
"# flag 1 (R < 335 & R >= 205)",
"flag1",
"=",
"np",
".",
"zeros",
"(",
"len",
"(",
"dists",
".",
"rhypo",
")",
")",
"ind1",
"=",
"np",
".",
... | Compute back-arc term of Equation 3 | [
"Compute",
"back",
"-",
"arc",
"term",
"of",
"Equation",
"3"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/skarlatoudis_2013.py#L177-L219 |
270 | gem/oq-engine | openquake/hazardlib/gsim/gmpe_table.py | AmplificationTable._build_data | def _build_data(self, amplification_group):
"""
Creates the numpy array tables from the hdf5 tables
"""
# Determine shape of the tables
n_levels = len(amplification_group)
# Checks the first group in the amplification group and returns the
# shape of the SA array ... | python | def _build_data(self, amplification_group):
"""
Creates the numpy array tables from the hdf5 tables
"""
# Determine shape of the tables
n_levels = len(amplification_group)
# Checks the first group in the amplification group and returns the
# shape of the SA array ... | [
"def",
"_build_data",
"(",
"self",
",",
"amplification_group",
")",
":",
"# Determine shape of the tables",
"n_levels",
"=",
"len",
"(",
"amplification_group",
")",
"# Checks the first group in the amplification group and returns the",
"# shape of the SA array - implicitly assumes th... | Creates the numpy array tables from the hdf5 tables | [
"Creates",
"the",
"numpy",
"array",
"tables",
"from",
"the",
"hdf5",
"tables"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/gmpe_table.py#L112-L150 |
271 | gem/oq-engine | openquake/hazardlib/gsim/gmpe_table.py | AmplificationTable.get_amplification_factors | def get_amplification_factors(self, imt, sctx, rctx, dists, stddev_types):
"""
Returns the amplification factors for the given rupture and site
conditions.
:param imt:
Intensity measure type as an instance of the :class:
`openquake.hazardlib.imt`
:param s... | python | def get_amplification_factors(self, imt, sctx, rctx, dists, stddev_types):
"""
Returns the amplification factors for the given rupture and site
conditions.
:param imt:
Intensity measure type as an instance of the :class:
`openquake.hazardlib.imt`
:param s... | [
"def",
"get_amplification_factors",
"(",
"self",
",",
"imt",
",",
"sctx",
",",
"rctx",
",",
"dists",
",",
"stddev_types",
")",
":",
"dist_level_table",
"=",
"self",
".",
"get_mean_table",
"(",
"imt",
",",
"rctx",
")",
"sigma_tables",
"=",
"self",
".",
"get... | Returns the amplification factors for the given rupture and site
conditions.
:param imt:
Intensity measure type as an instance of the :class:
`openquake.hazardlib.imt`
:param sctx:
SiteCollection instance
:param rctx:
Rupture instance
... | [
"Returns",
"the",
"amplification",
"factors",
"for",
"the",
"given",
"rupture",
"and",
"site",
"conditions",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/gmpe_table.py#L158-L202 |
272 | gem/oq-engine | openquake/hazardlib/gsim/gmpe_table.py | AmplificationTable.get_mean_table | def get_mean_table(self, imt, rctx):
"""
Returns amplification factors for the mean, given the rupture and
intensity measure type.
:returns:
amplification table as an array of [Number Distances,
Number Levels]
"""
# Levels by Distances
if ... | python | def get_mean_table(self, imt, rctx):
"""
Returns amplification factors for the mean, given the rupture and
intensity measure type.
:returns:
amplification table as an array of [Number Distances,
Number Levels]
"""
# Levels by Distances
if ... | [
"def",
"get_mean_table",
"(",
"self",
",",
"imt",
",",
"rctx",
")",
":",
"# Levels by Distances",
"if",
"imt",
".",
"name",
"in",
"'PGA PGV'",
":",
"interpolator",
"=",
"interp1d",
"(",
"self",
".",
"magnitudes",
",",
"numpy",
".",
"log10",
"(",
"self",
... | Returns amplification factors for the mean, given the rupture and
intensity measure type.
:returns:
amplification table as an array of [Number Distances,
Number Levels] | [
"Returns",
"amplification",
"factors",
"for",
"the",
"mean",
"given",
"the",
"rupture",
"and",
"intensity",
"measure",
"type",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/gmpe_table.py#L204-L229 |
273 | gem/oq-engine | openquake/hazardlib/gsim/gmpe_table.py | AmplificationTable.get_sigma_tables | def get_sigma_tables(self, imt, rctx, stddev_types):
"""
Returns modification factors for the standard deviations, given the
rupture and intensity measure type.
:returns:
List of standard deviation modification tables, each as an array
of [Number Distances, Numbe... | python | def get_sigma_tables(self, imt, rctx, stddev_types):
"""
Returns modification factors for the standard deviations, given the
rupture and intensity measure type.
:returns:
List of standard deviation modification tables, each as an array
of [Number Distances, Numbe... | [
"def",
"get_sigma_tables",
"(",
"self",
",",
"imt",
",",
"rctx",
",",
"stddev_types",
")",
":",
"output_tables",
"=",
"[",
"]",
"for",
"stddev_type",
"in",
"stddev_types",
":",
"# For PGA and PGV only needs to apply magnitude interpolation",
"if",
"imt",
".",
"name"... | Returns modification factors for the standard deviations, given the
rupture and intensity measure type.
:returns:
List of standard deviation modification tables, each as an array
of [Number Distances, Number Levels] | [
"Returns",
"modification",
"factors",
"for",
"the",
"standard",
"deviations",
"given",
"the",
"rupture",
"and",
"intensity",
"measure",
"type",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/gmpe_table.py#L231-L263 |
274 | gem/oq-engine | openquake/hazardlib/gsim/gmpe_table.py | GMPETable.init | def init(self, fle=None):
"""
Executes the preprocessing steps at the instantiation stage to read in
the tables from hdf5 and hold them in memory.
"""
if fle is None:
fname = self.kwargs.get('gmpe_table', self.GMPE_TABLE)
if fname is None:
... | python | def init(self, fle=None):
"""
Executes the preprocessing steps at the instantiation stage to read in
the tables from hdf5 and hold them in memory.
"""
if fle is None:
fname = self.kwargs.get('gmpe_table', self.GMPE_TABLE)
if fname is None:
... | [
"def",
"init",
"(",
"self",
",",
"fle",
"=",
"None",
")",
":",
"if",
"fle",
"is",
"None",
":",
"fname",
"=",
"self",
".",
"kwargs",
".",
"get",
"(",
"'gmpe_table'",
",",
"self",
".",
"GMPE_TABLE",
")",
"if",
"fname",
"is",
"None",
":",
"raise",
"... | Executes the preprocessing steps at the instantiation stage to read in
the tables from hdf5 and hold them in memory. | [
"Executes",
"the",
"preprocessing",
"steps",
"at",
"the",
"instantiation",
"stage",
"to",
"read",
"in",
"the",
"tables",
"from",
"hdf5",
"and",
"hold",
"them",
"in",
"memory",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/gmpe_table.py#L306-L342 |
275 | gem/oq-engine | openquake/hazardlib/gsim/gmpe_table.py | GMPETable._setup_amplification | def _setup_amplification(self, fle):
"""
If amplification data is specified then reads into memory and updates
the required rupture and site parameters
"""
self.amplification = AmplificationTable(fle["Amplification"],
self.m_w,
... | python | def _setup_amplification(self, fle):
"""
If amplification data is specified then reads into memory and updates
the required rupture and site parameters
"""
self.amplification = AmplificationTable(fle["Amplification"],
self.m_w,
... | [
"def",
"_setup_amplification",
"(",
"self",
",",
"fle",
")",
":",
"self",
".",
"amplification",
"=",
"AmplificationTable",
"(",
"fle",
"[",
"\"Amplification\"",
"]",
",",
"self",
".",
"m_w",
",",
"self",
".",
"distances",
")",
"if",
"self",
".",
"amplifica... | If amplification data is specified then reads into memory and updates
the required rupture and site parameters | [
"If",
"amplification",
"data",
"is",
"specified",
"then",
"reads",
"into",
"memory",
"and",
"updates",
"the",
"required",
"rupture",
"and",
"site",
"parameters"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/gmpe_table.py#L364-L380 |
276 | gem/oq-engine | openquake/hazardlib/gsim/gmpe_table.py | GMPETable._supported_imts | def _supported_imts(self):
"""
Updates the list of supported IMTs from the tables
"""
imt_list = []
for key in self.imls:
if "SA" in key:
imt_list.append(imt_module.SA)
elif key == "T":
continue
else:
... | python | def _supported_imts(self):
"""
Updates the list of supported IMTs from the tables
"""
imt_list = []
for key in self.imls:
if "SA" in key:
imt_list.append(imt_module.SA)
elif key == "T":
continue
else:
... | [
"def",
"_supported_imts",
"(",
"self",
")",
":",
"imt_list",
"=",
"[",
"]",
"for",
"key",
"in",
"self",
".",
"imls",
":",
"if",
"\"SA\"",
"in",
"key",
":",
"imt_list",
".",
"append",
"(",
"imt_module",
".",
"SA",
")",
"elif",
"key",
"==",
"\"T\"",
... | Updates the list of supported IMTs from the tables | [
"Updates",
"the",
"list",
"of",
"supported",
"IMTs",
"from",
"the",
"tables"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/gmpe_table.py#L382-L398 |
277 | gem/oq-engine | openquake/hazardlib/gsim/gmpe_table.py | GMPETable.get_mean_and_stddevs | def get_mean_and_stddevs(self, sctx, rctx, dctx, imt, stddev_types):
"""
Returns the mean and standard deviations
"""
# Return Distance Tables
imls = self._return_tables(rctx.mag, imt, "IMLs")
# Get distance vector for the given magnitude
idx = numpy.searchsorted(... | python | def get_mean_and_stddevs(self, sctx, rctx, dctx, imt, stddev_types):
"""
Returns the mean and standard deviations
"""
# Return Distance Tables
imls = self._return_tables(rctx.mag, imt, "IMLs")
# Get distance vector for the given magnitude
idx = numpy.searchsorted(... | [
"def",
"get_mean_and_stddevs",
"(",
"self",
",",
"sctx",
",",
"rctx",
",",
"dctx",
",",
"imt",
",",
"stddev_types",
")",
":",
"# Return Distance Tables",
"imls",
"=",
"self",
".",
"_return_tables",
"(",
"rctx",
".",
"mag",
",",
"imt",
",",
"\"IMLs\"",
")",... | Returns the mean and standard deviations | [
"Returns",
"the",
"mean",
"and",
"standard",
"deviations"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/gmpe_table.py#L400-L425 |
278 | gem/oq-engine | openquake/hazardlib/gsim/gmpe_table.py | GMPETable._get_stddevs | def _get_stddevs(self, dists, mag, dctx, imt, stddev_types):
"""
Returns the total standard deviation of the intensity measure level
from the tables.
:param fle:
HDF5 data stream as instance of :class:`h5py.File`
:param distances:
The distance vector for ... | python | def _get_stddevs(self, dists, mag, dctx, imt, stddev_types):
"""
Returns the total standard deviation of the intensity measure level
from the tables.
:param fle:
HDF5 data stream as instance of :class:`h5py.File`
:param distances:
The distance vector for ... | [
"def",
"_get_stddevs",
"(",
"self",
",",
"dists",
",",
"mag",
",",
"dctx",
",",
"imt",
",",
"stddev_types",
")",
":",
"stddevs",
"=",
"[",
"]",
"for",
"stddev_type",
"in",
"stddev_types",
":",
"if",
"stddev_type",
"not",
"in",
"self",
".",
"DEFINED_FOR_S... | Returns the total standard deviation of the intensity measure level
from the tables.
:param fle:
HDF5 data stream as instance of :class:`h5py.File`
:param distances:
The distance vector for the given magnitude and IMT
:param key:
The distance type
... | [
"Returns",
"the",
"total",
"standard",
"deviation",
"of",
"the",
"intensity",
"measure",
"level",
"from",
"the",
"tables",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/gmpe_table.py#L454-L480 |
279 | gem/oq-engine | openquake/hazardlib/gsim/gmpe_table.py | GMPETable._return_tables | def _return_tables(self, mag, imt, val_type):
"""
Returns the vector of ground motions or standard deviations
corresponding to the specific magnitude and intensity measure type.
:param val_type:
String indicating the type of data {"IMLs", "Total", "Inter" etc}
"""
... | python | def _return_tables(self, mag, imt, val_type):
"""
Returns the vector of ground motions or standard deviations
corresponding to the specific magnitude and intensity measure type.
:param val_type:
String indicating the type of data {"IMLs", "Total", "Inter" etc}
"""
... | [
"def",
"_return_tables",
"(",
"self",
",",
"mag",
",",
"imt",
",",
"val_type",
")",
":",
"if",
"imt",
".",
"name",
"in",
"'PGA PGV'",
":",
"# Get scalar imt",
"if",
"val_type",
"==",
"\"IMLs\"",
":",
"iml_table",
"=",
"self",
".",
"imls",
"[",
"imt",
"... | Returns the vector of ground motions or standard deviations
corresponding to the specific magnitude and intensity measure type.
:param val_type:
String indicating the type of data {"IMLs", "Total", "Inter" etc} | [
"Returns",
"the",
"vector",
"of",
"ground",
"motions",
"or",
"standard",
"deviations",
"corresponding",
"to",
"the",
"specific",
"magnitude",
"and",
"intensity",
"measure",
"type",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/gmpe_table.py#L482-L518 |
280 | gem/oq-engine | openquake/hazardlib/gsim/gmpe_table.py | GMPETable.apply_magnitude_interpolation | def apply_magnitude_interpolation(self, mag, iml_table):
"""
Interpolates the tables to the required magnitude level
:param float mag:
Magnitude
:param iml_table:
Intensity measure level table
"""
# do not allow "mag" to exceed maximum table magni... | python | def apply_magnitude_interpolation(self, mag, iml_table):
"""
Interpolates the tables to the required magnitude level
:param float mag:
Magnitude
:param iml_table:
Intensity measure level table
"""
# do not allow "mag" to exceed maximum table magni... | [
"def",
"apply_magnitude_interpolation",
"(",
"self",
",",
"mag",
",",
"iml_table",
")",
":",
"# do not allow \"mag\" to exceed maximum table magnitude",
"if",
"mag",
">",
"self",
".",
"m_w",
"[",
"-",
"1",
"]",
":",
"mag",
"=",
"self",
".",
"m_w",
"[",
"-",
... | Interpolates the tables to the required magnitude level
:param float mag:
Magnitude
:param iml_table:
Intensity measure level table | [
"Interpolates",
"the",
"tables",
"to",
"the",
"required",
"magnitude",
"level"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/gmpe_table.py#L520-L542 |
281 | gem/oq-engine | openquake/hazardlib/gsim/sadigh_1997.py | SadighEtAl1997._get_mean_deep_soil | def _get_mean_deep_soil(self, mag, rake, rrup, is_reverse, imt):
"""
Calculate and return the mean intensity for deep soil sites.
Implements an equation from table 4.
"""
if mag <= self.NEAR_FIELD_SATURATION_MAG:
c4 = self.COEFFS_SOIL_IMT_INDEPENDENT['c4lowmag']
... | python | def _get_mean_deep_soil(self, mag, rake, rrup, is_reverse, imt):
"""
Calculate and return the mean intensity for deep soil sites.
Implements an equation from table 4.
"""
if mag <= self.NEAR_FIELD_SATURATION_MAG:
c4 = self.COEFFS_SOIL_IMT_INDEPENDENT['c4lowmag']
... | [
"def",
"_get_mean_deep_soil",
"(",
"self",
",",
"mag",
",",
"rake",
",",
"rrup",
",",
"is_reverse",
",",
"imt",
")",
":",
"if",
"mag",
"<=",
"self",
".",
"NEAR_FIELD_SATURATION_MAG",
":",
"c4",
"=",
"self",
".",
"COEFFS_SOIL_IMT_INDEPENDENT",
"[",
"'c4lowmag... | Calculate and return the mean intensity for deep soil sites.
Implements an equation from table 4. | [
"Calculate",
"and",
"return",
"the",
"mean",
"intensity",
"for",
"deep",
"soil",
"sites",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/sadigh_1997.py#L114-L139 |
282 | gem/oq-engine | openquake/hazardlib/gsim/sadigh_1997.py | SadighEtAl1997._get_mean_rock | def _get_mean_rock(self, mag, _rake, rrup, is_reverse, imt):
"""
Calculate and return the mean intensity for rock sites.
Implements an equation from table 2.
"""
if mag <= self.NEAR_FIELD_SATURATION_MAG:
C = self.COEFFS_ROCK_LOWMAG[imt]
else:
C = ... | python | def _get_mean_rock(self, mag, _rake, rrup, is_reverse, imt):
"""
Calculate and return the mean intensity for rock sites.
Implements an equation from table 2.
"""
if mag <= self.NEAR_FIELD_SATURATION_MAG:
C = self.COEFFS_ROCK_LOWMAG[imt]
else:
C = ... | [
"def",
"_get_mean_rock",
"(",
"self",
",",
"mag",
",",
"_rake",
",",
"rrup",
",",
"is_reverse",
",",
"imt",
")",
":",
"if",
"mag",
"<=",
"self",
".",
"NEAR_FIELD_SATURATION_MAG",
":",
"C",
"=",
"self",
".",
"COEFFS_ROCK_LOWMAG",
"[",
"imt",
"]",
"else",
... | Calculate and return the mean intensity for rock sites.
Implements an equation from table 2. | [
"Calculate",
"and",
"return",
"the",
"mean",
"intensity",
"for",
"rock",
"sites",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/sadigh_1997.py#L141-L163 |
283 | gem/oq-engine | openquake/hazardlib/gsim/sadigh_1997.py | SadighEtAl1997._get_stddev_rock | def _get_stddev_rock(self, mag, imt):
"""
Calculate and return total standard deviation for rock sites.
Implements formulae from table 3.
"""
C = self.COEFFS_ROCK_STDDERR[imt]
if mag > C['maxmag']:
return C['maxsigma']
else:
return C['sigm... | python | def _get_stddev_rock(self, mag, imt):
"""
Calculate and return total standard deviation for rock sites.
Implements formulae from table 3.
"""
C = self.COEFFS_ROCK_STDDERR[imt]
if mag > C['maxmag']:
return C['maxsigma']
else:
return C['sigm... | [
"def",
"_get_stddev_rock",
"(",
"self",
",",
"mag",
",",
"imt",
")",
":",
"C",
"=",
"self",
".",
"COEFFS_ROCK_STDDERR",
"[",
"imt",
"]",
"if",
"mag",
">",
"C",
"[",
"'maxmag'",
"]",
":",
"return",
"C",
"[",
"'maxsigma'",
"]",
"else",
":",
"return",
... | Calculate and return total standard deviation for rock sites.
Implements formulae from table 3. | [
"Calculate",
"and",
"return",
"total",
"standard",
"deviation",
"for",
"rock",
"sites",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/sadigh_1997.py#L165-L175 |
284 | gem/oq-engine | openquake/hazardlib/gsim/sadigh_1997.py | SadighEtAl1997._get_stddev_deep_soil | def _get_stddev_deep_soil(self, mag, imt):
"""
Calculate and return total standard deviation for deep soil sites.
Implements formulae from the last column of table 4.
"""
# footnote from table 4 says that stderr for magnitudes over 7
# is equal to one of magnitude 7.
... | python | def _get_stddev_deep_soil(self, mag, imt):
"""
Calculate and return total standard deviation for deep soil sites.
Implements formulae from the last column of table 4.
"""
# footnote from table 4 says that stderr for magnitudes over 7
# is equal to one of magnitude 7.
... | [
"def",
"_get_stddev_deep_soil",
"(",
"self",
",",
"mag",
",",
"imt",
")",
":",
"# footnote from table 4 says that stderr for magnitudes over 7",
"# is equal to one of magnitude 7.",
"if",
"mag",
">",
"7",
":",
"mag",
"=",
"7",
"C",
"=",
"self",
".",
"COEFFS_SOIL",
"... | Calculate and return total standard deviation for deep soil sites.
Implements formulae from the last column of table 4. | [
"Calculate",
"and",
"return",
"total",
"standard",
"deviation",
"for",
"deep",
"soil",
"sites",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/sadigh_1997.py#L177-L188 |
285 | gem/oq-engine | openquake/commands/zip.py | zip | def zip(what, archive_zip='', risk_file=''):
"""
Zip into an archive one or two job.ini files with all related files
"""
if os.path.isdir(what):
oqzip.zip_all(what)
elif what.endswith('.xml') and '<logicTree' in open(what).read(512):
# hack to see if the NRML file is of kind logicTre... | python | def zip(what, archive_zip='', risk_file=''):
"""
Zip into an archive one or two job.ini files with all related files
"""
if os.path.isdir(what):
oqzip.zip_all(what)
elif what.endswith('.xml') and '<logicTree' in open(what).read(512):
# hack to see if the NRML file is of kind logicTre... | [
"def",
"zip",
"(",
"what",
",",
"archive_zip",
"=",
"''",
",",
"risk_file",
"=",
"''",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"what",
")",
":",
"oqzip",
".",
"zip_all",
"(",
"what",
")",
"elif",
"what",
".",
"endswith",
"(",
"'.xml... | Zip into an archive one or two job.ini files with all related files | [
"Zip",
"into",
"an",
"archive",
"one",
"or",
"two",
"job",
".",
"ini",
"files",
"with",
"all",
"related",
"files"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/commands/zip.py#L25-L40 |
286 | gem/oq-engine | openquake/commands/reduce.py | reduce | def reduce(fname, reduction_factor):
"""
Produce a submodel from `fname` by sampling the nodes randomly.
Supports source models, site models and exposure models. As a special
case, it is also able to reduce .csv files by sampling the lines.
This is a debugging utility to reduce large computations to... | python | def reduce(fname, reduction_factor):
"""
Produce a submodel from `fname` by sampling the nodes randomly.
Supports source models, site models and exposure models. As a special
case, it is also able to reduce .csv files by sampling the lines.
This is a debugging utility to reduce large computations to... | [
"def",
"reduce",
"(",
"fname",
",",
"reduction_factor",
")",
":",
"if",
"fname",
".",
"endswith",
"(",
"'.csv'",
")",
":",
"with",
"open",
"(",
"fname",
")",
"as",
"f",
":",
"line",
"=",
"f",
".",
"readline",
"(",
")",
"# read the first line",
"if",
... | Produce a submodel from `fname` by sampling the nodes randomly.
Supports source models, site models and exposure models. As a special
case, it is also able to reduce .csv files by sampling the lines.
This is a debugging utility to reduce large computations to small ones. | [
"Produce",
"a",
"submodel",
"from",
"fname",
"by",
"sampling",
"the",
"nodes",
"randomly",
".",
"Supports",
"source",
"models",
"site",
"models",
"and",
"exposure",
"models",
".",
"As",
"a",
"special",
"case",
"it",
"is",
"also",
"able",
"to",
"reduce",
".... | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/commands/reduce.py#L60-L111 |
287 | gem/oq-engine | openquake/hazardlib/geo/surface/base.py | downsample_mesh | def downsample_mesh(mesh, tol=1.0):
"""
Returns a mesh sampled at a lower resolution - if the difference
in azimuth is larger than the specified tolerance a turn is assumed
:returns:
Downsampled mesh as instance of :class:
openquake.hazardlib.geo.mesh.RectangularMesh
"""
idx = _... | python | def downsample_mesh(mesh, tol=1.0):
"""
Returns a mesh sampled at a lower resolution - if the difference
in azimuth is larger than the specified tolerance a turn is assumed
:returns:
Downsampled mesh as instance of :class:
openquake.hazardlib.geo.mesh.RectangularMesh
"""
idx = _... | [
"def",
"downsample_mesh",
"(",
"mesh",
",",
"tol",
"=",
"1.0",
")",
":",
"idx",
"=",
"_find_turning_points",
"(",
"mesh",
",",
"tol",
")",
"if",
"mesh",
".",
"depths",
"is",
"not",
"None",
":",
"return",
"RectangularMesh",
"(",
"lons",
"=",
"mesh",
"."... | Returns a mesh sampled at a lower resolution - if the difference
in azimuth is larger than the specified tolerance a turn is assumed
:returns:
Downsampled mesh as instance of :class:
openquake.hazardlib.geo.mesh.RectangularMesh | [
"Returns",
"a",
"mesh",
"sampled",
"at",
"a",
"lower",
"resolution",
"-",
"if",
"the",
"difference",
"in",
"azimuth",
"is",
"larger",
"than",
"the",
"specified",
"tolerance",
"a",
"turn",
"is",
"assumed"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/surface/base.py#L64-L80 |
288 | gem/oq-engine | openquake/hazardlib/geo/surface/base.py | downsample_trace | def downsample_trace(mesh, tol=1.0):
"""
Downsamples the upper edge of a fault within a rectangular mesh, retaining
node points only if changes in direction on the order of tol are found
:returns:
Downsampled edge as a numpy array of [long, lat, depth]
"""
idx = _find_turning_points(mes... | python | def downsample_trace(mesh, tol=1.0):
"""
Downsamples the upper edge of a fault within a rectangular mesh, retaining
node points only if changes in direction on the order of tol are found
:returns:
Downsampled edge as a numpy array of [long, lat, depth]
"""
idx = _find_turning_points(mes... | [
"def",
"downsample_trace",
"(",
"mesh",
",",
"tol",
"=",
"1.0",
")",
":",
"idx",
"=",
"_find_turning_points",
"(",
"mesh",
",",
"tol",
")",
"if",
"mesh",
".",
"depths",
"is",
"not",
"None",
":",
"return",
"numpy",
".",
"column_stack",
"(",
"[",
"mesh",... | Downsamples the upper edge of a fault within a rectangular mesh, retaining
node points only if changes in direction on the order of tol are found
:returns:
Downsampled edge as a numpy array of [long, lat, depth] | [
"Downsamples",
"the",
"upper",
"edge",
"of",
"a",
"fault",
"within",
"a",
"rectangular",
"mesh",
"retaining",
"node",
"points",
"only",
"if",
"changes",
"in",
"direction",
"on",
"the",
"order",
"of",
"tol",
"are",
"found"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/surface/base.py#L83-L97 |
289 | gem/oq-engine | openquake/hazardlib/geo/surface/base.py | BaseSurface.get_ry0_distance | def get_ry0_distance(self, mesh):
"""
Compute the minimum distance between each point of a mesh and the great
circle arcs perpendicular to the average strike direction of the
fault trace and passing through the end-points of the trace.
:param mesh:
:class:`~openquake... | python | def get_ry0_distance(self, mesh):
"""
Compute the minimum distance between each point of a mesh and the great
circle arcs perpendicular to the average strike direction of the
fault trace and passing through the end-points of the trace.
:param mesh:
:class:`~openquake... | [
"def",
"get_ry0_distance",
"(",
"self",
",",
"mesh",
")",
":",
"# This computes ry0 by using an average strike direction",
"top_edge",
"=",
"self",
".",
"mesh",
"[",
"0",
":",
"1",
"]",
"mean_strike",
"=",
"self",
".",
"get_strike",
"(",
")",
"dst1",
"=",
"geo... | Compute the minimum distance between each point of a mesh and the great
circle arcs perpendicular to the average strike direction of the
fault trace and passing through the end-points of the trace.
:param mesh:
:class:`~openquake.hazardlib.geo.mesh.Mesh` of points to calculate
... | [
"Compute",
"the",
"minimum",
"distance",
"between",
"each",
"point",
"of",
"a",
"mesh",
"and",
"the",
"great",
"circle",
"arcs",
"perpendicular",
"to",
"the",
"average",
"strike",
"direction",
"of",
"the",
"fault",
"trace",
"and",
"passing",
"through",
"the",
... | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/surface/base.py#L148-L180 |
290 | gem/oq-engine | openquake/hazardlib/geo/surface/base.py | BaseSurface.get_rx_distance | def get_rx_distance(self, mesh):
"""
Compute distance between each point of mesh and surface's great circle
arc.
Distance is measured perpendicular to the rupture strike, from
the surface projection of the updip edge of the rupture, with
the down dip direction being posi... | python | def get_rx_distance(self, mesh):
"""
Compute distance between each point of mesh and surface's great circle
arc.
Distance is measured perpendicular to the rupture strike, from
the surface projection of the updip edge of the rupture, with
the down dip direction being posi... | [
"def",
"get_rx_distance",
"(",
"self",
",",
"mesh",
")",
":",
"top_edge",
"=",
"self",
".",
"mesh",
"[",
"0",
":",
"1",
"]",
"dists",
"=",
"[",
"]",
"if",
"top_edge",
".",
"lons",
".",
"shape",
"[",
"1",
"]",
"<",
"3",
":",
"i",
"=",
"0",
"p1... | Compute distance between each point of mesh and surface's great circle
arc.
Distance is measured perpendicular to the rupture strike, from
the surface projection of the updip edge of the rupture, with
the down dip direction being positive (this distance is usually
called ``Rx``)... | [
"Compute",
"distance",
"between",
"each",
"point",
"of",
"mesh",
"and",
"surface",
"s",
"great",
"circle",
"arc",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/surface/base.py#L182-L266 |
291 | gem/oq-engine | openquake/hazardlib/geo/surface/base.py | BaseSurface.get_top_edge_depth | def get_top_edge_depth(self):
"""
Return minimum depth of surface's top edge.
:returns:
Float value, the vertical distance between the earth surface
and the shallowest point in surface's top edge in km.
"""
top_edge = self.mesh[0:1]
if top_edge.de... | python | def get_top_edge_depth(self):
"""
Return minimum depth of surface's top edge.
:returns:
Float value, the vertical distance between the earth surface
and the shallowest point in surface's top edge in km.
"""
top_edge = self.mesh[0:1]
if top_edge.de... | [
"def",
"get_top_edge_depth",
"(",
"self",
")",
":",
"top_edge",
"=",
"self",
".",
"mesh",
"[",
"0",
":",
"1",
"]",
"if",
"top_edge",
".",
"depths",
"is",
"None",
":",
"return",
"0",
"else",
":",
"return",
"numpy",
".",
"min",
"(",
"top_edge",
".",
... | Return minimum depth of surface's top edge.
:returns:
Float value, the vertical distance between the earth surface
and the shallowest point in surface's top edge in km. | [
"Return",
"minimum",
"depth",
"of",
"surface",
"s",
"top",
"edge",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/surface/base.py#L268-L280 |
292 | gem/oq-engine | openquake/hazardlib/geo/surface/base.py | BaseSurface.get_area | def get_area(self):
"""
Compute area as the sum of the mesh cells area values.
"""
mesh = self.mesh
_, _, _, area = mesh.get_cell_dimensions()
return numpy.sum(area) | python | def get_area(self):
"""
Compute area as the sum of the mesh cells area values.
"""
mesh = self.mesh
_, _, _, area = mesh.get_cell_dimensions()
return numpy.sum(area) | [
"def",
"get_area",
"(",
"self",
")",
":",
"mesh",
"=",
"self",
".",
"mesh",
"_",
",",
"_",
",",
"_",
",",
"area",
"=",
"mesh",
".",
"get_cell_dimensions",
"(",
")",
"return",
"numpy",
".",
"sum",
"(",
"area",
")"
] | Compute area as the sum of the mesh cells area values. | [
"Compute",
"area",
"as",
"the",
"sum",
"of",
"the",
"mesh",
"cells",
"area",
"values",
"."
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/surface/base.py#L290-L297 |
293 | gem/oq-engine | openquake/hazardlib/geo/surface/base.py | BaseSurface.get_surface_boundaries | def get_surface_boundaries(self):
"""
Returns the boundaries in the same format as a multiplanar
surface, with two one-element lists of lons and lats
"""
mesh = self.mesh
lons = numpy.concatenate((mesh.lons[0, :],
mesh.lons[1:, -1],
... | python | def get_surface_boundaries(self):
"""
Returns the boundaries in the same format as a multiplanar
surface, with two one-element lists of lons and lats
"""
mesh = self.mesh
lons = numpy.concatenate((mesh.lons[0, :],
mesh.lons[1:, -1],
... | [
"def",
"get_surface_boundaries",
"(",
"self",
")",
":",
"mesh",
"=",
"self",
".",
"mesh",
"lons",
"=",
"numpy",
".",
"concatenate",
"(",
"(",
"mesh",
".",
"lons",
"[",
"0",
",",
":",
"]",
",",
"mesh",
".",
"lons",
"[",
"1",
":",
",",
"-",
"1",
... | Returns the boundaries in the same format as a multiplanar
surface, with two one-element lists of lons and lats | [
"Returns",
"the",
"boundaries",
"in",
"the",
"same",
"format",
"as",
"a",
"multiplanar",
"surface",
"with",
"two",
"one",
"-",
"element",
"lists",
"of",
"lons",
"and",
"lats"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/surface/base.py#L326-L340 |
294 | gem/oq-engine | openquake/hazardlib/geo/surface/base.py | BaseSurface.get_resampled_top_edge | def get_resampled_top_edge(self, angle_var=0.1):
"""
This methods computes a simplified representation of a fault top edge
by removing the points that are not describing a change of direction,
provided a certain tolerance angle.
:param float angle_var:
Number represe... | python | def get_resampled_top_edge(self, angle_var=0.1):
"""
This methods computes a simplified representation of a fault top edge
by removing the points that are not describing a change of direction,
provided a certain tolerance angle.
:param float angle_var:
Number represe... | [
"def",
"get_resampled_top_edge",
"(",
"self",
",",
"angle_var",
"=",
"0.1",
")",
":",
"mesh",
"=",
"self",
".",
"mesh",
"top_edge",
"=",
"[",
"Point",
"(",
"mesh",
".",
"lons",
"[",
"0",
"]",
"[",
"0",
"]",
",",
"mesh",
".",
"lats",
"[",
"0",
"]"... | This methods computes a simplified representation of a fault top edge
by removing the points that are not describing a change of direction,
provided a certain tolerance angle.
:param float angle_var:
Number representing the maximum deviation (in degrees) admitted
without... | [
"This",
"methods",
"computes",
"a",
"simplified",
"representation",
"of",
"a",
"fault",
"top",
"edge",
"by",
"removing",
"the",
"points",
"that",
"are",
"not",
"describing",
"a",
"change",
"of",
"direction",
"provided",
"a",
"certain",
"tolerance",
"angle",
".... | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/surface/base.py#L342-L375 |
295 | gem/oq-engine | openquake/hazardlib/geo/surface/base.py | BaseSurface.get_hypo_location | def get_hypo_location(self, mesh_spacing, hypo_loc=None):
"""
The method determines the location of the hypocentre within the rupture
:param mesh:
:class:`~openquake.hazardlib.geo.mesh.Mesh` of points
:param mesh_spacing:
The desired distance between two adjacent... | python | def get_hypo_location(self, mesh_spacing, hypo_loc=None):
"""
The method determines the location of the hypocentre within the rupture
:param mesh:
:class:`~openquake.hazardlib.geo.mesh.Mesh` of points
:param mesh_spacing:
The desired distance between two adjacent... | [
"def",
"get_hypo_location",
"(",
"self",
",",
"mesh_spacing",
",",
"hypo_loc",
"=",
"None",
")",
":",
"mesh",
"=",
"self",
".",
"mesh",
"centroid",
"=",
"mesh",
".",
"get_middle_point",
"(",
")",
"if",
"hypo_loc",
"is",
"None",
":",
"return",
"centroid",
... | The method determines the location of the hypocentre within the rupture
:param mesh:
:class:`~openquake.hazardlib.geo.mesh.Mesh` of points
:param mesh_spacing:
The desired distance between two adjacent points in source's
ruptures' mesh, in km. Mainly this parameter a... | [
"The",
"method",
"determines",
"the",
"location",
"of",
"the",
"hypocentre",
"within",
"the",
"rupture"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/surface/base.py#L377-L414 |
296 | gem/oq-engine | openquake/engine/tools/viewlog.py | viewlog | def viewlog(calc_id, host='localhost', port=8000):
"""
Extract the log of the given calculation ID from the WebUI
"""
base_url = 'http://%s:%s/v1/calc/' % (host, port)
start = 0
psize = 10 # page size
try:
while True:
url = base_url + '%d/log/%d:%d' % (calc_id, start, st... | python | def viewlog(calc_id, host='localhost', port=8000):
"""
Extract the log of the given calculation ID from the WebUI
"""
base_url = 'http://%s:%s/v1/calc/' % (host, port)
start = 0
psize = 10 # page size
try:
while True:
url = base_url + '%d/log/%d:%d' % (calc_id, start, st... | [
"def",
"viewlog",
"(",
"calc_id",
",",
"host",
"=",
"'localhost'",
",",
"port",
"=",
"8000",
")",
":",
"base_url",
"=",
"'http://%s:%s/v1/calc/'",
"%",
"(",
"host",
",",
"port",
")",
"start",
"=",
"0",
"psize",
"=",
"10",
"# page size",
"try",
":",
"wh... | Extract the log of the given calculation ID from the WebUI | [
"Extract",
"the",
"log",
"of",
"the",
"given",
"calculation",
"ID",
"from",
"the",
"WebUI"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/engine/tools/viewlog.py#L33-L49 |
297 | gem/oq-engine | openquake/baselib/parallel.py | pickle_sequence | def pickle_sequence(objects):
"""
Convert an iterable of objects into a list of pickled objects.
If the iterable contains copies, the pickling will be done only once.
If the iterable contains objects already pickled, they will not be
pickled again.
:param objects: a sequence of objects to pickl... | python | def pickle_sequence(objects):
"""
Convert an iterable of objects into a list of pickled objects.
If the iterable contains copies, the pickling will be done only once.
If the iterable contains objects already pickled, they will not be
pickled again.
:param objects: a sequence of objects to pickl... | [
"def",
"pickle_sequence",
"(",
"objects",
")",
":",
"cache",
"=",
"{",
"}",
"out",
"=",
"[",
"]",
"for",
"obj",
"in",
"objects",
":",
"obj_id",
"=",
"id",
"(",
"obj",
")",
"if",
"obj_id",
"not",
"in",
"cache",
":",
"if",
"isinstance",
"(",
"obj",
... | Convert an iterable of objects into a list of pickled objects.
If the iterable contains copies, the pickling will be done only once.
If the iterable contains objects already pickled, they will not be
pickled again.
:param objects: a sequence of objects to pickle | [
"Convert",
"an",
"iterable",
"of",
"objects",
"into",
"a",
"list",
"of",
"pickled",
"objects",
".",
"If",
"the",
"iterable",
"contains",
"copies",
"the",
"pickling",
"will",
"be",
"done",
"only",
"once",
".",
"If",
"the",
"iterable",
"contains",
"objects",
... | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/baselib/parallel.py#L294-L313 |
298 | gem/oq-engine | openquake/baselib/parallel.py | check_mem_usage | def check_mem_usage(soft_percent=None, hard_percent=None):
"""
Display a warning if we are running out of memory
"""
soft_percent = soft_percent or config.memory.soft_mem_limit
hard_percent = hard_percent or config.memory.hard_mem_limit
used_mem_percent = psutil.virtual_memory().percent
if u... | python | def check_mem_usage(soft_percent=None, hard_percent=None):
"""
Display a warning if we are running out of memory
"""
soft_percent = soft_percent or config.memory.soft_mem_limit
hard_percent = hard_percent or config.memory.hard_mem_limit
used_mem_percent = psutil.virtual_memory().percent
if u... | [
"def",
"check_mem_usage",
"(",
"soft_percent",
"=",
"None",
",",
"hard_percent",
"=",
"None",
")",
":",
"soft_percent",
"=",
"soft_percent",
"or",
"config",
".",
"memory",
".",
"soft_mem_limit",
"hard_percent",
"=",
"hard_percent",
"or",
"config",
".",
"memory",... | Display a warning if we are running out of memory | [
"Display",
"a",
"warning",
"if",
"we",
"are",
"running",
"out",
"of",
"memory"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/baselib/parallel.py#L370-L383 |
299 | gem/oq-engine | openquake/baselib/parallel.py | init_workers | def init_workers():
"""Waiting function, used to wake up the process pool"""
setproctitle('oq-worker')
# unregister raiseMasterKilled in oq-workers to avoid deadlock
# since processes are terminated via pool.terminate()
signal.signal(signal.SIGTERM, signal.SIG_DFL)
# prctl is still useful (on Li... | python | def init_workers():
"""Waiting function, used to wake up the process pool"""
setproctitle('oq-worker')
# unregister raiseMasterKilled in oq-workers to avoid deadlock
# since processes are terminated via pool.terminate()
signal.signal(signal.SIGTERM, signal.SIG_DFL)
# prctl is still useful (on Li... | [
"def",
"init_workers",
"(",
")",
":",
"setproctitle",
"(",
"'oq-worker'",
")",
"# unregister raiseMasterKilled in oq-workers to avoid deadlock",
"# since processes are terminated via pool.terminate()",
"signal",
".",
"signal",
"(",
"signal",
".",
"SIGTERM",
",",
"signal",
"."... | Waiting function, used to wake up the process pool | [
"Waiting",
"function",
"used",
"to",
"wake",
"up",
"the",
"process",
"pool"
] | 8294553a0b8aba33fd96437a35065d03547d0040 | https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/baselib/parallel.py#L567-L581 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.