home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 1766076828

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
1766076828 I_kwDOAMm_X85pRDGc 7932 RecursionError: maximum recursion depth exceeded while calling a Python object 90645468 closed 0     2 2023-06-20T20:07:22Z 2023-11-06T06:14:45Z 2023-11-06T06:14:45Z NONE      

What happened?

Traceback (most recent call last): File "/home/qiahan/.conda/envs/firstEnv/lib/python3.9/site-packages/xarray/core/variable.py", line 264, in _as_array_or_item data = np.asarray(data) File "/home/qiahan/.local/lib/python3.9/site-packages/dask/array/core.py", line 1701, in array x = self.compute() File "/home/qiahan/.local/lib/python3.9/site-packages/dask/base.py", line 314, in compute (result,) = compute(self, traverse=False, kwargs) File "/home/qiahan/.local/lib/python3.9/site-packages/dask/base.py", line 599, in compute results = schedule(dsk, keys, kwargs) File "/home/qiahan/.local/lib/python3.9/site-packages/dask/threaded.py", line 89, in get results = get_async( File "/home/qiahan/.local/lib/python3.9/site-packages/dask/local.py", line 511, in get_async raise_exception(exc, tb) File "/home/qiahan/.local/lib/python3.9/site-packages/dask/local.py", line 319, in reraise raise exc File "/home/qiahan/.local/lib/python3.9/site-packages/dask/local.py", line 224, in execute_task result = _execute_task(task, data) File "/home/qiahan/.local/lib/python3.9/site-packages/dask/core.py", line 119, in _execute_task return func((_execute_task(a, cache) for a in args)) File "/home/qiahan/.local/lib/python3.9/site-packages/dask/core.py", line 119, in <genexpr> return func((_execute_task(a, cache) for a in args)) File "/home/qiahan/.local/lib/python3.9/site-packages/dask/core.py", line 119, in _execute_task return func((_execute_task(a, cache) for a in args)) File "/home/qiahan/.local/lib/python3.9/site-packages/dask/core.py", line 119, in <genexpr> return func((_execute_task(a, cache) for a in args)) File "/home/qiahan/.local/lib/python3.9/site-packages/dask/core.py", line 38, in istask return type(x) is tuple and x and callable(x[0]) RecursionError: maximum recursion depth exceeded while calling a Python object

What did you expect to happen?

When the for loop is 1500 times, no error, but when it is like 17000 times, I got this recursion error.

Minimal Complete Verifiable Example

```Python for count_i,t in enumerate(all_resample.time.to_numpy()[96:17137],96): print(t, flush=True) ds_era5land = all_resample.sel(time=t, method='nearest').compute() ds = xr.merge([ds_era5land]) ds_ss = xr.Dataset() ds_ss["Rin"] = Rin.sel(time=t, method='nearest').compute() ds_ss["Rli"] = Rli.sel(time=t, method='nearest').compute() ds_ss["p"] = ds["sp"]/100 # Pa -> hPa ds_ss["Ta"] = ds["t2m"] - 273.15 # K -> degC ds_ss["ea"] = vc.calculate_es(ds["d2m"] - 273.15) ds_ss["u"] = (ds["u10"] ** 2 + ds["v10"] ** 2) ** 0.5 ds_ss["Precip_msr"] = ds["tp"]*1000 # mm ds_ss['LAI'] = lai.sel(time=t, method='nearest').compute() ds_ss['CO2'] = ds_co2_10km.sel(time=t, method='nearest').compute() ds_ss['SSM'] = SSM.sel(time=t, method='nearest').compute()

    ds_ss = ds_ss.to_array()
    Rin_line = ds_ss[0,:,:].to_numpy().reshape(1, ds_ss.latitude.size*ds_ss.longitude.size)
    Rli_line = ds_ss[1,:,:].to_numpy().reshape(1, ds_ss.latitude.size*ds_ss.longitude.size)
    p_line = ds_ss[2,:,:].to_numpy().reshape(1, ds_ss.latitude.size*ds_ss.longitude.size)
    Ta_line = ds_ss[3,:,:].to_numpy().reshape(1, ds_ss.latitude.size*ds_ss.longitude.size)
    ea_line = ds_ss[4,:,:].to_numpy().reshape(1, ds_ss.latitude.size*ds_ss.longitude.size)
    u_line = ds_ss[5,:,:].to_numpy().reshape(1, ds_ss.latitude.size*ds_ss.longitude.size)
    Precip_msr_line = ds_ss[6,:,:].to_numpy().reshape(1, ds_ss.latitude.size*ds_ss.longitude.size)
    LAI_line = ds_ss[7,:,:].to_numpy().reshape(1, ds_ss.latitude.size*ds_ss.longitude.size)
    CO2_line = ds_ss[8,:,:].to_numpy().reshape(1, ds_ss.latitude.size*ds_ss.longitude.size)
    SSM_line = ds_ss[9,:,:].to_numpy().reshape(1, ds_ss.latitude.size*ds_ss.longitude.size)

    features_arr = np.concatenate((Rin_line, Rli_line, p_line, Ta_line,ea_line, u_line, Precip_msr_line,
                                   LAI_line, hc_line, CO2_line, SSM_line, Vcmo_line,
                                   IGBP1, IGBP2, IGBP3,IGBP4,IGBP5,IGBP6,IGBP7,IGBP8,IGBP9,IGBP10,IGBP11))
    features_arr = features_arr.transpose()

    # Nan value.
    df_features = pd.DataFrame(data=features_arr)
    df_features_drop_nan = df_features.dropna()
    invalid_index = sorted(set(df_features.index.to_list()) - set(df_features_drop_nan.index.to_list()))

    # # Convert the nan value as 0 for the calculation
    where_are_NaNs = np.isnan(features_arr)
    features_arr[where_are_NaNs] = 0

    estimated_LEH = rfLEHmulti.predict(features_arr)

```

MVCE confirmation

  • [X] Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray.
  • [ ] Complete example — the example is self-contained, including all data and the text of any traceback.
  • [ ] Verifiable example — the example copy & pastes into an IPython prompt or Binder notebook, returning the result.
  • [ ] New issue — a search of GitHub Issues suggests this is not a duplicate.

Relevant log output

No response

Anything else we need to know?

No response

Environment

xarray version is 2022.9.0, python is 3.9.16
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/7932/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  not_planned 13221727 issue

Links from other tables

  • 2 rows from issues_id in issues_labels
  • 0 rows from issue in issue_comments
Powered by Datasette · Queries took 0.855ms · About: xarray-datasette