Skip to content
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

Assertion failed: Gaussian: values size equals iterator count in validate #65

Open
raybellwaves opened this issue Nov 15, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@raybellwaves
Copy link

raybellwaves commented Nov 15, 2024

What happened?

Exception                                 Traceback (most recent call last)
Cell In[2], line 22
     20 def roll_longitude(ds):
     21     return ds.assign_coords(longitude=(((ds.longitude + 180) % 360) - 180)).sortby('longitude')
---> 22 ds_single_ll = roll_longitude(mv.read(data=single_fieldset, grid=[0.25,0.25]).to_dataset())

File [~/miniforge3/envs/main/lib/python3.12/site-packages/metview/bindings.py:1285](http://localhost:8889/lab/tree/docs/~/miniforge3/envs/main/lib/python3.12/site-packages/metview/bindings.py#line=1284), in make.<locals>.wrapped(*args, **kwargs)
   1282     pass  # throw Exception
   1284 val = lib.p_result_as_value()
-> 1285 return value_from_metview(val)

File [~/miniforge3/envs/main/lib/python3.12/site-packages/metview/bindings.py:1239](http://localhost:8889/lab/tree/docs/~/miniforge3/envs/main/lib/python3.12/site-packages/metview/bindings.py#line=1238), in value_from_metview(val)
   1237 retval = vr.translate_return_val(val)
   1238 if isinstance(retval, Exception):
-> 1239     raise retval
   1240 return retval

Exception: Metview error: Exception: Assertion failed: Gaussian: values size equals iterator count in validate, line 90 of [/Users/runner/miniforge3/conda-bld/metview_1727940057426/work/mir/src/mir/repres/gauss/Gaussian.cc](http://localhost:8889/Users/runner/miniforge3/conda-bld/metview_1727940057426/work/mir/src/mir/repres/gauss/Gaussian.cc)

What are the steps to reproduce the bug?

import metview as mv
import xarray as xr
ds = xr.open_zarr(
    "gs://gcp-public-data-arco-era5/co/single-level-reanalysis.zarr-v2",
    chunks=None,
    storage_options=dict(token="anon"),
)
valid_time_start = ds.attrs["valid_time_start"]
valid_time_stop = ds.attrs["valid_time_stop"]
# single_level_reanalysis = ds.sel(time=slice(valid_time_start, valid_time_stop))
single_level_reanalysis = ds.sel(time=slice("2024-01-01", "2024-01-01"))[["t2m"]].compute()
longitude = single_level_reanalysis["longitude"]
latitude = single_level_reanalysis["latitude"]
single_level_reanalysis_us = single_level_reanalysis.where(
    (longitude > 235.0) & (latitude > 25.0) &
    (longitude < 293.0) & (latitude < 50.0),
    drop=True
)
single_fieldset = mv.dataset_to_fieldset(single_level_reanalysis_us.squeeze())
def roll_longitude(ds):
    return ds.assign_coords(longitude=(((ds.longitude + 180) % 360) - 180)).sortby('longitude')
ds_single_ll = roll_longitude(mv.read(data=single_fieldset, grid=[0.25,0.25]).to_dataset())

Version

5.23.0

Platform (OS and architecture)

Darwin Rays-MacBook-Pro.local 24.1.0 Darwin Kernel Version 24.1.0: Thu Oct 10 21:00:32 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6030 arm64

Relevant log output

/Users/raybell/miniforge3/envs/main/lib/python3.12/site-packages/cfgrib/xarray_to_grib.py:252: FutureWarning: GRIB write support is experimental, DO NOT RELY ON IT!
  warnings.warn("GRIB write support is experimental, DO NOT RELY ON IT!", FutureWarning)
failed to set key 'stepUnits:int' to 1
failed to set key 'endStep:int' to 0
failed to set key 'stepUnits:int' to 1
failed to set key 'endStep:int' to 0
failed to set key 'stepUnits:int' to 1
failed to set key 'endStep:int' to 0
failed to set key 'stepUnits:int' to 1
failed to set key 'endStep:int' to 0
failed to set key 'stepUnits:int' to 1
failed to set key 'endStep:int' to 0
failed to set key 'stepUnits:int' to 1
failed to set key 'endStep:int' to 0
failed to set key 'stepUnits:int' to 1
failed to set key 'endStep:int' to 0
failed to set key 'stepUnits:int' to 1
failed to set key 'endStep:int' to 0
failed to set key 'stepUnits:int' to 1
failed to set key 'endStep:int' to 0
failed to set key 'stepUnits:int' to 1
failed to set key 'endStep:int' to 0
failed to set key 'stepUnits:int' to 1
failed to set key 'endStep:int' to 0
failed to set key 'stepUnits:int' to 1
failed to set key 'endStep:int' to 0
failed to set key 'stepUnits:int' to 1
failed to set key 'endStep:int' to 0
failed to set key 'stepUnits:int' to 1
failed to set key 'endStep:int' to 0
failed to set key 'stepUnits:int' to 1
failed to set key 'endStep:int' to 0
failed to set key 'stepUnits:int' to 1
failed to set key 'endStep:int' to 0
failed to set key 'stepUnits:int' to 1
failed to set key 'endStep:int' to 0
failed to set key 'stepUnits:int' to 1
failed to set key 'endStep:int' to 0
failed to set key 'stepUnits:int' to 1
failed to set key 'endStep:int' to 0
failed to set key 'stepUnits:int' to 1
failed to set key 'endStep:int' to 0
failed to set key 'stepUnits:int' to 1
failed to set key 'endStep:int' to 0
failed to set key 'stepUnits:int' to 1
failed to set key 'endStep:int' to 0
failed to set key 'stepUnits:int' to 1
failed to set key 'endStep:int' to 0
failed to set key 'stepUnits:int' to 1
failed to set key 'endStep:int' to 0
failed to set key 'stepUnits:int' to 1
Python - ERROR  - 20241115.035553 - Line 0 in 'PythonScript': Exception: Assertion failed: Gaussian: values size equals iterator count in validate, line 90 of /Users/runner/miniforge3/conda-bld/metview_1727940057426/work/mir/src/mir/repres/gauss/Gaussian.cc
Python - ERROR  - 20241115.035553 - Line 0 in 'PythonScript': MIR: Assertion failed: Gaussian: values size equals iterator count in validate, line 90 of /Users/runner/miniforge3/conda-bld/metview_1727940057426/work/mir/src/mir/repres/gauss/Gaussian.cc
Python - ERROR  - 20241115.035553 - Line 0 in 'PythonScript': Interpolation failed (-2)
Python - ERROR  - 20241115.035553 - Line 0 in 'PythonScript': Retrieve-> Error code: -2
---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
Cell In[2], line 22
     20 def roll_longitude(ds):
     21     return ds.assign_coords(longitude=(((ds.longitude + 180) % 360) - 180)).sortby('longitude')
---> 22 ds_single_ll = roll_longitude(mv.read(data=single_fieldset, grid=[0.25,0.25]).to_dataset())

File ~/miniforge3/envs/main/lib/python3.12/site-packages/metview/bindings.py:1285, in make.<locals>.wrapped(*args, **kwargs)
   1282     pass  # throw Exception
   1284 val = lib.p_result_as_value()
-> 1285 return value_from_metview(val)

File ~/miniforge3/envs/main/lib/python3.12/site-packages/metview/bindings.py:1239, in value_from_metview(val)
   1237 retval = vr.translate_return_val(val)
   1238 if isinstance(retval, Exception):
-> 1239     raise retval
   1240 return retval

Exception: Metview error: Exception: Assertion failed: Gaussian: values size equals iterator count in validate, line 90 of /Users/runner/miniforge3/conda-bld/metview_1727940057426/work/mir/src/mir/repres/gauss/Gaussian.cc

Accompanying data

No response

Organisation

Self

@raybellwaves raybellwaves added the bug Something isn't working label Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant