├── .dvc ├── .gitignore └── config ├── .dvcignore ├── .github ├── ISSUE_TEMPLATE │ ├── 1-bug_report.yaml │ ├── 2-feature_request.yaml │ ├── 3-module_request.yaml │ ├── 4-release_checklist.md │ ├── 5-bump_gmt_checklist.md │ └── config.yml ├── PULL_REQUEST_TEMPLATE.md ├── codecov.yml ├── config.yml ├── dependabot.yml ├── release-drafter.yml └── workflows │ ├── benchmarks.yml │ ├── cache_data.yaml │ ├── check-links.yml │ ├── ci_docs.yml │ ├── ci_doctests.yaml │ ├── ci_tests.yaml │ ├── ci_tests_dev.yaml │ ├── ci_tests_legacy.yaml │ ├── dvc-diff.yml │ ├── format-command.yml │ ├── publish-to-pypi.yml │ ├── release-baseline-images.yml │ ├── release-drafter.yml │ ├── slash-command-dispatch.yml │ ├── style_checks.yaml │ └── type_checks.yml ├── .gitignore ├── .mailmap ├── .pre-commit-config.yaml ├── .readthedocs.yaml ├── AUTHORS.md ├── AUTHORSHIP.md ├── CITATION.cff ├── CONTRIBUTING.md ├── LICENSE.txt ├── MANIFEST.in ├── Makefile ├── README.md ├── ci └── requirements │ └── docs.yml ├── doc ├── Makefile ├── _static │ ├── agu2017-poster.jpg │ ├── agu2019-poster.jpg │ ├── aogs2018-poster.jpg │ ├── favicon.png │ ├── fonts │ │ ├── Atkinson-Hyperlegible-Bold-102a.woff2 │ │ ├── Atkinson-Hyperlegible-BoldItalic-102a.woff2 │ │ ├── Atkinson-Hyperlegible-Italic-102a.woff2 │ │ └── Atkinson-Hyperlegible-Regular-102a.woff2 │ ├── scipy2017-youtube-thumbnail.png │ ├── scipy2018-youtube-thumbnail.png │ ├── scipy2022-youtube-thumbnail.jpg │ ├── style.css │ └── version_switch.js ├── _templates │ ├── autosummary │ │ ├── base.rst │ │ ├── class.rst │ │ ├── enums.rst │ │ ├── exception.rst │ │ ├── function.rst │ │ ├── method.rst │ │ └── module.rst │ ├── breadcrumbs.html │ ├── footer.html │ └── layout.html ├── api │ └── index.rst ├── changes.md ├── conf.py ├── contributing.md ├── ecosystem.md ├── external_resources.md ├── index.md ├── install.md ├── maintenance.md ├── minversions.md ├── overview.md ├── team.md └── techref │ ├── common_parameters.md │ ├── encodings.md │ ├── environment_variables.md │ ├── fonts.md │ ├── index.md │ ├── patterns.md │ └── projections.md ├── environment.yml ├── examples ├── gallery │ ├── 3d_plots │ │ ├── GALLERY_HEADER.rst │ │ ├── grdview_surface.py │ │ └── scatter3d.py │ ├── GALLERY_HEADER.rst │ ├── basemaps │ │ ├── GALLERY_HEADER.rst │ │ ├── double_y_axes.py │ │ └── ternary.py │ ├── embellishments │ │ ├── GALLERY_HEADER.rst │ │ ├── colorbar.py │ │ ├── colorbars_multiple.py │ │ ├── gmt_logo.py │ │ ├── inset.py │ │ ├── inset_rectangle_region.py │ │ ├── legend.py │ │ ├── scalebar.py │ │ ├── solar.py │ │ └── timestamp.py │ ├── histograms │ │ ├── GALLERY_HEADER.rst │ │ ├── blockm.py │ │ ├── histogram.py │ │ ├── rose.py │ │ └── scatter_and_histograms.py │ ├── images │ │ ├── GALLERY_HEADER.rst │ │ ├── contours.py │ │ ├── cross_section.py │ │ ├── grdclip.py │ │ ├── grdgradient.py │ │ ├── grdgradient_shading.py │ │ ├── grdlandmask.py │ │ ├── image.py │ │ ├── rgb_image.py │ │ └── track_sampling.py │ ├── lines │ │ ├── GALLERY_HEADER.rst │ │ ├── connection_lines.py │ │ ├── decorated_lines.py │ │ ├── envelope.py │ │ ├── great_circles.py │ │ ├── hlines_vlines.py │ │ ├── line_custom_cpt.py │ │ ├── line_segment_ends.py │ │ ├── linefronts.py │ │ ├── linestrings.py │ │ ├── linestyles.py │ │ ├── quoted_lines.py │ │ ├── vector_heads_tails.py │ │ ├── vector_styles.py │ │ └── wiggle.py │ ├── maps │ │ ├── GALLERY_HEADER.rst │ │ ├── borders.py │ │ ├── choropleth_map.py │ │ ├── country_polygons.py │ │ ├── land_and_water.py │ │ ├── shorelines.py │ │ └── tilemaps.py │ ├── seismology │ │ ├── GALLERY_HEADER.rst │ │ ├── meca.py │ │ └── velo_arrow_ellipse.py │ └── symbols │ │ ├── GALLERY_HEADER.rst │ │ ├── bars.py │ │ ├── basic_symbols.py │ │ ├── custom_symbols.py │ │ ├── datetime_inputs.py │ │ ├── multi_parameter_symbols.py │ │ ├── patterns.py │ │ ├── points.py │ │ ├── points_categorical.py │ │ ├── points_transparency.py │ │ ├── scatter.py │ │ └── text_symbols.py ├── intro │ ├── 01_first_figure.py │ ├── 02_contour_map.py │ ├── 03_figure_element.py │ ├── 04_table_inputs.py │ └── GALLERY_HEADER.rst ├── projections │ ├── GALLERY_HEADER.rst │ ├── azim │ │ ├── GALLERY_HEADER.rst │ │ ├── azim_equidistant.py │ │ ├── azim_general_perspective.py │ │ ├── azim_general_stereographic.py │ │ ├── azim_gnomonic.py │ │ ├── azim_lambert.py │ │ └── azim_orthographic.py │ ├── conic │ │ ├── GALLERY_HEADER.rst │ │ ├── conic_albers.py │ │ ├── conic_equidistant.py │ │ ├── conic_lambert.py │ │ └── polyconic.py │ ├── cyl │ │ ├── GALLERY_HEADER.rst │ │ ├── cyl_cassini.py │ │ ├── cyl_equal_area.py │ │ ├── cyl_equidistant.py │ │ ├── cyl_mercator.py │ │ ├── cyl_miller.py │ │ ├── cyl_oblique_mercator.py │ │ ├── cyl_stereographic.py │ │ ├── cyl_transverse_mercator.py │ │ └── cyl_universal_transverse_mercator.py │ ├── misc │ │ ├── GALLERY_HEADER.rst │ │ ├── misc_eckertIV.py │ │ ├── misc_eckertVI.py │ │ ├── misc_hammer.py │ │ ├── misc_mollweide.py │ │ ├── misc_robinson.py │ │ ├── misc_sinusoidal.py │ │ ├── misc_van_der_grinten.py │ │ └── misc_winkel_tripel.py │ └── nongeo │ │ ├── GALLERY_HEADER.rst │ │ ├── cartesian_linear.py │ │ ├── cartesian_logarithmic.py │ │ ├── cartesian_power.py │ │ └── polar.py └── tutorials │ ├── GALLERY_HEADER.rst │ ├── advanced │ ├── 3d_perspective_image.py │ ├── GALLERY_HEADER.rst │ ├── cartesian_histograms.py │ ├── configuration.py │ ├── contour_map.py │ ├── date_time_charts.py │ ├── draping_on_3d_surface.py │ ├── earth_relief.py │ ├── focal_mechanisms.py │ ├── grid_equalization.py │ ├── insets.py │ ├── legends.py │ ├── non_ascii_text.py │ ├── subplots.py │ ├── vectors.py │ └── working_with_panel.py │ └── basics │ ├── GALLERY_HEADER.rst │ ├── coastlines.py │ ├── frames.py │ ├── lines.py │ ├── plot.py │ ├── polygons.py │ ├── regions.py │ └── text.py ├── pygmt ├── __init__.py ├── _show_versions.py ├── _typing.py ├── clib │ ├── __init__.py │ ├── conversion.py │ ├── loading.py │ └── session.py ├── conftest.py ├── datasets │ ├── __init__.py │ ├── earth_age.py │ ├── earth_day.py │ ├── earth_deflection.py │ ├── earth_dist.py │ ├── earth_free_air_anomaly.py │ ├── earth_geoid.py │ ├── earth_magnetic_anomaly.py │ ├── earth_mask.py │ ├── earth_mean_dynamic_topography.py │ ├── earth_mean_sea_surface.py │ ├── earth_night.py │ ├── earth_relief.py │ ├── earth_vertical_gravity_gradient.py │ ├── load_remote_dataset.py │ ├── mars_relief.py │ ├── mercury_relief.py │ ├── moon_relief.py │ ├── pluto_relief.py │ ├── samples.py │ ├── tile_map.py │ └── venus_relief.py ├── datatypes │ ├── __init__.py │ ├── dataset.py │ ├── grid.py │ ├── header.py │ └── image.py ├── encodings.py ├── enums.py ├── exceptions.py ├── figure.py ├── helpers │ ├── __init__.py │ ├── caching.py │ ├── decorators.py │ ├── tempfile.py │ ├── testing.py │ ├── utils.py │ └── validators.py ├── io.py ├── session_management.py ├── sphinx_gallery.py ├── src │ ├── __init__.py │ ├── _common.py │ ├── basemap.py │ ├── binstats.py │ ├── blockm.py │ ├── coast.py │ ├── colorbar.py │ ├── config.py │ ├── contour.py │ ├── dimfilter.py │ ├── filter1d.py │ ├── grd2cpt.py │ ├── grd2xyz.py │ ├── grdclip.py │ ├── grdcontour.py │ ├── grdcut.py │ ├── grdfill.py │ ├── grdfilter.py │ ├── grdgradient.py │ ├── grdhisteq.py │ ├── grdimage.py │ ├── grdinfo.py │ ├── grdlandmask.py │ ├── grdproject.py │ ├── grdsample.py │ ├── grdtrack.py │ ├── grdview.py │ ├── grdvolume.py │ ├── histogram.py │ ├── hlines.py │ ├── image.py │ ├── info.py │ ├── inset.py │ ├── legend.py │ ├── logo.py │ ├── makecpt.py │ ├── meca.py │ ├── nearneighbor.py │ ├── plot.py │ ├── plot3d.py │ ├── project.py │ ├── psconvert.py │ ├── rose.py │ ├── select.py │ ├── shift_origin.py │ ├── solar.py │ ├── sph2grd.py │ ├── sphdistance.py │ ├── sphinterpolate.py │ ├── subplot.py │ ├── surface.py │ ├── ternary.py │ ├── text.py │ ├── tilemap.py │ ├── timestamp.py │ ├── triangulate.py │ ├── velo.py │ ├── vlines.py │ ├── which.py │ ├── wiggle.py │ ├── x2sys_cross.py │ ├── x2sys_init.py │ └── xyz2grd.py ├── tests │ ├── __init__.py │ ├── baseline │ │ ├── test_basemap.png.dvc │ │ ├── test_basemap_compass.png.dvc │ │ ├── test_basemap_loglog.png.dvc │ │ ├── test_basemap_map_scale.png.dvc │ │ ├── test_basemap_polar.png.dvc │ │ ├── test_basemap_power_axis.png.dvc │ │ ├── test_basemap_rose.png.dvc │ │ ├── test_basemap_subplot.png.dvc │ │ ├── test_basemap_utm_projection.png.dvc │ │ ├── test_basemap_winkel_tripel.png.dvc │ │ ├── test_coast_dcw_list.png.dvc │ │ ├── test_coast_dcw_single.png.dvc │ │ ├── test_coast_region.png.dvc │ │ ├── test_coast_world_mercator.png.dvc │ │ ├── test_colorbar.png.dvc │ │ ├── test_colorbar_shading_list.png.dvc │ │ ├── test_config.png.dvc │ │ ├── test_config_font_annot.png.dvc │ │ ├── test_config_font_one.png.dvc │ │ ├── test_config_format_date_map.png.dvc │ │ ├── test_config_format_time_map.png.dvc │ │ ├── test_config_map_annot_offset.png.dvc │ │ ├── test_config_map_grid_cross_size.png.dvc │ │ ├── test_config_map_grid_pen.png.dvc │ │ ├── test_config_map_tick_length.png.dvc │ │ ├── test_config_map_tick_pen.png.dvc │ │ ├── test_contour_from_file.png.dvc │ │ ├── test_contour_interval.png.dvc │ │ ├── test_contour_matrix.png.dvc │ │ ├── test_contour_multiple_levels.png.dvc │ │ ├── test_contour_one_level.png.dvc │ │ ├── test_contour_vec.png.dvc │ │ ├── test_geopandas_plot3d_default_cube.png.dvc │ │ ├── test_geopandas_plot3d_non_default_circle.png.dvc │ │ ├── test_geopandas_plot_default_square.png.dvc │ │ ├── test_geopandas_plot_int_dtypes.png.dvc │ │ ├── test_geopandas_plot_non_default_circle.png.dvc │ │ ├── test_grd2cpt.png.dvc │ │ ├── test_grdcontour.png.dvc │ │ ├── test_grdcontour_interval_file_full_opts.png.dvc │ │ ├── test_grdcontour_labels.png.dvc │ │ ├── test_grdcontour_multiple_levels.png.dvc │ │ ├── test_grdcontour_one_level.png.dvc │ │ ├── test_grdcontour_slice.png.dvc │ │ ├── test_grdimage.png.dvc │ │ ├── test_grdimage_file.png.dvc │ │ ├── test_grdimage_global_subset.png.dvc │ │ ├── test_grdimage_grid_no_redundant_360.png.dvc │ │ ├── test_grdimage_image.png.dvc │ │ ├── test_grdimage_over_dateline.png.dvc │ │ ├── test_grdimage_slice.png.dvc │ │ ├── test_grdview_drapegrid_dataarray.png.dvc │ │ ├── test_grdview_grid_dataarray.png.dvc │ │ ├── test_grdview_on_a_plane.png.dvc │ │ ├── test_grdview_on_a_plane_styled_with_facadepen.png.dvc │ │ ├── test_grdview_on_a_plane_with_colored_frontal_facade.png.dvc │ │ ├── test_grdview_surface_mesh_plot_styled_with_meshpen.png.dvc │ │ ├── test_grdview_surface_plot_styled_with_contourpen.png.dvc │ │ ├── test_grdview_with_cmap_for_image_plot.png.dvc │ │ ├── test_grdview_with_cmap_for_perspective_surface_plot.png.dvc │ │ ├── test_grdview_with_cmap_for_surface_monochrome_plot.png.dvc │ │ ├── test_grdview_with_perspective.png.dvc │ │ ├── test_grdview_with_perspective_and_zaxis_frame.png.dvc │ │ ├── test_grdview_with_perspective_and_zscale.png.dvc │ │ ├── test_grdview_with_perspective_and_zsize.png.dvc │ │ ├── test_histogram.png.dvc │ │ ├── test_hlines_clip.png.dvc │ │ ├── test_hlines_geographic_global_d.png.dvc │ │ ├── test_hlines_geographic_global_g.png.dvc │ │ ├── test_hlines_multiple_lines.png.dvc │ │ ├── test_hlines_one_line.png.dvc │ │ ├── test_hlines_polar_projection.png.dvc │ │ ├── test_image.png.dvc │ │ ├── test_inset_aliases.png.dvc │ │ ├── test_inset_context_manager.png.dvc │ │ ├── test_legend_default_position.png.dvc │ │ ├── test_legend_entries.png.dvc │ │ ├── test_legend_position.png.dvc │ │ ├── test_legend_specfile.png.dvc │ │ ├── test_logo.png.dvc │ │ ├── test_logo_on_a_map.png.dvc │ │ ├── test_makecpt_categorical.png.dvc │ │ ├── test_makecpt_continuous.png.dvc │ │ ├── test_makecpt_cyclic.png.dvc │ │ ├── test_makecpt_plot_colorbar.png.dvc │ │ ├── test_makecpt_plot_colorbar_scaled_with_series.png.dvc │ │ ├── test_makecpt_plot_points.png.dvc │ │ ├── test_makecpt_reverse_color_and_zsign.png.dvc │ │ ├── test_makecpt_reverse_color_only.png.dvc │ │ ├── test_makecpt_truncated_zlow_zhigh.png.dvc │ │ ├── test_meca_dict_offset_eventname.png.dvc │ │ ├── test_meca_eventname.png.dvc │ │ ├── test_meca_offset.png.dvc │ │ ├── test_meca_spec_multiple_focalmecha.png.dvc │ │ ├── test_meca_spec_single_focalmecha.png.dvc │ │ ├── test_non_ascii_to_octal.png.dvc │ │ ├── test_plot3d_colors.png.dvc │ │ ├── test_plot3d_colors_sizes.png.dvc │ │ ├── test_plot3d_colors_sizes_proj.png.dvc │ │ ├── test_plot3d_from_file.png.dvc │ │ ├── test_plot3d_matrix.png.dvc │ │ ├── test_plot3d_matrix_color.png.dvc │ │ ├── test_plot3d_ogrgmt_file_multipoint_default_style.png.dvc │ │ ├── test_plot3d_ogrgmt_file_multipoint_non_default_style.png.dvc │ │ ├── test_plot3d_projection.png.dvc │ │ ├── test_plot3d_red_circles_zscale.png.dvc │ │ ├── test_plot3d_red_circles_zsize.png.dvc │ │ ├── test_plot3d_scalar_xyz.png.dvc │ │ ├── test_plot3d_sizes.png.dvc │ │ ├── test_plot3d_sizes_colors_transparencies.png.dvc │ │ ├── test_plot3d_symbol.png.dvc │ │ ├── test_plot3d_transparency.png.dvc │ │ ├── test_plot3d_varying_intensity.png.dvc │ │ ├── test_plot3d_varying_transparency.png.dvc │ │ ├── test_plot3d_vectors.png.dvc │ │ ├── test_plot_colors.png.dvc │ │ ├── test_plot_colors_sizes.png.dvc │ │ ├── test_plot_colors_sizes_proj.png.dvc │ │ ├── test_plot_dataframe_incols.png.dvc │ │ ├── test_plot_datetime.png.dvc │ │ ├── test_plot_from_file.png.dvc │ │ ├── test_plot_lines_with_arrows.png.dvc │ │ ├── test_plot_matrix.png.dvc │ │ ├── test_plot_matrix_color.png.dvc │ │ ├── test_plot_ogrgmt_file_multipoint_default_style.png.dvc │ │ ├── test_plot_ogrgmt_file_multipoint_non_default_style.png.dvc │ │ ├── test_plot_projection.png.dvc │ │ ├── test_plot_red_circles.png.dvc │ │ ├── test_plot_scalar_xy.png.dvc │ │ ├── test_plot_shapefile.png.dvc │ │ ├── test_plot_sizes.png.dvc │ │ ├── test_plot_sizes_colors_transparencies.png.dvc │ │ ├── test_plot_symbol.png.dvc │ │ ├── test_plot_timedelta64.png.dvc │ │ ├── test_plot_transparency.png.dvc │ │ ├── test_plot_varying_intensity.png.dvc │ │ ├── test_plot_varying_transparency.png.dvc │ │ ├── test_plot_vectors.png.dvc │ │ ├── test_rose_2d_array_multiple.png.dvc │ │ ├── test_rose_2d_array_single.png.dvc │ │ ├── test_rose_bools.png.dvc │ │ ├── test_rose_data_file.png.dvc │ │ ├── test_rose_no_sectors.png.dvc │ │ ├── test_rose_plot_data_using_cpt.png.dvc │ │ ├── test_rose_plot_with_transparency.png.dvc │ │ ├── test_shift_origin.png.dvc │ │ ├── test_shift_origin_context_manager.png.dvc │ │ ├── test_shift_origin_mixed_modes.png.dvc │ │ ├── test_shift_origin_nested_context_manager.png.dvc │ │ ├── test_solar_set_terminator_datetime.png.dvc │ │ ├── test_solar_terminators.png.dvc │ │ ├── test_subplot_autolabel_margins_title.png.dvc │ │ ├── test_subplot_basic_frame.png.dvc │ │ ├── test_subplot_clearance_and_shared_xy_axis_layout.png.dvc │ │ ├── test_subplot_direct.png.dvc │ │ ├── test_subplot_outside_plotting_positioning.png.dvc │ │ ├── test_ternary.png.dvc │ │ ├── test_ternary_1_label.png.dvc │ │ ├── test_ternary_3_labels.png.dvc │ │ ├── test_text_angle_30.png.dvc │ │ ├── test_text_angle_font_justify_from_textfile.png.dvc │ │ ├── test_text_angle_justify_font_arrays.png.dvc │ │ ├── test_text_fill.png.dvc │ │ ├── test_text_font_bold.png.dvc │ │ ├── test_text_input_multiple_filenames.png.dvc │ │ ├── test_text_input_remote_filename.png.dvc │ │ ├── test_text_input_single_filename.png.dvc │ │ ├── test_text_justify_bottom_right_and_top_left.png.dvc │ │ ├── test_text_justify_parsed_from_textfile.png.dvc │ │ ├── test_text_multiple_lines_of_text.png.dvc │ │ ├── test_text_nonascii.png.dvc │ │ ├── test_text_nonascii_iso8859.png.dvc │ │ ├── test_text_nonstr_text.png.dvc │ │ ├── test_text_numeric_text.png.dvc │ │ ├── test_text_pen.png.dvc │ │ ├── test_text_position.png.dvc │ │ ├── test_text_position_offset_with_line.png.dvc │ │ ├── test_text_quotation_marks.png.dvc │ │ ├── test_text_round_clearance.png.dvc │ │ ├── test_text_single_line_of_text.png.dvc │ │ ├── test_text_transparency.png.dvc │ │ ├── test_text_varying_transparency.png.dvc │ │ ├── test_tilemap_no_clip_False.png.dvc │ │ ├── test_tilemap_no_clip_True.png.dvc │ │ ├── test_tilemap_ogc_crs84.png.dvc │ │ ├── test_tilemap_web_mercator.png.dvc │ │ ├── test_timestamp.png.dvc │ │ ├── test_timestamp_font.png.dvc │ │ ├── test_timestamp_justify.png.dvc │ │ ├── test_timestamp_label.png.dvc │ │ ├── test_timestamp_offset.png.dvc │ │ ├── test_timestamp_text_truncated.png.dvc │ │ ├── test_velo_numpy_array_numeric_only.png.dvc │ │ ├── test_velo_pandas_dataframe.png.dvc │ │ ├── test_vlines_clip.png.dvc │ │ ├── test_vlines_geographic_global.png.dvc │ │ ├── test_vlines_multiple_lines.png.dvc │ │ ├── test_vlines_one_line.png.dvc │ │ ├── test_vlines_polar_projection.png.dvc │ │ └── test_wiggle.png.dvc │ ├── data │ │ ├── cities.txt │ │ ├── contours.txt │ │ ├── points.txt │ │ └── track.txt │ ├── test_basemap.py │ ├── test_binstats.py │ ├── test_blockm.py │ ├── test_blockmedian.py │ ├── test_clib.py │ ├── test_clib_call_module.py │ ├── test_clib_create_data.py │ ├── test_clib_dataarray_to_matrix.py │ ├── test_clib_extract_region.py │ ├── test_clib_inquire_virtualfile.py │ ├── test_clib_loading.py │ ├── test_clib_put_matrix.py │ ├── test_clib_put_strings.py │ ├── test_clib_put_vector.py │ ├── test_clib_read_data.py │ ├── test_clib_to_numpy.py │ ├── test_clib_vectors_to_arrays.py │ ├── test_clib_virtualfile_from_matrix.py │ ├── test_clib_virtualfile_from_stringio.py │ ├── test_clib_virtualfile_from_vectors.py │ ├── test_clib_virtualfile_in.py │ ├── test_clib_virtualfiles.py │ ├── test_clib_write_data.py │ ├── test_coast.py │ ├── test_colorbar.py │ ├── test_config.py │ ├── test_contour.py │ ├── test_datasets_earth_age.py │ ├── test_datasets_earth_day.py │ ├── test_datasets_earth_deflection.py │ ├── test_datasets_earth_dist.py │ ├── test_datasets_earth_free_air_anomaly.py │ ├── test_datasets_earth_geoid.py │ ├── test_datasets_earth_magnetic_anomaly.py │ ├── test_datasets_earth_mask.py │ ├── test_datasets_earth_mean_sea_surface.py │ ├── test_datasets_earth_night.py │ ├── test_datasets_earth_relief.py │ ├── test_datasets_earth_vertical_gravity_gradient.py │ ├── test_datasets_load_remote_datasets.py │ ├── test_datasets_mars_relief.py │ ├── test_datasets_mean_dynamic_topography.py │ ├── test_datasets_mercury_relief.py │ ├── test_datasets_moon_relief.py │ ├── test_datasets_pluto_relief.py │ ├── test_datasets_samples.py │ ├── test_datasets_venus_relief.py │ ├── test_datatypes_dataset.py │ ├── test_dimfilter.py │ ├── test_figure.py │ ├── test_filter1d.py │ ├── test_geopandas.py │ ├── test_grd2cpt.py │ ├── test_grd2xyz.py │ ├── test_grdclip.py │ ├── test_grdcontour.py │ ├── test_grdcut.py │ ├── test_grdcut_image.py │ ├── test_grdfill.py │ ├── test_grdfilter.py │ ├── test_grdgradient.py │ ├── test_grdhisteq.py │ ├── test_grdimage.py │ ├── test_grdimage_image.py │ ├── test_grdinfo.py │ ├── test_grdlandmask.py │ ├── test_grdproject.py │ ├── test_grdsample.py │ ├── test_grdtrack.py │ ├── test_grdview.py │ ├── test_grdvolume.py │ ├── test_helpers.py │ ├── test_histogram.py │ ├── test_hlines.py │ ├── test_image.py │ ├── test_info.py │ ├── test_inset.py │ ├── test_io.py │ ├── test_legend.py │ ├── test_logo.py │ ├── test_makecpt.py │ ├── test_meca.py │ ├── test_nearneighbor.py │ ├── test_plot.py │ ├── test_plot3d.py │ ├── test_project.py │ ├── test_psconvert.py │ ├── test_rose.py │ ├── test_select.py │ ├── test_session_management.py │ ├── test_shift_origin.py │ ├── test_show_versions.py │ ├── test_solar.py │ ├── test_sph2grd.py │ ├── test_sphdistance.py │ ├── test_sphinterpolate.py │ ├── test_sphinx_gallery.py │ ├── test_subplot.py │ ├── test_surface.py │ ├── test_ternary.py │ ├── test_text.py │ ├── test_tilemap.py │ ├── test_timestamp.py │ ├── test_triangulate.py │ ├── test_velo.py │ ├── test_vlines.py │ ├── test_which.py │ ├── test_wiggle.py │ ├── test_x2sys_cross.py │ ├── test_x2sys_init.py │ ├── test_xarray_accessor.py │ ├── test_xarray_backend.py │ └── test_xyz2grd.py └── xarray │ ├── __init__.py │ ├── accessor.py │ └── backend.py ├── pyproject.toml └── requirements.txt /.dvc/.gitignore: -------------------------------------------------------------------------------- 1 | /config.local 2 | /tmp 3 | /cache 4 | -------------------------------------------------------------------------------- /.dvc/config: -------------------------------------------------------------------------------- 1 | [core] 2 | remote = upstream 3 | ['remote "upstream"'] 4 | url = https://dagshub.com/GenericMappingTools/pygmt.dvc 5 | -------------------------------------------------------------------------------- /.dvcignore: -------------------------------------------------------------------------------- 1 | # Add patterns of files dvc should ignore, which could improve the performance. 2 | # Learn more at https://dvc.org/doc/user-guide/project-structure/dvcignore-files 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/2-feature_request.yaml: -------------------------------------------------------------------------------- 1 | name: Feature request - General feature 2 | description: Request the addition of a new feature/functionality 3 | labels: ["feature request"] 4 | body: 5 | - type: textarea 6 | attributes: 7 | label: "Description of the desired feature" 8 | description: > 9 | Please be as detailed as you can in your description. If possible, include 10 | an example of how you would like to use this feature (even better if it's a code example). 11 | - type: dropdown 12 | id: help 13 | attributes: 14 | label: Are you willing to help implement and maintain this feature? 15 | description: > 16 | Every feature we add is code that we will have to maintain and keep updated. 17 | This takes a lot of effort. If you are willing to be involved in the project and 18 | help maintain your feature, it will make it easier for us to accept it. 19 | options: 20 | - "No" 21 | - "Yes" 22 | - "Maybe" 23 | validations: 24 | required: true 25 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/3-module_request.yaml: -------------------------------------------------------------------------------- 1 | name: Feature request - Wrap a new GMT module 2 | description: Request PyGMT wrapper for a GMT module 3 | title: "Wrapper for " 4 | labels: ["feature request"] 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: > 9 | Please replace `` in the issue title and the description with the 10 | name of the requested module and add the description of the module. 11 | - type: textarea 12 | id: which-module 13 | attributes: 14 | label: Description of the desired module 15 | description: > 16 | Please be as detailed as you can in your description. If possible, include 17 | an example of how you would like to use this feature (even better if it's a code example). 18 | placeholder: > 19 | Implement [``](https://docs.generic-mapping-tools.org/latest/.html) 20 | which ``. 21 | validations: 22 | required: true 23 | - type: dropdown 24 | id: help 25 | attributes: 26 | label: Are you willing to help implement and maintain this feature? 27 | description: > 28 | Every feature we add is code that we will have to maintain and keep updated. 29 | This takes a lot of effort. If you are willing to be involved in the project and 30 | help maintain your feature, it will make it easier for us to accept it. 31 | options: 32 | - "No" 33 | - "Yes" 34 | - "Maybe" 35 | validations: 36 | required: true 37 | - type: markdown 38 | attributes: 39 | value: > 40 | Progress on wrapping the module will be tracked in the 41 | [project board](https://github.com/orgs/GenericMappingTools/projects/3). 42 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: true 2 | contact_links: 3 | - name: GMT Community Forum 4 | url: https://forum.generic-mapping-tools.org/c/questions/pygmt-q-a 5 | about: Please ask questions here or find answers to common problems. 6 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | **Description of proposed changes** 2 | 3 | 4 | 5 | 6 | 7 | 8 | Fixes # 9 | 10 | 11 | 12 | **Preview**: 13 | 14 | 15 | **Reminders** 16 | 17 | - [ ] Run `make format` and `make check` to make sure the code follows the style guide. 18 | - [ ] Add tests for new features or tests that would have caught the bug that you're fixing. 19 | - [ ] Add new public functions/methods/classes to `doc/api/index.rst`. 20 | - [ ] Write detailed docstrings for all functions/methods. 21 | - [ ] If wrapping a new module, open a 'Wrap new GMT module' issue and submit reasonably-sized PRs. 22 | - [ ] If adding new functionality, add an example to docstrings or tutorials. 23 | 24 | **Slash Commands** 25 | 26 | You can write slash commands (`/command`) in the first line of a comment to perform 27 | specific operations. Supported slash command is: 28 | 29 | - `/format`: automatically format and lint the code 30 | -------------------------------------------------------------------------------- /.github/codecov.yml: -------------------------------------------------------------------------------- 1 | codecov: 2 | notify: 3 | require_ci_to_pass: no 4 | 5 | coverage: 6 | status: 7 | project: 8 | default: 9 | target: auto # increase overall coverage on each pull request 10 | threshold: 0.25% # Allow the coverage to drop by X% 11 | if_not_found: success 12 | if_ci_failed: failure 13 | patch: 14 | default: 15 | target: 90% # >=90% of new changes should be tested 16 | if_not_found: success 17 | if_ci_failed: failure 18 | 19 | comment: off 20 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Set update schedule for GitHub Actions 2 | 3 | version: 2 4 | updates: 5 | 6 | - package-ecosystem: "github-actions" 7 | directory: "/" 8 | schedule: 9 | # Check for updates to GitHub Actions on Tuesdays 10 | interval: "weekly" 11 | day: "tuesday" 12 | # Allow up to 2 open pull requests at a time 13 | open-pull-requests-limit: 2 14 | # Specify labels for pull requests 15 | labels: 16 | - "maintenance" 17 | - "skip-changelog" 18 | -------------------------------------------------------------------------------- /.github/release-drafter.yml: -------------------------------------------------------------------------------- 1 | name-template: 'v$RESOLVED_VERSION' 2 | tag-template: 'v$RESOLVED_VERSION' 3 | version-resolver: 4 | minor: 5 | labels: 6 | - 'feature' 7 | default: patch 8 | categories: 9 | - title: 'New Features' 10 | label: 'feature' 11 | - title: 'Enhancements' 12 | label: 'enhancement' 13 | - title: 'Deprecations' 14 | label: 'deprecation' 15 | - title: 'Bug Fixes' 16 | label: 'bug' 17 | - title: 'Documentation' 18 | label: 'documentation' 19 | - title: 'Maintenance' 20 | label: 'maintenance' 21 | exclude-labels: 22 | - 'skip-changelog' 23 | exclude-contributors: 24 | - 'actions-bot' 25 | - 'dependabot' 26 | - 'dependabot[bot]' 27 | - 'pre-commit-ci' 28 | - 'pre-commit-ci[bot]' 29 | category-template: '### $TITLE' 30 | change-template: '* $TITLE ([#$NUMBER]($URL))' 31 | sort-by: 'title' 32 | replacers: 33 | - search: '/@(\w+)?/g' 34 | replace: '[@$1](https://github.com/$1)' 35 | - search: '@maxrjones' 36 | replace: 'Max Jones' 37 | - search: '@michaelgrund' 38 | replace: 'Michael Grund' 39 | - search: '@seisman' 40 | replace: 'Dongdong Tian' 41 | - search: '@weiji14' 42 | replace: 'Wei Ji Leong' 43 | - search: '@willschlitzer' 44 | replace: 'Will Schlitzer' 45 | - search: '@yvonnefroehlich' 46 | replace: 'Yvonne Fröhlich' 47 | template: | 48 | ## Release v$RESOLVED_VERSION (20YY/MM/DD) 49 | 50 | [![Digital Object Identifier for PyGMT v$RESOLVED_VERSION](https://zenodo.org/badge/DOI/10.5281/zenodo.3781524.svg)](https://doi.org/10.5281/zenodo.3781524) 51 | 52 | ### Highlights 53 | 54 | * 55 | 56 | $CHANGES 57 | 58 | **Full Changelog**: 59 | 60 | ### Contributors 61 | 62 | $CONTRIBUTORS 63 | -------------------------------------------------------------------------------- /.github/workflows/format-command.yml: -------------------------------------------------------------------------------- 1 | # Format the codes using slash command 2 | # 3 | # This workflow is triggered in a PR if the slash command `/format` is used. 4 | # 5 | name: format-command 6 | 7 | on: 8 | repository_dispatch: 9 | types: [format-command] 10 | 11 | permissions: 12 | contents: write 13 | 14 | jobs: 15 | format: 16 | runs-on: ubuntu-latest 17 | steps: 18 | # Generate token from GenericMappingTools bot 19 | - uses: actions/create-github-app-token@v2.0.6 20 | id: generate-token 21 | with: 22 | app-id: ${{ secrets.APP_ID }} 23 | private-key: ${{ secrets.APP_PRIVATE_KEY }} 24 | 25 | # Checkout the pull request branch 26 | - uses: actions/checkout@v4.2.2 27 | with: 28 | token: ${{ steps.generate-token.outputs.token }} 29 | repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }} 30 | ref: ${{ github.event.client_payload.pull_request.head.ref }} 31 | persist-credentials: false 32 | 33 | # Setup Python environment 34 | - uses: actions/setup-python@v5.6.0 35 | with: 36 | python-version: '3.13' 37 | 38 | # Install formatting tools 39 | - name: Install formatting tools 40 | run: | 41 | python -m pip install ruff pre-commit 42 | python -m pip list 43 | 44 | # Run "make format" and commit the change to the PR branch 45 | - name: Commit to the PR branch if any changes 46 | run: | 47 | make format 48 | if [[ $(git ls-files -m) ]]; then 49 | git config --global user.name 'actions-bot' 50 | git config --global user.email '58130806+actions-bot@users.noreply.github.com' 51 | git commit -am "[format-command] fixes" 52 | git push 53 | fi 54 | -------------------------------------------------------------------------------- /.github/workflows/release-baseline-images.yml: -------------------------------------------------------------------------------- 1 | # Upload the ZIP archive of baseline images as a release asset 2 | # 3 | # This workflow is run to upload the ZIP archive of baseline images as a 4 | # release asset when a release is published. 5 | # 6 | name: Upload baseline images 7 | 8 | # Only run for releases 9 | on: 10 | release: 11 | types: 12 | - published 13 | 14 | jobs: 15 | upload-baseline: 16 | name: Upload baseline images 17 | runs-on: ubuntu-latest 18 | if: github.repository == 'GenericMappingTools/pygmt' 19 | 20 | permissions: 21 | # To write assets to GitHub release 22 | contents: write 23 | 24 | steps: 25 | - name: Checkout 26 | uses: actions/checkout@v4.2.2 27 | with: 28 | persist-credentials: false 29 | 30 | - name: Setup data version control (DVC) 31 | uses: iterative/setup-dvc@v1.1.2 32 | 33 | - name: Pull baseline image data from dvc remote 34 | run: dvc pull && ls -lhR pygmt/tests/baseline/ 35 | 36 | - name: Create the baseline image asset in zip format 37 | run: | 38 | mkdir baseline-images 39 | mv pygmt/tests/baseline/*.png baseline-images/ 40 | zip -r baseline-images.zip baseline-images 41 | shasum -a 256 baseline-images.zip 42 | 43 | - name: Upload baseline image as a release asset 44 | run: gh release upload ${REF_NAME} baseline-images.zip 45 | env: 46 | GH_TOKEN: ${{ github.token }} 47 | REF_NAME: ${{ github.ref_name }} 48 | -------------------------------------------------------------------------------- /.github/workflows/release-drafter.yml: -------------------------------------------------------------------------------- 1 | # Draft the next release notes 2 | # 3 | # This workflow is run to update the next release notes as pull requests are merged into 4 | # the main branch. The configuration file is located at `.github/release-drafter.yml`. 5 | # 6 | name: Release Drafter 7 | 8 | on: 9 | push: 10 | branches: 11 | - main 12 | 13 | permissions: 14 | contents: read 15 | 16 | jobs: 17 | update_release_draft: 18 | permissions: 19 | # write permission is required to create a github release 20 | contents: write 21 | runs-on: ubuntu-latest 22 | if: github.repository == 'GenericMappingTools/pygmt' 23 | 24 | steps: 25 | # Drafts your next Release notes as Pull Requests are merged into "main" 26 | - uses: release-drafter/release-drafter@v6.1.0 27 | with: 28 | # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml 29 | config-name: release-drafter.yml 30 | env: 31 | GITHUB_TOKEN: ${{ github.token }} 32 | -------------------------------------------------------------------------------- /.github/workflows/slash-command-dispatch.yml: -------------------------------------------------------------------------------- 1 | # Support slash commands in pull requests 2 | # 3 | # Currently, only one slash command `format` is supported. 4 | # 5 | name: Slash Command Dispatch 6 | 7 | on: 8 | issue_comment: 9 | types: [created] 10 | # Add "edited" type for test purposes. Where possible, avoid using to prevent processing unnecessary events. 11 | # types: [created, edited] 12 | 13 | permissions: 14 | issues: write 15 | 16 | jobs: 17 | slashCommandDispatch: 18 | if: ${{ github.event.issue.pull_request }} 19 | runs-on: ubuntu-latest 20 | steps: 21 | - name: Slash Command Dispatch 22 | uses: peter-evans/slash-command-dispatch@v4.0.0 23 | with: 24 | token: ${{ github.token }} 25 | commands: | 26 | format 27 | issue-type: pull-request 28 | permission: none 29 | -------------------------------------------------------------------------------- /.github/workflows/type_checks.yml: -------------------------------------------------------------------------------- 1 | # Static type checks 2 | # 3 | # This workflow runs static type checks using mypy. 4 | # 5 | # It is run on every commit to the main and pull request branches. It is also 6 | # scheduled to run daily on the main branch. 7 | # 8 | name: Static Type Checks 9 | 10 | on: 11 | push: 12 | branches: [ main ] 13 | paths: 14 | - 'pygmt/**/*.py' 15 | - '.github/workflows/type_checks.yml' 16 | pull_request: 17 | paths: 18 | - 'pygmt/**/*.py' 19 | - '.github/workflows/type_checks.yml' 20 | # Schedule daily tests 21 | schedule: 22 | - cron: '0 0 * * *' 23 | 24 | concurrency: 25 | group: ${{ github.workflow }}-${{ github.ref }} 26 | cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} 27 | 28 | permissions: {} 29 | 30 | jobs: 31 | static_check: 32 | name: Static Type Check 33 | runs-on: ubuntu-latest 34 | 35 | steps: 36 | # Checkout current git repository 37 | - name: Checkout 38 | uses: actions/checkout@v4.2.2 39 | with: 40 | persist-credentials: false 41 | 42 | # Setup Python 43 | - name: Set up Python 44 | uses: actions/setup-python@v5.6.0 45 | with: 46 | python-version: '3.13' 47 | 48 | - name: Install packages 49 | run: | 50 | # Need to install four groups of packages: 51 | # 1. required packages 52 | # 2. optional packages 53 | # 3. type checker and stub packages 54 | # 4. other packages that are used somewhere in PyGMT 55 | python -m pip install \ 56 | numpy pandas xarray packaging \ 57 | contextily geopandas ipython pyarrow rioxarray \ 58 | mypy pandas-stubs pyarrow-stubs \ 59 | matplotlib pytest 60 | python -m pip list 61 | 62 | - name: Static type check 63 | run: make typecheck 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | *.py[cd] 3 | 4 | # C extensions 5 | *.so 6 | 7 | # Distribution / packaging 8 | build/ 9 | dist/ 10 | *.egg 11 | *.egg-info/ 12 | .eggs/ 13 | MANIFEST 14 | 15 | # Unit test / coverage reports / linter cache 16 | .cache 17 | .coverage 18 | coverage.xml 19 | htmlcov/ 20 | .mypy_cache/ 21 | .pytest_cache/ 22 | .ruff_cache/ 23 | results/ 24 | result_images/ 25 | tmp-test-dir-with-unique-name/ 26 | 27 | # Sphinx documentation 28 | doc/api/generated/ 29 | doc/_build/ 30 | doc/intro/ 31 | doc/tutorials/ 32 | doc/gallery/ 33 | doc/projections/ 34 | # doc/sg_execution_time.rst is auto-generated by Sphinx-Gallery 35 | doc/sg_execution_times.rst 36 | 37 | # Jupyter notebook 38 | .ipynb_checkpoints/ 39 | 40 | # Visual Studio Code 41 | .vscode/ 42 | 43 | # Environments 44 | .env 45 | 46 | # Backup copies / swap files 47 | *~ 48 | .*.swp 49 | 50 | # macOS 51 | .DS_Store 52 | 53 | # Data files (tracked using dvc) 54 | pygmt/tests/baseline/test_*.png 55 | -------------------------------------------------------------------------------- /.mailmap: -------------------------------------------------------------------------------- 1 | Dongdong Tian 2 | Dongdong Tian 3 | Jiayuan Yao 4 | Jiayuan Yao 5 | Jing-Hui Tong <86273921+JingHuiTong@users.noreply.github.com> 6 | Jing-Hui Tong <86273921+JingHuiTong@users.noreply.github.com> 7 | Max Jones <14077947+maxrjones@users.noreply.github.com> 8 | Max Jones <14077947+maxrjones@users.noreply.github.com> 9 | Max Jones <14077947+maxrjones@users.noreply.github.com> 10 | Max Jones <14077947+maxrjones@users.noreply.github.com> 11 | Michael Grund <23025878+michaelgrund@users.noreply.github.com> 12 | Michael Grund 13 | Michael Grund 14 | Wei Ji Leong <23487320+weiji14@users.noreply.github.com> 15 | Wei Ji Leong <23487320+weiji14@users.noreply.github.com> 16 | Wei Ji Leong <23487320+weiji14@users.noreply.github.com> 17 | Will Schlitzer 18 | Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com> 19 | Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com> 20 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | # See https://pre-commit.com for more information 2 | # See https://pre-commit.com/hooks.html for more hooks 3 | repos: 4 | - repo: https://github.com/pre-commit/pre-commit-hooks 5 | rev: v5.0.0 6 | hooks: 7 | - id: check-added-large-files 8 | - id: check-yaml 9 | - id: end-of-file-fixer 10 | - id: trailing-whitespace 11 | - repo: https://github.com/Lucas-C/pre-commit-hooks 12 | rev: v1.5.5 13 | hooks: 14 | - id: forbid-crlf 15 | - id: remove-crlf 16 | - id: chmod 17 | args: ['644'] 18 | - repo: https://github.com/woodruffw/zizmor-pre-commit 19 | rev: v1.5.2 20 | hooks: 21 | - id: zizmor 22 | 23 | 24 | # https://pre-commit.ci/#configuration 25 | ci: 26 | skip: [chmod] 27 | autofix_prs: false 28 | autoupdate_schedule: quarterly 29 | -------------------------------------------------------------------------------- /.readthedocs.yaml: -------------------------------------------------------------------------------- 1 | # Read the Docs configuration file 2 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details 3 | 4 | # Required 5 | version: 2 6 | 7 | # Set the version of Python and other tools you might need 8 | build: 9 | os: ubuntu-24.04 10 | tools: 11 | python: "mambaforge-23.11" 12 | jobs: 13 | post_checkout: 14 | # Cancel building pull requests when there aren't changes related to docs. 15 | # If there are no changes (git diff exits with 0) we force the command to return with 183. 16 | # This is a special exit code on Read the Docs that will cancel the build immediately. 17 | - | 18 | if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && \ 19 | git diff --quiet origin/main -- \ 20 | doc/ \ 21 | examples \ 22 | pygmt/**/*.py \ 23 | ':!pygmt/tests' \ 24 | README.md \ 25 | ci/requirements/docs.yml \ 26 | .readthedocs.yaml; 27 | then 28 | exit 183; 29 | fi 30 | pre_build: 31 | # Generate api stub files before building 32 | - make -C doc api 33 | 34 | # Build documentation in the doc/ directory with Sphinx 35 | sphinx: 36 | configuration: doc/conf.py 37 | 38 | # If using Sphinx, optionally build your docs in additional formats such as PDF 39 | # formats: 40 | # - pdf 41 | 42 | # Optionally declare the Python requirements required to build your docs 43 | conda: 44 | environment: ci/requirements/docs.yml 45 | python: 46 | install: 47 | - method: pip 48 | path: . 49 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017-2025 The PyGMT Developers 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | * Neither the name of the PyGMT Developers nor the names of any contributors 13 | may be used to endorse or promote products derived from this software 14 | without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | prune .dvc 2 | prune .github* 3 | prune ci 4 | prune doc* 5 | prune examples* 6 | prune pygmt/tests* 7 | exclude .dvcignore 8 | exclude .gitignore 9 | exclude .pre-commit-config.yaml 10 | exclude .readthedocs.yaml 11 | exclude .mailmap 12 | exclude AUTHORSHIP.md 13 | exclude CONTRIBUTING.md 14 | exclude Makefile 15 | exclude environment.yml 16 | exclude requirements.txt 17 | -------------------------------------------------------------------------------- /ci/requirements/docs.yml: -------------------------------------------------------------------------------- 1 | name: pygmt 2 | channels: 3 | - conda-forge 4 | - nodefaults 5 | dependencies: 6 | # Required dependencies 7 | - python=3.13 8 | - gmt=6.5.0 9 | - ghostscript=10.04.0 10 | - numpy 11 | - pandas 12 | - xarray 13 | - packaging 14 | # Optional dependencies 15 | - contextily 16 | - geopandas 17 | - ipython 18 | - pyarrow-core 19 | - rioxarray 20 | # Development dependencies (general) 21 | - make 22 | - pip 23 | - python-build 24 | # Dev dependencies (building documentation) 25 | - geodatasets 26 | - myst-nb 27 | - panel 28 | - sphinx>=6.2 29 | - sphinx-autodoc-typehints 30 | - sphinx-copybutton 31 | - sphinx-design 32 | - sphinx-gallery 33 | - sphinx_rtd_theme 34 | # Dev dependencies (building PDF documentation) 35 | # 'sphinxcontrib-svg2pdfconverter' is required since it's added to `extensions`. 36 | - sphinxcontrib-svg2pdfconverter 37 | -------------------------------------------------------------------------------- /doc/_static/agu2017-poster.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GenericMappingTools/pygmt/72e5c528c171e9c31326f26d99d7ef0cd4e0b107/doc/_static/agu2017-poster.jpg -------------------------------------------------------------------------------- /doc/_static/agu2019-poster.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GenericMappingTools/pygmt/72e5c528c171e9c31326f26d99d7ef0cd4e0b107/doc/_static/agu2019-poster.jpg -------------------------------------------------------------------------------- /doc/_static/aogs2018-poster.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GenericMappingTools/pygmt/72e5c528c171e9c31326f26d99d7ef0cd4e0b107/doc/_static/aogs2018-poster.jpg -------------------------------------------------------------------------------- /doc/_static/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GenericMappingTools/pygmt/72e5c528c171e9c31326f26d99d7ef0cd4e0b107/doc/_static/favicon.png -------------------------------------------------------------------------------- /doc/_static/fonts/Atkinson-Hyperlegible-Bold-102a.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GenericMappingTools/pygmt/72e5c528c171e9c31326f26d99d7ef0cd4e0b107/doc/_static/fonts/Atkinson-Hyperlegible-Bold-102a.woff2 -------------------------------------------------------------------------------- /doc/_static/fonts/Atkinson-Hyperlegible-BoldItalic-102a.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GenericMappingTools/pygmt/72e5c528c171e9c31326f26d99d7ef0cd4e0b107/doc/_static/fonts/Atkinson-Hyperlegible-BoldItalic-102a.woff2 -------------------------------------------------------------------------------- /doc/_static/fonts/Atkinson-Hyperlegible-Italic-102a.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GenericMappingTools/pygmt/72e5c528c171e9c31326f26d99d7ef0cd4e0b107/doc/_static/fonts/Atkinson-Hyperlegible-Italic-102a.woff2 -------------------------------------------------------------------------------- /doc/_static/fonts/Atkinson-Hyperlegible-Regular-102a.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GenericMappingTools/pygmt/72e5c528c171e9c31326f26d99d7ef0cd4e0b107/doc/_static/fonts/Atkinson-Hyperlegible-Regular-102a.woff2 -------------------------------------------------------------------------------- /doc/_static/scipy2017-youtube-thumbnail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GenericMappingTools/pygmt/72e5c528c171e9c31326f26d99d7ef0cd4e0b107/doc/_static/scipy2017-youtube-thumbnail.png -------------------------------------------------------------------------------- /doc/_static/scipy2018-youtube-thumbnail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GenericMappingTools/pygmt/72e5c528c171e9c31326f26d99d7ef0cd4e0b107/doc/_static/scipy2018-youtube-thumbnail.png -------------------------------------------------------------------------------- /doc/_static/scipy2022-youtube-thumbnail.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GenericMappingTools/pygmt/72e5c528c171e9c31326f26d99d7ef0cd4e0b107/doc/_static/scipy2022-youtube-thumbnail.jpg -------------------------------------------------------------------------------- /doc/_templates/autosummary/base.rst: -------------------------------------------------------------------------------- 1 | {{ fullname | escape | underline }} 2 | 3 | .. currentmodule:: {{ module }} 4 | 5 | .. auto{{ objtype }}:: {{ objname }} 6 | 7 | .. raw:: html 8 | 9 |
10 | -------------------------------------------------------------------------------- /doc/_templates/autosummary/class.rst: -------------------------------------------------------------------------------- 1 | {{ fullname | escape | underline }} 2 | 3 | .. currentmodule:: {{ module }} 4 | 5 | .. autoclass:: {{ objname }} 6 | 7 | {% if attributes %} 8 | .. rubric:: Attributes 9 | 10 | {% for item in attributes %} 11 | .. autoproperty:: 12 | {{ objname }}.{{ item }} 13 | {% endfor %} 14 | {% endif %} 15 | 16 | {% if methods != ["__init__"] %} 17 | .. rubric:: Methods Summary 18 | 19 | .. autosummary:: 20 | :toctree: 21 | {% for item in methods %} 22 | {% if item != '__init__' %} 23 | {{ objname }}.{{ item }} 24 | {% endif %} 25 | {% endfor %} 26 | {% endif %} 27 | 28 | .. minigallery:: {{ fullname }} 29 | :add-heading: 30 | 31 | .. raw:: html 32 | 33 |
34 | -------------------------------------------------------------------------------- /doc/_templates/autosummary/enums.rst: -------------------------------------------------------------------------------- 1 | {{ fullname | escape | underline }} 2 | 3 | .. currentmodule:: {{ module }} 4 | 5 | .. autoclass:: {{ objname }} 6 | :members: 7 | :member-order: bysource 8 | -------------------------------------------------------------------------------- /doc/_templates/autosummary/exception.rst: -------------------------------------------------------------------------------- 1 | {{ fullname | escape | underline }} 2 | 3 | .. currentmodule:: {{ module }} 4 | 5 | .. autoexception:: {{ objname }} 6 | 7 | 8 | .. raw:: html 9 | 10 |
11 | -------------------------------------------------------------------------------- /doc/_templates/autosummary/function.rst: -------------------------------------------------------------------------------- 1 | {{ fullname | escape | underline }} 2 | 3 | .. currentmodule:: {{ module }} 4 | 5 | .. autofunction:: {{ objname }} 6 | 7 | .. minigallery:: {{ fullname }} 8 | :add-heading: 9 | 10 | .. raw:: html 11 | 12 |
13 | -------------------------------------------------------------------------------- /doc/_templates/autosummary/method.rst: -------------------------------------------------------------------------------- 1 | {{ fullname | escape | underline }} 2 | 3 | .. currentmodule:: {{ module }} 4 | 5 | .. automethod:: {{ objname }} 6 | 7 | .. minigallery:: {{ fullname }} 8 | :add-heading: 9 | 10 | .. raw:: html 11 | 12 |
13 | -------------------------------------------------------------------------------- /doc/_templates/autosummary/module.rst: -------------------------------------------------------------------------------- 1 | .. raw:: html 2 | 3 |
4 | 5 | ``{{ fullname }}`` 6 | {% for i in range(fullname|length + 15) %}-{% endfor %} 7 | 8 | .. raw:: html 9 | 10 |
11 | 12 | .. automodule:: {{ fullname }} 13 | 14 | {% block classes %} 15 | {% if classes %} 16 | .. rubric:: Classes 17 | 18 | .. autosummary:: 19 | :toctree: 20 | {% for item in classes %} 21 | {{ item }} 22 | {% endfor %} 23 | {% endif %} 24 | {% endblock %} 25 | 26 | 27 | {% block functions %} 28 | {% if functions %} 29 | .. rubric:: Functions 30 | 31 | .. autosummary:: 32 | :toctree: 33 | {% for item in functions %} 34 | {{ item }} 35 | {% endfor %} 36 | {% endif %} 37 | {% endblock %} 38 | 39 | 40 | {% block exceptions %} 41 | {% if exceptions %} 42 | .. rubric:: Exceptions 43 | 44 | .. autosummary:: 45 | :toctree: 46 | {% for item in exceptions %} 47 | {{ item }} 48 | {% endfor %} 49 | {% endif %} 50 | {% endblock %} 51 | 52 | .. raw:: html 53 | 54 |
55 | -------------------------------------------------------------------------------- /doc/_templates/footer.html: -------------------------------------------------------------------------------- 1 | {# Import the theme's layout. #} 2 | {% extends "!footer.html" %} 3 | 4 | {%- block extrafooter %} 5 |

6 | Built with Sphinx 7 | using a theme 8 | provided by Read the Docs 9 |

10 |

11 | This website uses Google Analytics to gather usage statistics. 12 | However, it does not use cookies or track you across different websites. 13 | Page view data are used to help us improve the site and provide an estimate of the 14 | software usage. 15 |

16 | {% endblock %} 17 | -------------------------------------------------------------------------------- /doc/index.md: -------------------------------------------------------------------------------- 1 | ```{title} Home 2 | ``` 3 | 4 | 11 | 12 | ```{include} ../README.md 13 | :start-after: 14 | :end-before: 15 | :relative-images: 16 | ``` 17 | 18 | ```{toctree} 19 | :maxdepth: 2 20 | :hidden: 21 | :caption: Getting Started 22 | 23 | overview.md 24 | install.md 25 | intro/index.rst 26 | ``` 27 | 28 | ```{toctree} 29 | :maxdepth: 2 30 | :hidden: 31 | :caption: User Guide 32 | 33 | tutorials/index.rst 34 | gallery/index.rst 35 | projections/index.rst 36 | external_resources.md 37 | ``` 38 | 39 | ```{toctree} 40 | :maxdepth: 2 41 | :hidden: 42 | :caption: Reference Documentation 43 | 44 | api/index.rst 45 | techref/index.md 46 | changes.md 47 | minversions.md 48 | ecosystem.md 49 | ``` 50 | 51 | ```{toctree} 52 | :maxdepth: 2 53 | :hidden: 54 | :caption: Development 55 | 56 | team.md 57 | contributing.md 58 | maintenance.md 59 | ``` 60 | -------------------------------------------------------------------------------- /doc/techref/common_parameters.md: -------------------------------------------------------------------------------- 1 | # Common Parameters 2 | 3 | ```{glossary} 4 | ``distcalc`` 5 | Determine how spherical distances are calculated. Valid values are: 6 | 7 | - ``"g"``: Perform great circle distance calculations, with parameters such as 8 | distance increments or radii compared against calculated great circle distances 9 | [Default]. 10 | - ``"e"``: Select ellipsoidal (or geodesic) mode for the highest precision but 11 | slowest calculation time. 12 | - ``"f"``: Select Flat Earth mode, which gives a more approximate but faster result. 13 | 14 | **Note:** (1) All spherical distance calculations depend on the current ellipsoid 15 | ({gmt-term}`PROJ_ELLIPSOID`), the definition of the mean radius 16 | ({gmt-term}`PROJ_MEAN_RADIUS`), and the specification of the latitude type 17 | ({gmt-term}`PROJ_AUX_LATITUDE`). Geodesic distance calculations are also controlled 18 | by the algorithm to use for geodesic calculations ({gmt-term}`PROJ_GEODESIC`). 19 | (2) Coordinate transformations that can use ellipsoidal or spherical forms will 20 | first consult this parameter if given. 21 | 22 | ``verbose`` 23 | Select verbosity level, which modulates the messages written to stderr. 24 | 25 | Choose among 7 levels of verbosity [Default is ``"w"``]: 26 | 27 | - ``"q"``: Quiet, not even fatal error messages are produced 28 | - ``"e"``: Error messages only 29 | - ``"w"``: Warnings [Default] 30 | - ``"t"``: Timings (report runtimes for time-intensive algorithms) 31 | - ``"i"``: Informational messages (same as ``verbose=True``) 32 | - ``"c"``: Compatibility warnings 33 | - ``"d"``: Debugging messages 34 | ``` 35 | -------------------------------------------------------------------------------- /doc/techref/index.md: -------------------------------------------------------------------------------- 1 | # Technical Reference 2 | 3 | The Technical Reference section provides detailed information on the technical aspects of 4 | GMT and PyGMT, including supported encodings, fonts, bit and hachure patterns, and other 5 | essential components for creating high-quality visualizations. For additional details, 6 | visit the {gmt-docs}`GMT Technical Reference `. 7 | 8 | ```{toctree} 9 | :maxdepth: 1 10 | 11 | common_parameters.md 12 | projections.md 13 | fonts.md 14 | patterns.md 15 | encodings.md 16 | environment_variables.md 17 | ``` 18 | -------------------------------------------------------------------------------- /doc/techref/patterns.md: -------------------------------------------------------------------------------- 1 | # Bit and Hachure Patterns 2 | 3 | PyGMT supports a variety of bit and hachure patterns that can be used to fill polygons. 4 | 5 | These patterns can be defined using the following syntax: 6 | 7 | **P**|**p**_pattern_[**+b**_color_][**+f**_color_][**+r**_dpi_] 8 | 9 | *pattern* can either be a number in the range 1-90 or the name of a 1-, 8-, or 24-bit 10 | image raster file. The former will result in one of the 90 predefined 64x64 bit-patterns 11 | provided by GMT (see the figure below). The latter allows the user to create customized, 12 | repeating images using image raster files. 13 | 14 | By specifying uppercase **P** instead of **p** the image will be bit-reversed, i.e., 15 | white and black areas will be interchanged (only applies to 1-bit images or predefined 16 | bit-image patterns). For these patterns and other 1-bit images one may specify 17 | alternative **b**ackground and **f**oreground colors (by appending **+b**_color_ and/or 18 | **+f**_color_) that will replace the default white and black pixels, respectively. 19 | Excluding *color* from a fore- or background specification yields a transparent image 20 | where only the back- or foreground pixels will be painted. The **+r**_dpi_ modifier sets 21 | the resolution in dpi. 22 | 23 | The image below shows the 90 predefined bit patterns that can be used in PyGMT. 24 | 25 | ![](https://docs.generic-mapping-tools.org/6.5/_images/GMT_App_E.png) 26 | -------------------------------------------------------------------------------- /environment.yml: -------------------------------------------------------------------------------- 1 | name: pygmt 2 | channels: 3 | - conda-forge 4 | - nodefaults 5 | dependencies: 6 | - python>=3.11 7 | # Required dependencies 8 | - gmt=6.5.0 9 | - ghostscript=10.04.0 10 | - numpy>=1.26 11 | - pandas>=2.1 12 | - xarray>=2023.07 13 | - packaging>=24.2 14 | # Optional dependencies 15 | - contextily>=1.5 16 | - geopandas>=1.0 17 | - ipython 18 | - pyarrow-core>=16 19 | - rioxarray 20 | # Development dependencies (general) 21 | - dvc 22 | - jupyter 23 | - make 24 | - pip 25 | - python-build 26 | # Dev dependencies (style checks) 27 | - codespell 28 | - pre-commit 29 | - ruff>=0.10.0 30 | # Dev dependencies (unit testing) 31 | - matplotlib-base 32 | - pytest>=6.0 33 | - pytest-cov 34 | - pytest-doctestplus 35 | - pytest-mpl 36 | - netCDF4 37 | # Dev dependencies (building documentation) 38 | - geodatasets 39 | - myst-nb 40 | - panel 41 | - sphinx>=6.2 42 | - sphinx-autodoc-typehints 43 | - sphinx-copybutton 44 | - sphinx-design 45 | - sphinx-gallery>=0.19.0 46 | - sphinx_rtd_theme 47 | # Dev dependencies (building PDF documentation) 48 | - cairosvg 49 | - sphinxcontrib-svg2pdfconverter 50 | - tectonic 51 | # Dev dependencies (type hints) 52 | - mypy 53 | - pandas-stubs 54 | -------------------------------------------------------------------------------- /examples/gallery/3d_plots/GALLERY_HEADER.rst: -------------------------------------------------------------------------------- 1 | 3D Plots 2 | -------- 3 | -------------------------------------------------------------------------------- /examples/gallery/GALLERY_HEADER.rst: -------------------------------------------------------------------------------- 1 | Gallery 2 | ======= 3 | 4 | This gallery contains examples of what PyGMT can do. Click on any example to see the 5 | code used to generate it. 6 | -------------------------------------------------------------------------------- /examples/gallery/basemaps/GALLERY_HEADER.rst: -------------------------------------------------------------------------------- 1 | Base maps 2 | --------- 3 | -------------------------------------------------------------------------------- /examples/gallery/basemaps/ternary.py: -------------------------------------------------------------------------------- 1 | """ 2 | Ternary diagram 3 | =============== 4 | 5 | The :meth:`pygmt.Figure.ternary` method can draw ternary diagrams. The example 6 | shows how to plot circles with a diameter of 0.1 centimeters 7 | (``style="c0.1c"``) on a 10-centimeters-wide (``width="10c"``) ternary diagram 8 | at the positions listed in the first three columns of the sample dataset 9 | ``rock_compositions``, with default annotations and gridline spacings, using 10 | the specified labeling defined via ``alabel``, ``blabel``, and ``clabel``. 11 | Points are colored based on the values given in the fourth columns of the 12 | sample dataset via ``cmap=True``. 13 | """ 14 | 15 | # %% 16 | import pygmt 17 | 18 | fig = pygmt.Figure() 19 | 20 | # Load sample data 21 | data = pygmt.datasets.load_sample_data(name="rock_compositions") 22 | 23 | # Define a colormap to be used for the values given in the fourth column 24 | # of the input dataset 25 | pygmt.makecpt(cmap="batlow", series=[0, 80, 10]) 26 | 27 | fig.ternary( 28 | data, 29 | region=[0, 100, 0, 100, 0, 100], 30 | width="10c", 31 | style="c0.1c", 32 | alabel="Limestone", 33 | blabel="Water", 34 | clabel="Air", 35 | cmap=True, 36 | frame=[ 37 | "aafg+lLimestone component+u %", 38 | "bafg+lWater component+u %", 39 | "cafg+lAir component+u %", 40 | ], 41 | ) 42 | 43 | # Add a colorbar indicating the values given in the fourth column of 44 | # the input dataset 45 | fig.colorbar(position="JBC+o0c/1.5c", frame="x+lPermittivity") 46 | fig.show() 47 | -------------------------------------------------------------------------------- /examples/gallery/embellishments/GALLERY_HEADER.rst: -------------------------------------------------------------------------------- 1 | Plot embellishments 2 | ------------------- 3 | -------------------------------------------------------------------------------- /examples/gallery/embellishments/gmt_logo.py: -------------------------------------------------------------------------------- 1 | """ 2 | GMT logo 3 | ======== 4 | 5 | The :meth:`pygmt.Figure.logo` method allows to place the GMT logo on a figure. 6 | """ 7 | 8 | # %% 9 | import pygmt 10 | 11 | fig = pygmt.Figure() 12 | fig.basemap(region=[0, 10, 0, 2], projection="X6c", frame=True) 13 | 14 | # Add the GMT logo in the Top Right (TR) corner of the current plot, scaled up to be 3 15 | # centimeters wide and offset by 0.3 cm in x-direction and 0.6 cm in y-direction. 16 | fig.logo(position="jTR+o0.3c/0.6c+w3c") 17 | 18 | fig.show() 19 | -------------------------------------------------------------------------------- /examples/gallery/embellishments/inset.py: -------------------------------------------------------------------------------- 1 | """ 2 | Inset 3 | ===== 4 | 5 | The :meth:`pygmt.Figure.inset` method adds an inset figure inside a larger 6 | figure. The method is called using a ``with`` statement, and its 7 | ``position``, ``box``, ``offset``, and ``margin`` parameters are set. Plotting 8 | methods called within the ``with`` statement are applied to the inset figure. 9 | """ 10 | 11 | # %% 12 | import pygmt 13 | 14 | fig = pygmt.Figure() 15 | # Create the primary figure, setting the region to Madagascar, the land color 16 | # to "brown", the water to "lightblue", the shorelines width to "thin", and 17 | # adding a frame 18 | fig.coast(region="MG+r2", land="brown", water="lightblue", shorelines="thin", frame="a") 19 | # Create an inset, placing it in the Top Left (TL) corner with a width of 3.5 cm and 20 | # x- and y-offsets of 0.2 cm. The margin is set to 0, and the border is "gold" with a 21 | # pen size of 1.5 points. 22 | with fig.inset(position="jTL+w3.5c+o0.2c", margin=0, box="+p1.5p,gold"): 23 | # Create a figure in the inset using coast. This example uses the azimuthal 24 | # orthogonal projection centered at 47E, 20S. The land color is set to 25 | # "gray" and Madagascar is highlighted in "red3". 26 | fig.coast( 27 | region="g", 28 | projection="G47/-20/?", 29 | land="gray", 30 | water="white", 31 | dcw="MG+gred3", 32 | ) 33 | fig.show() 34 | -------------------------------------------------------------------------------- /examples/gallery/embellishments/solar.py: -------------------------------------------------------------------------------- 1 | """ 2 | Day-night terminator and twilights 3 | ================================== 4 | 5 | Use :meth:`pygmt.Figure.solar` to show the different transition stages between daytime 6 | and nighttime. The parameter ``terminator`` is used to set the twilight stage, and can 7 | be either ``"day_night"`` (brightest), ``"civil"``, ``"nautical"``, or 8 | ``"astronomical"`` (darkest). Refer to https://en.wikipedia.org/wiki/Twilight for more 9 | information. 10 | """ 11 | 12 | # %% 13 | import datetime 14 | 15 | import pygmt 16 | 17 | fig = pygmt.Figure() 18 | # Create a global map using the Mollweide projection, centered at 0°E, with a width of 19 | # 15 centimeters. 20 | fig.basemap(region="d", projection="W15c", frame=True) 21 | fig.coast(land="darkgreen", water="lightblue") 22 | 23 | # Set a time for the day-night terminator and twilights to 17:00 UTC on January 1, 2000 24 | reference_time = datetime.datetime( 25 | year=2000, month=1, day=1, hour=17, minute=0, second=0 26 | ) 27 | 28 | # Plot the day-night terminator and twilights 29 | for terminator in ["day_night", "civil", "nautical", "astronomical"]: 30 | fig.solar( 31 | terminator=terminator, 32 | terminator_datetime=reference_time, 33 | # Set the fill for the night area to navy blue with 85 % transparency 34 | fill="navyblue@85", 35 | pen="0.5p", # Set the outline to be 0.5 points thick 36 | ) 37 | 38 | fig.show() 39 | -------------------------------------------------------------------------------- /examples/gallery/embellishments/timestamp.py: -------------------------------------------------------------------------------- 1 | """ 2 | Timestamp 3 | ========= 4 | 5 | The :meth:`pygmt.Figure.timestamp` method can draw the GMT timestamp logo on the plot. 6 | The timestamp will always be shown relative to the Bottom Left (BL) corner of the plot. 7 | By default, the ``offset`` and ``justify`` parameters are set to ``("-54p", "-54p")`` 8 | (x-, y-directions) and ``"BL"`` (Bottom Left), respectively. 9 | """ 10 | 11 | # %% 12 | import os 13 | 14 | import pygmt 15 | 16 | fig = pygmt.Figure() 17 | fig.basemap(region=[20, 30, -10, 10], projection="X10c/5c", frame=True) 18 | fig.timestamp() 19 | fig.show() 20 | 21 | # %% 22 | # Additionally, a custom label can be added via the ``label`` parameter. The font can be 23 | # defined via the ``font`` parameter and the timestamp string format via ``timefmt``. 24 | 25 | os.environ["TZ"] = "Pacific/Honolulu" # optionally set the time zone 26 | 27 | fig = pygmt.Figure() 28 | fig.coast(region="d", projection="H10c", land="black", water="cornsilk", frame="afg") 29 | fig.timestamp( 30 | label="Powered by PyGMT", 31 | justify="TL", 32 | font="Times-Bold", 33 | timefmt="%Y-%m-%dT%H:%M:%S%z", 34 | ) 35 | fig.show() 36 | 37 | # sphinx_gallery_thumbnail_number = 2 38 | -------------------------------------------------------------------------------- /examples/gallery/histograms/GALLERY_HEADER.rst: -------------------------------------------------------------------------------- 1 | Histograms 2 | ---------- 3 | -------------------------------------------------------------------------------- /examples/gallery/histograms/histogram.py: -------------------------------------------------------------------------------- 1 | """ 2 | Histogram 3 | ========= 4 | 5 | The :meth:`pygmt.Figure.histogram` method can plot regular histograms. 6 | Using the ``series`` parameter allows to set the interval for the width of 7 | each bar. The type of the histogram (frequency count or percentage) can be 8 | selected via the ``histtype`` parameter. 9 | """ 10 | 11 | # %% 12 | import numpy as np 13 | import pygmt 14 | 15 | # Generate random elevation data from a normal distribution 16 | rng = np.random.default_rng(seed=100) 17 | mean = 100 # mean of distribution 18 | stddev = 25 # standard deviation of distribution 19 | data = rng.normal(loc=mean, scale=stddev, size=521) 20 | 21 | 22 | fig = pygmt.Figure() 23 | 24 | fig.histogram( 25 | data=data, 26 | # Define the frame, add a title, and set the background color to 27 | # "lightgray". Add labels to the x-axis and y-axis 28 | frame=["WSne+tHistogram+glightgray", "x+lElevation (m)", "y+lCounts"], 29 | # Generate evenly spaced bins by increments of 5 30 | series=5, 31 | # Use "red3" as color fill for the bars 32 | fill="red3", 33 | # Use the pen parameter to draw the outlines with a width of 1 point 34 | pen="1p", 35 | # Choose histogram type 0, i.e., counts [Default] 36 | histtype=0, 37 | ) 38 | 39 | fig.show() 40 | -------------------------------------------------------------------------------- /examples/gallery/histograms/rose.py: -------------------------------------------------------------------------------- 1 | """ 2 | Rose diagram 3 | ============ 4 | 5 | The :meth:`pygmt.Figure.rose` method can plot windrose diagrams or polar 6 | histograms. 7 | """ 8 | 9 | # %% 10 | import pygmt 11 | 12 | # Load sample compilation of fracture lengths and azimuth as 13 | # hypothetically digitized from geological maps 14 | data = pygmt.datasets.load_sample_data(name="fractures") 15 | 16 | fig = pygmt.Figure() 17 | 18 | fig.rose( 19 | # use columns of the sample dataset as input for the length and azimuth 20 | # parameters 21 | length=data.length, 22 | azimuth=data.azimuth, 23 | # specify the "region" of interest in the (r,azimuth) space 24 | # [r0, r1, az0, az1], here, r0 is 0 and r1 is 1, for azimuth, az0 is 0 and 25 | # az1 is 360 which means we plot a full circle between 0 and 360 degrees 26 | region=[0, 1, 0, 360], 27 | # set the diameter of the rose diagram to 7.5 cm 28 | diameter="7.5c", 29 | # define the sector width in degrees, we append +r here to draw a rose 30 | # diagram instead of a sector diagram 31 | sector="10+r", 32 | # normalize bin counts by the largest value so all bin counts range from 33 | # 0 to 1 34 | norm=True, 35 | # use red3 as color fill for the sectors 36 | fill="red3", 37 | # define the frame with ticks and gridlines every 0.2 38 | # length unit in radial direction and every 30 degrees 39 | # in azimuthal direction, set background color to 40 | # lightgray 41 | frame=["x0.2g0.2", "y30g30", "+glightgray"], 42 | # use a pen size of 1p to draw the outlines 43 | pen="1p", 44 | ) 45 | 46 | fig.show() 47 | -------------------------------------------------------------------------------- /examples/gallery/images/GALLERY_HEADER.rst: -------------------------------------------------------------------------------- 1 | Images, contours, and fields 2 | ---------------------------- 3 | -------------------------------------------------------------------------------- /examples/gallery/images/contours.py: -------------------------------------------------------------------------------- 1 | """ 2 | Contours 3 | ======== 4 | 5 | The :meth:`pygmt.Figure.contour` method can plot contour lines from a table of 6 | points by direct triangulation. The data for the triangulation can be provided 7 | using one of three methods: 8 | 9 | #. ``x``, ``y``, ``z`` 1-D :class:`numpy.ndarray` data columns. 10 | #. ``data`` 2-D :class:`numpy.ndarray` data matrix with 3 columns corresponding 11 | to ``x``, ``y``, ``z``. 12 | #. ``data`` path string to a file containing the ``x``, ``y``, ``z`` in a 13 | tabular format. 14 | 15 | The parameters ``levels`` and ``annotation`` set the intervals of the contours 16 | and the annotations on the contours, respectively. 17 | 18 | In this example we supply the data as 1-D :class:`numpy.ndarray` with the ``x``, 19 | ``y``, and ``z`` parameters and draw the contours using a 0.5-points pen with 20 | contours every 10 z-values and annotations every 20 z-values. 21 | """ 22 | 23 | # %% 24 | import numpy as np 25 | import pygmt 26 | 27 | # Build the contours underlying data with the function z = x^2 + y^2 28 | X, Y = np.meshgrid(np.linspace(-10, 10, 50), np.linspace(-10, 10, 50)) 29 | Z = X**2 + Y**2 30 | x, y, z = X.flatten(), Y.flatten(), Z.flatten() 31 | 32 | 33 | fig = pygmt.Figure() 34 | fig.contour( 35 | region=[-10, 10, -10, 10], 36 | projection="X10c/10c", 37 | frame="ag", 38 | pen="0.5p", 39 | # Pass the data as 3 1-D data columns 40 | x=x, 41 | y=y, 42 | z=z, 43 | # Set the interval of the contours to 10 44 | levels=10, 45 | # Set the interval of the annotations to 20 46 | annotation=20, 47 | ) 48 | fig.show() 49 | -------------------------------------------------------------------------------- /examples/gallery/images/grdclip.py: -------------------------------------------------------------------------------- 1 | """ 2 | Clipping grid values 3 | ==================== 4 | 5 | The :func:`pygmt.grdclip` function allows to clip defined ranges of grid 6 | values. In the example shown below we set all elevation values (grid points) 7 | smaller than 0 m (in general the bathymetric part of the grid) to a common 8 | value of -2000 m via the ``below`` parameter. 9 | """ 10 | 11 | # %% 12 | import pygmt 13 | 14 | fig = pygmt.Figure() 15 | 16 | # Define region of interest around Iceland 17 | region = [-28, -10, 62, 68] 18 | 19 | # Load sample grid (3 arc-minutes global relief) in target area 20 | grid = pygmt.datasets.load_earth_relief(resolution="03m", region=region) 21 | 22 | # Plot original grid 23 | fig.basemap( 24 | region=region, 25 | projection="M12c", 26 | frame=["WSne+toriginal grid", "xa5f1", "ya2f1"], 27 | ) 28 | fig.grdimage(grid=grid, cmap="oleron") 29 | 30 | # Shift plot origin of the second map by "width of the first map + 0.5 cm" 31 | # in x-direction 32 | fig.shift_origin(xshift="w+0.5c") 33 | 34 | # Set all grid points < 0 m to a value of -2000 m. 35 | grid = pygmt.grdclip(grid, below=[0, -2000]) 36 | 37 | # Plot clipped grid 38 | fig.basemap( 39 | region=region, 40 | projection="M12c", 41 | frame=["wSne+tclipped grid", "xa5f1", "ya2f1"], 42 | ) 43 | fig.grdimage(grid=grid) 44 | fig.colorbar(frame=["x+lElevation", "y+lm"], position="JMR+o0.5c/0c+w8c") 45 | 46 | fig.show() 47 | -------------------------------------------------------------------------------- /examples/gallery/images/grdlandmask.py: -------------------------------------------------------------------------------- 1 | """ 2 | Create 'wet-dry' mask grid 3 | ========================== 4 | 5 | The :func:`pygmt.grdlandmask` function allows setting all nodes on land 6 | or water to a specified value using the ``maskvalues`` parameter. 7 | """ 8 | 9 | # %% 10 | import pygmt 11 | 12 | fig = pygmt.Figure() 13 | 14 | # Define region of interest 15 | region = [-65, -40, -40, -20] 16 | 17 | # Assign a value of 0 for all water masses and a value of 1 for all land 18 | # masses. 19 | # Use shoreline data with (l)ow resolution and set the grid spacing to 20 | # 5 arc-minutes in x- and y-directions. 21 | grid = pygmt.grdlandmask(region=region, spacing="5m", maskvalues=[0, 1], resolution="l") 22 | 23 | # Plot clipped grid 24 | fig.basemap(region=region, projection="M12c", frame=True) 25 | 26 | # Define a colormap to be used for two categories, define the range of the 27 | # new discrete CPT using series=(lowest_value, highest_value, interval), 28 | # use color_model="+cwater,land" to write the discrete color palette 29 | # "batlow" in categorical format and add water/land as annotations for the 30 | # colorbar. 31 | pygmt.makecpt(cmap="batlow", series=(0, 1, 1), color_model="+cwater,land") 32 | 33 | fig.grdimage(grid=grid, cmap=True) 34 | fig.colorbar(position="JMR+o0.5c/0c+w8c") 35 | 36 | fig.show() 37 | -------------------------------------------------------------------------------- /examples/gallery/images/image.py: -------------------------------------------------------------------------------- 1 | """ 2 | Image on a figure 3 | ================= 4 | 5 | The :meth:`pygmt.Figure.image` method can be used to read and place an image file in 6 | many formats (e.g., png, jpg, eps, pdf) on a figure. We must specify the filename via 7 | the ``imagefile`` parameter or simply use the filename as the first argument. You can 8 | also use a full URL pointing to your desired image. The ``position`` parameter allows 9 | us to set a reference point on the map for the image. 10 | """ 11 | 12 | # %% 13 | from pathlib import Path 14 | 15 | import pygmt 16 | 17 | fig = pygmt.Figure() 18 | fig.basemap(region=[0, 2, 0, 2], projection="X10c", frame=True) 19 | 20 | # Place and center ("+jCM") the image "needle.jpg" provided by GMT to the position 21 | # ("+g") 1/1 on the current plot, scale it to a width of 8 centimeters ("+w") and draw 22 | # a rectangular border around it 23 | fig.image( 24 | imagefile="https://oceania.generic-mapping-tools.org/cache/needle.jpg", 25 | position="g1/1+w8c+jCM", 26 | box=True, 27 | ) 28 | 29 | fig.show() 30 | 31 | # Clean up the downloaded image in the current directory 32 | Path("needle.jpg").unlink() 33 | -------------------------------------------------------------------------------- /examples/gallery/images/rgb_image.py: -------------------------------------------------------------------------------- 1 | """ 2 | RGB image 3 | ========= 4 | 5 | The :meth:`pygmt.Figure.grdimage` method can be used to plot Red, Green, Blue 6 | (RGB) images, or any 3-band false color combination. Here, we'll use 7 | :py:func:`rioxarray.open_rasterio` to read a GeoTIFF file into an 8 | :class:`xarray.DataArray` format, and plot it on a map. 9 | 10 | The example below shows a Worldview 2 satellite image over 11 | `Lāhainā, Hawaiʻi during the August 2023 wildfires 12 | `_. 13 | Data is sourced from a Cloud-Optimized GeoTIFF (COG) file hosted on 14 | `OpenAerialMap `_ under a 15 | `CC BY-NC 4.0 `_ license. 16 | """ # noqa: RUF002 17 | 18 | # %% 19 | import pygmt 20 | import rioxarray 21 | 22 | # %% 23 | # Read 3-band data from GeoTIFF into an xarray.DataArray object: 24 | with rioxarray.open_rasterio( 25 | filename="https://oin-hotosm-temp.s3.us-east-1.amazonaws.com/64d6a49a19cb3a000147a65b/0/64d6a49a19cb3a000147a65c.tif", 26 | overview_level=5, 27 | ) as img: 28 | # Subset to area of Lāhainā in EPSG:32604 coordinates 29 | image = img.rio.clip_box(minx=738000, maxx=755000, miny=2300000, maxy=2318000) 30 | image = image.load() # Force loading the DataArray into memory 31 | image 32 | 33 | # %% 34 | # Plot the RGB imagery: 35 | fig = pygmt.Figure() 36 | with pygmt.config(FONT_TITLE="Times-Roman"): # Set title font to Times-Roman 37 | fig.grdimage( 38 | grid=image, 39 | # Use a map scale where 1 cm on the map equals 1 km on the ground 40 | projection="x1:100000", 41 | frame=[r"WSne+tL@!a¯hain@!a¯, Hawai`i on 9 Aug 2023", "af"], 42 | ) 43 | fig.show() 44 | -------------------------------------------------------------------------------- /examples/gallery/images/track_sampling.py: -------------------------------------------------------------------------------- 1 | """ 2 | Sampling along tracks 3 | ===================== 4 | 5 | The :func:`pygmt.grdtrack` function samples a raster grid's value along 6 | specified points. We will need to input a 2-D raster to ``grid`` which can be 7 | an :class:`xarray.DataArray`. The argument passed to the ``points`` parameter 8 | can be a :class:`pandas.DataFrame` table where the first two columns are 9 | x and y (or longitude and latitude). Note also that there is a ``newcolname`` 10 | parameter that will be used to name the new column of values sampled from the 11 | grid. 12 | 13 | Alternatively, a netCDF file path can be passed to ``grid``. An ASCII file path 14 | can also be accepted for ``points``. To save an output ASCII file, a file name 15 | argument needs to be passed to the ``outfile`` parameter. 16 | """ 17 | 18 | # %% 19 | import pygmt 20 | 21 | # Load sample grid and point datasets 22 | grid = pygmt.datasets.load_earth_relief() 23 | points = pygmt.datasets.load_sample_data(name="ocean_ridge_points") 24 | # Sample the bathymetry along the world's ocean ridges at specified track 25 | # points 26 | track = pygmt.grdtrack(points=points, grid=grid, newcolname="bathymetry") 27 | 28 | fig = pygmt.Figure() 29 | # Plot the earth relief grid on Cylindrical Stereographic projection, masking 30 | # land areas 31 | fig.basemap(region="g", projection="Cyl_stere/150/-20/15c", frame=True) 32 | fig.grdimage(grid=grid, cmap="gray") 33 | fig.coast(land="#666666") 34 | # Plot the sampled bathymetry points using circles (c) of 0.15 cm size 35 | # Points are colored using elevation values (normalized for visual purposes) 36 | fig.plot( 37 | x=track.longitude, 38 | y=track.latitude, 39 | style="c0.15c", 40 | cmap="terra", 41 | fill=(track.bathymetry - track.bathymetry.mean()) / track.bathymetry.std(), 42 | ) 43 | fig.show() 44 | -------------------------------------------------------------------------------- /examples/gallery/lines/GALLERY_HEADER.rst: -------------------------------------------------------------------------------- 1 | Lines and vectors 2 | ----------------- 3 | -------------------------------------------------------------------------------- /examples/gallery/lines/line_custom_cpt.py: -------------------------------------------------------------------------------- 1 | """ 2 | Line colors with a custom CPT 3 | ============================= 4 | 5 | The color of the lines made by :meth:`pygmt.Figure.plot` can be set according 6 | to a custom CPT and assigned with the ``pen`` parameter. 7 | 8 | The custom CPT can be used by setting the plot command's ``cmap`` parameter to 9 | ``True``. The ``zvalue`` parameter sets the z-value (color) to be used from the 10 | custom CPT, and the line color is set as the z-value by using **+z** when 11 | setting the ``pen`` color. 12 | 13 | """ 14 | 15 | # %% 16 | import numpy as np 17 | import pygmt 18 | 19 | # Create a list of values between 20 and 30 with 0.2 intervals 20 | x = np.arange(start=20, stop=30, step=0.2) 21 | 22 | fig = pygmt.Figure() 23 | fig.basemap(frame=["WSne", "af"], region=[20, 30, -10, 10]) 24 | 25 | # Create a custom CPT with the batlow CPT and 10 discrete z-values (colors), 26 | # use color_model="+c0-9" to write the color palette in categorical format and 27 | # add labels (0) to (9) for the colorbar legend 28 | pygmt.makecpt(cmap="batlow", series=[0, 9, 1], color_model="+c0-9") 29 | 30 | # Plot 10 lines and set a different z-value for each line 31 | for zvalue in range(10): 32 | y = zvalue * np.sin(x) 33 | fig.plot(x=x, y=y, cmap=True, zvalue=zvalue, pen="thick,+z,-") 34 | 35 | # Color bar to show the custom CPT and the associated z-values 36 | fig.colorbar() 37 | fig.show() 38 | -------------------------------------------------------------------------------- /examples/gallery/lines/linestrings.py: -------------------------------------------------------------------------------- 1 | """ 2 | GeoPandas: Plotting lines with LineString or MultiLineString geometry 3 | ===================================================================== 4 | 5 | The :meth:`pygmt.Figure.plot` method allows us to plot geographical data such as lines 6 | with LineString or MultiLineString geometry types stored in a 7 | :class:`geopandas.GeoDataFrame` object or any object that implements the 8 | `__geo_interface__ `__ property. 9 | 10 | Use :func:`geopandas.read_file` to load data from any supported OGR format such as a 11 | shapefile (.shp), GeoJSON (.geojson), geopackage (.gpkg), etc. Then, pass the 12 | :class:`geopandas.GeoDataFrame` object as an argument to the ``data`` parameter of 13 | :meth:`pygmt.Figure.plot`, and style the lines using the ``pen`` parameter. 14 | """ 15 | 16 | # %% 17 | import geodatasets 18 | import geopandas as gpd 19 | import pygmt 20 | 21 | # Read a sample dataset provided by the geodatasets package. 22 | # The dataset contains large rivers in Europe, stored as LineString/MultiLineString 23 | # geometry types. 24 | gdf = gpd.read_file(geodatasets.get_path("eea large_rivers")) 25 | 26 | # Convert object to EPSG 4326 coordinate system 27 | gdf = gdf.to_crs("EPSG:4326") 28 | gdf.head() 29 | 30 | # %% 31 | fig = pygmt.Figure() 32 | 33 | fig.coast( 34 | projection="M10c", 35 | region=[-10, 30, 35, 57], 36 | resolution="l", 37 | land="gray95", 38 | shorelines="1/0.1p,gray50", 39 | borders="1/0.1,gray30", 40 | frame=True, 41 | ) 42 | 43 | # Add rivers to map 44 | fig.plot(data=gdf, pen="1p,steelblue") 45 | 46 | fig.show() 47 | -------------------------------------------------------------------------------- /examples/gallery/lines/wiggle.py: -------------------------------------------------------------------------------- 1 | """ 2 | Wiggle along tracks 3 | =================== 4 | 5 | The :meth:`pygmt.Figure.wiggle` method can plot z = f(x,y) anomalies along 6 | tracks. ``x``, ``y``, ``z`` can be specified as 1-D arrays or within a 7 | specified file. The ``scale`` parameter can be used to set the scale of the 8 | anomaly in data/distance units. The positive and/or negative areas can be 9 | filled with color by setting the ``fillpositive`` and/or ``fillnegative`` 10 | parameters. 11 | """ 12 | 13 | # %% 14 | import numpy as np 15 | import pygmt 16 | 17 | # Create (x, y, z) triplets 18 | x = np.arange(-7, 7, 0.1) 19 | y = np.zeros(x.size) 20 | z = 50 * np.exp(-((x / 3) ** 2)) * np.cos(2 * np.pi * x) 21 | 22 | fig = pygmt.Figure() 23 | fig.basemap(region=[-8, 12, -1, 1], projection="X10c", frame=["Snlr", "xa2f1"]) 24 | fig.wiggle( 25 | x=x, 26 | y=y, 27 | z=z, 28 | # Set anomaly scale to 20 centimeters 29 | scale="20c", 30 | # Fill positive areas red 31 | fillpositive="red", 32 | # Fill negative areas gray 33 | fillnegative="gray", 34 | # Set the outline width to 1.0 point 35 | pen="1.0p", 36 | # Draw a blue track with a width of 0.5 points 37 | track="0.5p,blue", 38 | # Plot a vertical scale bar at Middle Right (MR). The bar length (+w) 39 | # is 100 in data (z) units. Set the z unit label (+l) to "nT". 40 | position="jMR+w100+lnT", 41 | ) 42 | fig.show() 43 | -------------------------------------------------------------------------------- /examples/gallery/maps/GALLERY_HEADER.rst: -------------------------------------------------------------------------------- 1 | Maps and map elements 2 | --------------------- 3 | -------------------------------------------------------------------------------- /examples/gallery/maps/borders.py: -------------------------------------------------------------------------------- 1 | """ 2 | Political boundaries 3 | ==================== 4 | 5 | The ``borders`` parameter of :meth:`pygmt.Figure.coast` specifies levels of 6 | political boundaries to plot and the pen used to draw them. Choose from the 7 | list of boundaries below: 8 | 9 | * **1** = National boundaries 10 | * **2** = State boundaries within the Americas 11 | * **3** = Marine boundaries 12 | * **a** = All boundaries (1-3) 13 | 14 | For example, to draw national boundaries with a line thickness of 1 point and 15 | black line color use ``borders="1/1p,black"``. You can draw multiple boundaries 16 | by passing in a list to ``borders``. 17 | """ 18 | 19 | # %% 20 | import pygmt 21 | 22 | fig = pygmt.Figure() 23 | # Make a Sinusoidal projection map of the Americas with automatic annotations, 24 | # ticks and gridlines 25 | fig.basemap(region=[-150, -30, -60, 60], projection="I-90/15c", frame="afg") 26 | # Plot each level of the boundaries dataset with a different color. 27 | fig.coast(borders=["1/0.5p,black", "2/0.5p,red", "3/0.5p,blue"], land="gray") 28 | fig.show() 29 | -------------------------------------------------------------------------------- /examples/gallery/maps/land_and_water.py: -------------------------------------------------------------------------------- 1 | """ 2 | Color land and water 3 | ==================== 4 | 5 | The ``land`` and ``water`` parameters of :meth:`pygmt.Figure.coast` specify 6 | a color to fill in the land and water masses, respectively. There are many 7 | :gmt-docs:`color codes in GMT `, including standard GMT color 8 | names (like ``"skyblue"``), R/G/B levels (like ``"0/0/255"``), a hex value 9 | (like ``"#333333"``), and a gray level (like ``"gray50"``). 10 | """ 11 | 12 | # %% 13 | import pygmt 14 | 15 | fig = pygmt.Figure() 16 | # Make a global Mollweide map with automatic ticks 17 | fig.basemap(region="g", projection="W15c", frame=True) 18 | # Plot the land as light gray, and the water as sky blue 19 | fig.coast(land="#666666", water="skyblue") 20 | fig.show() 21 | -------------------------------------------------------------------------------- /examples/gallery/maps/shorelines.py: -------------------------------------------------------------------------------- 1 | """ 2 | Shorelines 3 | ========== 4 | 5 | Use :meth:`pygmt.Figure.coast` to display shorelines as black lines. 6 | """ 7 | 8 | # %% 9 | import pygmt 10 | 11 | fig = pygmt.Figure() 12 | # Make a global Mollweide map with automatic ticks 13 | fig.basemap(region="g", projection="W15c", frame=True) 14 | # Display the shorelines as black lines with 0.5 point thickness 15 | fig.coast(shorelines="0.5p,black") 16 | fig.show() 17 | -------------------------------------------------------------------------------- /examples/gallery/maps/tilemaps.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tile maps 3 | ========= 4 | 5 | The :meth:`pygmt.Figure.tilemap` method allows to plot 6 | tiles from a tile server or local file as a basemap or overlay. 7 | """ 8 | 9 | # %% 10 | import contextily 11 | import pygmt 12 | 13 | fig = pygmt.Figure() 14 | fig.tilemap( 15 | region=[-157.84, -157.8, 21.255, 21.285], 16 | projection="M12c", 17 | # Set level of details (0-22) 18 | # Higher levels mean a zoom level closer to the Earth's 19 | # surface with more tiles covering a smaller 20 | # geographic area and thus more details and vice versa 21 | # Please note, not all zoom levels are always available 22 | zoom=14, 23 | # Use tiles from OpenStreetMap tile server 24 | source="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", 25 | frame="afg", 26 | ) 27 | 28 | fig.show() 29 | 30 | # %% 31 | # It's also possible to use tiles provided via the 32 | # `contextily `__ 33 | # library. See :doc:`Contextily providers ` 34 | # for a list of possible tilemap options. 35 | 36 | fig = pygmt.Figure() 37 | fig.tilemap( 38 | region=[-157.84, -157.8, 21.255, 21.285], 39 | projection="M12c", 40 | # Use the CartoDB Positron option from contextily 41 | source=contextily.providers.CartoDB.Positron, 42 | frame="afg", 43 | ) 44 | 45 | fig.show() 46 | -------------------------------------------------------------------------------- /examples/gallery/seismology/GALLERY_HEADER.rst: -------------------------------------------------------------------------------- 1 | Seismology and geodesy 2 | ---------------------- 3 | -------------------------------------------------------------------------------- /examples/gallery/seismology/velo_arrow_ellipse.py: -------------------------------------------------------------------------------- 1 | """ 2 | Velocity arrows and confidence ellipses 3 | ======================================= 4 | 5 | The :meth:`pygmt.Figure.velo` method can be used to plot mean velocity arrows and 6 | confidence ellipses. The example below plots red velocity arrows with lightblue 7 | confidence ellipses outlined in red with the east_velocity x north_velocity used for 8 | the station names. Note that the velocity arrows are scaled by 0.2 and the 39% 9 | confidence limit will give an ellipse which fits inside a rectangle of dimension 10 | east_sigma by north_sigma. 11 | """ 12 | 13 | # %% 14 | import pandas as pd 15 | import pygmt 16 | 17 | fig = pygmt.Figure() 18 | df = pd.DataFrame( 19 | data={ 20 | "x": [0, -8, 0, -5, 5, 0], 21 | "y": [-8, 5, 0, -5, 0, -5], 22 | "east_velocity": [0, 3, 4, 6, -6, 6], 23 | "north_velocity": [0, 3, 6, 4, 4, -4], 24 | "east_sigma": [4, 0, 4, 6, 6, 6], 25 | "north_sigma": [6, 0, 6, 4, 4, 4], 26 | "correlation_EN": [0.5, 0.5, 0.5, 0.5, -0.5, -0.5], 27 | "SITE": ["0x0", "3x3", "4x6", "6x4", "-6x4", "6x-4"], 28 | } 29 | ) 30 | fig.velo( 31 | data=df, 32 | region=[-10, 8, -10, 6], 33 | projection="x0.8c", 34 | frame=["WSne", "2g2f"], 35 | spec="e0.2/0.39+f18", 36 | uncertaintyfill="lightblue1", 37 | pen="0.6p,red", 38 | line=True, 39 | vector="0.3c+p1p+e+gred", 40 | ) 41 | 42 | fig.show() 43 | -------------------------------------------------------------------------------- /examples/gallery/symbols/GALLERY_HEADER.rst: -------------------------------------------------------------------------------- 1 | Symbols and markers 2 | ------------------- 3 | -------------------------------------------------------------------------------- /examples/gallery/symbols/points.py: -------------------------------------------------------------------------------- 1 | """ 2 | Points 3 | ====== 4 | 5 | The :meth:`pygmt.Figure.plot` method can plot data points. The symbol and 6 | size are set with the ``style`` parameter. 7 | """ 8 | 9 | # %% 10 | import numpy as np 11 | import pygmt 12 | 13 | # Generate a random set of points to plot 14 | rng = np.random.default_rng(seed=42) 15 | region = [150, 240, -10, 60] 16 | x = rng.uniform(low=region[0], high=region[1], size=100) 17 | y = rng.uniform(low=region[2], high=region[3], size=100) 18 | 19 | 20 | fig = pygmt.Figure() 21 | # Create a 15 cm x 15 cm basemap with a Cartesian projection (X) using the 22 | # data region 23 | fig.basemap(region=region, projection="X15c", frame=True) 24 | # Plot using inverted triangles (i) of 0.5 cm size 25 | fig.plot(x=x, y=y, style="i0.5c", fill="black") 26 | fig.show() 27 | -------------------------------------------------------------------------------- /examples/gallery/symbols/points_transparency.py: -------------------------------------------------------------------------------- 1 | """ 2 | Points with varying transparency 3 | ================================ 4 | 5 | Points can be plotted with different transparency levels by passing in an array 6 | argument to the ``transparency`` parameter of :meth:`pygmt.Figure.plot`. 7 | """ 8 | 9 | # %% 10 | import numpy as np 11 | import pygmt 12 | 13 | # prepare the input x and y data 14 | x = np.arange(0, 105, 5) 15 | y = np.ones(x.size) 16 | # transparency level in percentage from 0 (i.e., opaque) to 100 17 | transparency = x 18 | 19 | fig = pygmt.Figure() 20 | fig.basemap( 21 | region=[-5, 105, 0, 2], 22 | frame=["xaf+lTransparency level+u%", "WSrt"], 23 | projection="X15c/6c", 24 | ) 25 | fig.plot(x=x, y=y, style="c0.6c", fill="blue", pen="1p,red", transparency=transparency) 26 | fig.show() 27 | -------------------------------------------------------------------------------- /examples/gallery/symbols/scatter.py: -------------------------------------------------------------------------------- 1 | """ 2 | Scatter plots with a legend 3 | =========================== 4 | 5 | To create a scatter plot with a legend one may use a loop and create one 6 | scatter plot per item to appear in the legend and set the label accordingly. 7 | 8 | Modified from the matplotlib example: 9 | https://matplotlib.org/stable/gallery/lines_bars_and_markers/scatter_with_legend.html 10 | """ 11 | 12 | # %% 13 | import numpy as np 14 | import pygmt 15 | 16 | rng = np.random.default_rng(seed=19680801) 17 | n = 200 # number of random data points 18 | 19 | fig = pygmt.Figure() 20 | fig.basemap( 21 | region=[-1, 1, -1, 1], 22 | projection="X10c/10c", 23 | frame=["xa0.5fg", "ya0.5fg", "WSrt"], 24 | ) 25 | for fill in ["gray73", "darkorange", "slateblue"]: 26 | # Generate standard normal distributions centered on 0 27 | # with standard deviations of 1 28 | x = rng.normal(loc=0, scale=0.5, size=n) # random x data 29 | y = rng.normal(loc=0, scale=0.5, size=n) # random y data 30 | size = rng.normal(loc=0, scale=0.5, size=n) * 0.5 # random size, in cm 31 | 32 | # plot data points as circles (style="c"), with different sizes 33 | fig.plot( 34 | x=x, 35 | y=y, 36 | style="c", 37 | size=size, 38 | fill=fill, 39 | # Set the legend label, 40 | # and set the symbol size to be 0.25 cm (+S0.25c) in legend 41 | label=f"{fill}+S0.25c", 42 | transparency=50, # set transparency level for all symbols 43 | ) 44 | 45 | fig.legend(transparency=30) # set transparency level for legends 46 | fig.show() 47 | -------------------------------------------------------------------------------- /examples/intro/GALLERY_HEADER.rst: -------------------------------------------------------------------------------- 1 | Intro to PyGMT 2 | ============== 3 | 4 | Welcome to PyGMT! The tutorials in this intro are designed to teach basic concepts to 5 | create maps in PyGMT. 6 | 7 | **About this intro** 8 | 9 | It is assumed that PyGMT has been successfully :doc:`installed ` on your 10 | system. To test this, run ``import pygmt`` in a Python IDE or 11 | `Jupyter `__ notebook. 12 | 13 | This intro will progressively cover PyGMT data manipulation and plotting concepts, and 14 | later tutorials will use concepts explained in previous ones. It will not cover all 15 | PyGMT functions and methods. 16 | -------------------------------------------------------------------------------- /examples/projections/GALLERY_HEADER.rst: -------------------------------------------------------------------------------- 1 | Projections 2 | =========== 3 | 4 | PyGMT supports many map projections; see :doc:`/techref/projections` for an overview. 5 | Use the ``projection`` parameter to specify which one you want to use in all plotting 6 | methods. The projection is specified by a one-letter code along with (sometimes optional) 7 | reference longitude and latitude and the width of the map (for example, 8 | **A**\ *lon0/lat0*\ [*/horizon*\ ]\ */width*). The map height is determined based on the 9 | region and projection. 10 | 11 | These are all the available projections: 12 | -------------------------------------------------------------------------------- /examples/projections/azim/GALLERY_HEADER.rst: -------------------------------------------------------------------------------- 1 | Azimuthal Projections 2 | --------------------- 3 | -------------------------------------------------------------------------------- /examples/projections/azim/azim_equidistant.py: -------------------------------------------------------------------------------- 1 | r""" 2 | Azimuthal equidistant projection 3 | ================================ 4 | 5 | The main advantage of this projection is that distances from the projection 6 | center are displayed in correct proportions. Also directions measured from the 7 | projection center are correct. It is very useful for a global view on locations 8 | that lie within a certain distance or for comparing distances of different 9 | locations relative to the projection center. 10 | 11 | **e**\ *lon0/lat0*\ [*/horizon*]\ */scale* or 12 | **E**\ *lon0/lat0*\ [*/horizon*]\ */width* 13 | 14 | The projection type is set with **e** or **E**. *lon0/lat0* specifies the 15 | projection center, and the optional parameter *horizon* specifies the maximum 16 | distance to the projection center (i.e. the visible portion of the rest of the 17 | world map) in degrees <= 180° (default 180°). The size of the figure is set by 18 | *scale* or *width*. 19 | """ 20 | 21 | # %% 22 | import pygmt 23 | 24 | fig = pygmt.Figure() 25 | fig.coast( 26 | region="g", projection="E-100/40/15c", frame="afg", land="khaki", water="white" 27 | ) 28 | fig.show() 29 | -------------------------------------------------------------------------------- /examples/projections/azim/azim_general_perspective.py: -------------------------------------------------------------------------------- 1 | r""" 2 | Perspective projection 3 | ====================== 4 | 5 | The perspective projection imitates the view of the Earth from a finite 6 | point in space. In a full view of the earth one third of its surface area can 7 | be seen. 8 | 9 | **g**\ *lon0/lat0*\ */scale*\ [**+a**\ *azimuth*]\ 10 | [**+t**\ *tilt*]\ [**+v**\ *vwidth/vheight*]\ [**+w**\ *twist*]\ 11 | [**+z**\ *altitude*] or **G**\ *lon0/lat0*\ */width*\ 12 | [**+a**\ *azimuth*]\ [**+t**\ *tilt*]\ [**+v**\ *vwidth/vheight*]\ 13 | [**+w**\ *twist*]\ [**+z**\ *altitude*] 14 | 15 | The projection type is set with **g** or **G**. *lon0/lat0* specifies the 16 | projection center and *scale* or *width* determine the size of the figure. 17 | With **+a**\ *azimuth* the direction (in degrees) in which you are looking is 18 | specified, measured clockwise from north. **+t**\ *tilt* is given in degrees 19 | and is the viewing angle relative to zenith. A tilt of 0° is looking straight 20 | down, 60° is looking 30° above horizon. The viewport angle in degrees is 21 | described via **+v**\ *vwidth/vheight* and **+w**\ *twist* is the clockwise 22 | rotation of the image (in degrees). **+z**\ *altitude* sets the height in km 23 | of the viewpoint above local sea level (If altitude is less than 10, then it is 24 | the distance from the center of the earth to the viewpoint in earth radii). 25 | 26 | The example shows the coast of Northern Europe viewed from 250 km above sea 27 | level looking 30° from north at a tilt of 45°. The height and width of the 28 | viewing angle is both 60°, which imitates viewing with naked eye. 29 | """ 30 | 31 | # %% 32 | import pygmt 33 | 34 | fig = pygmt.Figure() 35 | fig.coast( 36 | region="g", 37 | projection="G4/52/12c+a30+t45+v60/60+w0+z250", 38 | frame="afg", 39 | land="khaki", 40 | water="white", 41 | ) 42 | fig.show() 43 | -------------------------------------------------------------------------------- /examples/projections/azim/azim_general_stereographic.py: -------------------------------------------------------------------------------- 1 | r""" 2 | General stereographic projection 3 | ================================ 4 | 5 | This map projection is a conformal, azimuthal projection. It is mainly used 6 | with a projection center in one of the poles. Then meridians appear as straight 7 | lines and cross latitudes at a right angle. Unlike the azimuthal equidistant 8 | projection, the distances in this projection are not displayed in correct 9 | proportions. It is often used as a hemisphere map like the Lambert Azimuthal 10 | Equal Area projection. 11 | 12 | **s**\ *lon0/lat0*\ [*/horizon*]\ */scale* 13 | or **S**\ *lon0/lat0*\ [*/horizon*\]\ */width* 14 | 15 | The projection type is set with **s** or **S**. *lon0/lat0* specifies the 16 | projection center, the optional *horizon* parameter specifies the maximum 17 | distance from projection center (in degrees, < 180, default 90), and the 18 | *scale* or *width* sets the size of the figure. 19 | """ 20 | 21 | # %% 22 | import pygmt 23 | 24 | fig = pygmt.Figure() 25 | fig.coast( 26 | region=[4, 14, 52, 57], 27 | projection="S0/90/12c", 28 | frame="afg", 29 | land="khaki", 30 | water="white", 31 | ) 32 | fig.show() 33 | -------------------------------------------------------------------------------- /examples/projections/azim/azim_gnomonic.py: -------------------------------------------------------------------------------- 1 | r""" 2 | Gnomonic projection 3 | =================== 4 | 5 | The point of perspective of the gnomonic projection lies at the center of the 6 | Earth. As a consequence great circles (orthodromes) on the surface of the Earth 7 | are displayed as straight lines, which makes it suitable for distance 8 | estimation for navigational purposes. It is neither conformal nor equal-area 9 | and the distortion increases greatly with distance to the projection center. It 10 | follows that the scope of application is restricted to a small area around the 11 | projection center (at a maximum of 60°). 12 | 13 | **f**\ *lon0/lat0*\ [*/horizon*\ ]\ */scale* 14 | or **F**\ *lon0/lat0*\ [*/horizon*\ ]\ */width* 15 | 16 | **f** or **F** specifies the projection type, *lon0/lat0* specifies the 17 | projection center, the optional parameter *horizon* specifies the maximum 18 | distance from projection center (in degrees, < 90, default 60), and *scale* or 19 | *width* sets the size of the figure. 20 | """ 21 | 22 | # %% 23 | import pygmt 24 | 25 | fig = pygmt.Figure() 26 | fig.coast( 27 | region="g", 28 | projection="F-90/15/12c", 29 | frame="afg", 30 | land="khaki", 31 | water="white", 32 | ) 33 | fig.show() 34 | -------------------------------------------------------------------------------- /examples/projections/azim/azim_lambert.py: -------------------------------------------------------------------------------- 1 | r""" 2 | Lambert azimuthal equal-area projection 3 | ======================================= 4 | 5 | This projection was developed by Johann Heinrich Lambert in 1772 and is 6 | typically used for mapping large regions like continents and hemispheres. It is 7 | an azimuthal, equal-area projection, but is not perspective. Distortion is zero 8 | at the center of the projection, and increases radially away from this point. 9 | 10 | **a**\ *lon0/lat0*\ [*/horizon*\ ]\ */scale* 11 | or **A**\ *lon0/lat0*\ [*/horizon*\ ]\ */width* 12 | 13 | **a** or **A** specifies the projection type, and *lon0/lat0* specifies the 14 | projection center, *horizon* specifies the maximum distance from projection 15 | center (in degrees, <= 180, default 90), and *scale* or *width* sets the size 16 | of the figure. 17 | """ 18 | 19 | # %% 20 | import pygmt 21 | 22 | fig = pygmt.Figure() 23 | fig.coast( 24 | region="g", 25 | projection="A30/-20/60/12c", 26 | frame="afg", 27 | land="khaki", 28 | water="white", 29 | ) 30 | fig.show() 31 | -------------------------------------------------------------------------------- /examples/projections/azim/azim_orthographic.py: -------------------------------------------------------------------------------- 1 | r""" 2 | Orthographic projection 3 | ======================= 4 | 5 | This is a perspective projection like the general perspective, but with the 6 | difference that the point of perspective lies in infinite distance. 7 | It is therefore often used to give the appearance of a globe viewed from outer 8 | space, were one hemisphere can be seen as a whole. It is neither conformal nor 9 | equal-area and the distortion increases near the edges. 10 | 11 | **g**\ *lon0/lat0*\ [*/horizon*\ ]\ */scale* 12 | or **G**\ *lon0/lat0*\ [*/horizon*\ ]\ */width* 13 | 14 | **g** or **G** specifies the projection type, *lon0/lat0* specifies the 15 | projection center, the optional parameter *horizon* specifies the maximum 16 | distance from projection center (in degrees, <= 90, default 90), and *scale* 17 | and *width* set the figure size. 18 | """ 19 | 20 | # %% 21 | import pygmt 22 | 23 | fig = pygmt.Figure() 24 | fig.coast( 25 | region="g", 26 | projection="G10/52/12c", 27 | frame="afg", 28 | land="khaki", 29 | water="white", 30 | ) 31 | fig.show() 32 | -------------------------------------------------------------------------------- /examples/projections/conic/GALLERY_HEADER.rst: -------------------------------------------------------------------------------- 1 | Conic Projections 2 | ----------------- 3 | -------------------------------------------------------------------------------- /examples/projections/conic/conic_albers.py: -------------------------------------------------------------------------------- 1 | r""" 2 | Albers conic equal-area projection 3 | ================================== 4 | 5 | This projection, developed by Heinrich C. Albers in 1805, is predominantly used 6 | to map regions of large east-west extent, in particular the United States. It 7 | is a conic, equal-area projection, in which parallels are unequally spaced arcs 8 | of concentric circles, more closely spaced at the north and south edges of the 9 | map. Meridians, on the other hand, are equally spaced radii about a common 10 | center, and cut the parallels at right angles. Distortion in scale and shape 11 | vanishes along the two standard parallels. Between them, the scale along 12 | parallels is too small; beyond them it is too large. The opposite is true for 13 | the scale along meridians. 14 | 15 | **b**\ *lon0/lat0*\ /\ *lat1/lat2*\ */scale* 16 | or **B**\ *lon0/lat0*\ /\ *lat1/lat2*\ */width* 17 | 18 | The projection is set with **b** or **B**. The projection center is set by 19 | *lon0/lat0* and two standard parallels for the map are set with *lat1/lat2*. 20 | The figure size is set with *scale* or *width*. 21 | """ 22 | 23 | # %% 24 | import pygmt 25 | 26 | fig = pygmt.Figure() 27 | # Use the ISO country code for Brazil and add a padding of 2 degrees (+R2) 28 | fig.coast( 29 | region="BR+R2", 30 | projection="B-55/-15/-25/0/12c", 31 | frame="afg", 32 | land="seagreen", 33 | water="gray90", 34 | ) 35 | fig.show() 36 | -------------------------------------------------------------------------------- /examples/projections/conic/conic_equidistant.py: -------------------------------------------------------------------------------- 1 | r""" 2 | Equidistant conic projection 3 | ============================ 4 | 5 | The equidistant conic projection was described by the Greek philosopher 6 | Claudius Ptolemy about A.D. 150. It is neither conformal or equal-area, but 7 | serves as a compromise between them. The scale is true along all meridians and 8 | the standard parallels. 9 | 10 | **d**\ *lon0/lat0*\ /\ *lat1/lat2*\ */scale* 11 | or **D**\ *lon0/lat0*\ /\ *lat1/lat2*\ */width* 12 | 13 | The projection is set with **d** or **D**. The projection center is set by 14 | *lon0/lat0* and two standard parallels for the map are set with *lat1/lat2*. 15 | The figure size is set with *scale* or *width*. 16 | """ 17 | 18 | # %% 19 | import pygmt 20 | 21 | fig = pygmt.Figure() 22 | fig.coast( 23 | region=[-88, -70, 18, 24], 24 | projection="D-79/21/19/23/12c", 25 | frame="afg", 26 | land="seagreen", 27 | water="gray90", 28 | ) 29 | fig.show() 30 | -------------------------------------------------------------------------------- /examples/projections/conic/conic_lambert.py: -------------------------------------------------------------------------------- 1 | r""" 2 | Lambert conic conformal projection 3 | ================================== 4 | 5 | This conic projection was designed by the Alsatian mathematician Johann 6 | Heinrich Lambert (1772) and has been used extensively for mapping of regions 7 | with predominantly east-west orientation, just like the Albers projection. 8 | Unlike the Albers projection, Lambert's conformal projection is not equal-area. 9 | The parallels are arcs of circles with a common origin, and meridians are the 10 | equally spaced radii of these circles. As with Albers projection, it is only 11 | the two standard parallels that are distortion-free. 12 | 13 | **l**\ *lon0/lat0*\ /\ *lat1/lat2*\ */scale* 14 | or **L**\ *lon0/lat0*\ /\ *lat1/lat2*\ */width* 15 | 16 | The projection is set with **l** or **L**. The projection center is set by 17 | *lon0/lat0* and two standard parallels for the map are set with *lat1/lat2*. 18 | The figure size is set with *scale* or *width*. 19 | """ 20 | 21 | # %% 22 | import pygmt 23 | 24 | fig = pygmt.Figure() 25 | fig.coast( 26 | region=[-130, -70, 24, 52], 27 | projection="L-100/35/33/45/12c", 28 | frame="afg", 29 | land="seagreen", 30 | water="gray90", 31 | ) 32 | 33 | fig.show() 34 | -------------------------------------------------------------------------------- /examples/projections/conic/polyconic.py: -------------------------------------------------------------------------------- 1 | r""" 2 | Polyconic projection 3 | ==================== 4 | 5 | The polyconic projection, in Europe usually referred to as the American 6 | polyconic projection, was introduced shortly before 1820 by the Swiss-American 7 | cartographer Ferdinand Rodulph Hassler (1770-1843). As head of the Survey of 8 | the Coast, he was looking for a projection that would give the least distortion 9 | for mapping the coast of the United States. The projection acquired its name 10 | from the construction of each parallel, which is achieved by projecting the 11 | parallel onto the cone while it is rolled around the globe, along the central 12 | meridian, tangent to that parallel. As a consequence, the projection involves 13 | many cones rather than a single one used in regular conic projections. 14 | 15 | The polyconic projection is neither equal-area, nor conformal. It is true to 16 | scale without distortion along the central meridian. Each parallel is true to 17 | scale as well, but the meridians are not as they get further away from the 18 | central meridian. As a consequence, no parallel is standard because conformity 19 | is lost with the lengthening of the meridians. 20 | 21 | **poly**/\ [*lon0*/\ [*lat0*/]]\ *scale* or 22 | **Poly**/\ [*lon0*/\ [*lat0*/]]\ *width* 23 | 24 | The projection is set with **poly** or **Poly**. The figure size is set 25 | with *scale* or *width*. 26 | """ 27 | 28 | # %% 29 | import pygmt 30 | 31 | fig = pygmt.Figure() 32 | fig.coast( 33 | region=[-180, -20, 0, 90], 34 | projection="Poly/12c", 35 | frame="afg", 36 | land="seagreen", 37 | water="gray90", 38 | ) 39 | fig.show() 40 | -------------------------------------------------------------------------------- /examples/projections/cyl/GALLERY_HEADER.rst: -------------------------------------------------------------------------------- 1 | Cylindric Projections 2 | --------------------- 3 | -------------------------------------------------------------------------------- /examples/projections/cyl/cyl_cassini.py: -------------------------------------------------------------------------------- 1 | r""" 2 | Cassini cylindrical projection 3 | ============================== 4 | 5 | This cylindrical projection was developed in 1745 by César-François Cassini de 6 | Thury for the survey of France. It is occasionally called Cassini-Soldner since 7 | the latter provided the more accurate mathematical analysis that led to the 8 | development of the ellipsoidal formulae. The projection is neither conformal 9 | nor equal-area, and behaves as a compromise between the two end-members. The 10 | distortion is zero along the central meridian. It is best suited for mapping 11 | regions of north-south extent. The central meridian, each meridian 90° away, 12 | and equator are straight lines; all other meridians and parallels are complex 13 | curves. 14 | 15 | **c**\ *lon0/lat0*\ */scale* or **C**\ *lon0/lat0*\ */width* 16 | 17 | The projection is set with **c** or **C**. The projection center is set by 18 | *lon0/lat0*, and the figure size is set with *scale* or *width*. 19 | """ 20 | 21 | # %% 22 | import pygmt 23 | 24 | fig = pygmt.Figure() 25 | # Use the ISO code for Madagascar (MG) and pad it by 2 degrees (+R2) 26 | fig.coast( 27 | region="MG+R2", 28 | projection="C47/-19/12c", 29 | frame="afg", 30 | land="gray80", 31 | water="steelblue", 32 | ) 33 | fig.show() 34 | -------------------------------------------------------------------------------- /examples/projections/cyl/cyl_equal_area.py: -------------------------------------------------------------------------------- 1 | r""" 2 | Cylindrical equal-area projection 3 | ================================= 4 | 5 | This cylindrical projection is actually several projections, depending on what 6 | latitude is selected as the standard parallel. However, they are all equal area 7 | and hence non-conformal. All meridians and parallels are straight lines. 8 | 9 | **y**\ *lon0/lat0*\ */scale* or **Y**\ *lon0/lat0*\ */width* 10 | 11 | The projection is set with **y** or **Y**. The projection center is set by 12 | *lon0/lat0*, and the figure size is set with *scale* or *width*. 13 | """ 14 | 15 | # %% 16 | import pygmt 17 | 18 | fig = pygmt.Figure() 19 | # Use region "d" to specify global region (-180/180/-90/90) 20 | fig.coast( 21 | region="d", 22 | projection="Y35/30/12c", 23 | frame="afg", 24 | land="gray80", 25 | water="steelblue", 26 | ) 27 | fig.show() 28 | -------------------------------------------------------------------------------- /examples/projections/cyl/cyl_equidistant.py: -------------------------------------------------------------------------------- 1 | r""" 2 | Cylindrical equidistant projection 3 | ================================== 4 | 5 | This simple cylindrical projection is really a linear scaling of longitudes and 6 | latitudes. The most common form is the Plate Carrée projection, where the 7 | scaling of longitudes and latitudes is the same. All meridians and parallels 8 | are straight lines. 9 | 10 | **q**\ [*lon0*/\ [*lat0*/]]\ *scale* or **Q**\ [*lon0*/\ [*lat0*/]]\ *width* 11 | 12 | The projection is set with **q** or **Q**, and the figure size is set with 13 | *scale* or *width*. Optionally, the central meridian can be set with *lon0* 14 | [Default is the middle of the map]. Optionally, the standard parallel can 15 | be set with *lat0* [Default is the equator]. When supplied, the central 16 | meridian must be supplied as well. 17 | """ 18 | 19 | # %% 20 | import pygmt 21 | 22 | fig = pygmt.Figure() 23 | # Use region "d" to specify global region (-180/180/-90/90) 24 | fig.coast( 25 | region="d", 26 | projection="Q12c", 27 | frame="afg", 28 | land="gray80", 29 | water="steelblue", 30 | ) 31 | fig.show() 32 | -------------------------------------------------------------------------------- /examples/projections/cyl/cyl_mercator.py: -------------------------------------------------------------------------------- 1 | r""" 2 | Mercator projection 3 | =================== 4 | 5 | The Mercator projection takes its name from the Flemish cartographer Gheert 6 | Cremer, better known as Gerardus Mercator, who presented it in 1569. The 7 | projection is a cylindrical and conformal, with no distortion along the 8 | equator. A major navigational feature of the projection is that a line of 9 | constant azimuth is straight. Such a line is called a rhumb line or loxodrome. 10 | Thus, to sail from one point to another one only had to connect the points with 11 | a straight line, determine the azimuth of the line, and keep this constant 12 | course for the entire voyage. The Mercator projection has been used extensively 13 | for world maps in which the distortion towards the polar regions grows 14 | rather large. 15 | 16 | **m**\ [*lon0*/\ [*lat0*/]]\ *scale* or **M**\ [*lon0*/\ [*lat0*/]]\ *width* 17 | 18 | The projection is set with **m** or **M**. The central meridian is set with the 19 | optional *lon0* and the standard parallel is set with the optional *lat0*. 20 | The figure size is set with *scale* or *width*. 21 | """ 22 | 23 | # %% 24 | import pygmt 25 | 26 | fig = pygmt.Figure() 27 | fig.coast( 28 | region=[0, 360, -80, 80], 29 | projection="M0/0/12c", 30 | frame="afg", 31 | land="gray80", 32 | water="steelblue", 33 | ) 34 | fig.show() 35 | -------------------------------------------------------------------------------- /examples/projections/cyl/cyl_miller.py: -------------------------------------------------------------------------------- 1 | r""" 2 | Miller cylindrical projection 3 | ============================= 4 | 5 | This cylindrical projection, presented by Osborn Maitland Miller of the 6 | American Geographic Society in 1942, is neither equal nor conformal. All 7 | meridians and parallels are straight lines. The projection was designed to be a 8 | compromise between Mercator and other cylindrical projections. Specifically, 9 | Miller spaced the parallels by using Mercator's formula with 0.8 times the 10 | actual latitude, thus avoiding the singular poles; the result was then divided 11 | by 0.8. 12 | 13 | **j**\ [*lon0/*]\ */scale* or **J**\ [*lon0/*]\ */width* 14 | 15 | The projection is set with **j** or **J**. The central meridian is set by the 16 | optional *lon0*, and the figure size is set with *scale* or *width*. 17 | """ 18 | 19 | # %% 20 | import pygmt 21 | 22 | fig = pygmt.Figure() 23 | fig.coast( 24 | region=[-180, 180, -80, 80], 25 | projection="J-65/12c", 26 | frame="afg", 27 | land="gray80", 28 | water="steelblue", 29 | ) 30 | fig.show() 31 | -------------------------------------------------------------------------------- /examples/projections/cyl/cyl_stereographic.py: -------------------------------------------------------------------------------- 1 | r""" 2 | Cylindrical stereographic projection 3 | ==================================== 4 | 5 | The cylindrical stereographic projections are certainly not as notable as other 6 | cylindrical projections, but are still used because of their relative 7 | simplicity and their ability to overcome some of the downsides of other 8 | cylindrical projections, like extreme distortions of the higher latitudes. The 9 | stereographic projections are perspective projections, projecting the sphere 10 | onto a cylinder in the direction of the antipodal point on the equator. The 11 | cylinder crosses the sphere at two standard parallels, equidistant from the 12 | equator. 13 | 14 | **cyl_stere**/\ [*lon0*/\ [*lat0*/]]\ *scale* or 15 | **Cyl_stere**/\ [*lon0*/\ [*lat0*/]]\ *width* 16 | 17 | The projection is set with **cyl_stere** or **Cyl_stere**. The central meridian 18 | is set by the optional *lon0*, and the figure size is set with *scale* or 19 | *width*. 20 | 21 | The standard parallel is typically one of these (but can be any value): 22 | 23 | * 66.159467 - Miller's modified Gall 24 | * 55 - Kamenetskiy's First 25 | * 45 - Gall's Stereographic 26 | * 30 - Bolshoi Sovietskii Atlas Mira or Kamenetskiy's Second 27 | * 0 - Braun's Cylindrical 28 | 29 | """ 30 | 31 | # %% 32 | import pygmt 33 | 34 | fig = pygmt.Figure() 35 | fig.coast( 36 | region="g", 37 | projection="Cyl_stere/30/-20/12c", 38 | frame="afg", 39 | land="gray80", 40 | water="steelblue", 41 | ) 42 | fig.show() 43 | -------------------------------------------------------------------------------- /examples/projections/cyl/cyl_transverse_mercator.py: -------------------------------------------------------------------------------- 1 | r""" 2 | Transverse Mercator projection 3 | ============================== 4 | 5 | The transverse Mercator was invented by Johann Heinrich Lambert in 1772. In 6 | this projection the cylinder touches a meridian along which there is no 7 | distortion. The distortion increases away from the central meridian and goes to 8 | infinity at 90° from center. The central meridian, each meridian 90° away from 9 | the center, and equator are straight lines; other parallels and meridians are 10 | complex curves. 11 | 12 | **t**\ *lon0*\ [/\ *lat0*]/\ *scale* or **T**\ *lon0*\ [/\ *lat0*]/\ *width* 13 | 14 | The projection is set with **t** or **T**. The central meridian is set 15 | by *lon0*, the latitude of the origin is set by the optional *lat0*, and the 16 | figure size is set with *scale* or *width*. 17 | """ 18 | 19 | # %% 20 | import pygmt 21 | 22 | fig = pygmt.Figure() 23 | fig.coast( 24 | region=[20, 50, 30, 45], 25 | projection="T35/12c", 26 | frame="afg", 27 | land="gray80", 28 | water="steelblue", 29 | ) 30 | fig.show() 31 | -------------------------------------------------------------------------------- /examples/projections/misc/GALLERY_HEADER.rst: -------------------------------------------------------------------------------- 1 | Miscellaneous Projections 2 | ------------------------- 3 | -------------------------------------------------------------------------------- /examples/projections/misc/misc_eckertIV.py: -------------------------------------------------------------------------------- 1 | r""" 2 | Eckert IV equal-area projection 3 | =============================== 4 | 5 | The Eckert IV projection, presented by the German cartographer Max 6 | Eckert-Greiffendorff in 1906, is a pseudo-cylindrical equal-area projection. 7 | Central meridian and all parallels are straight lines; other meridians are 8 | equally spaced elliptical arcs. The scale is true along latitude 40°30'. 9 | 10 | **kf**\ [*lon0/*]\ *scale* or **Kf**\ [*lon0/*]\ *width* 11 | 12 | The projection is set with **kf** or **Kf**. The central meridian is set with 13 | the optional *lon0*, and the figure size is set with *scale* or *width*. 14 | """ 15 | 16 | # %% 17 | import pygmt 18 | 19 | fig = pygmt.Figure() 20 | # Use region "d" to specify global region (-180/180/-90/90) 21 | fig.coast(region="d", projection="Kf12c", frame="afg", land="ivory", water="bisque4") 22 | fig.show() 23 | -------------------------------------------------------------------------------- /examples/projections/misc/misc_eckertVI.py: -------------------------------------------------------------------------------- 1 | r""" 2 | Eckert VI equal-area projection 3 | =============================== 4 | 5 | The Eckert VI projections, presented by the German cartographer Max 6 | Eckert-Greiffendorff in 1906, is a pseudo-cylindrical equal-area projection. 7 | Central meridian and all parallels are straight lines; other meridians are 8 | equally spaced sinusoids. The scale is true along latitude 49°16'. 9 | 10 | 11 | **ks**\ [*lon0/*]\ *scale* or **Ks**\ [*lon0/*]\ *width* 12 | 13 | The projection is set with **ks** or **Ks**. The central meridian is set with 14 | the optional *lon0*, and the figure size is set with *scale* or *width*. 15 | """ 16 | 17 | # %% 18 | import pygmt 19 | 20 | fig = pygmt.Figure() 21 | # Use region "d" to specify global region (-180/180/-90/90) 22 | fig.coast(region="d", projection="Ks12c", frame="afg", land="ivory", water="bisque4") 23 | fig.show() 24 | -------------------------------------------------------------------------------- /examples/projections/misc/misc_hammer.py: -------------------------------------------------------------------------------- 1 | r""" 2 | Hammer projection 3 | ================= 4 | 5 | The equal-area Hammer projection, first presented by the German mathematician 6 | Ernst von Hammer in 1892, is also known as Hammer-Aitoff (the Aitoff projection 7 | looks similar, but is not equal-area). The border is an ellipse, equator and 8 | central meridian are straight lines, while other parallels and meridians are 9 | complex curves. 10 | 11 | **h**\ [*lon0/*]\ *scale* or **H**\ [*lon0/*]\ *width* 12 | 13 | The projection is set with **h** or **H**. The central meridian is set with the 14 | optional *lon0*, and the figure size is set with *scale* or *width*. 15 | """ 16 | 17 | # %% 18 | import pygmt 19 | 20 | fig = pygmt.Figure() 21 | # Use region "d" to specify global region (-180/180/-90/90) 22 | fig.coast(region="d", projection="H12c", frame="afg", land="ivory", water="bisque4") 23 | fig.show() 24 | -------------------------------------------------------------------------------- /examples/projections/misc/misc_mollweide.py: -------------------------------------------------------------------------------- 1 | r""" 2 | Mollweide projection 3 | ==================== 4 | 5 | This pseudo-cylindrical, equal-area projection was developed by the German 6 | mathematician and astronomer Karl Brandan Mollweide in 1805. Parallels are 7 | unequally spaced straight lines with the meridians being equally spaced 8 | elliptical arcs. The scale is only true along latitudes 40°44' north and south. 9 | The projection is used mainly for global maps showing data distributions. It is 10 | occasionally referenced under the name homalographic projection. 11 | 12 | **w**\ [*lon0/*]\ *scale* or **W**\ [*lon0/*]\ *width* 13 | 14 | The projection is set with **w** or **W**. The central meridian is set with the 15 | optional *lon0*, and the figure size is set with *scale* or *width*. 16 | """ 17 | 18 | # %% 19 | import pygmt 20 | 21 | fig = pygmt.Figure() 22 | # Use region "d" to specify global region (-180/180/-90/90) 23 | fig.coast(region="d", projection="W12c", frame="afg", land="ivory", water="bisque4") 24 | fig.show() 25 | -------------------------------------------------------------------------------- /examples/projections/misc/misc_robinson.py: -------------------------------------------------------------------------------- 1 | r""" 2 | Robinson projection 3 | =================== 4 | 5 | The Robinson projection, presented by the American geographer and cartographer 6 | Arthur H. Robinson in 1963, is a modified cylindrical projection that is 7 | neither conformal nor equal-area. Central meridian and all parallels are 8 | straight lines; other meridians are curved. It uses lookup tables rather than 9 | analytic expressions to make the world map "look" right [#f1]_. 10 | The scale is true along latitudes 38° north and south. The projection was 11 | originally developed for use by Rand McNally and is currently used by the 12 | National Geographic Society. 13 | 14 | **n**\ [*lon0/*]\ *scale* or **N**\ [*lon0/*]\ *width* 15 | 16 | The projection is set with **n** or **N**. The central meridian is set with the 17 | optional *lon0*, and the figure size is set with *scale* or *width*. 18 | 19 | .. rubric:: Footnotes 20 | 21 | .. [#f1] Robinson provided a table of y-coordinates for latitudes every 5°. 22 | To project values for intermediate latitudes one must interpolate 23 | the table. Different interpolants may result in slightly different 24 | maps. GMT uses the interpolant selected by the parameter 25 | :gmt-term:`GMT_INTERPOLANT` in the gmt.conf file. 26 | """ 27 | 28 | # %% 29 | import pygmt 30 | 31 | fig = pygmt.Figure() 32 | # Use region "d" to specify global region (-180/180/-90/90) 33 | fig.coast(region="d", projection="N12c", frame="afg", land="ivory", water="bisque4") 34 | fig.show() 35 | -------------------------------------------------------------------------------- /examples/projections/misc/misc_sinusoidal.py: -------------------------------------------------------------------------------- 1 | r""" 2 | Sinusoidal projection 3 | ===================== 4 | 5 | The sinusoidal projection is one of the oldest known projections, is 6 | equal-area, and has been used since the mid-16th century. It has also been 7 | called the "Equal-area Mercator" projection. The central meridian is a straight 8 | line; all other meridians are sinusoidal curves. Parallels are all equally 9 | spaced straight lines, with scale being true along all parallels (and central 10 | meridian). 11 | 12 | **i**\ [*lon0/*]\ *scale* or **I**\ [*lon0/*]\ *width* 13 | 14 | The projection is set with **i** or **I**. The central meridian is set with the 15 | optional *lon0*, and the figure size is set with *scale* or *width*. 16 | """ 17 | 18 | # %% 19 | import pygmt 20 | 21 | fig = pygmt.Figure() 22 | # Use region "d" to specify global region (-180/180/-90/90) 23 | fig.coast(region="d", projection="I12c", frame="afg", land="ivory", water="bisque4") 24 | fig.show() 25 | -------------------------------------------------------------------------------- /examples/projections/misc/misc_van_der_grinten.py: -------------------------------------------------------------------------------- 1 | r""" 2 | Van der Grinten projection 3 | ========================== 4 | 5 | The Van der Grinten projection, presented by Alphons J. van der Grinten in 6 | 1904, is neither equal-area nor conformal. Central meridian and Equator are 7 | straight lines; other meridians are arcs of circles. The scale is true along 8 | the Equator only. Its main use is to show the entire world enclosed in a 9 | circle. 10 | 11 | **v**\ [*lon0/*]\ *scale* or **V**\ [*lon0/*]\ *width* 12 | 13 | The projection is set with **v** or **V**. The central meridian is set with the 14 | optional *lon0*, and the figure size is set with *scale* or *width*. 15 | """ 16 | 17 | # %% 18 | import pygmt 19 | 20 | fig = pygmt.Figure() 21 | # Use region "d" to specify global region (-180/180/-90/90) 22 | fig.coast(region="d", projection="V12c", frame="afg", land="ivory", water="bisque4") 23 | fig.show() 24 | -------------------------------------------------------------------------------- /examples/projections/misc/misc_winkel_tripel.py: -------------------------------------------------------------------------------- 1 | r""" 2 | Winkel Tripel projection 3 | ======================== 4 | 5 | In 1921, the German mathematician Oswald Winkel made a projection that was to 6 | strike a compromise between the properties of three elements (area, angle and 7 | distance). The German word "tripel" refers to this junction of where each of 8 | these elements are least distorted when plotting global maps. The projection 9 | was popularized when Bartholomew and Son started to use it in its 10 | world-renowned "The Times Atlas of the World" in the mid-20th century. In 1998, 11 | the National Geographic Society made the Winkel Tripel as its map projection of 12 | choice for global maps. 13 | 14 | Naturally, this projection is neither conformal, nor equal-area. Central 15 | meridian and equator are straight lines; other parallels and meridians are 16 | curved. The projection is obtained by averaging the coordinates of the 17 | Equidistant Cylindrical and Aitoff (not Hammer-Aitoff) projections. The poles 18 | map into straight lines 0.4 times the length of equator. 19 | 20 | **r**\ [*lon0/*]\ *scale* or **R**\ [*lon0/*]\ *width* 21 | 22 | The projection is set with **r** or **R**. The central meridian is set with the 23 | optional *lon0*, and the figure size is set with *scale* or *width*. 24 | """ 25 | 26 | # %% 27 | import pygmt 28 | 29 | fig = pygmt.Figure() 30 | # Use region "d" to specify global region (-180/180/-90/90) 31 | fig.coast(region="d", projection="R12c", frame="afg", land="ivory", water="bisque4") 32 | fig.show() 33 | -------------------------------------------------------------------------------- /examples/projections/nongeo/GALLERY_HEADER.rst: -------------------------------------------------------------------------------- 1 | Non-geographic Projections 2 | -------------------------- 3 | -------------------------------------------------------------------------------- /examples/projections/nongeo/cartesian_linear.py: -------------------------------------------------------------------------------- 1 | r""" 2 | Cartesian linear 3 | ================ 4 | 5 | **X**\ *width*\ [/*height*] or **x**\ *x-scale*\ [/*y-scale*] 6 | 7 | Give the *width* of the figure and the optional *height*. The lowercase version 8 | **x** is similar to **X** but expects an *x-scale* and an optional *y-scale*. 9 | 10 | The Cartesian linear projection is primarily designed for regular floating point 11 | data. To plot geographical data in a linear projection, see the upstream GMT 12 | documentation :gmt-docs:`Geographic coordinates 13 | `. 14 | To make the linear plot using calendar date/time as input coordinates, see the 15 | tutorial :doc:`Plotting datetime charts `. 16 | GMT documentation :gmt-docs:`Calendar time coordinates 17 | `. 18 | """ 19 | 20 | # %% 21 | import pygmt 22 | 23 | fig = pygmt.Figure() 24 | # The region parameter is specified as x_min, x_max, y_min, y_max 25 | fig.basemap(region=[0, 10, 0, 50], projection="X15c/10c", frame=["afg", "+gbisque"]) 26 | fig.plot(x=[3, 9, 2], y=[4, 9, 37], pen="2p,black") 27 | # Plot data points on top of the line 28 | # Use squares with a size of 0.3 centimeters, an "orange" fill and a "black" outline 29 | fig.plot(x=[3, 9, 2], y=[4, 9, 37], style="s0.3c", fill="orange", pen="black") 30 | fig.show() 31 | -------------------------------------------------------------------------------- /examples/projections/nongeo/cartesian_logarithmic.py: -------------------------------------------------------------------------------- 1 | r""" 2 | Cartesian logarithmic 3 | ===================== 4 | 5 | **X**\ *width*\ [**l**][/*height*\ [**l**]] or 6 | **x**\ *x-scale*\ [**l**][/*y-scale*\ [**l**]] 7 | 8 | Give the *width* of the figure and the optional *height*. 9 | The lowercase version **x** is similar to **X** but expects 10 | an *x-scale* and an optional *y-scale*. 11 | Each axis with a logarithmic transformation requires **l** after 12 | its size argument. 13 | """ 14 | 15 | # %% 16 | import numpy as np 17 | import pygmt 18 | 19 | # Create a list of x-values 0-100 20 | xline = np.arange(0, 101) 21 | # Create a list of y-values that are the square root of the x-values 22 | yline = xline**0.5 23 | # Create a list of x-values for every 10 in 0-100 24 | xpoints = np.arange(0, 101, 10) 25 | # Create a list of y-values that are the square root of the x-values 26 | ypoints = xpoints**0.5 27 | 28 | fig = pygmt.Figure() 29 | fig.basemap( 30 | region=[1, 100, 0, 10], 31 | # Set a logarithmic transformation on the x-axis 32 | projection="X15cl/10c", 33 | # Set the figures frame and color as well as 34 | # annotations, ticks, and gridlines 35 | frame=["WSne+gbisque", "xa2g3", "ya2f1g2"], 36 | ) 37 | 38 | # Set the line thickness to "2p", the color to "black", and the style to "dashed" 39 | fig.plot(x=xline, y=yline, pen="2p,black,dashed") 40 | 41 | # Plot the square root values on top of the line 42 | # Use squares with a size of 0.3 centimeters, an "orange" fill and a "black" outline 43 | # Symbols are not clipped if they go off the figure 44 | fig.plot(x=xpoints, y=ypoints, style="s0.3c", fill="orange", pen="black", no_clip=True) 45 | fig.show() 46 | -------------------------------------------------------------------------------- /examples/projections/nongeo/cartesian_power.py: -------------------------------------------------------------------------------- 1 | r""" 2 | Cartesian power 3 | =============== 4 | 5 | **X**\ *width*\ [**p**\ *pvalue*][/*height*\ [**p**\ *pvalue*]] or 6 | **x**\ *x-scale*\ [**p**\ *pvalue*][/*y-scale*\ [**p**\ *pvalue*]] 7 | 8 | Give the *width* of the figure and the optional argument *height*. 9 | The lowercase version **x** is similar to **X** but expects 10 | an *x-scale* and an optional *y-scale*. 11 | Each axis with a power transformation requires **p** and the exponent 12 | for that axis after its size argument. 13 | """ 14 | 15 | # %% 16 | import numpy as np 17 | import pygmt 18 | 19 | # Create a list of y-values 0-10 20 | yvalues = np.arange(0, 11) 21 | # Create a list of x-values that are the square of the y-values 22 | xvalues = yvalues**2 23 | 24 | fig = pygmt.Figure() 25 | fig.basemap( 26 | region=[0, 100, 0, 10], 27 | # Set the power transformation of the x-axis, with a power of 0.5 28 | projection="X15cp0.5/10c", 29 | # Set the figures frame as well as annotations and ticks 30 | # The "p" forces to show only square numbers as annotations of the x-axis 31 | frame=["WSne+gbisque", "xfga1p", "ya2f1g"], 32 | ) 33 | 34 | # Set the line thickness to "thick" (equals "1p", i.e. 1 point) 35 | # Use as color "black" (default) and as style "solid" (default) 36 | fig.plot(x=xvalues, y=yvalues, pen="thick,black,solid") 37 | 38 | # Plot the data points on top of the line 39 | # Use circles with 0.3 centimeters diameter, with an "orange" fill and a "black" outline 40 | # Symbols are not clipped if they go off the figure 41 | fig.plot(x=xvalues, y=yvalues, style="c0.3c", fill="orange", pen="black", no_clip=True) 42 | fig.show() 43 | -------------------------------------------------------------------------------- /examples/tutorials/GALLERY_HEADER.rst: -------------------------------------------------------------------------------- 1 | Tutorials 2 | ========= 3 | 4 | These examples teach us how to complete various tasks using PyGMT! 5 | -------------------------------------------------------------------------------- /examples/tutorials/advanced/GALLERY_HEADER.rst: -------------------------------------------------------------------------------- 1 | Advanced 2 | -------- 3 | -------------------------------------------------------------------------------- /examples/tutorials/basics/GALLERY_HEADER.rst: -------------------------------------------------------------------------------- 1 | Basics 2 | ------ 3 | -------------------------------------------------------------------------------- /pygmt/_typing.py: -------------------------------------------------------------------------------- 1 | """ 2 | Type aliases for type hints. 3 | """ 4 | 5 | import contextlib 6 | import importlib 7 | import os 8 | from collections.abc import Sequence 9 | from typing import Literal 10 | 11 | import numpy as np 12 | import pandas as pd 13 | import xarray as xr 14 | 15 | # Anchor codes 16 | AnchorCode = Literal["TL", "TC", "TR", "ML", "MC", "MR", "BL", "BC", "BR"] 17 | 18 | # String array types 19 | StringArrayTypes = Sequence[str] | np.ndarray 20 | with contextlib.suppress(ImportError): 21 | StringArrayTypes |= importlib.import_module(name="pyarrow").StringArray 22 | 23 | # PathLike and TableLike types 24 | PathLike = str | os.PathLike 25 | TableLike = dict | np.ndarray | pd.DataFrame | xr.Dataset 26 | with contextlib.suppress(ImportError): 27 | TableLike |= importlib.import_module(name="geopandas").GeoDataFrame 28 | -------------------------------------------------------------------------------- /pygmt/clib/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Low-level wrapper for the GMT C API. 3 | 4 | The pygmt.clib.Session class wraps the GMT C shared library (libgmt) with a Pythonic 5 | interface. Access to the C library is done through ctypes. 6 | """ 7 | 8 | from packaging.version import Version 9 | from pygmt.clib.session import Session, __gmt_version__ 10 | from pygmt.exceptions import GMTVersionError 11 | 12 | required_gmt_version = "6.4.0" 13 | 14 | # Check if the GMT version is older than the required version. 15 | if Version(__gmt_version__) < Version(required_gmt_version): 16 | msg = ( 17 | f"Using an incompatible GMT version {__gmt_version__}. " 18 | f"Must be equal or newer than {required_gmt_version}." 19 | ) 20 | raise GMTVersionError(msg) 21 | -------------------------------------------------------------------------------- /pygmt/conftest.py: -------------------------------------------------------------------------------- 1 | """ 2 | conftest.py for pytest. 3 | """ 4 | 5 | import numpy as np 6 | from packaging.version import Version 7 | 8 | # TODO(NumPy>=2.0): Remove the conftest.py file. 9 | # Address https://github.com/GenericMappingTools/pygmt/issues/2628. 10 | if Version(np.__version__) >= Version("2.0.0.dev0+git20230726"): 11 | np.set_printoptions(legacy="1.25") # type: ignore[arg-type] 12 | -------------------------------------------------------------------------------- /pygmt/datasets/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Functions to load GMT remote data and sample data. 3 | 4 | Data are downloaded from the GMT data server. 5 | """ 6 | 7 | from pygmt.datasets.earth_age import load_earth_age 8 | from pygmt.datasets.earth_day import load_blue_marble 9 | from pygmt.datasets.earth_deflection import load_earth_deflection 10 | from pygmt.datasets.earth_dist import load_earth_dist 11 | from pygmt.datasets.earth_free_air_anomaly import load_earth_free_air_anomaly 12 | from pygmt.datasets.earth_geoid import load_earth_geoid 13 | from pygmt.datasets.earth_magnetic_anomaly import load_earth_magnetic_anomaly 14 | from pygmt.datasets.earth_mask import load_earth_mask 15 | from pygmt.datasets.earth_mean_dynamic_topography import ( 16 | load_earth_mean_dynamic_topography, 17 | ) 18 | from pygmt.datasets.earth_mean_sea_surface import load_earth_mean_sea_surface 19 | from pygmt.datasets.earth_night import load_black_marble 20 | from pygmt.datasets.earth_relief import load_earth_relief 21 | from pygmt.datasets.earth_vertical_gravity_gradient import ( 22 | load_earth_vertical_gravity_gradient, 23 | ) 24 | from pygmt.datasets.mars_relief import load_mars_relief 25 | from pygmt.datasets.mercury_relief import load_mercury_relief 26 | from pygmt.datasets.moon_relief import load_moon_relief 27 | from pygmt.datasets.pluto_relief import load_pluto_relief 28 | from pygmt.datasets.samples import list_sample_data, load_sample_data 29 | from pygmt.datasets.tile_map import load_tile_map 30 | from pygmt.datasets.venus_relief import load_venus_relief 31 | -------------------------------------------------------------------------------- /pygmt/datatypes/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Wrappers for GMT data types. 3 | """ 4 | 5 | from pygmt.datatypes.dataset import _GMT_DATASET 6 | from pygmt.datatypes.grid import _GMT_GRID 7 | from pygmt.datatypes.image import _GMT_IMAGE 8 | -------------------------------------------------------------------------------- /pygmt/exceptions.py: -------------------------------------------------------------------------------- 1 | """ 2 | Custom exception types used throughout the library. 3 | 4 | All exceptions derive from GMTError. 5 | """ 6 | 7 | 8 | class GMTError(Exception): 9 | """ 10 | Base class for all GMT related errors. 11 | """ 12 | 13 | 14 | class GMTOSError(GMTError): 15 | """ 16 | Unsupported operating system. 17 | """ 18 | 19 | 20 | class GMTCLibError(GMTError): 21 | """ 22 | Error encountered when running a function from the GMT shared library. 23 | """ 24 | 25 | 26 | class GMTCLibNotFoundError(GMTCLibError): 27 | """ 28 | Could not find the GMT shared library. 29 | """ 30 | 31 | 32 | class GMTCLibNoSessionError(GMTCLibError): 33 | """ 34 | Tried to access GMT API without a currently open GMT session. 35 | """ 36 | 37 | 38 | class GMTInvalidInput(GMTError): # noqa: N818 39 | """ 40 | Raised when the input of a function/method is invalid. 41 | """ 42 | 43 | 44 | class GMTVersionError(GMTError): 45 | """ 46 | Raised when an incompatible version of GMT is being used. 47 | """ 48 | 49 | 50 | class GMTImageComparisonFailure(AssertionError): # noqa: N818 51 | """ 52 | Raised when a comparison between two images fails. 53 | """ 54 | -------------------------------------------------------------------------------- /pygmt/helpers/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Functions, classes, decorators, and context managers to help wrap GMT modules. 3 | """ 4 | 5 | from pygmt.helpers.decorators import ( 6 | deprecate_parameter, 7 | fmt_docstring, 8 | kwargs_to_strings, 9 | use_alias, 10 | ) 11 | from pygmt.helpers.tempfile import ( 12 | GMTTempFile, 13 | tempfile_from_geojson, 14 | tempfile_from_image, 15 | unique_name, 16 | ) 17 | from pygmt.helpers.utils import ( 18 | _check_encoding, 19 | _validate_data_input, 20 | args_in_kwargs, 21 | build_arg_list, 22 | data_kind, 23 | is_nonstr_iter, 24 | launch_external_viewer, 25 | non_ascii_to_octal, 26 | sequence_join, 27 | ) 28 | from pygmt.helpers.validators import validate_output_table_type 29 | -------------------------------------------------------------------------------- /pygmt/session_management.py: -------------------------------------------------------------------------------- 1 | """ 2 | Modern mode session management modules. 3 | """ 4 | 5 | import os 6 | import sys 7 | 8 | from pygmt.clib import Session 9 | from pygmt.helpers import unique_name 10 | 11 | 12 | def begin() -> None: 13 | """ 14 | Initiate a new GMT modern mode session. 15 | 16 | Used in combination with :func:`pygmt.end`. 17 | 18 | Only meant to be used once for creating the global session. 19 | """ 20 | # On Windows, need to set GMT_SESSION_NAME to a unique value. 21 | if sys.platform == "win32": 22 | os.environ["GMT_SESSION_NAME"] = unique_name() 23 | 24 | prefix = "pygmt-session" 25 | with Session() as lib: 26 | lib.call_module(module="begin", args=[prefix]) 27 | # PyGMT relies on GMT modern mode with GMT_COMPATIBILITY at version 6. 28 | lib.call_module(module="set", args=["GMT_COMPATIBILITY=6"]) 29 | 30 | 31 | def end() -> None: 32 | """ 33 | Terminate the GMT modern mode session created by :func:`pygmt.begin`. 34 | 35 | Called after :func:`pygmt.begin` and all commands that you want included in a 36 | session. Will clean up the session directory completely. 37 | """ 38 | with Session() as lib: 39 | lib.call_module(module="end", args=[]) 40 | -------------------------------------------------------------------------------- /pygmt/sphinx_gallery.py: -------------------------------------------------------------------------------- 1 | """ 2 | Utilities for using pygmt with sphinx-gallery. 3 | """ 4 | 5 | try: 6 | from sphinx_gallery.scrapers import figure_rst 7 | except ImportError: 8 | figure_rst = None 9 | from pygmt.figure import SHOWED_FIGURES 10 | 11 | 12 | class PyGMTScraper: 13 | """ 14 | Save ``pygmt.Figure`` objects that had their ``show`` method called. 15 | 16 | Used by sphinx-gallery to generate the plots from the code in the examples. 17 | 18 | Pass an instance of this class to ``sphinx_gallery_conf`` in your 19 | ``conf.py`` as the ``"image_scrapers"`` argument. 20 | """ 21 | 22 | def __call__(self, block, block_vars, gallery_conf): # noqa: ARG002 23 | """ 24 | Called by sphinx-gallery to save the figures generated after running code. 25 | """ 26 | image_names = [] 27 | image_path_iterator = block_vars["image_path_iterator"] 28 | figures = SHOWED_FIGURES 29 | while figures: 30 | fname = next(image_path_iterator) 31 | fig = figures.pop(0) 32 | fig.savefig(fname, transparent=True, dpi=200) 33 | image_names.append(fname) 34 | return figure_rst(image_names, gallery_conf["src_dir"]) 35 | -------------------------------------------------------------------------------- /pygmt/src/logo.py: -------------------------------------------------------------------------------- 1 | """ 2 | logo - Plot the GMT logo. 3 | """ 4 | 5 | from pygmt.clib import Session 6 | from pygmt.helpers import build_arg_list, fmt_docstring, kwargs_to_strings, use_alias 7 | 8 | 9 | @fmt_docstring 10 | @use_alias( 11 | R="region", 12 | J="projection", 13 | D="position", 14 | F="box", 15 | S="style", 16 | V="verbose", 17 | c="panel", 18 | t="transparency", 19 | ) 20 | @kwargs_to_strings(R="sequence", c="sequence_comma", p="sequence") 21 | def logo(self, **kwargs): 22 | r""" 23 | Plot the GMT logo. 24 | 25 | By default, the GMT logo is 2 inches wide and 1 inch high and 26 | will be positioned relative to the current plot origin. 27 | Use various options to change this and to place a transparent or 28 | opaque rectangular map panel behind the GMT logo. 29 | 30 | Full GMT docs at :gmt-docs:`gmtlogo.html`. 31 | 32 | {aliases} 33 | 34 | Parameters 35 | ---------- 36 | {projection} 37 | {region} 38 | position : str 39 | [**g**\|\ **j**\|\ **J**\|\ **n**\|\ **x**]\ *refpoint*\ 40 | **+w**\ *width*\ [**+j**\ *justify*]\ [**+o**\ *dx*\ [/*dy*]]. 41 | Set reference point on the map for the image. 42 | box : bool or str 43 | If set to ``True``, draw a rectangular border around the 44 | GMT logo. 45 | style : str 46 | [**l**\|\ **n**\|\ **u**]. 47 | Control what is written beneath the map portion of the logo. 48 | 49 | - **l** to plot the text label "The Generic Mapping Tools" 50 | [Default] 51 | - **n** to skip the label placement 52 | - **u** to place the URL to the GMT site 53 | {verbose} 54 | {panel} 55 | {transparency} 56 | """ 57 | self._activate_figure() 58 | with Session() as lib: 59 | lib.call_module(module="logo", args=build_arg_list(kwargs)) 60 | -------------------------------------------------------------------------------- /pygmt/tests/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | PyGMT test suite. 3 | """ 4 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_basemap.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: a0c8f76cac48621f24a14b2c6fa26d09 3 | size: 6260 4 | path: test_basemap.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_basemap_compass.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 3e0d9c5fbedf71d7bb0315797e7d0493 3 | size: 71791 4 | path: test_basemap_compass.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_basemap_loglog.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 01ea1c00700565057596c12d18c7146d 3 | size: 24551 4 | path: test_basemap_loglog.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_basemap_map_scale.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 0660d501d81ef890a9cf94bd92e0673e 3 | size: 31423 4 | path: test_basemap_map_scale.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_basemap_polar.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: e4bc1a90f4f25220fe759cdb0a709db8 3 | size: 31915 4 | path: test_basemap_polar.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_basemap_power_axis.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: f3151c1afe508404fc9c2cafcd34535d 3 | size: 16272 4 | path: test_basemap_power_axis.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_basemap_rose.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 86acd995f29f961bdf86afc22e2afff6 3 | size: 32873 4 | path: test_basemap_rose.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_basemap_subplot.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: d7049472c881d3a567e8e583b6ff54e1 3 | size: 8752 4 | path: test_basemap_subplot.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_basemap_utm_projection.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 5ac71f946749a8c4786416d780ba9ccf 3 | size: 9719 4 | path: test_basemap_utm_projection.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_basemap_winkel_tripel.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 23ae073b94dd213d02dc689fb867c230 3 | size: 62561 4 | path: test_basemap_winkel_tripel.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_coast_dcw_list.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 8ba6d6b9f0b7771fb78fcf5544a4aa42 3 | size: 89807 4 | path: test_coast_dcw_list.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_coast_dcw_single.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: a170637bdd47946399013fba43098f98 3 | size: 80182 4 | path: test_coast_dcw_single.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_coast_region.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 86bee0e5c92b6d5813cb8fac55ec6593 3 | size: 77964 4 | path: test_coast_region.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_coast_world_mercator.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 9d4b8ad917870dacd0cbbb06da6cc765 3 | size: 115070 4 | path: test_coast_world_mercator.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_colorbar.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: b274fb18c46c404e79dc293af9529567 3 | size: 2652 4 | hash: md5 5 | path: test_colorbar.png 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_colorbar_shading_list.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 52364ac84db033b53f7125ce12e95cce 3 | size: 25000 4 | path: test_colorbar_shading_list.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_config.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: abb5c720dfd2452426f6cb9c66e8c9a9 3 | size: 19567 4 | path: test_config.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_config_font_annot.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: b2db8e630d3807a5b81f8ecd002c3ac9 3 | size: 51186 4 | path: test_config_font_annot.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_config_font_one.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 21c66badaad4555b241e0a308227e4ae 3 | size: 54733 4 | path: test_config_font_one.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_config_format_date_map.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 589f1a3cefee9dc8d46f51650d7e14c7 3 | size: 1416 4 | path: test_config_format_date_map.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_config_format_time_map.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: ee87a487ac3f9e9840895dd7e1153649 3 | size: 7634 4 | path: test_config_format_time_map.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_config_map_annot_offset.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: bd80bd813ebc25b1be1d45a68568fc20 3 | size: 6820 4 | path: test_config_map_annot_offset.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_config_map_grid_cross_size.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: e1e7252855ceef3258475040a0ccf000 3 | size: 13229 4 | path: test_config_map_grid_cross_size.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_config_map_grid_pen.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 700c84364738976df5320c06770d68b3 3 | size: 13472 4 | path: test_config_map_grid_pen.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_config_map_tick_length.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 81637ceb091700c6d1ad4390b931c354 3 | size: 12678 4 | path: test_config_map_tick_length.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_config_map_tick_pen.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 2388937fb5953f6aaecaee826dd043c1 3 | size: 13083 4 | path: test_config_map_tick_pen.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_contour_from_file.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 4ec146ddfa70fa1b4cf6f48e9fcaa540 3 | size: 60483 4 | path: test_contour_from_file.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_contour_interval.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 44d70a0b17bc7c7939462184bf06e4da 3 | size: 50998 4 | isexec: true 5 | hash: md5 6 | path: test_contour_interval.png 7 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_contour_matrix.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: e147503fcaacb1686211653be7eb7709 3 | size: 74897 4 | path: test_contour_matrix.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_contour_multiple_levels.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 7bef85a616c46b9f05f4dbed07bd703d 3 | size: 29247 4 | isexec: true 5 | hash: md5 6 | path: test_contour_multiple_levels.png 7 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_contour_one_level.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 8c1ed221788e3af76279a7765640ea43 3 | size: 28882 4 | isexec: true 5 | hash: md5 6 | path: test_contour_one_level.png 7 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_contour_vec.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 017a19fea9fda195fae9deeb329f761a 3 | size: 82368 4 | path: test_contour_vec.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_geopandas_plot3d_default_cube.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: bc1515edbb0af03b0bd0d2cd4028c825 3 | size: 11912 4 | path: test_geopandas_plot3d_default_cube.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_geopandas_plot3d_non_default_circle.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 60016f76424ef8288e02ed56ed0fd1c8 3 | size: 11698 4 | path: test_geopandas_plot3d_non_default_circle.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_geopandas_plot_default_square.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 1564cd76fe8323fd0164bd9eb8efa08c 3 | size: 4461 4 | path: test_geopandas_plot_default_square.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_geopandas_plot_int_dtypes.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 5920ec05c2aaaf9f36df2bf371a15056 3 | size: 43224 4 | path: test_geopandas_plot_int_dtypes.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_geopandas_plot_non_default_circle.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 31d0dcb4bc3c97fc2e8a6d451009f204 3 | size: 4620 4 | path: test_geopandas_plot_non_default_circle.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_grd2cpt.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 3ef5930b17345f3f50ac65c0a8d46c22 3 | size: 22020 4 | path: test_grd2cpt.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_grdcontour.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: ebb68bfcd849c6f0f1e8ad6fde8ab419 3 | size: 107992 4 | path: test_grdcontour.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_grdcontour_interval_file_full_opts.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 70d2b0ac9ec8a317b4f382047587e9f2 3 | size: 29475 4 | path: test_grdcontour_interval_file_full_opts.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_grdcontour_labels.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 5dc625ae9ba8a041111cbf3d8864731b 3 | size: 112245 4 | path: test_grdcontour_labels.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_grdcontour_multiple_levels.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 4d20cdb71af2e6568f64f0246ec860ea 3 | size: 64008 4 | isexec: true 5 | hash: md5 6 | path: test_grdcontour_multiple_levels.png 7 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_grdcontour_one_level.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: fc624766f0b8eac8206735a05c7c9662 3 | size: 45023 4 | isexec: true 5 | hash: md5 6 | path: test_grdcontour_one_level.png 7 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_grdcontour_slice.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: b73351d7d37e5d56fbcab6d46132026a 3 | size: 54026 4 | path: test_grdcontour_slice.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_grdimage.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 4a4d857b9169baf53f4e6a3385539a84 3 | size: 162344 4 | path: test_grdimage.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_grdimage_file.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 8ee66ca045cf9031998fef75176681c6 3 | size: 152716 4 | path: test_grdimage_file.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_grdimage_global_subset.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 4cf31252e6c47d9263395205335932db 3 | size: 65582 4 | path: test_grdimage_global_subset.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_grdimage_grid_no_redundant_360.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 6145622653eaedd2b4845400aa09ac75 3 | size: 239431 4 | hash: md5 5 | path: test_grdimage_grid_no_redundant_360.png 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_grdimage_image.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: c54ef487ed5bb07aec5d8bba29469410 3 | size: 101095 4 | path: test_grdimage_image.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_grdimage_over_dateline.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: cfd6484e1e2eddea0d4b56df54aabe05 3 | size: 10854 4 | path: test_grdimage_over_dateline.png 5 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_grdimage_slice.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 2481f1366431e4e601ccdaf25830c33e 3 | size: 65041 4 | path: test_grdimage_slice.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_grdview_drapegrid_dataarray.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 7a2f20428f6e1450c51aa5105df47a81 3 | size: 315273 4 | path: test_grdview_drapegrid_dataarray.png 5 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_grdview_grid_dataarray.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: f28c636ae0fcd7518c53d72c4e11d6b0 3 | size: 8835 4 | path: test_grdview_grid_dataarray.png 5 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_grdview_on_a_plane.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: a1391d3165dc83a99b36dc9f390167f3 3 | size: 30369 4 | path: test_grdview_on_a_plane.png 5 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_grdview_on_a_plane_styled_with_facadepen.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 6c47058d09e1b75f3d724692ff00b703 3 | size: 32988 4 | path: test_grdview_on_a_plane_styled_with_facadepen.png 5 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_grdview_on_a_plane_with_colored_frontal_facade.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 9f55861b41df32e0b94ef5dadc80fb06 3 | size: 31036 4 | path: test_grdview_on_a_plane_with_colored_frontal_facade.png 5 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_grdview_surface_mesh_plot_styled_with_meshpen.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 83acb7282135b4cc4491c3a5afe4679e 3 | size: 43983 4 | path: test_grdview_surface_mesh_plot_styled_with_meshpen.png 5 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_grdview_surface_plot_styled_with_contourpen.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: b490c8a81b97cc54b42160115aac95c9 3 | size: 67769 4 | path: test_grdview_surface_plot_styled_with_contourpen.png 5 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_grdview_with_cmap_for_image_plot.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 22264dc7db5565465d47092a139377cc 3 | size: 267613 4 | path: test_grdview_with_cmap_for_image_plot.png 5 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_grdview_with_cmap_for_perspective_surface_plot.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: c32ce35f51b3e11cb1c9b9fad9ef7a0a 3 | size: 76504 4 | path: test_grdview_with_cmap_for_perspective_surface_plot.png 5 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_grdview_with_cmap_for_surface_monochrome_plot.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 152085fd81de3ad78b5c7ffb3cf0d080 3 | size: 95530 4 | path: test_grdview_with_cmap_for_surface_monochrome_plot.png 5 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_grdview_with_perspective.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 97be3a9ca7932beddb07db4f34d80719 3 | size: 28285 4 | path: test_grdview_with_perspective.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_grdview_with_perspective_and_zaxis_frame.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: f4514ea3d35211af6e4d2ff415c360d4 3 | size: 60378 4 | path: test_grdview_with_perspective_and_zaxis_frame.png 5 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_grdview_with_perspective_and_zscale.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 6074c0d7e5dcf0dc02df96de87d0d384 3 | size: 26169 4 | path: test_grdview_with_perspective_and_zscale.png 5 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_grdview_with_perspective_and_zsize.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: b2db2a4e6d14b53ac960abd87aacb488 3 | size: 38017 4 | path: test_grdview_with_perspective_and_zsize.png 5 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_histogram.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 63d28a2592bcdaaf2e51a0d8d9c11504 3 | size: 10822 4 | path: test_histogram.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_hlines_clip.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: e87ea1b80ae5d32d49e9ad94a5c25f96 3 | size: 7199 4 | hash: md5 5 | path: test_hlines_clip.png 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_hlines_geographic_global_d.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: b7055f03ff5bc152c0f6b72f2d39f32c 3 | size: 29336 4 | hash: md5 5 | path: test_hlines_geographic_global_d.png 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_hlines_geographic_global_g.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: ab2e7717cad6ac4132fd3e3af1fefa89 3 | size: 29798 4 | hash: md5 5 | path: test_hlines_geographic_global_g.png 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_hlines_multiple_lines.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 70c8decbffd37fc48b2eb9ff84442ec0 3 | size: 14139 4 | hash: md5 5 | path: test_hlines_multiple_lines.png 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_hlines_one_line.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 121970f75d34c552e632cacc692f09e9 3 | size: 13685 4 | hash: md5 5 | path: test_hlines_one_line.png 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_hlines_polar_projection.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 0c0eeb160dd6beb06bb6d3dcc264127a 3 | size: 57789 4 | hash: md5 5 | path: test_hlines_polar_projection.png 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_image.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: d7d0d71a44a232d5907dbd44f7a08f18 3 | size: 30811 4 | path: test_image.png 5 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_inset_aliases.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 813f2c05cf552a9a015c4cc44c9e4246 3 | size: 30075 4 | path: test_inset_aliases.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_inset_context_manager.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: fad7ee8d74cd61f73a8f218be6b0f9c0 3 | size: 10547 4 | path: test_inset_context_manager.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_legend_default_position.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: e4800fef6c670c29ba79296e2d7032af 3 | size: 20701 4 | path: test_legend_default_position.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_legend_entries.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: a135c47ee62e4bd9604eda3b04bbd6ab 3 | size: 68425 4 | path: test_legend_entries.png 5 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_legend_position.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: c0e2d094a25066a6a3cf473579ab97b8 3 | size: 25243 4 | path: test_legend_position.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_legend_specfile.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 8cb19cc2939be8df0f813b822718d1f8 3 | size: 52883 4 | path: test_legend_specfile.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_logo.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: a261222d0d214a2b4cad31a670b9fe03 3 | size: 31954 4 | path: test_logo.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_logo_on_a_map.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: c2efdf64f52fa34d1cc962e001bb5dc5 3 | size: 70814 4 | path: test_logo_on_a_map.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_makecpt_categorical.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 7f9c8ddaf7c1da61b06459182c60cab0 3 | size: 1831 4 | path: test_makecpt_categorical.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_makecpt_continuous.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: b0f663b1e029cb76fc9bf771cb237b41 3 | size: 2440 4 | path: test_makecpt_continuous.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_makecpt_cyclic.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 7e7d5d650a45fe92e56d52415078ec6a 3 | size: 3789 4 | path: test_makecpt_cyclic.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_makecpt_plot_colorbar.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: c690fe78fafb2f3184e59a9fdf71b0eb 3 | size: 2490 4 | path: test_makecpt_plot_colorbar.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_makecpt_plot_colorbar_scaled_with_series.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 00a0d3c6fa455414d391ab3f1cd11349 3 | size: 3184 4 | path: test_makecpt_plot_colorbar_scaled_with_series.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_makecpt_plot_points.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 7944289487b6efd9755a931e371d8022 3 | size: 26601 4 | path: test_makecpt_plot_points.png 5 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_makecpt_reverse_color_and_zsign.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 57608311311085dad38177c85671c441 3 | size: 3466 4 | path: test_makecpt_reverse_color_and_zsign.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_makecpt_reverse_color_only.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 6d89c3555e5ac3f92d38e27493072f40 3 | size: 3958 4 | path: test_makecpt_reverse_color_only.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_makecpt_truncated_zlow_zhigh.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: b6c4eb20f4c642562815ed3ffd39453f 3 | size: 2492 4 | path: test_makecpt_truncated_zlow_zhigh.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_meca_dict_offset_eventname.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 3ec9fb5ea39e00552b26116d0275ed66 3 | size: 11328 4 | path: test_meca_dict_offset_eventname.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_meca_eventname.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 6d8b48d9c7ddc07923f6c04e7aeed6e2 3 | size: 10600 4 | path: test_meca_eventname.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_meca_offset.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: a7c9e10a59030c98581d91c6e92a9f35 3 | size: 9988 4 | path: test_meca_offset.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_meca_spec_multiple_focalmecha.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 3ce57fca619482344cd1f4c55c4004d3 3 | size: 13904 4 | path: test_meca_spec_multiple_focalmecha.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_meca_spec_single_focalmecha.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 48cfe4ad779d7694b4b4743320b30b61 3 | size: 9902 4 | path: test_meca_spec_single_focalmecha.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_non_ascii_to_octal.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 1eff4f2997c10e3eaca95e8e92e20332 3 | size: 19326 4 | path: test_non_ascii_to_octal.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot3d_colors.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 5abc63f462b425682e93bd6086b0343c 3 | size: 35435 4 | path: test_plot3d_colors.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot3d_colors_sizes.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 62a9184d3326508b6d5688688dbf0a70 3 | size: 23874 4 | path: test_plot3d_colors_sizes.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot3d_colors_sizes_proj.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: eb8dfb229f30a68fd0eb09e1ec3e1ae9 3 | size: 46516 4 | path: test_plot3d_colors_sizes_proj.png 5 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot3d_from_file.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: cb66a8d11e211fcc8c58a35e1bb3a957 3 | size: 40754 4 | path: test_plot3d_from_file.png 5 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot3d_matrix.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 2dfb17a65aedde7e5503b751bfc5e9c8 3 | size: 34236 4 | path: test_plot3d_matrix.png 5 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot3d_matrix_color.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 25eda5adedc9ec4a22d9a3464d2df135 3 | size: 24861 4 | path: test_plot3d_matrix_color.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot3d_ogrgmt_file_multipoint_default_style.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 9429b4e9a52bcfc0e4d13dbc4ffb9d1b 3 | size: 11805 4 | path: test_plot3d_ogrgmt_file_multipoint_default_style.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot3d_ogrgmt_file_multipoint_non_default_style.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: ec5bec39de79e1104eb1c6b2c99d9e7c 3 | size: 11794 4 | path: test_plot3d_ogrgmt_file_multipoint_non_default_style.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot3d_projection.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: ee7848ae45db468995689efcd7da43e0 3 | size: 34959 4 | path: test_plot3d_projection.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot3d_red_circles_zscale.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: a5c85cb5c6e457c9ee39d41261b2fa21 3 | size: 45323 4 | path: test_plot3d_red_circles_zscale.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot3d_red_circles_zsize.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: a829e0e663a9c3e49c62683e710d02db 3 | size: 44396 4 | path: test_plot3d_red_circles_zsize.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot3d_scalar_xyz.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: e6139d3463805a58727f0f277b54cd14 3 | size: 31643 4 | path: test_plot3d_scalar_xyz.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot3d_sizes.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: e9738472f2a5ee5d400deb59cd692afc 3 | size: 31390 4 | path: test_plot3d_sizes.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot3d_sizes_colors_transparencies.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: e18e3177408aec9bb8815838c0c9a319 3 | size: 25638 4 | path: test_plot3d_sizes_colors_transparencies.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot3d_symbol.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 5593426a0fde7cc591e89b8309f73402 3 | size: 9170 4 | hash: md5 5 | path: test_plot3d_symbol.png 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot3d_transparency.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: d6c5a7b43189ac32ca098701851703fb 3 | size: 21479 4 | path: test_plot3d_transparency.png 5 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot3d_varying_intensity.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: cbdb71d2bbf5ec6b0a3846114fc241cf 3 | size: 22129 4 | path: test_plot3d_varying_intensity.png 5 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot3d_varying_transparency.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 2879b4839e231c72a7ea94114d08a2ac 3 | size: 22459 4 | path: test_plot3d_varying_transparency.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot3d_vectors.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: cbc43a6768b1766494248491b29bd4b1 3 | size: 22521 4 | path: test_plot3d_vectors.png 5 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot_colors.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 9b9e794d848ff9bc2d02d6ad029e50b5 3 | size: 23004 4 | path: test_plot_colors.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot_colors_sizes.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: ce685bece84f1893d9f241e8d2c8b5c2 3 | size: 19085 4 | path: test_plot_colors_sizes.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot_colors_sizes_proj.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: e2a4079f89a8d894ef06777923bc1641 3 | size: 28360 4 | path: test_plot_colors_sizes_proj.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot_dataframe_incols.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 783930f2c828f9630206b3389bf6feed 3 | size: 7684 4 | path: test_plot_dataframe_incols.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot_datetime.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 0a2eae0da1e3d5b71d7392de1c081346 3 | size: 13124 4 | path: test_plot_datetime.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot_from_file.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 09748e01d78191f2077bb334a0c7f24f 3 | size: 22903 4 | path: test_plot_from_file.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot_lines_with_arrows.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 99ab8b3b7700ab5c988b4abb60a124dd 3 | size: 22391 4 | path: test_plot_lines_with_arrows.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot_matrix.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: fbcd521efdb2368ffb225a0b038666f4 3 | size: 13713 4 | path: test_plot_matrix.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot_matrix_color.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 438619f4176a8c892a0cd17a8c400831 3 | size: 21281 4 | path: test_plot_matrix_color.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot_ogrgmt_file_multipoint_default_style.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 1564cd76fe8323fd0164bd9eb8efa08c 3 | size: 4461 4 | path: test_plot_ogrgmt_file_multipoint_default_style.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot_ogrgmt_file_multipoint_non_default_style.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 31d0dcb4bc3c97fc2e8a6d451009f204 3 | size: 4620 4 | path: test_plot_ogrgmt_file_multipoint_non_default_style.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot_projection.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 878e608c22064f29530975f2534f97a1 3 | size: 21339 4 | path: test_plot_projection.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot_red_circles.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: bb8b7408f83442f726d905f0035ff5df 3 | size: 15447 4 | path: test_plot_red_circles.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot_scalar_xy.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 28c9a67c9e52d17b82d6fb86f309049f 3 | size: 24639 4 | path: test_plot_scalar_xy.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot_shapefile.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 3dde1d0aef7227ddc6be47442d1aa4e5 3 | size: 33213 4 | path: test_plot_shapefile.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot_sizes.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 31dbeece7f15ceb3525226cfb0edaebb 3 | size: 17262 4 | path: test_plot_sizes.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot_sizes_colors_transparencies.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: a702ab2c944f22d36f00a83e62ed939e 3 | size: 14788 4 | path: test_plot_sizes_colors_transparencies.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot_symbol.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: bf71e5e72529a85d9ac45aa71321962e 3 | size: 3798 4 | hash: md5 5 | path: test_plot_symbol.png 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot_timedelta64.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 8edddcec764d244053c4d675e98732b9 3 | size: 13201 4 | path: test_plot_timedelta64.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot_transparency.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: ae116eaad0d5c840645c37aed83d2159 3 | size: 12704 4 | path: test_plot_transparency.png 5 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot_varying_intensity.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 38895d0b790627c39785a5af76030381 3 | size: 9126 4 | path: test_plot_varying_intensity.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot_varying_transparency.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 909d6563c03ac58eaa40555955167ed5 3 | size: 12783 4 | path: test_plot_varying_transparency.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_plot_vectors.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 959aacffe503907929118c39373dd257 3 | size: 12165 4 | path: test_plot_vectors.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_rose_2d_array_multiple.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: bf8a48349d1af0029dce3f21dd740fbe 3 | size: 36599 4 | path: test_rose_2d_array_multiple.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_rose_2d_array_single.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 0e8aceb803dab08caac392a6dd1cf997 3 | size: 34355 4 | path: test_rose_2d_array_single.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_rose_bools.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 1e12ca9c45c0ab27621f7455318855d7 3 | size: 59907 4 | path: test_rose_bools.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_rose_data_file.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: d3f789296b8b43457897af84511dcef4 3 | size: 31827 4 | path: test_rose_data_file.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_rose_no_sectors.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 470dcb51dfb1573827803730cb3c4005 3 | size: 150500 4 | path: test_rose_no_sectors.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_rose_plot_data_using_cpt.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: cfbe8a6396e10461fb8f2bb7c0de8112 3 | size: 38924 4 | path: test_rose_plot_data_using_cpt.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_rose_plot_with_transparency.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 991da190e85635e2b9bf6d38bcf7ae61 3 | size: 58215 4 | path: test_rose_plot_with_transparency.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_shift_origin.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 39b241fdd879271cf1e8cf1f73454706 3 | size: 9910 4 | hash: md5 5 | path: test_shift_origin.png 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_shift_origin_context_manager.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 6c63b9935618f607fe22608f7561be22 3 | size: 4869 4 | hash: md5 5 | path: test_shift_origin_context_manager.png 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_shift_origin_mixed_modes.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 3a31df374874ae00920ada0b311b4266 3 | size: 5678 4 | hash: md5 5 | path: test_shift_origin_mixed_modes.png 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_shift_origin_nested_context_manager.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: cd83745f2657ff7daeaba368143db72f 3 | size: 4876 4 | hash: md5 5 | path: test_shift_origin_nested_context_manager.png 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_solar_set_terminator_datetime.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 76efee7c1a8b5704485216637c5d94df 3 | size: 25022 4 | path: test_solar_set_terminator_datetime.png 5 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_solar_terminators.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 8325728360e1d302bb9abbb681b41cc6 3 | size: 42122 4 | path: test_solar_terminators.png 5 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_subplot_autolabel_margins_title.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: a4af27ae0468c63a8d6200c6a7f9908f 3 | size: 22646 4 | path: test_subplot_autolabel_margins_title.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_subplot_basic_frame.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 192b6e13adb19e698ea584295ddcfec1 3 | size: 7724 4 | path: test_subplot_basic_frame.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_subplot_clearance_and_shared_xy_axis_layout.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 2070952590776d7d98cab88a06924c78 3 | size: 8782 4 | path: test_subplot_clearance_and_shared_xy_axis_layout.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_subplot_direct.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 61c8c5376cc625a0ea943978dadfe53a 3 | size: 6807 4 | path: test_subplot_direct.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_subplot_outside_plotting_positioning.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: ab48de732fa2243e78db5ce3eb62819b 3 | size: 11565 4 | path: test_subplot_outside_plotting_positioning.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_ternary.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 065ea10a2ed961df29defd6a1dfd1a4c 3 | size: 62296 4 | path: test_ternary.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_ternary_1_label.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 8046b09ffd4020ac84b43704b39597d3 3 | size: 63378 4 | path: test_ternary_1_label.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_ternary_3_labels.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: af08eb16a966e9e8b72137c22c880c60 3 | size: 64686 4 | path: test_ternary_3_labels.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_text_angle_30.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 7435aca0582dc193bc58c6d9bf0322d4 3 | size: 5543 4 | path: test_text_angle_30.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_text_angle_font_justify_from_textfile.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: ad3a6c9390031ee2a8481c28802c372f 3 | size: 9433 4 | path: test_text_angle_font_justify_from_textfile.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_text_angle_justify_font_arrays.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 069a50aace4873e32c1a74d394d30321 3 | size: 8143 4 | hash: md5 5 | path: test_text_angle_justify_font_arrays.png 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_text_fill.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 34a424220e49e9e36463587755acc7fa 3 | size: 1964 4 | path: test_text_fill.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_text_font_bold.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 66c152c2d2f86776415e106fc5a3c98b 3 | size: 1362 4 | path: test_text_font_bold.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_text_input_multiple_filenames.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 00d30a6f9a3df5b3205f9a2699025c4c 3 | size: 29075 4 | path: test_text_input_multiple_filenames.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_text_input_remote_filename.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: b547ef1c85c89fbed994eaf0785c87d1 3 | size: 42703 4 | path: test_text_input_remote_filename.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_text_input_single_filename.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 4cecb7910012e951b957b82215a6db1b 3 | size: 27249 4 | path: test_text_input_single_filename.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_text_justify_bottom_right_and_top_left.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: e0955670dccdd55de3e8af7f51cd663b 3 | size: 4893 4 | path: test_text_justify_bottom_right_and_top_left.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_text_justify_parsed_from_textfile.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 6907c62187ac92ab7ad10d2bb66c9db9 3 | size: 10380 4 | path: test_text_justify_parsed_from_textfile.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_text_multiple_lines_of_text.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: a92c964b4d1e3fc8d2a1c99fbeb4337d 3 | size: 6095 4 | path: test_text_multiple_lines_of_text.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_text_nonascii.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 5442ca4a23e43b9f3e4d5794ccb5448a 3 | size: 17286 4 | hash: md5 5 | path: test_text_nonascii.png 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_text_nonascii_iso8859.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: a0f35a1d58c95e6589c7397e7660e946 3 | size: 17089 4 | hash: md5 5 | path: test_text_nonascii_iso8859.png 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_text_nonstr_text.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 41625972ee97af25965877eb78e0a673 3 | size: 12270 4 | path: test_text_nonstr_text.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_text_numeric_text.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 97d7780216d535c0400f6117cf47ff65 3 | size: 8657 4 | hash: md5 5 | path: test_text_numeric_text.png 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_text_pen.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 9216363f7a5604cddfb4db910638b8aa 3 | size: 2618 4 | path: test_text_pen.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_text_position.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 7e2e4bbb6db83478d8b5069955e9e60c 3 | size: 6247 4 | path: test_text_position.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_text_position_offset_with_line.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: ccd10643c7e6072e5a356442a71957ca 3 | size: 7220 4 | path: test_text_position_offset_with_line.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_text_quotation_marks.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: f3ddc9b50f3da1facdbcd32261db3bd6 3 | size: 2965 4 | hash: md5 5 | path: test_text_quotation_marks.png 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_text_round_clearance.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: d6aeb66b3a02147c7049175574b52c58 3 | size: 3631 4 | path: test_text_round_clearance.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_text_single_line_of_text.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: d2c9e47dceffb0b4f6573c55d7a49635 3 | size: 1842 4 | path: test_text_single_line_of_text.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_text_transparency.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 3e44dbdab2c386fd361481438fa10d58 3 | size: 18174 4 | path: test_text_transparency.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_text_varying_transparency.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: f16009816a1a007a93aef6cfc21f5dee 3 | size: 18382 4 | path: test_text_varying_transparency.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_tilemap_no_clip_False.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: e55d9848135fc14c9cfc3d2c85bd82bb 3 | size: 16472 4 | path: test_tilemap_no_clip_False.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_tilemap_no_clip_True.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 53949854f32b450e55f1be86102387e9 3 | size: 38816 4 | path: test_tilemap_no_clip_True.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_tilemap_ogc_crs84.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 5f225e4dd26f44e07bcbd8e713c67dbe 3 | size: 37343 4 | path: test_tilemap_ogc_crs84.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_tilemap_web_mercator.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 14f7afd5d48ed6aed88d495783f0ba42 3 | size: 62398 4 | path: test_tilemap_web_mercator.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_timestamp.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 718155c9d3d80177f6465a317bb17354 3 | size: 1677 4 | path: test_timestamp.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_timestamp_font.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 3be1c3ac318ed3663f86548d69368231 3 | size: 2792 4 | path: test_timestamp_font.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_timestamp_justify.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: fcf1511052ece6b0e2ed97b6ae5af772 3 | size: 8828 4 | path: test_timestamp_justify.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_timestamp_label.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: fd532295c0c13855715190ea1b03facd 3 | size: 3037 4 | path: test_timestamp_label.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_timestamp_offset.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: c9274f7984b0c3f7228dd758d45d93b6 3 | size: 12286 4 | path: test_timestamp_offset.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_timestamp_text_truncated.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 71aa608f602f44450260653e26bb6bc1 3 | size: 3544 4 | path: test_timestamp_text_truncated.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_velo_numpy_array_numeric_only.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 44e226325f73e43b4cb62c26680371a8 3 | size: 44580 4 | path: test_velo_numpy_array_numeric_only.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_velo_pandas_dataframe.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 2157d1041d1a33460c92143f0a742800 3 | size: 42738 4 | path: test_velo_pandas_dataframe.png 5 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_vlines_clip.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 4eb9c7fd7e3a803dcc3cde1409ad7fa7 3 | size: 7361 4 | hash: md5 5 | path: test_vlines_clip.png 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_vlines_geographic_global.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 3fb4a271c670e4cbe647838b6fee5a8c 3 | size: 67128 4 | hash: md5 5 | path: test_vlines_geographic_global.png 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_vlines_multiple_lines.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 499b2d08832247673f208b1c0a282c4c 3 | size: 13874 4 | hash: md5 5 | path: test_vlines_multiple_lines.png 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_vlines_one_line.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 2cd30ad55fc660123c67e6a684a5ea21 3 | size: 13589 4 | hash: md5 5 | path: test_vlines_one_line.png 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_vlines_polar_projection.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 1981df3bd9c57cd975b6e74946496175 3 | size: 44621 4 | hash: md5 5 | path: test_vlines_polar_projection.png 6 | -------------------------------------------------------------------------------- /pygmt/tests/baseline/test_wiggle.png.dvc: -------------------------------------------------------------------------------- 1 | outs: 2 | - md5: 78ca6cf49e085f5c450d2421f3a6bcb9 3 | size: 9136 4 | path: test_wiggle.png 5 | hash: md5 6 | -------------------------------------------------------------------------------- /pygmt/tests/data/cities.txt: -------------------------------------------------------------------------------- 1 | 105.87 21.02 LM HANOI 2 | 282.95 -12.1 LM LIMA 3 | 178.42 -18.13 LM SUVA 4 | 237.67 47.58 RM SEATTLE 5 | 28.20 -25.75 LM PRETORIA 6 | -------------------------------------------------------------------------------- /pygmt/tests/data/contours.txt: -------------------------------------------------------------------------------- 1 | 200 A 2 | 300 C 3 | 400 A 4 | 500 C 5 | 600 A 6 | 700 C 7 | 800 A 8 | 900 C 9 | -------------------------------------------------------------------------------- /pygmt/tests/data/points.txt: -------------------------------------------------------------------------------- 1 | 43.4847 0.6227 0.5309 2 | 22.3310 3.7556 0.3817 3 | 40.8023 5.5903 0.7764 4 | 49.8760 1.1690 0.9222 5 | 60.6897 -2.3304 0.3358 6 | 27.7790 7.8648 0.8780 7 | 40.3582 4.9328 0.1412 8 | 18.9422 6.5730 0.4647 9 | 20.7545 0.4177 0.3740 10 | 19.8565 7.0446 0.3204 11 | 19.9855 -2.9289 0.9053 12 | 46.4844 -1.3304 0.4515 13 | 43.2328 6.3035 0.8857 14 | 59.3526 2.1551 0.4707 15 | 16.7597 0.8547 0.3714 16 | 32.3278 3.8075 0.9225 17 | 11.5309 4.6619 0.7622 18 | 61.7074 1.4425 0.4305 19 | 28.1125 3.8456 0.9338 20 | 47.8333 -0.7225 0.5969 21 | -------------------------------------------------------------------------------- /pygmt/tests/data/track.txt: -------------------------------------------------------------------------------- 1 | -51.613 -17.93 2 | -48.917 -22.434 3 | -50.444 -16.358 4 | -50.721 -16.628 5 | -51.394 -12.196 6 | -50.207 -18.404 7 | -52.56 -16.977 8 | -51.866 -19.794 9 | -48.001 -14.144 10 | -54.438 -19.193 11 | -------------------------------------------------------------------------------- /pygmt/tests/test_binstats.py: -------------------------------------------------------------------------------- 1 | """ 2 | Test pygmt.binstats. 3 | """ 4 | 5 | from pathlib import Path 6 | 7 | import numpy.testing as npt 8 | import pytest 9 | from pygmt import binstats 10 | from pygmt.enums import GridRegistration, GridType 11 | from pygmt.helpers import GMTTempFile 12 | 13 | 14 | def test_binstats_outgrid(): 15 | """ 16 | Test binstats with a set outgrid. 17 | """ 18 | with GMTTempFile(suffix=".nc") as tmpfile: 19 | result = binstats( 20 | data="@capitals.gmt", 21 | outgrid=tmpfile.name, 22 | spacing=5, 23 | statistic="z", 24 | search_radius="1000k", 25 | aspatial="2=population", 26 | region="g", 27 | ) 28 | assert result is None # return value is None 29 | assert Path(tmpfile.name).stat().st_size > 0 # check that outgrid exists 30 | 31 | 32 | @pytest.mark.benchmark 33 | def test_binstats_no_outgrid(): 34 | """ 35 | Test binstats with no set outgrid. 36 | """ 37 | temp_grid = binstats( 38 | data="@capitals.gmt", 39 | spacing=5, 40 | statistic="z", 41 | search_radius="1000k", 42 | aspatial="2=population", 43 | region="g", 44 | ) 45 | assert temp_grid.dims == ("y", "x") 46 | assert temp_grid.gmt.gtype is GridType.CARTESIAN 47 | assert temp_grid.gmt.registration is GridRegistration.GRIDLINE 48 | npt.assert_allclose(temp_grid.max(), 35971536) 49 | npt.assert_allclose(temp_grid.min(), 53) 50 | npt.assert_allclose(temp_grid.median(), 1232714.5) 51 | npt.assert_allclose(temp_grid.mean(), 4227489) 52 | -------------------------------------------------------------------------------- /pygmt/tests/test_clib_extract_region.py: -------------------------------------------------------------------------------- 1 | """ 2 | Test the Session.extract_region function. 3 | """ 4 | 5 | import numpy as np 6 | import numpy.testing as npt 7 | import pytest 8 | from pygmt import Figure, clib 9 | from pygmt.exceptions import GMTCLibError 10 | 11 | 12 | def test_extract_region_fails(): 13 | """ 14 | Check that extract region fails if nothing has been plotted. 15 | """ 16 | Figure() 17 | with pytest.raises(GMTCLibError): 18 | with clib.Session() as lib: 19 | lib.extract_region() 20 | 21 | 22 | def test_extract_region_two_figures(): 23 | """ 24 | Extract region should handle multiple figures existing at the same time. 25 | """ 26 | # Make two figures before calling extract_region to make sure that it's 27 | # getting from the current figure, not the last figure. 28 | fig1 = Figure() 29 | region1 = np.array([0, 10, -20, -10]) 30 | fig1.coast(region=region1, projection="M6i", frame=True, land="black") 31 | 32 | fig2 = Figure() 33 | fig2.basemap(region="US.HI+r5", projection="M6i", frame=True) 34 | 35 | # Activate the first figure and extract the region from it 36 | # Use in a different session to avoid any memory problems. 37 | with clib.Session() as lib: 38 | lib.call_module("figure", [fig1._name, "-"]) 39 | with clib.Session() as lib: 40 | wesn1 = lib.extract_region() 41 | npt.assert_allclose(wesn1, region1) 42 | 43 | # Now try it with the second one 44 | with clib.Session() as lib: 45 | lib.call_module("figure", [fig2._name, "-"]) 46 | with clib.Session() as lib: 47 | wesn2 = lib.extract_region() 48 | npt.assert_allclose(wesn2, np.array([-165.0, -150.0, 15.0, 25.0])) 49 | -------------------------------------------------------------------------------- /pygmt/tests/test_clib_inquire_virtualfile.py: -------------------------------------------------------------------------------- 1 | """ 2 | Test the Session.inquire_virtualfile method. 3 | """ 4 | 5 | from pygmt import clib 6 | 7 | 8 | def test_inquire_virtualfile(): 9 | """ 10 | Test that the inquire_virtualfile method returns the correct family. 11 | 12 | Currently, only output virtual files are tested. 13 | """ 14 | with clib.Session() as lib: 15 | for family in [ 16 | "GMT_IS_DATASET", 17 | "GMT_IS_DATASET|GMT_VIA_MATRIX", 18 | "GMT_IS_DATASET|GMT_VIA_VECTOR", 19 | ]: 20 | with lib.open_virtualfile( 21 | family, "GMT_IS_PLP", "GMT_OUT|GMT_IS_REFERENCE", None 22 | ) as vfile: 23 | assert lib.inquire_virtualfile(vfile) == lib["GMT_IS_DATASET"] 24 | 25 | for family, geometry in [ 26 | ("GMT_IS_GRID", "GMT_IS_SURFACE"), 27 | ("GMT_IS_IMAGE", "GMT_IS_SURFACE"), 28 | ("GMT_IS_CUBE", "GMT_IS_VOLUME"), 29 | ("GMT_IS_PALETTE", "GMT_IS_NONE"), 30 | ("GMT_IS_POSTSCRIPT", "GMT_IS_NONE"), 31 | ]: 32 | with lib.open_virtualfile(family, geometry, "GMT_OUT", None) as vfile: 33 | assert lib.inquire_virtualfile(vfile) == lib[family] 34 | -------------------------------------------------------------------------------- /pygmt/tests/test_clib_write_data.py: -------------------------------------------------------------------------------- 1 | """ 2 | Test the Session.write_data method. 3 | """ 4 | 5 | import pytest 6 | from pygmt import clib 7 | from pygmt.exceptions import GMTCLibError 8 | from pygmt.tests.test_clib import mock 9 | 10 | 11 | def test_write_data_fails(): 12 | """ 13 | Check that write data raises an exception for non-zero return codes. 14 | """ 15 | # It's hard to make the C API function fail without causing a Segmentation 16 | # Fault. Can't test this if by giving a bad file name because if 17 | # output=='', GMT will just write to stdout and spaces are valid file 18 | # names. Use a mock instead just to exercise this part of the code. 19 | with clib.Session() as lib: 20 | with mock(lib, "GMT_Write_Data", returns=1): 21 | with pytest.raises(GMTCLibError): 22 | lib.write_data( 23 | "GMT_IS_VECTOR", 24 | "GMT_IS_POINT", 25 | "GMT_WRITE_SET", 26 | [1] * 6, 27 | "some-file-name", 28 | None, 29 | ) 30 | -------------------------------------------------------------------------------- /pygmt/tests/test_colorbar.py: -------------------------------------------------------------------------------- 1 | """ 2 | Test Figure.colorbar. 3 | """ 4 | 5 | import pytest 6 | from pygmt import Figure 7 | 8 | 9 | @pytest.mark.benchmark 10 | @pytest.mark.mpl_image_compare 11 | def test_colorbar(): 12 | """ 13 | Create a simple colorbar. 14 | """ 15 | fig = Figure() 16 | fig.colorbar(cmap="rainbow", position="x0c/0c+w4c", frame=True) 17 | return fig 18 | 19 | 20 | @pytest.mark.mpl_image_compare 21 | def test_colorbar_shading_list(): 22 | """ 23 | Create colorbar and set shading by passing the high/low values as a list. 24 | """ 25 | fig = Figure() 26 | fig.basemap(region=[0, 10, 0, 2], projection="X10c/2c", frame="a") 27 | fig.colorbar(cmap="geo", shading=[-0.7, 0.2], frame=True) 28 | return fig 29 | -------------------------------------------------------------------------------- /pygmt/tests/test_datasets_earth_day.py: -------------------------------------------------------------------------------- 1 | """ 2 | Test basic functionality for loading Blue Marble datasets. 3 | """ 4 | 5 | import numpy as np 6 | import numpy.testing as npt 7 | from pygmt.datasets import load_blue_marble 8 | from pygmt.enums import GridRegistration, GridType 9 | 10 | 11 | def test_blue_marble_01d(): 12 | """ 13 | Test some properties of the Blue Marble 01d data. 14 | """ 15 | data = load_blue_marble(resolution="01d") 16 | assert data.name == "z" 17 | assert data.long_name == "blue_marble" 18 | assert data.attrs["horizontal_datum"] == "WGS84" 19 | assert data.attrs["description"] == "NASA Day Images" 20 | assert data.shape == (3, 180, 360) 21 | assert data.dtype == "uint8" 22 | assert data.gmt.registration is GridRegistration.PIXEL 23 | assert data.gmt.gtype is GridType.GEOGRAPHIC 24 | npt.assert_allclose(data.y, np.arange(89.5, -90.5, -1)) 25 | npt.assert_allclose(data.x, np.arange(-179.5, 180.5, 1)) 26 | npt.assert_allclose(data.min(), 10, atol=1) 27 | npt.assert_allclose(data.max(), 255, atol=1) 28 | 29 | 30 | def test_blue_marble_01d_with_region(): 31 | """ 32 | Test loading low-resolution Blue Marble with 'region'. 33 | """ 34 | data = load_blue_marble(resolution="01d", region=[-10, 10, -5, 5]) 35 | assert data.shape == (3, 10, 20) 36 | assert data.dtype == "uint8" 37 | assert data.gmt.registration is GridRegistration.PIXEL 38 | assert data.gmt.gtype is GridType.GEOGRAPHIC 39 | npt.assert_allclose(data.y, np.arange(4.5, -5.5, -1)) 40 | npt.assert_allclose(data.x, np.arange(-9.5, 10.5, 1)) 41 | npt.assert_allclose(data.min(), 10, atol=1) 42 | npt.assert_allclose(data.max(), 77, atol=1) 43 | -------------------------------------------------------------------------------- /pygmt/tests/test_datasets_earth_mask.py: -------------------------------------------------------------------------------- 1 | """ 2 | Test basic functionality for loading Earth mask datasets. 3 | """ 4 | 5 | import numpy as np 6 | import numpy.testing as npt 7 | from pygmt.datasets import load_earth_mask 8 | from pygmt.enums import GridRegistration, GridType 9 | 10 | 11 | def test_earth_mask_01d(): 12 | """ 13 | Test some properties of the Earth mask 01d data. 14 | """ 15 | data = load_earth_mask(resolution="01d") 16 | assert data.name == "z" 17 | assert data.attrs["description"] == "GSHHG Earth mask" 18 | assert data.attrs["horizontal_datum"] == "WGS84" 19 | assert data.shape == (181, 361) 20 | assert data.gmt.registration is GridRegistration.GRIDLINE 21 | assert data.gmt.gtype is GridType.GEOGRAPHIC 22 | assert data.dtype == "int8" 23 | npt.assert_allclose(data.lat, np.arange(-90, 91, 1)) 24 | npt.assert_allclose(data.lon, np.arange(-180, 181, 1)) 25 | npt.assert_allclose(data.min(), 0) 26 | npt.assert_allclose(data.max(), 2) 27 | npt.assert_allclose(data[36, 45], 0) 28 | 29 | 30 | def test_earth_mask_01d_with_region(): 31 | """ 32 | Test loading low-resolution Earth mask with 'region'. 33 | """ 34 | data = load_earth_mask(resolution="01d", region=[-7, 4, 13, 19]) 35 | assert data.shape == (7, 12) 36 | assert data.gmt.registration is GridRegistration.GRIDLINE 37 | assert data.gmt.gtype is GridType.GEOGRAPHIC 38 | assert data.dtype == "int8" 39 | npt.assert_allclose(data.lat, np.arange(13, 20, 1)) 40 | npt.assert_allclose(data.lon, np.arange(-7, 5, 1)) 41 | npt.assert_allclose(data[1, 5], 1) 42 | -------------------------------------------------------------------------------- /pygmt/tests/test_datasets_earth_night.py: -------------------------------------------------------------------------------- 1 | """ 2 | Test basic functionality for loading Black Marble datasets. 3 | """ 4 | 5 | import numpy as np 6 | import numpy.testing as npt 7 | from pygmt.datasets import load_black_marble 8 | from pygmt.enums import GridRegistration, GridType 9 | 10 | 11 | def test_black_marble_01d(): 12 | """ 13 | Test some properties of the Black Marble 01d data. 14 | """ 15 | data = load_black_marble(resolution="01d") 16 | assert data.name == "z" 17 | assert data.long_name == "black_marble" 18 | assert data.attrs["horizontal_datum"] == "WGS84" 19 | assert data.attrs["description"] == "NASA Night Images" 20 | assert data.shape == (3, 180, 360) 21 | assert data.dtype == "uint8" 22 | assert data.gmt.registration is GridRegistration.PIXEL 23 | assert data.gmt.gtype is GridType.GEOGRAPHIC 24 | npt.assert_allclose(data.y, np.arange(89.5, -90.5, -1)) 25 | npt.assert_allclose(data.x, np.arange(-179.5, 180.5, 1)) 26 | npt.assert_allclose(data.min(), 3, atol=1) 27 | npt.assert_allclose(data.max(), 174, atol=1) 28 | 29 | 30 | def test_black_marble_01d_with_region(): 31 | """ 32 | Test loading low-resolution Black Marble with 'region'. 33 | """ 34 | data = load_black_marble(resolution="01d", region=[-10, 10, -5, 5]) 35 | assert data.shape == (3, 10, 20) 36 | assert data.dtype == "uint8" 37 | assert data.gmt.registration is GridRegistration.PIXEL 38 | assert data.gmt.gtype is GridType.GEOGRAPHIC 39 | npt.assert_allclose(data.y, np.arange(4.5, -5.5, -1)) 40 | npt.assert_allclose(data.x, np.arange(-9.5, 10.5, 1)) 41 | npt.assert_allclose(data.min(), 3, atol=1) 42 | npt.assert_allclose(data.max(), 40, atol=1) 43 | -------------------------------------------------------------------------------- /pygmt/tests/test_filter1d.py: -------------------------------------------------------------------------------- 1 | """ 2 | Test pygmt.filter1d. 3 | """ 4 | 5 | import pandas as pd 6 | import pytest 7 | from pygmt import filter1d 8 | from pygmt.datasets import load_sample_data 9 | 10 | 11 | @pytest.fixture(scope="module", name="data") 12 | def fixture_data(): 13 | """ 14 | Load the @MaunaLoa_CO2.txt dataset as a pandas dataframe. 15 | """ 16 | return load_sample_data(name="maunaloa_co2") 17 | 18 | 19 | @pytest.mark.benchmark 20 | def test_filter1d(data): 21 | """ 22 | Test the basic functionality of filter1d. 23 | """ 24 | result = filter1d(data=data, filter_type="g5") 25 | assert isinstance(result, pd.DataFrame) 26 | assert result.shape == (671, 2) 27 | -------------------------------------------------------------------------------- /pygmt/tests/test_grd2xyz.py: -------------------------------------------------------------------------------- 1 | """ 2 | Test pygmt.grd2xyz. 3 | """ 4 | 5 | import numpy as np 6 | import pandas as pd 7 | import pytest 8 | from pygmt import grd2xyz 9 | from pygmt.exceptions import GMTInvalidInput 10 | from pygmt.helpers.testing import load_static_earth_relief 11 | 12 | 13 | @pytest.fixture(scope="module", name="grid") 14 | def fixture_grid(): 15 | """ 16 | Load the grid data from the static_earth_relief file. 17 | """ 18 | return load_static_earth_relief() 19 | 20 | 21 | @pytest.mark.benchmark 22 | def test_grd2xyz(grid): 23 | """ 24 | Test the basic functionality of grd2xyz. 25 | """ 26 | xyz_df = grd2xyz(grid=grid) 27 | assert isinstance(xyz_df, pd.DataFrame) 28 | assert list(xyz_df.columns) == ["lon", "lat", "z"] 29 | assert xyz_df.shape == (112, 3) 30 | 31 | lon, lat = -50.5, -18.5 32 | orig_val = grid.sel(lon=lon, lat=lat).to_numpy() 33 | xyz_val = xyz_df[(xyz_df["lon"] == lon) & (xyz_df["lat"] == lat)]["z"].to_numpy() 34 | np.testing.assert_allclose(orig_val, xyz_val) 35 | 36 | 37 | def test_grd2xyz_pandas_output_with_o(grid): 38 | """ 39 | Test that grd2xyz fails when outcols is set and output_type is set to 'pandas'. 40 | """ 41 | with pytest.raises(GMTInvalidInput): 42 | grd2xyz(grid=grid, output_type="pandas", outcols="2") 43 | -------------------------------------------------------------------------------- /pygmt/tests/test_grdimage_image.py: -------------------------------------------------------------------------------- 1 | """ 2 | Test Figure.grdimage on 3-band RGB images. 3 | """ 4 | 5 | import numpy as np 6 | import pytest 7 | from pygmt import Figure 8 | from pygmt.clib.session import DTYPES_NUMERIC 9 | from pygmt.datasets import load_blue_marble 10 | 11 | rioxarray = pytest.importorskip("rioxarray") 12 | 13 | 14 | @pytest.fixture(scope="module", name="xr_image") 15 | def fixture_xr_image(): 16 | """ 17 | Load the image data from Blue Marble as an xarray.DataArray with shape {"band": 3, 18 | "y": 180, "x": 360}. 19 | """ 20 | xr_image = load_blue_marble(resolution="01d") 21 | assert xr_image.sizes == {"band": 3, "y": 180, "x": 360} 22 | return xr_image 23 | 24 | 25 | @pytest.mark.mpl_image_compare 26 | def test_grdimage_image(): 27 | """ 28 | Plot a 3-band RGB image using file input. 29 | """ 30 | fig = Figure() 31 | fig.grdimage(grid="@earth_day_01d") 32 | return fig 33 | 34 | 35 | @pytest.mark.benchmark 36 | @pytest.mark.mpl_image_compare(filename="test_grdimage_image.png") 37 | def test_grdimage_image_dataarray(xr_image): 38 | """ 39 | Plot a 3-band RGB image using xarray.DataArray input. 40 | """ 41 | fig = Figure() 42 | fig.grdimage(grid=xr_image) 43 | return fig 44 | 45 | 46 | @pytest.mark.parametrize( 47 | "dtype", 48 | [dtype for dtype in DTYPES_NUMERIC if dtype not in {np.uint8, np.timedelta64}], 49 | ) 50 | def test_grdimage_image_dataarray_unsupported_dtype(dtype, xr_image): 51 | """ 52 | Plot a 3-band RGB image using xarray.DataArray input, with an unsupported data type. 53 | """ 54 | fig = Figure() 55 | image = xr_image.copy().astype(dtype=dtype) 56 | with pytest.warns(expected_warning=RuntimeWarning) as record: 57 | fig.grdimage(grid=image) 58 | assert len(record) == 1 59 | -------------------------------------------------------------------------------- /pygmt/tests/test_grdinfo.py: -------------------------------------------------------------------------------- 1 | """ 2 | Test pygmt.grdinfo. 3 | """ 4 | 5 | import numpy as np 6 | import pytest 7 | from pygmt import grdinfo 8 | from pygmt.exceptions import GMTInvalidInput 9 | from pygmt.helpers.testing import load_static_earth_relief 10 | 11 | 12 | @pytest.fixture(scope="module", name="grid") 13 | def fixture_grid(): 14 | """ 15 | Load the grid data from the static_earth_relief file. 16 | """ 17 | return load_static_earth_relief() 18 | 19 | 20 | @pytest.mark.benchmark 21 | def test_grdinfo(grid): 22 | """ 23 | Make sure grdinfo works as expected. 24 | """ 25 | result = grdinfo(grid=grid, force_scan=0, per_column="n") 26 | assert result.strip() == "-55 -47 -24 -10 190 981 1 1 8 14 1 1" 27 | 28 | 29 | def test_grdinfo_fails(): 30 | """ 31 | Check that grdinfo fails correctly. 32 | """ 33 | with pytest.raises(GMTInvalidInput): 34 | grdinfo(np.arange(10).reshape((5, 2))) 35 | 36 | 37 | def test_grdinfo_region(grid): 38 | """ 39 | Check that the region argument works in grdinfo. 40 | """ 41 | result = grdinfo( 42 | grid=grid, force_scan=0, per_column="n", region=[-54, -50, -23, -20] 43 | ) 44 | assert result.strip() == "-54 -50 -23 -20 284.5 491 1 1 4 3 1 1" 45 | -------------------------------------------------------------------------------- /pygmt/tests/test_grdvolume.py: -------------------------------------------------------------------------------- 1 | """ 2 | Test pygmt.grdvolume. 3 | """ 4 | 5 | import numpy as np 6 | import numpy.testing as npt 7 | import pandas as pd 8 | import pytest 9 | from pygmt import grdvolume 10 | from pygmt.helpers.testing import load_static_earth_relief 11 | 12 | 13 | @pytest.fixture(scope="module", name="grid") 14 | def fixture_grid(): 15 | """ 16 | Load the grid data from the sample earth_relief file. 17 | """ 18 | return load_static_earth_relief() 19 | 20 | 21 | @pytest.fixture(scope="module", name="data") 22 | def fixture_data(): 23 | """ 24 | Load the expected grdvolume data result as a numpy array. 25 | """ 26 | data = np.array( 27 | [ 28 | [2.00000000e02, 2.30079975e10, 3.92142453e12, 1.70437454e02], 29 | [2.50000000e02, 2.30079975e10, 2.77102465e12, 1.20437454e02], 30 | [3.00000000e02, 2.30079975e10, 1.62062477e12, 7.04374542e01], 31 | [3.50000000e02, 1.76916116e10, 4.53991397e11, 2.56613930e01], 32 | [4.00000000e02, 2.81602292e09, 2.34764859e10, 8.33675242e00], 33 | ] 34 | ) 35 | return data 36 | 37 | 38 | @pytest.mark.benchmark 39 | def test_grdvolume(grid, data): 40 | """ 41 | Test the basic functionality of grdvolume. 42 | """ 43 | test_output = grdvolume( 44 | grid=grid, 45 | contour=[200, 400, 50], 46 | region=[-53, -50, -22, -20], 47 | ) 48 | assert isinstance(test_output, pd.DataFrame) 49 | npt.assert_allclose(test_output, data) 50 | -------------------------------------------------------------------------------- /pygmt/tests/test_histogram.py: -------------------------------------------------------------------------------- 1 | """ 2 | Test Figure.histogram. 3 | """ 4 | 5 | import pandas as pd 6 | import pytest 7 | from pygmt import Figure 8 | 9 | 10 | @pytest.fixture(scope="module", name="data", params=[list, pd.Series]) 11 | def fixture_data(request): 12 | """ 13 | Return a list of integers to be used in the histogram. 14 | """ 15 | data = [1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 4, 5, 6, 7, 8, 8, 8, 8, 8, 8] 16 | return request.param(data) 17 | 18 | 19 | @pytest.mark.benchmark 20 | @pytest.mark.mpl_image_compare(filename="test_histogram.png") 21 | def test_histogram(data): 22 | """ 23 | Test plotting a histogram using a sequence of integers from a table. 24 | """ 25 | fig = Figure() 26 | fig.histogram( 27 | data=data, 28 | projection="X10c/10c", 29 | region=[0, 9, 0, 6], 30 | series=1, 31 | frame="a", 32 | fill="green", 33 | ) 34 | return fig 35 | -------------------------------------------------------------------------------- /pygmt/tests/test_image.py: -------------------------------------------------------------------------------- 1 | """ 2 | Test Figure.image. 3 | """ 4 | 5 | import pytest 6 | from pygmt import Figure 7 | 8 | 9 | @pytest.mark.mpl_image_compare 10 | def test_image(): 11 | """ 12 | Place images on map. 13 | """ 14 | fig = Figure() 15 | fig.image(imagefile="@circuit.png", position="x0/0+w2c", box="+pthin,blue") 16 | return fig 17 | -------------------------------------------------------------------------------- /pygmt/tests/test_inset.py: -------------------------------------------------------------------------------- 1 | """ 2 | Test Figure.inset. 3 | """ 4 | 5 | import pytest 6 | from pygmt import Figure 7 | 8 | 9 | @pytest.mark.benchmark 10 | @pytest.mark.mpl_image_compare 11 | def test_inset_aliases(): 12 | """ 13 | Test the aliases for the inset function. 14 | """ 15 | fig = Figure() 16 | fig.basemap(region="MG+r2", frame="afg") 17 | with fig.inset(position="jTL+w3.5c+o0.2c", margin=0, box="+pgreen"): 18 | fig.basemap(region="g", projection="G47/-20/4c", frame="afg") 19 | return fig 20 | 21 | 22 | @pytest.mark.mpl_image_compare 23 | def test_inset_context_manager(): 24 | """ 25 | Test that the inset context manager works and, once closed, plotting elements are 26 | added to the larger figure. 27 | """ 28 | fig = Figure() 29 | fig.basemap(region=[-74, -69.5, 41, 43], projection="M9c", frame=True) 30 | with fig.inset(position="jBL+w3c+o0.2c", margin=0, box="+pblack"): 31 | fig.basemap(region=[-80, -65, 35, 50], projection="M3c", frame="afg") 32 | fig.basemap(rose="jTR+w3c") # Pass rose argument with basemap after the inset 33 | return fig 34 | -------------------------------------------------------------------------------- /pygmt/tests/test_io.py: -------------------------------------------------------------------------------- 1 | """ 2 | Test input/output (I/O) utilities. 3 | """ 4 | 5 | import numpy as np 6 | import pytest 7 | import xarray as xr 8 | from pygmt.enums import GridRegistration, GridType 9 | from pygmt.helpers import GMTTempFile 10 | from pygmt.io import load_dataarray 11 | 12 | pytest.importorskip("netCDF4") 13 | 14 | 15 | # TODO(PyGMT>=0.20.0): Remove test_io_load_dataarray 16 | def test_io_load_dataarray(): 17 | """ 18 | Check that load_dataarray works to read a netCDF grid with GMTDataArrayAccessor 19 | information loaded. 20 | """ 21 | with GMTTempFile(suffix=".nc") as tmpfile: 22 | rng = np.random.default_rng() 23 | grid = xr.DataArray( 24 | data=rng.random((2, 2)), coords=[[0.1, 0.2], [0.3, 0.4]], dims=("x", "y") 25 | ) 26 | grid.to_netcdf(tmpfile.name) 27 | 28 | with pytest.warns(FutureWarning): 29 | dataarray = load_dataarray(tmpfile.name) 30 | 31 | assert dataarray.gmt.gtype is GridType.CARTESIAN 32 | assert dataarray.gmt.registration is GridRegistration.PIXEL 33 | # this would fail if we used xr.open_dataarray instead of load_dataarray 34 | dataarray.to_netcdf(tmpfile.name) 35 | 36 | 37 | def test_io_load_dataarray_cache(): 38 | """ 39 | Check that load_dataarray fails when the cache argument is used. 40 | """ 41 | with pytest.raises(TypeError): 42 | _ = load_dataarray("somefile.nc", cache=True) 43 | -------------------------------------------------------------------------------- /pygmt/tests/test_logo.py: -------------------------------------------------------------------------------- 1 | """ 2 | Test Figure.logo. 3 | """ 4 | 5 | import pytest 6 | from pygmt import Figure 7 | 8 | 9 | @pytest.mark.benchmark 10 | @pytest.mark.mpl_image_compare 11 | def test_logo(): 12 | """ 13 | Plot the GMT logo as a stand-alone plot. 14 | """ 15 | fig = Figure() 16 | fig.logo() 17 | return fig 18 | 19 | 20 | @pytest.mark.mpl_image_compare 21 | def test_logo_on_a_map(): 22 | """ 23 | Plot the GMT logo at the upper right corner of a map. 24 | """ 25 | fig = Figure() 26 | fig.basemap(region=[-90, -70, 0, 20], projection="M15c", frame=True) 27 | fig.logo(position="jTR+o0.25c/0.25c+w7.5c", box=True) 28 | return fig 29 | -------------------------------------------------------------------------------- /pygmt/tests/test_psconvert.py: -------------------------------------------------------------------------------- 1 | """ 2 | Test Figure.psconvert. 3 | """ 4 | 5 | from pathlib import Path 6 | 7 | import pytest 8 | from pygmt import Figure 9 | from pygmt.exceptions import GMTInvalidInput 10 | 11 | 12 | @pytest.mark.benchmark 13 | def test_psconvert(): 14 | """ 15 | Check that psconvert creates a figure in the current directory. 16 | """ 17 | fig = Figure() 18 | fig.basemap(region="10/70/-3/8", projection="X4i/3i", frame="a") 19 | prefix = "test_psconvert" 20 | fig.psconvert(prefix=prefix, fmt="f", crop=True) 21 | fname = Path(prefix + ".pdf") 22 | assert fname.exists() 23 | fname.unlink() 24 | 25 | 26 | def test_psconvert_twice(): 27 | """ 28 | Call psconvert twice to get two figures. 29 | """ 30 | fig = Figure() 31 | fig.basemap(region="10/70/-3/8", projection="X4i/3i", frame="a") 32 | prefix = "test_psconvert_twice" 33 | # Make a PDF 34 | fig.psconvert(prefix=prefix, fmt="f") 35 | fname = Path(prefix + ".pdf") 36 | assert fname.exists() 37 | fname.unlink() 38 | # Make a PNG 39 | fig.psconvert(prefix=prefix, fmt="g") 40 | fname = Path(prefix + ".png") 41 | assert fname.exists() 42 | fname.unlink() 43 | 44 | 45 | def test_psconvert_without_prefix(): 46 | """ 47 | Call psconvert without the 'prefix' parameter. 48 | """ 49 | fig = Figure() 50 | with pytest.raises(GMTInvalidInput): 51 | fig.psconvert(fmt="g") 52 | 53 | 54 | @pytest.mark.parametrize("prefix", ["", None, False, True]) 55 | def test_psconvert_invalid_prefix(prefix): 56 | """ 57 | Call psconvert with an invalid 'prefix' argument. 58 | """ 59 | fig = Figure() 60 | with pytest.raises(GMTInvalidInput): 61 | fig.psconvert(fmt="g", prefix=prefix) 62 | -------------------------------------------------------------------------------- /pygmt/tests/test_sph2grd.py: -------------------------------------------------------------------------------- 1 | """ 2 | Test pygmt.sph2grd. 3 | """ 4 | 5 | from pathlib import Path 6 | 7 | import numpy.testing as npt 8 | import pytest 9 | from pygmt import sph2grd 10 | from pygmt.enums import GridRegistration, GridType 11 | from pygmt.helpers import GMTTempFile 12 | 13 | 14 | def test_sph2grd_outgrid(): 15 | """ 16 | Test sph2grd with a set outgrid. 17 | """ 18 | with GMTTempFile(suffix=".nc") as tmpfile: 19 | result = sph2grd( 20 | data="@EGM96_to_36.txt", outgrid=tmpfile.name, spacing=1, region="g" 21 | ) 22 | assert result is None # return value is None 23 | assert Path(tmpfile.name).stat().st_size > 0 # check that outgrid exists 24 | 25 | 26 | @pytest.mark.benchmark 27 | def test_sph2grd_no_outgrid(): 28 | """ 29 | Test sph2grd with no set outgrid. 30 | """ 31 | temp_grid = sph2grd(data="@EGM96_to_36.txt", spacing=1, region="g", cores=2) 32 | assert temp_grid.dims == ("y", "x") 33 | assert temp_grid.gmt.gtype is GridType.CARTESIAN 34 | assert temp_grid.gmt.registration is GridRegistration.GRIDLINE 35 | npt.assert_allclose(temp_grid.max(), 0.00021961, rtol=1e-4) 36 | npt.assert_allclose(temp_grid.min(), -0.0004326, rtol=1e-4) 37 | npt.assert_allclose(temp_grid.median(), -0.00010894, rtol=1e-4) 38 | npt.assert_allclose(temp_grid.mean(), -0.00010968, rtol=1e-4) 39 | -------------------------------------------------------------------------------- /pygmt/tests/test_sphinterpolate.py: -------------------------------------------------------------------------------- 1 | """ 2 | Test pygmt.sphinterpolate. 3 | """ 4 | 5 | from pathlib import Path 6 | 7 | import numpy as np 8 | import numpy.testing as npt 9 | import pytest 10 | from packaging.version import Version 11 | from pygmt import sphinterpolate 12 | from pygmt.datasets import load_sample_data 13 | from pygmt.enums import GridRegistration, GridType 14 | from pygmt.helpers import GMTTempFile 15 | 16 | 17 | @pytest.fixture(scope="module", name="mars") 18 | def fixture_mars(): 19 | """ 20 | Load the table data for the shape of Mars. 21 | """ 22 | return load_sample_data(name="mars_shape") 23 | 24 | 25 | def test_sphinterpolate_outgrid(mars): 26 | """ 27 | Test sphinterpolate with a set outgrid. 28 | """ 29 | with GMTTempFile(suffix=".nc") as tmpfile: 30 | result = sphinterpolate(data=mars, outgrid=tmpfile.name, spacing=1, region="g") 31 | assert result is None # return value is None 32 | assert Path(tmpfile.name).stat().st_size > 0 # check that outgrid exists 33 | 34 | 35 | @pytest.mark.benchmark 36 | def test_sphinterpolate_no_outgrid(mars): 37 | """ 38 | Test sphinterpolate with no set outgrid. 39 | """ 40 | temp_grid = sphinterpolate(data=mars, spacing=1, region="g") 41 | assert temp_grid.dims == ("lat", "lon") 42 | assert temp_grid.gmt.gtype is GridType.GEOGRAPHIC 43 | assert temp_grid.gmt.registration is GridRegistration.GRIDLINE 44 | npt.assert_allclose(temp_grid.max(), 14628.144) 45 | npt.assert_allclose(temp_grid.min(), -6908.1987) 46 | npt.assert_allclose(temp_grid.median(), 118.96849) 47 | # TODO(NumPy>=2.3.0): Remove the numpy version check. 48 | mean = 272.60568 if Version(np.__version__) >= Version("2.3.0dev") else 272.60593 49 | npt.assert_allclose(temp_grid.mean(), mean) 50 | -------------------------------------------------------------------------------- /pygmt/tests/test_sphinx_gallery.py: -------------------------------------------------------------------------------- 1 | """ 2 | Test the sphinx-gallery scraper and code required to make it work. 3 | """ 4 | 5 | from pathlib import Path 6 | from tempfile import TemporaryDirectory 7 | 8 | import pytest 9 | from pygmt.figure import SHOWED_FIGURES, Figure 10 | from pygmt.sphinx_gallery import PyGMTScraper 11 | 12 | pytest.importorskip("sphinx_gallery", reason="Requires sphinx-gallery to be installed") 13 | pytest.importorskip("IPython", reason="Requires IPython to be installed") 14 | 15 | 16 | def test_pygmtscraper(): 17 | """ 18 | Make sure the scraper finds the figures and removes them from the pool. 19 | """ 20 | showed = SHOWED_FIGURES.copy() 21 | for _ in range(len(SHOWED_FIGURES)): 22 | SHOWED_FIGURES.pop() 23 | try: 24 | fig = Figure() 25 | fig.coast(region="BR", projection="M6i", land="gray", frame=True) 26 | fig.show() 27 | assert len(SHOWED_FIGURES) == 1 28 | assert SHOWED_FIGURES[0] is fig 29 | scraper = PyGMTScraper() 30 | with TemporaryDirectory(dir=Path.cwd()) as tmpdir: 31 | conf = {"src_dir": "meh"} 32 | fname = Path(tmpdir) / "meh.png" 33 | block_vars = {"image_path_iterator": (i for i in [fname])} 34 | assert not fname.exists() 35 | scraper(None, block_vars, conf) 36 | assert fname.exists() 37 | assert not SHOWED_FIGURES 38 | finally: 39 | SHOWED_FIGURES.extend(showed) 40 | -------------------------------------------------------------------------------- /pygmt/tests/test_wiggle.py: -------------------------------------------------------------------------------- 1 | """ 2 | Test Figure.wiggle. 3 | """ 4 | 5 | import numpy as np 6 | import pytest 7 | from pygmt import Figure 8 | 9 | 10 | @pytest.mark.mpl_image_compare 11 | def test_wiggle(): 12 | """ 13 | Plot the z=f(x,y) anomalies along tracks. 14 | """ 15 | x = np.arange(-2, 2, 0.02) 16 | y = np.zeros(x.size) 17 | z = np.cos(2 * np.pi * x) 18 | 19 | fig = Figure() 20 | fig.wiggle( 21 | region=[-4, 4, -1, 1], 22 | projection="X8c", 23 | x=x, 24 | y=y, 25 | z=z, 26 | scale="0.5c", 27 | fillpositive="red", 28 | fillnegative="gray", 29 | pen="1.0p", 30 | track="0.5p", 31 | position="jRM+w2+lnT", 32 | ) 33 | return fig 34 | 35 | 36 | @pytest.mark.benchmark 37 | @pytest.mark.mpl_image_compare(filename="test_wiggle.png") 38 | def test_wiggle_data_incols(): 39 | """ 40 | Make sure that incols parameter works with input data array. 41 | """ 42 | 43 | # put data into numpy array and swap x and y columns 44 | # as the use of the 'incols' parameter will reverse this action 45 | x = np.arange(-2, 2, 0.02) 46 | y = np.zeros(x.size) 47 | z = np.cos(2 * np.pi * x) 48 | data = np.array([y, x, z]).T 49 | 50 | fig = Figure() 51 | fig.wiggle( 52 | data, 53 | region=[-4, 4, -1, 1], 54 | projection="X8c", 55 | incols=[1, 0, 2], 56 | scale="0.5c", 57 | fillpositive="red", 58 | fillnegative="gray", 59 | pen="1.0p", 60 | track="0.5p", 61 | position="jRM+w2+lnT", 62 | ) 63 | return fig 64 | -------------------------------------------------------------------------------- /pygmt/xarray/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | PyGMT integration with Xarray accessors and backends. 3 | """ 4 | 5 | from pygmt.xarray.accessor import GMTDataArrayAccessor 6 | from pygmt.xarray.backend import GMTBackendEntrypoint 7 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | # Required packages 2 | numpy>=1.26 3 | pandas>=2.1 4 | xarray>=2023.07 5 | packaging>=24.2 6 | --------------------------------------------------------------------------------