Skip to content

Fix the DataArray repr in the load_tile_map doctest for xarray v2024.02 #3062

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Mar 15, 2024

Conversation

seisman
Copy link
Member

@seisman seisman commented Feb 21, 2024

xarray v2024.2 was released in Feb, 2024. This new version changed the representation of DataArray (pydata/xarray#8690), making our one doctest failing(https://github.com/GenericMappingTools/pygmt/actions/runs/7982166393/job/21795212745):

_______________ [doctest] pygmt.datasets.tile_map.load_tile_map _______________
115     >>> from pygmt.datasets import load_tile_map
116     >>> raster = load_tile_map(
117     ...     region=[-180.0, 180.0, -90.0, 0.0],  # West, East, South, North
118     ...     zoom=1,  # less detailed zoom level
119     ...     source=contextily.providers.OpenTopoMap,
120     ...     lonlat=True,  # bounding box coordinates are longitude/latitude
121     ... )
122     >>> raster.sizes
123     Frozen({'band': 3, 'y': 256, 'x': 512})
124     >>> raster.coords
Differences (unified diff with -expected +actual):
    @@ -1,4 +1,4 @@
     Coordinates:
    -  * band         (band) uint8 0 1 2
    -  * y            (y) float64 -7.081e-10 -7.858e+04 ... -1.996e+07 ...
    -  * x            (x) float64 -2.004e+07 -1.996e+07 ... 1.996e+07 2.004e+07
    +  * band     (band) uint8 3B 0 1 2
    +  * y        (y) float64 2kB -7.081e-10 -7.858e+04 ... -1.996e+07 -2.004e+07
    +  * x        (x) float64 4kB -2.004e+07 -1.996e+07 ... 1.996e+07 2.004e+07

We can't simply change the output to the new version, because our CI jobs are using different xarray versions (i.e., the minimum supported version with Python 3.10 and the latest version with Python 3.12). We can't make both happy.

We can only let doctest ignore the differences in whitespaces use ellipse for the newly added nbytes.

@seisman seisman added maintenance Boring but important stuff for the core devs skip-changelog Skip adding Pull Request to changelog run/test-gmt-dev Trigger the GMT Dev Tests workflow in PR labels Feb 21, 2024
@seisman seisman added this to the 0.12.0 milestone Feb 21, 2024
@seisman seisman changed the title Fix the load_tile_map doctest for xarray v2024.02 WIP: Fix the load_tile_map doctest for xarray v2024.02 Feb 21, 2024
@seisman

This comment was marked as outdated.

@seisman seisman marked this pull request as draft February 21, 2024 06:07
@seisman seisman changed the title WIP: Fix the load_tile_map doctest for xarray v2024.02 Fix the load_tile_map doctest for xarray v2024.02 Mar 12, 2024
@seisman seisman changed the title Fix the load_tile_map doctest for xarray v2024.02 Fix the DataArray repr in the load_tile_map doctest for xarray v2024.02 Mar 12, 2024
@seisman seisman changed the title Fix the DataArray repr in the load_tile_map doctest for xarray v2024.02 WIP: Fix the DataArray repr in the load_tile_map doctest for xarray v2024.02 Mar 13, 2024
@seisman seisman marked this pull request as ready for review March 15, 2024 00:32
@seisman seisman changed the title WIP: Fix the DataArray repr in the load_tile_map doctest for xarray v2024.02 Fix the DataArray repr in the load_tile_map doctest for xarray v2024.02 Mar 15, 2024
@seisman seisman added needs review This PR has higher priority and needs review. and removed run/test-gmt-dev Trigger the GMT Dev Tests workflow in PR needs review This PR has higher priority and needs review. labels Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Boring but important stuff for the core devs skip-changelog Skip adding Pull Request to changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant