-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sample earthquake example (#382)
* Add sample earthquake example * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update pantry.py * Update pantry.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
da42fdc
commit 1447094
Showing
4 changed files
with
84 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env python3 | ||
"""Importable and runnable geovista example. | ||
Notes | ||
----- | ||
.. versionadded:: 0.4.0 | ||
""" | ||
from __future__ import annotations | ||
|
||
import geovista as gv | ||
from geovista.common import to_cartesian | ||
from geovista.pantry import sample_earthquake | ||
import geovista.theme | ||
|
||
|
||
def main() -> None: | ||
"""Create a point cloud from 2-D latitude and longitude large earthquake dataset. | ||
The resulting mesh contains point cloud of large earthquake. | ||
It uses a sample large earthquake dataset with point model. | ||
""" | ||
# load sample data | ||
sample = sample_earthquake() | ||
|
||
# convert coordinate to cartesian | ||
points = to_cartesian(lons=sample.lons, lats=sample.lats) | ||
|
||
# plot the mesh | ||
plotter = gv.GeoPlotter() | ||
plotter.add_points(points, render_points_as_spheres=True, color="red") | ||
plotter.add_base_layer(texture=gv.natural_earth_1()) | ||
plotter.add_coastlines() | ||
plotter.add_axes() | ||
plotter.show() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters