Repository: fatiando/verde

Issue:
Block reduction error when block size > coordinate variation
**Description of the problem:**
<!--
Please be as detailed as you can when describing an issue. The more information
we have, the easier it will be for us to track this down.
-->
I'm attempting to block-reduce some data along a single flight line. The flight line is oriented E-W, so there should only be a single block in the N-S direction, but several blocks in the E-W direction. The single N-S block is resulting in an error. I can fix this by using the `shape` parameter instead of `size`. 

It looks like `verde.line_coordinates` needs at least 2 blocks to shift pixel registered values? 

**Full code that generated the error**
<!--
Include any data files or inputs required to run the code. It really helps if
we can run the code on our own machines.
-->

```python
df = rosetta[rosetta.Line.isin([200])]

reducer = vd.BlockReduce(np.mean, spacing=20e3,)

input_coords = (df.x, df.y)
input_data= df.Height

coords, data = reducer.filter(
        coordinates=input_coords,
        data=input_data,
    )
```


**Full error message**

```
ndexError                                Traceback (most recent call last)
Cell In[103], line 13
      9 input_coords = (df.x, df.y)
     10 input_data= df.Height
---> 13 coords, data = reducer.filter(
     14         coordinates=input_coords,
     15         data=input_data,
     16     )
     17 coords, data

File /home/tankerma/miniconda/envs/RIS_gravity_inversion/lib/python3.10/site-packages/verde/blockreduce.py:163, in BlockReduce.filter(self, coordinates, data, weights)
    118 """
    119 Apply the blocked aggregation to the given data.
    120 
   (...)
    158 
    159 """
    160 coordinates, data, weights = check_fit_input(
    161     coordinates, data, weights, unpack=False
    162 )
--> 163 blocks, labels = block_split(
    164     coordinates,
    165     spacing=self.spacing,
    166     shape=self.shape,
    167     adjust=self.adjust,
    168     region=self.region,
    169 )
    170 if any(w is None for w in weights):
    171     reduction = self.reduction

File /home/tankerma/miniconda/envs/RIS_gravity_inversion/lib/python3.10/site-packages/verde/coordinates.py:933, in block_split(coordinates, spacing, adjust, region, shape)
    931 if region is None:
    932     region = get_region(coordinates)
--> 933 block_coords = grid_coordinates(
    934     region, spacing=spacing, shape=shape, adjust=adjust, pixel_register=True
    935 )
    936 tree = kdtree(block_coords)
    937 labels = tree.query(np.transpose(n_1d_arrays(coordinates, 2)))[1]

File /home/tankerma/miniconda/envs/RIS_gravity_inversion/lib/python3.10/site-packages/verde/coordinates.py:574, in grid_coordinates(region, shape, spacing, adjust, pixel_register, extra_coords, meshgrid)
    564     spacing = (None, None)
    566 east = line_coordinates(
    567     region[0],
    568     region[1],
   (...)
    572     pixel_register=pixel_register,
    573 )
--> 574 north = line_coordinates(
    575     region[2],
    576     region[3],
    577     size=shape[0],
    578     spacing=spacing[0],
    579     adjust=adjust,
    580     pixel_register=pixel_register,
    581 )
    582 coordinates = [east, north]
    583 if meshgrid:

File /home/tankerma/miniconda/envs/RIS_gravity_inversion/lib/python3.10/site-packages/verde/coordinates.py:286, in line_coordinates(start, stop, size, spacing, adjust, pixel_register)
    284 values = np.linspace(start, stop, size)
    285 if pixel_register:
--> 286     values = values[:-1] + (values[1] - values[0]) / 2
    287 return values

IndexError: index 1 is out of bounds for axis 0 with size 1
```



**System information**

* Operating system: Linux
* Python installation (Anaconda, system, ETS): Mambaforge
* Version of Python: 3.10.9
* Version of this package: 'v1.7.0.post25+g0a4478a'
* If using conda, paste the output of `conda list` below:

<details>
<summary>Output of conda list</summary>
<pre>
# packages in environment at /home/tankerma/miniconda/envs/RIS_gravity_inversion:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
affine                    2.4.0              pyhd8ed1ab_0    conda-forge
aiofiles                  22.1.0             pyhd8ed1ab_0    conda-forge
aiohttp                   3.8.4           py310h1fa729e_0    conda-forge
aiosignal                 1.3.1              pyhd8ed1ab_0    conda-forge
aiosqlite                 0.18.0             pyhd8ed1ab_0    conda-forge
alembic                   1.10.2             pyhd8ed1ab_0    conda-forge
alsa-lib                  1.2.8                h166bdaf_0    conda-forge
antarctic-plots           0.0.6                    pypi_0    pypi
anyio                     3.6.2              pyhd8ed1ab_0    conda-forge
aom                       3.5.0                h27087fc_0    conda-forge
argon2-cffi               21.3.0             pyhd8ed1ab_0    conda-forge
argon2-cffi-bindings      21.2.0          py310h5764c6d_3    conda-forge
arrow                     1.2.3                    pypi_0    pypi
arrow-cpp                 11.0.0          ha770c72_13_cpu    conda-forge
asciitree                 0.3.3                    pypi_0    pypi
asttokens                 2.2.1              pyhd8ed1ab_0    conda-forge
async-timeout             4.0.2              pyhd8ed1ab_0    conda-forge
attr                      2.5.1                h166bdaf_1    conda-forge
attrs                     22.2.0             pyh71513ae_0    conda-forge
aws-c-auth                0.6.26               hdca2abe_0    conda-forge
aws-c-cal                 0.5.21               h48707d8_2    conda-forge
aws-c-common              0.8.14               h0b41bf4_0    conda-forge
aws-c-compression         0.2.16               h03acc5a_5    conda-forge
aws-c-event-stream        0.2.20               h00877a2_4    conda-forge
aws-c-http                0.7.5                hf342b9f_5    conda-forge
aws-c-io                  0.13.19              hef0810e_1    conda-forge
aws-c-mqtt                0.8.6               h337b09f_11    conda-forge
aws-c-s3                  0.2.7                hde0a405_0    conda-forge
aws-c-sdkutils            0.1.8                h03acc5a_0    conda-forge
aws-checksums             0.1.14               h03acc5a_5    conda-forge
aws-crt-cpp               0.19.8              h85f3b07_11    conda-forge
aws-sdk-cpp               1.10.57              h17c43bd_8    conda-forge
babel                     2.12.1             pyhd8ed1ab_1    conda-forge
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                pyhd8ed1ab_3    conda-forge
backports.functools_lru_cache 1.6.4              pyhd8ed1ab_0    conda-forge
beautifulsoup4            4.12.0             pyha770c72_0    conda-forge
black                     23.1.0                   pypi_0    pypi
bleach                    6.0.0              pyhd8ed1ab_0    conda-forge
blosc                     1.21.3               hafa529b_0    conda-forge
bokeh                     2.4.3              pyhd8ed1ab_3    conda-forge
boost-cpp                 1.78.0               h75c5d50_1    conda-forge
branca                    0.6.0              pyhd8ed1ab_0    conda-forge
brotli                    1.0.9                h166bdaf_8    conda-forge
brotli-bin                1.0.9                h166bdaf_8    conda-forge
brotlipy                  0.7.0           py310h5764c6d_1005    conda-forge
bzip2                     1.0.8                h7f98852_4    conda-forge
c-ares                    1.18.1               h7f98852_0    conda-forge
ca-certificates           2022.12.7            ha878542_0    conda-forge
cairo                     1.16.0            ha61ee94_1014    conda-forge
cartopy                   0.21.1          py310hcb7e713_0    conda-forge
certifi                   2022.12.7          pyhd8ed1ab_0    conda-forge
cf_xarray                 0.8.0              pyhd8ed1ab_0    conda-forge
cffi                      1.15.1          py310h255011f_3    conda-forge
cfgrib                    0.9.10.3                 pypi_0    pypi
cfitsio                   4.2.0                hd9d235c_0    conda-forge
cftime                    1.6.2           py310hde88566_1    conda-forge
charset-normalizer        2.1.1              pyhd8ed1ab_0    conda-forge
click                     8.1.3           unix_pyhd8ed1ab_2    conda-forge
click-plugins             1.1.1                      py_0    conda-forge
cligj                     0.7.2              pyhd8ed1ab_1    conda-forge
cloudpickle               2.2.1              pyhd8ed1ab_0    conda-forge
cmaes                     0.9.1              pyhd8ed1ab_0    conda-forge
colorama                  0.4.6              pyhd8ed1ab_0    conda-forge
colorcet                  3.0.1              pyhd8ed1ab_0    conda-forge
colorlog                  6.7.0           py310hff52083_1    conda-forge
comm                      0.1.2              pyhd8ed1ab_0    conda-forge
conda                     23.1.0          py310hff52083_0    conda-forge
conda-package-handling    2.0.2              pyh38be061_0    conda-forge
conda-package-streaming   0.7.0              pyhd8ed1ab_1    conda-forge
contourpy                 1.0.7           py310hdf3cbec_0    conda-forge
coverage                  7.2.2           py310h1fa729e_0    conda-forge
cryptography              39.0.2          py310h34c0648_0    conda-forge
curl                      7.88.1               hdc1c0ab_1    conda-forge
cycler                    0.11.0             pyhd8ed1ab_0    conda-forge
cytoolz                   0.12.0          py310h5764c6d_1    conda-forge
dask                      2023.3.1           pyhd8ed1ab_0    conda-forge
dask-core                 2023.3.1           pyhd8ed1ab_0    conda-forge
datashader                0.14.4             pyh1a96a4e_0    conda-forge
datashape                 0.5.4                      py_1    conda-forge
dbus                      1.13.6               h5008d03_3    conda-forge
dcw-gmt                   2.1.1                ha770c72_0    conda-forge
debugpy                   1.6.6           py310heca2aa9_0    conda-forge
decorator                 5.1.1              pyhd8ed1ab_0    conda-forge
defusedxml                0.7.1              pyhd8ed1ab_0    conda-forge
distributed               2023.3.1           pyhd8ed1ab_0    conda-forge
docrep                    0.3.2              pyh44b312d_0    conda-forge
double-conversion         3.2.0                h27087fc_1    conda-forge
eccodes                   1.5.1                    pypi_0    pypi
eigen                     3.4.0                h4bd325d_0    conda-forge
entrypoints               0.4                pyhd8ed1ab_0    conda-forge
esmf                      8.4.1           nompi_he2e5181_0    conda-forge
esmpy                     8.4.1              pyhc1e730c_0    conda-forge
et-xmlfile                1.1.0                    pypi_0    pypi
exceptiongroup            1.1.1              pyhd8ed1ab_0    conda-forge
executing                 1.2.0              pyhd8ed1ab_0    conda-forge
expat                     2.5.0                h27087fc_0    conda-forge
fasteners                 0.18                     pypi_0    pypi
ffmpeg                    5.1.2           gpl_h8dda1f0_106    conda-forge
fftw                      3.3.10          nompi_hf0379b8_106    conda-forge
findlibs                  0.0.2                    pypi_0    pypi
fiona                     1.9.2           py310ha325b7b_0    conda-forge
flake8                    6.0.0                    pypi_0    pypi
flake8-pyproject          1.2.3                    pypi_0    pypi
flit-core                 3.8.0              pyhd8ed1ab_0    conda-forge
fmt                       9.1.0                h924138e_0    conda-forge
folium                    0.14.0             pyhd8ed1ab_0    conda-forge
font-ttf-dejavu-sans-mono 2.37                 hab24e00_0    conda-forge
font-ttf-inconsolata      3.000                h77eed37_0    conda-forge
font-ttf-source-code-pro  2.038                h77eed37_0    conda-forge
font-ttf-ubuntu           0.83                 hab24e00_0    conda-forge
fontconfig                2.14.2               h14ed4e7_0    conda-forge
fonts-conda-ecosystem     1                             0    conda-forge
fonts-conda-forge         1                             0    conda-forge
fonttools                 4.39.2          py310h1fa729e_0    conda-forge
fqdn                      1.5.1                    pypi_0    pypi
freetype                  2.12.1               hca18f0e_1    conda-forge
freexl                    1.0.6                h166bdaf_1    conda-forge
frozenlist                1.3.3           py310h5764c6d_0    conda-forge
fsspec                    2023.3.0           pyhd8ed1ab_1    conda-forge
future                    0.18.3             pyhd8ed1ab_0    conda-forge
gdal                      3.6.3           py310hc1b7723_0    conda-forge
geopandas                 0.12.2             pyhd8ed1ab_0    conda-forge
geopandas-base            0.12.2             pyha770c72_0    conda-forge
geos                      3.11.1               h27087fc_0    conda-forge
geotiff                   1.7.1                hb963b44_7    conda-forge
geoviews                  1.9.6              pyhd8ed1ab_0    conda-forge
geoviews-core             1.9.6              pyha770c72_0    conda-forge
gettext                   0.21.1               h27087fc_0    conda-forge
gflags                    2.2.2             he1b5a44_1004    conda-forge
ghostscript               9.54.0               h27087fc_2    conda-forge
giflib                    5.2.1                h0b41bf4_3    conda-forge
gl2ps                     1.4.2                h0708190_0    conda-forge
glew                      2.1.0                h9c3ff4c_2    conda-forge
glib                      2.74.1               h6239696_1    conda-forge
glib-tools                2.74.1               h6239696_1    conda-forge
glog                      0.6.0                h6f12383_0    conda-forge
gmp                       6.2.1                h58526e2_0    conda-forge
gmt                       6.4.0                h3fec0b5_7    conda-forge
gnutls                    3.7.8                hf3e180e_0    conda-forge
graphite2                 1.3.13            h58526e2_1001    conda-forge
greenlet                  2.0.2           py310heca2aa9_0    conda-forge
gshhg-gmt                 2.3.7             ha770c72_1003    conda-forge
gst-plugins-base          1.22.0               h4243ec0_2    conda-forge
gstatsim                  1.0.0                     dev_0    <develop>
gstreamer                 1.22.0               h25f0c4b_2    conda-forge
gstreamer-orc             0.4.33               h166bdaf_0    conda-forge
h5netcdf                  1.1.0                    pypi_0    pypi
h5py                      3.8.0                    pypi_0    pypi
harfbuzz                  6.0.0                h8e241bc_0    conda-forge
harmonica                 0.6.0              pyhd8ed1ab_0    conda-forge
hdf4                      4.2.15               h501b40f_6    conda-forge
hdf5                      1.12.2          nompi_h4df4325_101    conda-forge
heapdict                  1.0.1                      py_0    conda-forge
holoviews                 1.15.4             pyhd8ed1ab_0    conda-forge
hvplot                    0.8.3              pyhd8ed1ab_0    conda-forge
icu                       70.1                 h27087fc_0    conda-forge
idna                      3.4                pyhd8ed1ab_0    conda-forge
imageio                   2.26.0             pyh24c5eb1_0    conda-forge
importlib-metadata        6.1.0              pyha770c72_0    conda-forge
importlib_metadata        6.1.0                hd8ed1ab_0    conda-forge
importlib_resources       5.12.0             pyhd8ed1ab_0    conda-forge
iniconfig                 2.0.0              pyhd8ed1ab_0    conda-forge
ipykernel                 6.22.0             pyh210e3f2_0    conda-forge
ipyleaflet                0.17.2                   pypi_0    pypi
ipython                   8.11.0             pyh41d4057_0    conda-forge
ipython_genutils          0.2.0                      py_1    conda-forge
ipywidgets                8.0.5              pyhd8ed1ab_0    conda-forge
isoduration               20.11.0                  pypi_0    pypi
isort                     5.12.0             pyhd8ed1ab_1    conda-forge
jack                      1.9.22               h11f4161_0    conda-forge
jedi                      0.18.2             pyhd8ed1ab_0    conda-forge
jinja2                    3.1.2              pyhd8ed1ab_1    conda-forge
joblib                    1.2.0              pyhd8ed1ab_0    conda-forge
json-c                    0.16                 hc379101_0    conda-forge
json5                     0.9.5              pyh9f0ad1d_0    conda-forge
jsoncpp                   1.9.5                h4bd325d_1    conda-forge
jsonpointer               2.3                      pypi_0    pypi
jsonschema                4.17.3             pyhd8ed1ab_0    conda-forge
jupyter-server-proxy      3.2.2                    pypi_0    pypi
jupyter_bokeh             3.0.5              pyhd8ed1ab_0    conda-forge
jupyter_client            8.1.0              pyhd8ed1ab_0    conda-forge
jupyter_core              5.3.0           py310hff52083_0    conda-forge
jupyter_events            0.6.3              pyhd8ed1ab_0    conda-forge
jupyter_server            2.5.0              pyhd8ed1ab_0    conda-forge
jupyter_server_fileid     0.8.0              pyhd8ed1ab_0    conda-forge
jupyter_server_terminals  0.4.4              pyhd8ed1ab_1    conda-forge
jupyter_server_ydoc       0.8.0              pyhd8ed1ab_0    conda-forge
jupyter_ydoc              0.2.3              pyhd8ed1ab_0    conda-forge
jupyterlab                3.6.2              pyhd8ed1ab_0    conda-forge
jupyterlab_pygments       0.2.2              pyhd8ed1ab_0    conda-forge
jupyterlab_server         2.20.0             pyhd8ed1ab_0    conda-forge
jupyterlab_widgets        3.0.6              pyhd8ed1ab_0    conda-forge
kealib                    1.5.0                ha7026e8_0    conda-forge
keyutils                  1.6.1                h166bdaf_0    conda-forge
kiwisolver                1.4.4           py310hbf28c38_1    conda-forge
krb5                      1.20.1               h81ceb04_0    conda-forge
lame                      3.100             h166bdaf_1003    conda-forge
lcms2                     2.15                 haa2dc70_1    conda-forge
ld_impl_linux-64          2.40                 h41732ed_0    conda-forge
lerc                      4.0.0                h27087fc_0    conda-forge
libabseil                 20230125.0      cxx17_hcb278e6_1    conda-forge
libaec                    1.0.6                hcb278e6_1    conda-forge
libarchive                3.6.2                h3d51595_0    conda-forge
libarrow                  11.0.0          h93537a5_13_cpu    conda-forge
libblas                   3.9.0           16_linux64_openblas    conda-forge
libbrotlicommon           1.0.9                h166bdaf_8    conda-forge
libbrotlidec              1.0.9                h166bdaf_8    conda-forge
libbrotlienc              1.0.9                h166bdaf_8    conda-forge
libcap                    2.66                 ha37c62d_0    conda-forge
libcblas                  3.9.0           16_linux64_openblas    conda-forge
libclang                  15.0.7          default_had23c3d_1    conda-forge
libclang13                15.0.7          default_h3e3d535_1    conda-forge
libcrc32c                 1.1.2                h9c3ff4c_0    conda-forge
libcups                   2.3.3                h36d4200_3    conda-forge
libcurl                   7.88.1               hdc1c0ab_1    conda-forge
libdb                     6.2.32               h9c3ff4c_0    conda-forge
libdeflate                1.17                 h0b41bf4_0    conda-forge
libdrm                    2.4.114              h166bdaf_0    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libev                     4.33                 h516909a_1    conda-forge
libevent                  2.1.10               h28343ad_4    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libflac                   1.4.2                h27087fc_0    conda-forge
libgcc-ng                 12.2.0              h65d4601_19    conda-forge
libgcrypt                 1.10.1               h166bdaf_0    conda-forge
libgdal                   3.6.3                hb7af45b_0    conda-forge
libgfortran-ng            12.2.0              h69a702a_19    conda-forge
libgfortran5              12.2.0              h337968e_19    conda-forge
libglib                   2.74.1               h606061b_1    conda-forge
libglu                    9.0.0             he1b5a44_1001    conda-forge
libgomp                   12.2.0              h65d4601_19    conda-forge
libgoogle-cloud           2.8.0                h0bc5f78_1    conda-forge
libgpg-error              1.46                 h620e276_0    conda-forge
libgrpc                   1.52.1               hcf146ea_1    conda-forge
libhwloc                  2.9.0                hd6dc26d_0    conda-forge
libiconv                  1.17                 h166bdaf_0    conda-forge
libidn2                   2.3.4                h166bdaf_0    conda-forge
libjpeg-turbo             2.1.5.1              h0b41bf4_0    conda-forge
libkml                    1.3.0             h37653c0_1015    conda-forge
liblapack                 3.9.0           16_linux64_openblas    conda-forge
libllvm11                 11.1.0               he0ac6c6_5    conda-forge
libllvm15                 15.0.7               hadd5161_1    conda-forge
libmamba                  1.3.1                hcea66bb_2    conda-forge
libmambapy                1.3.1           py310h1428755_2    conda-forge
libnetcdf                 4.9.1           nompi_hd2e9713_102    conda-forge
libnghttp2                1.52.0               h61bc06f_0    conda-forge
libnsl                    2.0.0                h7f98852_0    conda-forge
libnuma                   2.0.16               h0b41bf4_1    conda-forge
libogg                    1.3.4                h7f98852_1    conda-forge
libopenblas               0.3.21          pthreads_h78a6416_3    conda-forge
libopus                   1.3.1                h7f98852_1    conda-forge
libpciaccess              0.17                 h166bdaf_0    conda-forge
libpng                    1.6.39               h753d276_0    conda-forge
libpq                     15.2                 hb675445_0    conda-forge
libprotobuf               3.21.12              h3eb15da_0    conda-forge
librttopo                 1.1.0               ha49c73b_12    conda-forge
libsndfile                1.2.0                hb75c966_0    conda-forge
libsodium                 1.0.18               h36c2ea0_1    conda-forge
libsolv                   0.7.23               h3eb15da_0    conda-forge
libspatialindex           1.9.3                h9c3ff4c_4    conda-forge
libspatialite             5.0.1               h221c8f1_23    conda-forge
libsqlite                 3.40.0               h753d276_0    conda-forge
libssh2                   1.10.0               hf14f497_3    conda-forge
libstdcxx-ng              12.2.0              h46fd767_19    conda-forge
libsystemd0               252                  h2a991cd_0    conda-forge
libtasn1                  4.19.0               h166bdaf_0    conda-forge
libtheora                 1.1.1             h7f98852_1005    conda-forge
libthrift                 0.18.1               h5e4af38_0    conda-forge
libtiff                   4.5.0                hddfeb54_5    conda-forge
libtool                   2.4.7                h27087fc_0    conda-forge
libudev1                  253                  h0b41bf4_0    conda-forge
libunistring              0.9.10               h7f98852_0    conda-forge
libutf8proc               2.8.0                h166bdaf_0    conda-forge
libuuid                   2.32.1            h7f98852_1000    conda-forge
libva                     2.18.0               h0b41bf4_0    conda-forge
libvorbis                 1.3.7                h9c3ff4c_0    conda-forge
libvpx                    1.11.0               h9c3ff4c_3    conda-forge
libwebp-base              1.3.0                h0b41bf4_0    conda-forge
libxcb                    1.13              h7f98852_1004    conda-forge
libxkbcommon              1.5.0                h79f4944_1    conda-forge
libxml2                   2.10.3               hca2bb57_4    conda-forge
libzip                    1.9.2                hc929e4a_1    conda-forge
libzlib                   1.2.13               h166bdaf_4    conda-forge
line-profiler             4.0.3                    pypi_0    pypi
llvmlite                  0.39.1          py310h58363a5_1    conda-forge
locket                    1.0.0              pyhd8ed1ab_0    conda-forge
loguru                    0.6.0           py310hff52083_2    conda-forge
lz4                       4.3.2           py310h0cfdcf0_0    conda-forge
lz4-c                     1.9.4                hcb278e6_0    conda-forge
lzo                       2.10              h516909a_1000    conda-forge
mako                      1.2.4              pyhd8ed1ab_0    conda-forge
mamba                     1.3.1           py310h51d5547_2    conda-forge
mapclassify               2.5.0              pyhd8ed1ab_1    conda-forge
markdown                  3.4.1              pyhd8ed1ab_0    conda-forge
markupsafe                2.1.2           py310h1fa729e_0    conda-forge
matplotlib                3.7.1           py310hff52083_0    conda-forge
matplotlib-base           3.7.1           py310he60537e_0    conda-forge
matplotlib-inline         0.1.6              pyhd8ed1ab_0    conda-forge
mccabe                    0.7.0                    pypi_0    pypi
mistune                   2.0.5              pyhd8ed1ab_0    conda-forge
mpg123                    1.31.3               hcb278e6_0    conda-forge
msgpack-python            1.0.5           py310hdf3cbec_0    conda-forge
multidict                 6.0.4           py310h1fa729e_0    conda-forge
multipledispatch          0.6.0                      py_0    conda-forge
munch                     2.5.0                      py_0    conda-forge
munkres                   1.1.4              pyh9f0ad1d_0    conda-forge
mypy-extensions           1.0.0                    pypi_0    pypi
mysql-common              8.0.32               ha901b37_0    conda-forge
mysql-libs                8.0.32               hd7da12d_0    conda-forge
nbclassic                 0.5.3              pyhb4ecaf3_3    conda-forge
nbclient                  0.7.2              pyhd8ed1ab_0    conda-forge
nbconvert                 7.2.9              pyhd8ed1ab_0    conda-forge
nbconvert-core            7.2.9              pyhd8ed1ab_0    conda-forge
nbconvert-pandoc          7.2.9              pyhd8ed1ab_0    conda-forge
nbformat                  5.8.0              pyhd8ed1ab_0    conda-forge
ncurses                   6.3                  h27087fc_1    conda-forge
nest-asyncio              1.5.6              pyhd8ed1ab_0    conda-forge
netcdf-fortran            4.6.0           nompi_heb5813c_103    conda-forge
netcdf4                   1.6.3           nompi_py310h0feb132_100    conda-forge
nettle                    3.8.1                hc379101_1    conda-forge
networkx                  3.0                pyhd8ed1ab_0    conda-forge
nlohmann_json             3.11.2               h27087fc_0    conda-forge
notebook                  6.5.3              pyha770c72_0    conda-forge
notebook-shim             0.2.2              pyhd8ed1ab_0    conda-forge
nspr                      4.35                 h27087fc_0    conda-forge
nss                       3.89                 he45b914_0    conda-forge
numba                     0.56.4          py310ha5257ce_0    conda-forge
numba-progress            0.0.4                    pypi_0    pypi
numcodecs                 0.11.0                   pypi_0    pypi
numpy                     1.23.5          py310h53a5b5f_0    conda-forge
openblas                  0.3.21          pthreads_h320a7e8_3    conda-forge
openh264                  2.3.1                hcb278e6_2    conda-forge
openjpeg                  2.5.0                hfec8fc6_2    conda-forge
openpyxl                  3.1.2                    pypi_0    pypi
openssl                   3.1.0                h0b41bf4_0    conda-forge
optuna                    3.1.0              pyhd8ed1ab_0    conda-forge
orc                       1.8.3                hfdbbad2_0    conda-forge
p11-kit                   0.24.1               hc5aa10d_0    conda-forge
packaging                 23.0               pyhd8ed1ab_0    conda-forge
pandas                    1.5.3           py310h9b08913_0    conda-forge
pandoc                    3.1.1                h32600fe_0    conda-forge
pandocfilters             1.5.0              pyhd8ed1ab_0    conda-forge
panel                     0.14.4             pyhd8ed1ab_0    conda-forge
param                     1.13.0             pyh1a96a4e_0    conda-forge
parquet-cpp               1.5.1                         2    conda-forge
parso                     0.8.3              pyhd8ed1ab_0    conda-forge
partd                     1.3.0              pyhd8ed1ab_0    conda-forge
pathspec                  0.11.1                   pypi_0    pypi
patsy                     0.5.3              pyhd8ed1ab_0    conda-forge
pcre                      8.45                 h9c3ff4c_0    conda-forge
pcre2                     10.40                hc3806b6_0    conda-forge
pexpect                   4.8.0              pyh1a96a4e_2    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pillow                    9.4.0           py310h065c6d2_2    conda-forge
pip                       23.0.1             pyhd8ed1ab_0    conda-forge
pixman                    0.40.0               h36c2ea0_0    conda-forge
pkgutil-resolve-name      1.3.10             pyhd8ed1ab_0    conda-forge
platformdirs              3.1.1              pyhd8ed1ab_0    conda-forge
plotly                    5.13.1             pyhd8ed1ab_0    conda-forge
pluggy                    1.0.0              pyhd8ed1ab_5    conda-forge
ply                       3.11                       py_1    conda-forge
pooch                     1.7.0              pyha770c72_1    conda-forge
poppler                   23.03.0              hf052cbe_1    conda-forge
poppler-data              0.4.12               hd8ed1ab_0    conda-forge
postgresql                15.2                 h3248436_0    conda-forge
proj                      9.1.1                h8ffa02c_2    conda-forge
prometheus_client         0.16.0             pyhd8ed1ab_0    conda-forge
prompt-toolkit            3.0.38             pyha770c72_0    conda-forge
prompt_toolkit            3.0.38               hd8ed1ab_0    conda-forge
psutil                    5.9.4           py310h5764c6d_0    conda-forge
pthread-stubs             0.4               h36c2ea0_1001    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
pugixml                   1.11.4               h9c3ff4c_0    conda-forge
pulseaudio                16.1                 ha8d29e2_1    conda-forge
pure_eval                 0.2.2              pyhd8ed1ab_0    conda-forge
pyarrow                   11.0.0          py310h633f555_13_cpu    conda-forge
pybind11-abi              4                    hd8ed1ab_3    conda-forge
pycodestyle               2.10.0                   pypi_0    pypi
pycosat                   0.6.4           py310h5764c6d_1    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pyct                      0.4.6                      py_0    conda-forge
pyct-core                 0.4.6                      py_0    conda-forge
pyflakes                  3.0.1                    pypi_0    pypi
pygments                  2.14.0             pyhd8ed1ab_0    conda-forge
pygmt                     0.8.0              pyhd8ed1ab_0    conda-forge
pyinterp                  2023.2.1        openblas_py310hb50a16d_100    conda-forge
pykdtree                  1.3.7.post0     py310h0a54255_0    conda-forge
pyogrio                   0.5.1                    pypi_0    pypi
pyopenssl                 23.0.0             pyhd8ed1ab_0    conda-forge
pyparsing                 3.0.9              pyhd8ed1ab_0    conda-forge
pyproj                    3.4.1           py310h15e2413_1    conda-forge
pyqt                      5.15.7          py310hab646b1_3    conda-forge
pyqt5-sip                 12.11.0         py310heca2aa9_3    conda-forge
pyrsistent                0.19.3          py310h1fa729e_0    conda-forge
pyshp                     2.3.1              pyhd8ed1ab_0    conda-forge
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
pytest                    7.2.2              pyhd8ed1ab_0    conda-forge
pytest-cov                4.0.0              pyhd8ed1ab_0    conda-forge
python                    3.10.9          he550d4f_0_cpython    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python-dotenv             1.0.0              pyhd8ed1ab_0    conda-forge
python-fastjsonschema     2.16.3             pyhd8ed1ab_0    conda-forge
python-json-logger        2.0.7              pyhd8ed1ab_0    conda-forge
python_abi                3.10                    3_cp310    conda-forge
pytz                      2022.7.1           pyhd8ed1ab_0    conda-forge
pyvista                   0.38.5             pyhd8ed1ab_0    conda-forge
pyvista-xarray            0.1.3              pyhd8ed1ab_0    conda-forge
pyviz_comms               2.2.1              pyhd8ed1ab_1    conda-forge
pyyaml                    6.0             py310h5764c6d_5    conda-forge
pyzmq                     25.0.2          py310h059b190_0    conda-forge
qt-main                   5.15.8               h67dfc38_7    conda-forge
rasterio                  1.3.6           py310h3e853a9_0    conda-forge
re2                       2023.02.02           hcb278e6_0    conda-forge
readline                  8.1.2                h0f457ee_0    conda-forge
reproc                    14.2.4               h0b41bf4_0    conda-forge
reproc-cpp                14.2.4               hcb278e6_0    conda-forge
requests                  2.28.2             pyhd8ed1ab_0    conda-forge
rfc3339-validator         0.1.4              pyhd8ed1ab_0    conda-forge
rfc3986-validator         0.1.1              pyh9f0ad1d_0    conda-forge
rioxarray                 0.14.0             pyhd8ed1ab_0    conda-forge
ris-gravity-inversion     0.0.1                    pypi_0    pypi
rtree                     1.0.1           py310hbdcdc62_1    conda-forge
ruamel.yaml               0.17.21         py310h1fa729e_3    conda-forge
ruamel.yaml.clib          0.2.7           py310h1fa729e_1    conda-forge
s2n                       1.3.39               h3358134_0    conda-forge
scikit-gstat              1.0.9           py310hff52083_0    conda-forge
scikit-learn              1.2.2           py310h209a8ca_0    conda-forge
scipy                     1.10.1          py310h8deb116_0    conda-forge
scooby                    0.7.1              pyhd8ed1ab_0    conda-forge
seaborn                   0.12.2               hd8ed1ab_0    conda-forge
seaborn-base              0.12.2             pyhd8ed1ab_0    conda-forge
send2trash                1.8.0              pyhd8ed1ab_0    conda-forge
setuptools                67.6.0             pyhd8ed1ab_0    conda-forge
shapely                   1.8.5           py310h5b266fc_2    conda-forge
simpervisor               0.4                      pypi_0    pypi
sip                       6.7.7           py310heca2aa9_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
snakeviz                  2.1.1              pyhd8ed1ab_0    conda-forge
snappy                    1.1.10               h9fff704_0    conda-forge
sniffio                   1.3.0              pyhd8ed1ab_0    conda-forge
snuggs                    1.4.7                      py_0    conda-forge
sortedcontainers          2.4.0              pyhd8ed1ab_0    conda-forge
soupsieve                 2.3.2.post1        pyhd8ed1ab_0    conda-forge
sparse                    0.14.0             pyhd8ed1ab_0    conda-forge
sqlalchemy                2.0.7           py310h1fa729e_0    conda-forge
sqlite                    3.40.0               h4ff8645_0    conda-forge
stack_data                0.6.2              pyhd8ed1ab_0    conda-forge
statsmodels               0.13.5          py310hde88566_2    conda-forge
svt-av1                   1.4.1                hcb278e6_0    conda-forge
tbb                       2021.8.0             hf52228f_0    conda-forge
tbb-devel                 2021.8.0             hf52228f_0    conda-forge
tblib                     1.7.0              pyhd8ed1ab_0    conda-forge
tenacity                  8.2.2              pyhd8ed1ab_0    conda-forge
terminado                 0.17.1             pyh41d4057_0    conda-forge
threadpoolctl             3.1.0              pyh8a188c0_0    conda-forge
tiledb                    2.13.2               hd532e3d_0    conda-forge
tinycss2                  1.2.1              pyhd8ed1ab_0    conda-forge
tk                        8.6.12               h27826a3_0    conda-forge
tokenize-rt               5.0.0                    pypi_0    pypi
toml                      0.10.2             pyhd8ed1ab_0    conda-forge
tomli                     2.0.1              pyhd8ed1ab_0    conda-forge
toolz                     0.12.0             pyhd8ed1ab_0    conda-forge
tornado                   6.2             py310h5764c6d_1    conda-forge
tqdm                      4.65.0             pyhd8ed1ab_1    conda-forge
tqdm-joblib               0.0.3                    pypi_0    pypi
traitlets                 5.9.0              pyhd8ed1ab_0    conda-forge
traittypes                0.2.1                    pypi_0    pypi
trame                     2.3.2                    pypi_0    pypi
trame-client              2.7.4                    pypi_0    pypi
trame-components          2.1.0                    pypi_0    pypi
trame-deckgl              2.0.1                    pypi_0    pypi
trame-markdown            2.0.2                    pypi_0    pypi
trame-matplotlib          2.0.1                    pypi_0    pypi
trame-plotly              2.1.0                    pypi_0    pypi
trame-rca                 0.3.0                    pypi_0    pypi
trame-router              2.0.1                    pypi_0    pypi
trame-server              2.9.1                    pypi_0    pypi
trame-simput              2.3.1                    pypi_0    pypi
trame-vega                2.0.2                    pypi_0    pypi
trame-vtk                 2.3.5                    pypi_0    pypi
trame-vuetify             2.2.4                    pypi_0    pypi
typing-extensions         4.5.0                hd8ed1ab_0    conda-forge
typing_extensions         4.5.0              pyha770c72_0    conda-forge
tzcode                    2022g                h166bdaf_0    conda-forge
tzdata                    2022g                h191b570_0    conda-forge
ucx                       1.14.0               ha0ee010_0    conda-forge
unicodedata2              15.0.0          py310h5764c6d_0    conda-forge
uri-template              1.2.0                    pypi_0    pypi
urllib3                   1.26.15            pyhd8ed1ab_0    conda-forge
utfcpp                    3.2.3                ha770c72_0    conda-forge
verde                     1.7.0.post25+g0a4478a          pypi_0    pypi
vtk                       9.2.6           qt_py310h2e23b3e_201    conda-forge
wcwidth                   0.2.6              pyhd8ed1ab_0    conda-forge
webcolors                 1.12                     pypi_0    pypi
webencodings              0.5.1                      py_1    conda-forge
websocket-client          1.5.1              pyhd8ed1ab_0    conda-forge
wheel                     0.40.0             pyhd8ed1ab_0    conda-forge
widgetsnbextension        4.0.6              pyhd8ed1ab_0    conda-forge
wslink                    1.10.1             pyhd8ed1ab_0    conda-forge
x264                      1!164.3095           h166bdaf_2    conda-forge
x265                      3.5                  h924138e_3    conda-forge
xarray                    2023.2.0           pyhd8ed1ab_0    conda-forge
xarray-extras             0.5.0           py310h6acc77f_1    conda-forge
xcb-util                  0.4.0                h516909a_0    conda-forge
xcb-util-image            0.4.0                h166bdaf_0    conda-forge
xcb-util-keysyms          0.4.0                h516909a_0    conda-forge
xcb-util-renderutil       0.3.9                h166bdaf_0    conda-forge
xcb-util-wm               0.4.1                h516909a_0    conda-forge
xerces-c                  3.2.4                h55805fa_1    conda-forge
xesmf                     0.7.0              pyhd8ed1ab_0    conda-forge
xkeyboard-config          2.38                 h0b41bf4_0    conda-forge
xorg-fixesproto           5.0               h7f98852_1002    conda-forge
xorg-kbproto              1.0.7             h7f98852_1002    conda-forge
xorg-libice               1.0.10               h7f98852_0    conda-forge
xorg-libsm                1.2.3             hd9c2040_1000    conda-forge
xorg-libx11               1.8.4                h0b41bf4_0    conda-forge
xorg-libxau               1.0.9                h7f98852_0    conda-forge
xorg-libxdmcp             1.1.3                h7f98852_0    conda-forge
xorg-libxext              1.3.4                h0b41bf4_2    conda-forge
xorg-libxfixes            5.0.3             h7f98852_1004    conda-forge
xorg-libxrender           0.9.10            h7f98852_1003    conda-forge
xorg-libxt                1.2.1                h7f98852_2    conda-forge
xorg-renderproto          0.11.1            h7f98852_1002    conda-forge
xorg-xextproto            7.3.0             h0b41bf4_1003    conda-forge
xorg-xf86vidmodeproto     2.3.1             h7f98852_1002    conda-forge
xorg-xproto               7.0.31            h7f98852_1007    conda-forge
xrft                      1.0.1                    pypi_0    pypi
xyzservices               2023.2.0           pyhd8ed1ab_0    conda-forge
xz                        5.2.6                h166bdaf_0    conda-forge
y-py                      0.5.9           py310h4426083_0    conda-forge
yaml                      0.2.5                h7f98852_2    conda-forge
yaml-cpp                  0.7.0                h27087fc_2    conda-forge
yarl                      1.8.2           py310h5764c6d_0    conda-forge
ypy-websocket             0.8.2              pyhd8ed1ab_0    conda-forge
zarr                      2.14.2                   pypi_0    pypi
zeromq                    4.3.4                h9c3ff4c_1    conda-forge
zict                      2.2.0              pyhd8ed1ab_0    conda-forge
zipp                      3.15.0             pyhd8ed1ab_0    conda-forge
zlib                      1.2.13               h166bdaf_4    conda-forge
zstandard                 0.19.0          py310hdeb6495_1    conda-forge
zstd                      1.5.2                h3eb15da_6    conda-forge

</pre>
</details>


Discussion:

Patch:
diff --git a/verde/__init__.py b/verde/__init__.py
index 661d38a..ddb1903 100644
--- a/verde/__init__.py
+++ b/verde/__init__.py
@@ -93,6 +93,7 @@ def test(doctest=True, verbose=True, coverage=False, figures=True):
         "will be removed in v2.0.0. "
         f"Use 'pytest --pyargs {package}' to run the tests.",
         FutureWarning,
+        stacklevel=2,
     )
 
     assert status == 0, "Some tests have failed."
diff --git a/verde/base/base_classes.py b/verde/base/base_classes.py
index ecf48d1..9f49480 100644
--- a/verde/base/base_classes.py
+++ b/verde/base/base_classes.py
@@ -361,6 +361,7 @@ class BaseGridder(BaseEstimator):
             "squared error (RMSE) in Verde 2.0.0. "
             "This may change model selection results slightly.",
             FutureWarning,
+            stacklevel=2,
         )
         return score_estimator("r2", self, coordinates, data, weights=weights)
 
@@ -572,6 +573,7 @@ class BaseGridder(BaseEstimator):
             "2.0.0. Use 'verde.scatter_points' and the 'predict' method "
             "instead.",
             FutureWarning,
+            stacklevel=2,
         )
         dims = self._get_dims(dims)
         region = get_instance_region(self, region)
diff --git a/verde/coordinates.py b/verde/coordinates.py
index f9a2a9c..9ca4995 100644
--- a/verde/coordinates.py
+++ b/verde/coordinates.py
@@ -249,6 +249,10 @@ def line_coordinates(
     The spacing is adjusted to fit the interval by default but this can be
     changed to adjusting the interval/region instead:
 
+    >>> print(line_coordinates(0, 10, spacing=2.4))
+    [ 0.   2.5  5.   7.5 10. ]
+    >>> print(line_coordinates(0, 10, spacing=2.4, adjust="region"))
+    [0.  2.4 4.8 7.2 9.6]
     >>> print(line_coordinates(0, 10, spacing=2.6))
     [ 0.   2.5  5.   7.5 10. ]
     >>> print(line_coordinates(0, 10, spacing=2.6, adjust="region"))
@@ -277,9 +281,9 @@ def line_coordinates(
         size, stop = spacing_to_size(start, stop, spacing, adjust)
     elif pixel_register:
         # Starts by generating grid-line registered coordinates and shifting
-        # them to the center of the pixel. Need 1 more point if given a shape
-        # so that we can do that because we discard the last point when
-        # shifting the coordinates.
+        # them to the center of the pixel. Need 1 more point if given a size
+        # instead of spacing so that we can do that because we discard the last
+        # point when shifting the coordinates.
         size = size + 1
     values = np.linspace(start, stop, size)
     if pixel_register:
@@ -626,6 +630,14 @@ def spacing_to_size(start, stop, spacing, adjust):
         )
     # Add 1 to get the number of nodes, not segments
     size = int(round((stop - start) / spacing)) + 1
+    # If the spacing >= 2 * (stop - start), it rounds to zero so we'd be
+    # generating a single point, which isn't equivalent to adjusting the
+    # spacing or the region. To get the appropriate behaviour of decreasing the
+    # spacing until it fits the region or increasing the region until it fits
+    # at least 1 spacing, we need to always round to at least 1 in the code
+    # above.
+    if size == 1:
+        size += 1
     if adjust == "region":
         # The size is the same but we adjust the interval so that the spacing
         # isn't altered when we do the linspace.
@@ -1211,7 +1223,8 @@ def _check_rolling_window_overlap(region, size, shape, spacing):
         warnings.warn(
             f"Rolling windows do not overlap (size '{size}' and spacing '{spacing}'). "
             "Some data points may not be included in any window. "
-            "Increase size or decrease spacing to avoid this."
+            "Increase size or decrease spacing to avoid this.",
+            stacklevel=2,
         )
 
 
diff --git a/verde/datasets/sample_data.py b/verde/datasets/sample_data.py
index 8e0c6da..8cfbde8 100644
--- a/verde/datasets/sample_data.py
+++ b/verde/datasets/sample_data.py
@@ -39,6 +39,7 @@ def _datasets_deprecation_warning():
         "removed in Verde v2.0.0. The tutorials/examples will transition "
         "to using Ensaio (https://www.fatiando.org/ensaio/) instead.",
         DeprecationWarning,
+        stacklevel=2,
     )
 
 
@@ -158,7 +159,8 @@ def setup_baja_bathymetry_map(
     if kwargs:
         warnings.warn(
             "All kwargs are being ignored. They are accepted to "
-            + "guarantee backward compatibility."
+            + "guarantee backward compatibility.",
+            stacklevel=2,
         )
     _setup_map(
         ax,
@@ -217,6 +219,7 @@ def fetch_rio_magnetic():
         "The Rio magnetic anomaly dataset is deprecated and will be removed "
         "in Verde v2.0.0. Use a different dataset instead.",
         FutureWarning,
+        stacklevel=2,
     )
     data_file = REGISTRY.fetch("rio-magnetic.csv.xz")
     data = pd.read_csv(data_file, compression="xz")
@@ -250,6 +253,7 @@ def setup_rio_magnetic_map(ax, region=(-42.6, -42, -22.5, -22)):
         "The Rio magnetic anomaly dataset is deprecated and will be removed "
         "in Verde v2.0.0. Use a different dataset instead.",
         FutureWarning,
+        stacklevel=2,
     )
     _setup_map(
         ax,
@@ -337,7 +341,8 @@ def setup_california_gps_map(
     if kwargs:
         warnings.warn(
             "All kwargs are being ignored. They are accepted to "
-            + "guarantee backward compatibility."
+            + "guarantee backward compatibility.",
+            stacklevel=2,
         )
     _setup_map(
         ax,
@@ -416,7 +421,8 @@ def setup_texas_wind_map(ax, region=(-107, -93, 25.5, 37), coastlines=True, **kw
     if kwargs:
         warnings.warn(
             "All kwargs are being ignored. They are accepted to "
-            + "guarantee backward compatibility."
+            + "guarantee backward compatibility.",
+            stacklevel=2,
         )
     _setup_map(
         ax,
diff --git a/verde/datasets/synthetic.py b/verde/datasets/synthetic.py
index d053a39..a0b6c3f 100644
--- a/verde/datasets/synthetic.py
+++ b/verde/datasets/synthetic.py
@@ -29,4 +29,5 @@ class CheckerBoard(_CheckerBoard):
             "removed in Verde 2.0.0. "
             "Use verde.synthetic.CheckerBoard instead.",
             FutureWarning,
+            stacklevel=2,
         )
diff --git a/verde/model_selection.py b/verde/model_selection.py
index 23bd246..998d119 100644
--- a/verde/model_selection.py
+++ b/verde/model_selection.py
@@ -413,6 +413,7 @@ class BlockKFold(BaseBlockCrossValidator):
                     "number of blocks instead. Decreasing n_splits or increasing "
                     "the number of blocks may help.",
                     UserWarning,
+                    stacklevel=2,
                 )
                 folds = [i for _, i in KFold(n_splits=self.n_splits).split(block_ids)]
         else:
@@ -749,6 +750,7 @@ def cross_val_score(
             "and will be removed in Verde 2.0.0. "
             "Use the 'delayed' parameter instead.",
             FutureWarning,
+            stacklevel=2,
         )
     coordinates, data, weights = check_fit_input(
         coordinates, data, weights, unpack=False
diff --git a/verde/neighbors.py b/verde/neighbors.py
index 658c4fc..9d2a82f 100644
--- a/verde/neighbors.py
+++ b/verde/neighbors.py
@@ -97,7 +97,8 @@ class KNeighbors(BaseGridder):
             warnings.warn(
                 "{} does not support weights and they will be ignored.".format(
                     self.__class__.__name__
-                )
+                ),
+                stacklevel=2,
             )
         coordinates, data, weights = check_fit_input(coordinates, data, weights)
         self.region_ = get_region(coordinates[:2])
diff --git a/verde/spline.py b/verde/spline.py
index df19e0d..69521dd 100644
--- a/verde/spline.py
+++ b/verde/spline.py
@@ -157,6 +157,7 @@ class SplineCV(BaseGridder):
                 "The faster and memory efficient numba engine will be "
                 "the only option.",
                 FutureWarning,
+                stacklevel=2,
             )
         if client is not None:
             warnings.warn(
@@ -164,6 +165,7 @@ class SplineCV(BaseGridder):
                 "deprecated and will be removed in Verde 2.0.0. "
                 "Use the 'delayed' parameter instead.",
                 FutureWarning,
+                stacklevel=2,
             )
 
     def fit(self, coordinates, data, weights=None):
@@ -394,6 +396,7 @@ class Spline(BaseGridder):
                 "The faster and memory efficient numba engine will be "
                 "the only option.",
                 FutureWarning,
+                stacklevel=2,
             )
 
     def fit(self, coordinates, data, weights=None):
@@ -529,7 +532,8 @@ def warn_weighted_exact_solution(spline, weights):
     if weights is not None and spline.damping is None:
         warnings.warn(
             "Weights might have no effect if no regularization is used. "
-            "Use damping or specify force positions that are different from the data."
+            "Use damping or specify force positions that are different from the data.",
+            stacklevel=2,
         )
 
 


Test patch:
diff --git a/verde/tests/test_coordinates.py b/verde/tests/test_coordinates.py
index 86cceae..f7d7a7e 100644
--- a/verde/tests/test_coordinates.py
+++ b/verde/tests/test_coordinates.py
@@ -136,13 +136,28 @@ def test_line_coordinates_fails():
     # Make sure it doesn't fail for these parameters
     line_coordinates(start, stop, size=size)
     line_coordinates(start, stop, spacing=spacing)
-
     with pytest.raises(ValueError):
         line_coordinates(start, stop)
     with pytest.raises(ValueError):
         line_coordinates(start, stop, size=size, spacing=spacing)
 
 
+def test_line_coordinates_spacing_larger_than_twice_interval():
+    "Check if pixel_register works when the spacing is greater than the limits"
+    start, stop = 0, 1
+    spacing = 3
+    coordinates = line_coordinates(start, stop, spacing=spacing)
+    npt.assert_allclose(coordinates, [0, 1])
+    coordinates = line_coordinates(start, stop, spacing=spacing, pixel_register=True)
+    npt.assert_allclose(coordinates, [0.5])
+    coordinates = line_coordinates(start, stop, spacing=spacing, adjust="region")
+    npt.assert_allclose(coordinates, [0, 3])
+    coordinates = line_coordinates(
+        start, stop, spacing=spacing, pixel_register=True, adjust="region"
+    )
+    npt.assert_allclose(coordinates, [1.5])
+
+
 def test_grid_coordinates_fails():
     "Check failures for invalid arguments"
     region = (0, 1, 0, 10)