Skip to content

Commit

Permalink
Merge branch 'main' into plot/straight_line
Browse files Browse the repository at this point in the history
  • Loading branch information
seisman committed Jan 2, 2025
2 parents 3c3c52a + d54e6e1 commit 48febe5
Show file tree
Hide file tree
Showing 56 changed files with 991 additions and 297 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cache_data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:

# Upload the downloaded files as artifacts to GitHub
- name: Upload artifacts to GitHub
uses: actions/upload-artifact@v4.4.3
uses: actions/upload-artifact@v4.5.0
with:
name: gmt-cache
include-hidden-files: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ jobs:

# Upload diff images on test failure
- name: Upload diff images if any test fails
uses: actions/upload-artifact@v4.4.3
uses: actions/upload-artifact@v4.5.0
if: failure()
with:
name: artifact-${{ runner.os }}-${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_tests_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ jobs:

# Upload diff images on test failure
- name: Upload diff images if any test fails
uses: actions/upload-artifact@v4.4.3
uses: actions/upload-artifact@v4.5.0
if: ${{ failure() }}
with:
name: artifact-GMT-${{ matrix.gmt_git_ref }}-${{ runner.os }}
Expand Down
14 changes: 7 additions & 7 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ authors:
family-names: Yao
affiliation: Nanyang Technological University, Singapore
orcid: https://orcid.org/0000-0001-7036-4238
- given-names: Jing-Hui
family-names: Tong
affiliation: National Taiwan Normal University, Taiwan
orcid: https://orcid.org/0009-0002-7195-3071
- given-names: Yohai
family-names: Magen
affiliation: Tel Aviv University, Israel
orcid: https://orcid.org/0000-0002-4892-4013
- given-names: Tong
family-names: Jing-Hui
affiliation: National Taiwan Normal University, Taiwan
orcid: https://orcid.org/0009-0002-7195-3071
- given-names: Kathryn
family-names: Materna
affiliation: US Geological Survey, USA
Expand Down Expand Up @@ -76,9 +76,9 @@ authors:
family-names: Wessel
affiliation: University of Hawaiʻi at Mānoa, USA
orcid: https://orcid.org/0000-0001-5708-7336
date-released: 2024-09-05
doi: 10.5281/zenodo.13679420
date-released: 2024-12-31
doi: 10.5281/zenodo.14535921
license: BSD-3-Clause
repository-code: https://github.com/GenericMappingTools/pygmt
type: software
version: 0.13.0
version: 0.14.0
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2017-2024 The PyGMT Developers
Copyright (c) 2017-2025 The PyGMT Developers
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ research using the following BibTeX:

```
@software{
pygmt_2024_13679420,
pygmt_2024_14535921,
author = {Tian, Dongdong and
Uieda, Leonardo and
Leong, Wei Ji and
Expand All @@ -142,8 +142,8 @@ research using the following BibTeX:
Jones, Max and
Toney, Liam and
Yao, Jiayuan and
Magen, Yohai and
Tong, Jing-Hui and
Magen, Yohai and
Materna, Kathryn and
Belem, Andre and
Newton, Tyler and
Expand All @@ -152,12 +152,12 @@ research using the following BibTeX:
Quinn, Jamie and
Wessel, Paul},
title = {{PyGMT: A Python interface for the Generic Mapping Tools}},
month = sep,
month = dec,
year = 2024,
publisher = {Zenodo},
version = {0.13.0},
doi = {10.5281/zenodo.13679420},
url = {https://doi.org/10.5281/zenodo.13679420}
version = {0.14.0},
doi = {10.5281/zenodo.14535921},
url = {https://doi.org/10.5281/zenodo.14535921}
}
```

Expand Down
1 change: 1 addition & 0 deletions doc/_static/version_switch.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
var all_versions = {
'latest': 'latest',
'dev': 'dev',
'v0.14.0': 'v0.14.0',
'v0.13.0': 'v0.13.0',
'v0.12.0': 'v0.12.0',
'v0.11.0': 'v0.11.0',
Expand Down
2 changes: 2 additions & 0 deletions doc/api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Plotting map elements
Figure.solar
Figure.text
Figure.timestamp
Figure.vlines

Plotting tabular data
~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -234,6 +235,7 @@ and store them in GMT's user data directory.
datasets.load_black_marble
datasets.load_blue_marble
datasets.load_earth_age
datasets.load_earth_deflection
datasets.load_earth_dist
datasets.load_earth_free_air_anomaly
datasets.load_earth_geoid
Expand Down
102 changes: 102 additions & 0 deletions doc/changes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,107 @@
# Changelog

## Release v0.14.0 (2024/12/31)

[![Digital Object Identifier for PyGMT v0.14.0](https://zenodo.org/badge/DOI/10.5281/zenodo.14535921.svg)](https://doi.org/10.5281/zenodo.14535921)

### Highlights

* 🎉 **Fourteenth minor release of PyGMT** 🎉
* Bump minimum supported version to GMT>=6.4.0 ([#3450](https://github.com/GenericMappingTools/pygmt/pull/3450))
* Two new plotting methods and six new functions to access more GMT remote datasets
* PyArrow as an optional dependency and improved support of PyArrow data types ([#3592](https://github.com/GenericMappingTools/pygmt/pull/3592))

### New Features

* Add Figure.hlines for plotting horizontal lines ([#923](https://github.com/GenericMappingTools/pygmt/pull/923))
* Add Figure.vlines for plotting vertical lines ([#3726](https://github.com/GenericMappingTools/pygmt/pull/3726))
* Add load_black_marble to load "Black Marble" dataset ([#3469](https://github.com/GenericMappingTools/pygmt/pull/3469))
* Add load_blue_marble to load "Blue Marble" dataset ([#2235](https://github.com/GenericMappingTools/pygmt/pull/2235))
* Add load_earth_deflection to load "IGPP Earth east-west and north-south deflection" datasets ([#3728](https://github.com/GenericMappingTools/pygmt/pull/3728))
* Add load_earth_dist to load "GSHHG Earth distance to shoreline" dataset ([#3706](https://github.com/GenericMappingTools/pygmt/pull/3706))
* Add load_earth_mean_dynamic_topography to load "CNES Earth Mean Dynamic Topography" dataset ([#3718](https://github.com/GenericMappingTools/pygmt/pull/3718))
* Add load_earth_mean_sea_surface to load "CNES Earth Mean Sea Surface" dataset ([#3717](https://github.com/GenericMappingTools/pygmt/pull/3717))
* load_earth_free_air_anomaly: Add "uncertainty" parameter to load the "IGPP Earth free-air anomaly uncertainty" dataset ([#3727](https://github.com/GenericMappingTools/pygmt/pull/3727))


### Enhancements

* Figure.plot: Add the "symbol" parameter to support plotting data points with varying symbols ([#1117](https://github.com/GenericMappingTools/pygmt/pull/1117))
* Figure.plot3d: Add the "symbol" parameter to support plotting data points with varying symbols ([#3559](https://github.com/GenericMappingTools/pygmt/pull/3559))
* Figure.legend: Support passing a StringIO object as the legend specification ([#3438](https://github.com/GenericMappingTools/pygmt/pull/3438))
* load_tile_map: Add parameter "crs" to set the CRS of the returned dataarray ([#3554](https://github.com/GenericMappingTools/pygmt/pull/3554))
* PyArrow: Support pyarrow arrays with string/large_string/string_view types ([#3619](https://github.com/GenericMappingTools/pygmt/pull/3619))
* Support 1-D/2-D numpy arrays with longlong and ulonglong dtype ([#3566](https://github.com/GenericMappingTools/pygmt/pull/3566))
* GMT_IMAGE: Implement the to_dataarray method for 3-band images ([#3128](https://github.com/GenericMappingTools/pygmt/pull/3128))
* Ensure non-ASCII characters are typeset correctly even if PS_CHAR_ENCODING is not "ISOLatin1+" ([#3611](https://github.com/GenericMappingTools/pygmt/pull/3611))
* Add enums GridRegistration and GridType for grid registration and type ([#3693](https://github.com/GenericMappingTools/pygmt/pull/3693))

### Deprecations

* SPEC 0: Bump minimum supported versions to Python 3.11, NumPy 1.25, pandas>=2.0 and xarray>=2023.04 ([#3460](https://github.com/GenericMappingTools/pygmt/pull/3460), [#3606](https://github.com/GenericMappingTools/pygmt/pull/3606), [#3697](https://github.com/GenericMappingTools/pygmt/pull/3697))
* clib.Session.virtualfile_from_vectors: Now takes a sequence of vectors as its single argument (Passing multiple arguments will be unsupported in v0.16.0) ([#3522](https://github.com/GenericMappingTools/pygmt/pull/3522))
* Remove the deprecated build_arg_string function (deprecated since v0.12.0) ([#3427](https://github.com/GenericMappingTools/pygmt/pull/3427))
* Figure.grdcontour: Remove the deprecated syntax for the 'annotation' parameter (deprecated since v0.12.0) ([#3428](https://github.com/GenericMappingTools/pygmt/pull/3428))

### Bug Fixes

* launch_external_viewer: Use full path when opening the file in a web browser ([#3647](https://github.com/GenericMappingTools/pygmt/pull/3647))
* PyArrow: Map date32[day]/date64[ms] dtypes in pandas objects to np.datetime64 with correct date/time units ([#3617](https://github.com/GenericMappingTools/pygmt/pull/3617))
* clib.session: Add the GMT_SESSION_NOGDALCLOSE flag to keep GDAL open ([#3672](https://github.com/GenericMappingTools/pygmt/pull/3672))
* Set the "Conventions" attribute to "CF-1.7" for netCDF grids only ([#3463](https://github.com/GenericMappingTools/pygmt/pull/3463))
* Fix the conversion error for pandas.Series with missing values in pandas<=2.1 ([#3505](https://github.com/GenericMappingTools/pygmt/pull/3505), [#3596](https://github.com/GenericMappingTools/pygmt/pull/3596))
* GeoPandas: Explicitly convert columns with overflow integers to avoid OverflowError with fiona 1.10 ([#3455](https://github.com/GenericMappingTools/pygmt/pull/3455))
* Figure.plot/Figure.plot3d: Improve the check of the "style" parameter for "v" or "V" ([#3603](https://github.com/GenericMappingTools/pygmt/pull/3603))
* Correctly reserve the grid data dtype by converting ctypes array to numpy array with np.ctypeslib.as_array ([#3446](https://github.com/GenericMappingTools/pygmt/pull/3446))
* **Breaking**: Figure.text: Fix typesetting of integers when mixed with floating-point values ([#3493](https://github.com/GenericMappingTools/pygmt/pull/3493))

### Documentation

* Add basic tutorial "Plotting polygons" ([#3593](https://github.com/GenericMappingTools/pygmt/pull/3593))
* Update the gallery example for plotting lines with LineString/MultiLineString geometry ([#3711](https://github.com/GenericMappingTools/pygmt/pull/3711))
* Add the PyGMT ecosystem page ([#3475](https://github.com/GenericMappingTools/pygmt/pull/3475))
* Document the support policy for optional packages ([#3616](https://github.com/GenericMappingTools/pygmt/pull/3616))
* Document the environment variables that can affect the behavior of PyGMT ([#3432](https://github.com/GenericMappingTools/pygmt/pull/3432))
* Document the built-in patterns in the Technical Reference section ([#3466](https://github.com/GenericMappingTools/pygmt/pull/3466))
* Document Continuous Benchmarking in Maintainers Guides ([#3631](https://github.com/GenericMappingTools/pygmt/pull/3631))
* Add instructions for installing optional dependencies ([#3506](https://github.com/GenericMappingTools/pygmt/pull/3506))
* Update "PyData Ecosystem" to "Scientific Python Ecosystem" ([#3447](https://github.com/GenericMappingTools/pygmt/pull/3447))
* Figure.savefig: Clarify that the "transparent" parameter also works for the PNG file associated with the KML format ([#3579](https://github.com/GenericMappingTools/pygmt/pull/3579))
* Add the PyGMT talk at AGU24 to the "Overview" section ([#3685](https://github.com/GenericMappingTools/pygmt/pull/3685))
* Add the GMT/PyGMT pre-conference workshop at AGU24 to the "External resources" section ([#3689](https://github.com/GenericMappingTools/pygmt/pull/3689))
* Add TODO comments in the maintainers guides and update the release checklist ([#3724](https://github.com/GenericMappingTools/pygmt/pull/3724))

### Maintenance

* **Breaking**: data_kind: data is None and required now returns the "empty" kind ([#3482](https://github.com/GenericMappingTools/pygmt/pull/3482))
* **Breaking**: data_kind: Now "matrix" represents a 2-D numpy array and unrecognized data types fall back to "vectors" ([#3351](https://github.com/GenericMappingTools/pygmt/pull/3351))
* Add Support for Python 3.13 ([#3490](https://github.com/GenericMappingTools/pygmt/pull/3490))
* Add the Session.virtualfile_from_stringio method to allow StringIO input for certain functions/methods ([#3326](https://github.com/GenericMappingTools/pygmt/pull/3326))
* Add "geodatasets" as a dependency for docs and update the choropleth example ([#3719](https://github.com/GenericMappingTools/pygmt/pull/3719))
* PyArrow: Check compatibility of pyarrow.array with string type ([#2933](https://github.com/GenericMappingTools/pygmt/pull/2933))
* Rename sphinx-gallery's README.txt to GALLERY_HEADER.rst and require Sphinx-Gallery>=0.17.0 ([#3348](https://github.com/GenericMappingTools/pygmt/pull/3348))
* clib.conversion: Remove the as_c_contiguous function and use np.ascontiguousarray instead ([#3492](https://github.com/GenericMappingTools/pygmt/pull/3492))
* Use TODO comments to track deprecations and workarounds ([#3722](https://github.com/GenericMappingTools/pygmt/pull/3722))
* Move Figure.psconvert into a separate file ([#3553](https://github.com/GenericMappingTools/pygmt/pull/3553))
* Improve the data type checking for 2-D arrays passed to the GMT C API ([#3563](https://github.com/GenericMappingTools/pygmt/pull/3563))
* Enable ruff's TD (flake8-todos), COM (flake8-commas), TRY (tryceratops), and EM (flake8-errmsg) rules ([#3723](https://github.com/GenericMappingTools/pygmt/pull/3723), [#3531](https://github.com/GenericMappingTools/pygmt/pull/3531), [#3665](https://github.com/GenericMappingTools/pygmt/pull/3665), [#3661](https://github.com/GenericMappingTools/pygmt/pull/3661))
* CI: Install pyarrow-core instead of pyarrow from conda-forge ([#3698](https://github.com/GenericMappingTools/pygmt/pull/3698))
* CI: Ensure no hyphens in Python file and directory names in the "Style Checks" workflow ([#3703](https://github.com/GenericMappingTools/pygmt/pull/3703))
* Bump to ruff>=0.8.0 and rename rule TCH to TC ([#3662](https://github.com/GenericMappingTools/pygmt/pull/3662))
* Bump to Ghostscript 10.04.0 ([#3443](https://github.com/GenericMappingTools/pygmt/pull/3443))
* Add enums GridFormat for GMT grid format ID ([#3449](https://github.com/GenericMappingTools/pygmt/pull/3449))

**Full Changelog**: <https://github.com/GenericMappingTools/pygmt/compare/v0.13.0...v0.14.0>

### Contributors

* [Dongdong Tian](https://github.com/seisman)
* [Yvonne Fröhlich](https://github.com/yvonnefroehlich)
* [Wei Ji Leong](https://github.com/weiji14)
* [Michael Grund](https://github.com/michaelgrund)
* [Will Schlitzer](https://github.com/willschlitzer)
* [Jiayuan Yao](https://github.com/core-man)

## Release v0.13.0 (2024/09/05)

[![Digital Object Identifier for PyGMT v0.13.0](https://zenodo.org/badge/DOI/10.5281/zenodo.13679420.svg)](https://doi.org/10.5281/zenodo.13679420)
Expand Down
1 change: 1 addition & 0 deletions doc/minversions.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ compatibility reasons.
| PyGMT Version | GMT | Python | NumPy | pandas | Xarray |
|---|---|---|---|---|---|
| [Dev][]* [<doc:dev>] | {{ requires.gmt }} | {{ requires.python }} | {{ requires.numpy }} | {{ requires.pandas }} | {{ requires.xarray }} |
| <tag:v0.14.0> [<doc:v0.14.0>] | >=6.4.0 | >=3.11 | >=1.25 | >=2.0 | >=2023.04 |
| <tag:v0.13.0> [<doc:v0.13.0>] | >=6.3.0 | >=3.10 | >=1.24 | >=1.5 | >=2022.09 |
| <tag:v0.12.0> [<doc:v0.12.0>] | >=6.3.0 | >=3.10 | >=1.23 | >=1.5 | >=2022.06 |
| <tag:v0.11.0> [<doc:v0.11.0>] | >=6.3.0 | >=3.9 | >=1.23 | | |
Expand Down
46 changes: 46 additions & 0 deletions examples/gallery/lines/linestrings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
"""
GeoPandas: Plotting lines with LineString or MultiLineString geometry
=====================================================================
The :meth:`pygmt.Figure.plot` method allows us to plot geographical data such as lines
with LineString or MultiLineString geometry types stored in a
:class:`geopandas.GeoDataFrame` object or any object that implements the
`__geo_interface__ <https://gist.github.com/sgillies/2217756>`__ property.
Use :func:`geopandas.read_file` to load data from any supported OGR format such as a
shapefile (.shp), GeoJSON (.geojson), geopackage (.gpkg), etc. Then, pass the
:class:`geopandas.GeoDataFrame` object as an argument to the ``data`` parameter of
:meth:`pygmt.Figure.plot`, and style the lines using the ``pen`` parameter.
"""

# %%
import geodatasets
import geopandas as gpd
import pygmt

# Read a sample dataset provided by the geodatasets package.
# The dataset contains large rivers in Europe, stored as LineString/MultiLineString
# geometry types.
gdf = gpd.read_file(geodatasets.get_path("eea large_rivers"))

# Convert object to EPSG 4326 coordinate system
gdf = gdf.to_crs("EPSG:4326")
print(gdf.head())

# %%
fig = pygmt.Figure()

fig.coast(
projection="M10c",
region=[-10, 30, 35, 57],
resolution="l",
land="gray95",
shorelines="1/0.1p,gray50",
borders="1/0.1,gray30",
frame=True,
)

# Add rivers to map
fig.plot(data=gdf, pen="1p,steelblue")

fig.show()
46 changes: 0 additions & 46 deletions examples/gallery/lines/roads.py

This file was deleted.

5 changes: 2 additions & 3 deletions pygmt/clib/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,11 @@ def _to_numpy(data: Any) -> np.ndarray:
# The numpy dtype for the result numpy array, but can be None.
numpy_dtype = dtypes.get(str(dtype))

# TODO(pandas>=2.2): Remove the workaround for pandas<2.2.
#
# pandas numeric dtypes were converted to np.object_ dtype prior pandas 2.2, and are
# converted to suitable NumPy dtypes since pandas 2.2. Refer to the following link
# for details: https://pandas.pydata.org/docs/whatsnew/v2.2.0.html#to-numpy-for-numpy-nullable-and-arrow-types-converts-to-suitable-numpy-dtype
#
# Workarounds for pandas < 2.2. Following SPEC 0, pandas 2.1 should be dropped in
# 2025 Q3, so it's likely we can remove the workaround in PyGMT v0.17.0.
if (
Version(pd.__version__) < Version("2.2") # pandas < 2.2 only.
and hasattr(data, "dtype") # NumPy array or pandas objects only.
Expand Down
Loading

0 comments on commit 48febe5

Please sign in to comment.