From ece073013fc85887a99ac7ee4b720639dd0867cb Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Sun, 15 Oct 2023 22:59:35 +1300 Subject: [PATCH] Fix W505 line-too-long lint error by moving noqa after the triple quotes Xref https://github.com/astral-sh/ruff/issues/3972 and https://docs.astral.sh/ruff/configuration/#error-suppression. --- .../projections/cyl/cyl_universal_transverse_mercator.py | 4 ++-- pygmt/datasets/earth_age.py | 4 ++-- pygmt/datasets/earth_free_air_anomaly.py | 4 ++-- pygmt/datasets/earth_geoid.py | 4 ++-- pygmt/datasets/earth_magnetic_anomaly.py | 6 +++--- pygmt/datasets/earth_mask.py | 4 ++-- pygmt/datasets/earth_relief.py | 4 ++-- pygmt/datasets/earth_vertical_gravity_gradient.py | 4 ++-- pygmt/datasets/samples.py | 7 +++---- pygmt/src/nearneighbor.py | 4 ++-- 10 files changed, 22 insertions(+), 23 deletions(-) diff --git a/examples/projections/cyl/cyl_universal_transverse_mercator.py b/examples/projections/cyl/cyl_universal_transverse_mercator.py index 27f2299a48d..6d6c6365cf2 100644 --- a/examples/projections/cyl/cyl_universal_transverse_mercator.py +++ b/examples/projections/cyl/cyl_universal_transverse_mercator.py @@ -14,7 +14,7 @@ .. _GMT_utm_zones: -.. figure:: https://docs.generic-mapping-tools.org/latest/_images/GMT_utm_zones.png # noqa: W505 +.. figure:: https://docs.generic-mapping-tools.org/latest/_images/GMT_utm_zones.png :width: 700 px :align: center @@ -34,7 +34,7 @@ The projection is set with **u** or **U**. *zone* sets the zone for the figure, and the figure size is set with *scale* or *width*. -""" +""" # noqa: W505 # %% import pygmt diff --git a/pygmt/datasets/earth_age.py b/pygmt/datasets/earth_age.py index 8182be77b28..42a598819c9 100644 --- a/pygmt/datasets/earth_age.py +++ b/pygmt/datasets/earth_age.py @@ -15,7 +15,7 @@ def load_earth_age(resolution="01d", region=None, registration=None): r""" Load the Earth seafloor crustal age dataset in various resolutions. - .. figure:: https://www.generic-mapping-tools.org/remote-datasets/_images/GMT_earth_age.png # noqa: W505 + .. figure:: https://www.generic-mapping-tools.org/remote-datasets/_images/GMT_earth_age.png :width: 80 % :align: center @@ -91,7 +91,7 @@ def load_earth_age(resolution="01d", region=None, registration=None): ... region=[120, 160, 30, 60], ... registration="gridline", ... ) - """ + """ # noqa: W505 grid = _load_remote_dataset( dataset_name="earth_age", dataset_prefix="earth_age_", diff --git a/pygmt/datasets/earth_free_air_anomaly.py b/pygmt/datasets/earth_free_air_anomaly.py index 8e411e14359..cc07507d752 100644 --- a/pygmt/datasets/earth_free_air_anomaly.py +++ b/pygmt/datasets/earth_free_air_anomaly.py @@ -16,7 +16,7 @@ def load_earth_free_air_anomaly(resolution="01d", region=None, registration=None Load the IGPP Global Earth Free-Air Anomaly datatset in various resolutions. - .. figure:: https://www.generic-mapping-tools.org/remote-datasets/_images/GMT_earth_faa.jpg # noqa: W505 + .. figure:: https://www.generic-mapping-tools.org/remote-datasets/_images/GMT_earth_faa.jpg :width: 80 % :align: center @@ -95,7 +95,7 @@ def load_earth_free_air_anomaly(resolution="01d", region=None, registration=None ... region=[120, 160, 30, 60], ... registration="gridline", ... ) - """ + """ # noqa: W505 grid = _load_remote_dataset( dataset_name="earth_free_air_anomaly", dataset_prefix="earth_faa_", diff --git a/pygmt/datasets/earth_geoid.py b/pygmt/datasets/earth_geoid.py index 104df50e344..27f07f9e29e 100644 --- a/pygmt/datasets/earth_geoid.py +++ b/pygmt/datasets/earth_geoid.py @@ -15,7 +15,7 @@ def load_earth_geoid(resolution="01d", region=None, registration=None): r""" Load the EGM2008 Global Earth Geoid dataset in various resolutions. - .. figure:: https://www.generic-mapping-tools.org/remote-datasets/_images/GMT_earth_geoid.jpg # noqa: W505 + .. figure:: https://www.generic-mapping-tools.org/remote-datasets/_images/GMT_earth_geoid.jpg :width: 80 % :align: center @@ -84,7 +84,7 @@ def load_earth_geoid(resolution="01d", region=None, registration=None): ... region=[120, 160, 30, 60], ... registration="gridline", ... ) - """ + """ # noqa: W505 grid = _load_remote_dataset( dataset_name="earth_geoid", dataset_prefix="earth_geoid_", diff --git a/pygmt/datasets/earth_magnetic_anomaly.py b/pygmt/datasets/earth_magnetic_anomaly.py index 7372ba486d7..4a52f280824 100644 --- a/pygmt/datasets/earth_magnetic_anomaly.py +++ b/pygmt/datasets/earth_magnetic_anomaly.py @@ -24,8 +24,8 @@ def load_earth_magnetic_anomaly( * - Global Earth Magnetic Anomaly Model (EMAG2) - World Digital Magnetic Anomaly Map (WDMAM) - * - .. figure:: https://www.generic-mapping-tools.org/remote-datasets/_images/GMT_earth_mag4km.jpg # noqa: W505 - - .. figure:: https://www.generic-mapping-tools.org/remote-datasets/_images/GMT_earth_wdmam.jpg # noqa: W505 + * - .. figure:: https://www.generic-mapping-tools.org/remote-datasets/_images/GMT_earth_mag4km.jpg + - .. figure:: https://www.generic-mapping-tools.org/remote-datasets/_images/GMT_earth_wdmam.jpg The grids are downloaded to a user data directory (usually ``~/.gmt/server/earth/earth_mag/``, @@ -132,7 +132,7 @@ def load_earth_magnetic_anomaly( >>> grid = load_earth_magnetic_anomaly( ... resolution="20m", registration="gridline", data_source="wdmam" ... ) - """ + """ # noqa: W505 magnetic_anomaly_sources = { "emag2": "earth_mag_", "emag2_4km": "earth_mag4km_", diff --git a/pygmt/datasets/earth_mask.py b/pygmt/datasets/earth_mask.py index 99bb57f51b2..b87250b0010 100644 --- a/pygmt/datasets/earth_mask.py +++ b/pygmt/datasets/earth_mask.py @@ -15,7 +15,7 @@ def load_earth_mask(resolution="01d", region=None, registration=None): r""" Load the GSHHG Global Earth Mask dataset in various resolutions. - .. figure:: https://www.generic-mapping-tools.org/remote-datasets/_images/GMT_earth_mask.png # noqa: W505 + .. figure:: https://www.generic-mapping-tools.org/remote-datasets/_images/GMT_earth_mask.png :width: 80 % :align: center @@ -88,7 +88,7 @@ def load_earth_mask(resolution="01d", region=None, registration=None): >>> # location (170°E, 50°N) is in oceanic area (0) >>> grid.sel(lon=170, lat=50).values array(0, dtype=int8) - """ + """ # noqa: W505 grid = _load_remote_dataset( dataset_name="earth_mask", dataset_prefix="earth_mask_", diff --git a/pygmt/datasets/earth_relief.py b/pygmt/datasets/earth_relief.py index aa7df5cfbca..53e8e45ec9a 100644 --- a/pygmt/datasets/earth_relief.py +++ b/pygmt/datasets/earth_relief.py @@ -23,7 +23,7 @@ def load_earth_relief( Load the Earth relief datasets (topography and bathymetry) in various resolutions. - .. figure:: https://www.generic-mapping-tools.org/remote-datasets/_images/GMT_earth_gebcosi.jpg # noqa: W505 + .. figure:: https://www.generic-mapping-tools.org/remote-datasets/_images/GMT_earth_gebcosi.jpg :width: 80 % :align: center @@ -136,7 +136,7 @@ def load_earth_relief( ... registration="gridline", ... use_srtm=True, ... ) - """ + """ # noqa: W505 # resolutions of original land-only SRTM tiles from NASA land_only_srtm_resolutions = ["03s", "01s"] diff --git a/pygmt/datasets/earth_vertical_gravity_gradient.py b/pygmt/datasets/earth_vertical_gravity_gradient.py index 30ac2c427f4..c0590efbe24 100644 --- a/pygmt/datasets/earth_vertical_gravity_gradient.py +++ b/pygmt/datasets/earth_vertical_gravity_gradient.py @@ -18,7 +18,7 @@ def load_earth_vertical_gravity_gradient( Load the IGPP Global Earth Vertical Gravity Gradient dataset in various resolutions. - .. figure:: https://www.generic-mapping-tools.org/remote-datasets/_images/GMT_earth_vgg.jpg # noqa: W505 + .. figure:: https://www.generic-mapping-tools.org/remote-datasets/_images/GMT_earth_vgg.jpg :width: 80 % :align: center @@ -97,7 +97,7 @@ def load_earth_vertical_gravity_gradient( ... region=[120, 160, 30, 60], ... registration="gridline", ... ) - """ + """ # noqa: W505 grid = _load_remote_dataset( dataset_name="earth_vgg", dataset_prefix="earth_vgg_", diff --git a/pygmt/datasets/samples.py b/pygmt/datasets/samples.py index 7471ad473c4..3d26a039b72 100644 --- a/pygmt/datasets/samples.py +++ b/pygmt/datasets/samples.py @@ -301,7 +301,6 @@ def list_sample_data(): def load_sample_data(name): - # pylint: disable=line-too-long """ Load an example dataset from the GMT server. @@ -317,8 +316,8 @@ def load_sample_data(name): Returns ------- :class:`pandas.DataFrame` or :class:`xarray.DataArray` - Sample dataset loaded as a :class:`pandas.DataFrame` for tabular data or - :class:`xarray.DataArray` for raster data. + Sample dataset loaded as a :class:`pandas.DataFrame` for tabular data + or :class:`xarray.DataArray` for raster data. See Also -------- @@ -345,7 +344,7 @@ def load_sample_data(name): 'usgs_quakes': 'Table of earthquakes from the USGS'} >>> # load the sample bathymetry dataset >>> data = load_sample_data("bathymetry") - """ + """ # noqa: W505 if name not in datasets: raise GMTInvalidInput(f"Invalid dataset name '{name}'.") return datasets[name].func() diff --git a/pygmt/src/nearneighbor.py b/pygmt/src/nearneighbor.py index 53aa9057dde..ba0bada2e8d 100644 --- a/pygmt/src/nearneighbor.py +++ b/pygmt/src/nearneighbor.py @@ -57,7 +57,7 @@ def nearneighbor(data=None, x=None, y=None, z=None, **kwargs): criteria and :math:`r_i` is the distance from the node to the *i*'th data point. If no data weights are supplied then :math:`w_i = 1`. - .. figure:: https://docs.generic-mapping-tools.org/dev/_images/GMT_nearneighbor.png # noqa: W505 + .. figure:: https://docs.generic-mapping-tools.org/dev/_images/GMT_nearneighbor.png :width: 300 px :align: center @@ -146,7 +146,7 @@ def nearneighbor(data=None, x=None, y=None, z=None, **kwargs): ... region=[245, 255, 20, 30], ... search_radius="10m", ... ) - """ + """ # noqa: W505 with GMTTempFile(suffix=".nc") as tmpfile: with Session() as lib: table_context = lib.virtualfile_from_data(