Hi Billy,
Thanks very much for your post!
Relevant to this, check out
Chapter 3, Section 2.4.5 of the User's Guide, "Method 3" toward the end of that subsection, for a description of the new @IIN "regridding transformation" (rather than the older "regular transformation" form that the script currently uses). The regridding form was introduced in Ferret v7.4.2 (summer 2018?), largely to address the half-cell shift that you mentioned in the regular form -- namely that the integral-to-edge values were placed at the cellcenters of the original axis. It's better to either have the integral-to-center values placed at the cell centers, or the integral-to-edge values placed at the cell edges.
This can now be done very easily, using the "regridding form" of @IIN, which allows one to obtain the indefinite integral at arbitrary points. These points can be the grid cell centers (e.g. if you regrid to the original axis, Z[GZ=my_variable]), the grid cell edges (if you regrid to the cell edges at, say, ZBOXHI[GZ=my_variable] or ZBOXLO[GZ=my_variable]), or any other set of target points defined with DEFINE AXIS. Simply regrid to that target axis using: integrand[GZ=target_z_axis@IIN].
=> Bottom line is that the results of @iin and @rsum need to be considered with care.
Where exactly do you expect the result to apply?
Billy K