# Bug in w2rho() loop body / croco\_pytools v2.0.4

**URL:** <https://forum.croco-ocean.org/t/bug-in-w2rho-loop-body-croco-pytools-v2-0-4/7645>\
**Category:** croco tools (pre/post-processing)\
**Created:** [April 22, 2026, 3:25pm UTC](https://forum.croco-ocean.org/t/bug-in-w2rho-loop-body-croco-pytools-v2-0-4/7645 "2026-04-22T15:25:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Heszo](https://forum.croco-ocean.org/user_avatar/forum.croco-ocean.org/heszo/32/385_2.png) [@Heszo](https://forum.croco-ocean.org/u/Heszo)\
**Post date:** [April 22, 2026, 3:25pm UTC](https://forum.croco-ocean.org/t/bug-in-w2rho-loop-body-croco-pytools-v2-0-4/7645/1 "2026-04-22T15:25:36Z")

</div>

Hi all,  
While working with croco\_pytools v2.0.4, I found a bug in the w2rho() function (prepro/Modules/Cgrid\_transformation\_tools.py).  
Loop body, incorrect slice

Current(wrong): var\_w[iz + 2 :, :]  
Fix: var\_w[iz + 2, :, :]

The open slice returns a 3D sub-array instead of a 2D layer, breaking the interpolation arithmetic for all interior levels.  
Best,  
Bruno H.
