It is common practice to represent by a streamfunction the transport field ensuing from the integration - over one horizontal coordinate - of the velocity field predicted by ocean models. This very useful visualization technique requires that the transport field be divergenceless. If this is not the case, it is suggested to extract the divergenceless transport field that is closest to that stemming from the model while verifying the impermeability conditions of the ocean surface and bottom. A variational approach is examined.