home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 1254862548

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/7065#issuecomment-1254862548 https://api.github.com/repos/pydata/xarray/issues/7065 1254862548 IC_kwDOAMm_X85Ky67U 4160723 2022-09-22T10:58:10Z 2022-09-22T10:58:36Z MEMBER

Hi @guidocioni.

I see that the longitude and latitude coordinates both have different dtype in the two input datasets, which likely explains why you have many NaNs and larger sizes (almost 2x) for the lat and lon dimensions in the resulting dataset.

Here's a small reproducible example:

```python import numpy as np import xarray as xr

lat = np.random.uniform(0, 40, size=100) lon = np.random.uniform(0, 180, size=100)

ds1 = xr.Dataset( coords={"lon": lon.astype(np.float32), "lat": lat.astype(np.float32)} ) ds2 = xr.Dataset( coords={"lon": lon, "lat": lat} )

ds1.indexes["lat"].equals(ds2.indexes["lat"])

False

xr.merge([ds1, ds2], join="exact")

ValueError: cannot align objects with join='exact' where index/labels/sizes

are not equal along these coordinates (dimensions): 'lon' ('lon',)

```

If coordinates labels differ only by their encoding, you could use xr.merge([ds1, ds2], join="override"), which will take the coordinates from the 1st object.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  1381955373
Powered by Datasette · Queries took 159.002ms · About: xarray-datasette