Skip to content

LatLon coordinates in boundary datastore don't match grid_index #54

Description

@sadamov

When generating a boundary zarr archive, lat*lon==grid_index should hold true, where lat and lon are 1D vectors. This however is not the case, as can be reproduced following the steps below. I have attached the two config-files in a zip-folder. Make sure to update the absolute path to the DANRA datastore for cropping in the era5.datastore.yaml before proceeding.

Now follow these steps in order:

python -m mllam_data_prep ./neural-lam/test_example/danra.datastore.yaml
python -m mllam_data_prep ./neural-lam/test_example/era5.datastore.yaml

Open a Python console and inspect the created era5.datastore.zarr

import xarray as xr
ds=xr.open_zarr("era5.datastore.zarr/")
ds=ds.set_index(grid_index=["latitude","longitude"])
ds_unstacked=ds.unstack("grid_index")
try:
    assert len(ds_unstacked.longitude)*len(ds_unstacked.latitude) == len(ds.grid_index)
except AssertionError:
    print(f"Dimensions mismatch:")
    print(f"len(longitude): {len(ds_unstacked.longitude)}")
    print(f"len(latitude): {len(ds_unstacked.latitude)}")
    print(f"longitude * latitude: {len(ds_unstacked.longitude) * len(ds_unstacked.latitude)}")
    print(f"len(grid_index): {len(ds.grid_index)}")
    raise

For me this returns a significant mismatch:

Dimensions mismatch:
len(longitude): 321
len(latitude): 147
longitude * latitude: 47187
len(grid_index): 28143

yaml-files.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions