FUNCTION RemoteView_CurrentSheet, FOVInfo, P
    @compile_opt.pro            ; On error, return to caller

; Set up the rectangular heliographic grid for the mesh.
; Convert to spherical coordinates

nMesh = 16

; Cartesian coordinates in AU; convert to spherical coordinates

x = gridgen(nMesh*[1,1,1], range=(FOVInfo.matrix_rEdge[1]*[-1,1])#[1,1,1])
x = cv_coord(from_rect=x, /to_sphere)

; For the interpolation on the magnetic field matrix the longitudes need
; to be defined relative to the start longitude of the matrix.

x[0,*] = AngleRange(x[0,*]-FOVInfo.matrix_lng0) ; Map to [0,360]


; Convert to array indices needed for the interpolation

sz = size( *FOVInfo.matrixb )

x[0,*] =  x[0,*]/(2*!pi)*(sz[1]-1)
x[1,*] = (x[1,*]+!pi/2)/!pi*(sz[2]-1)
x[2,*] = (x[2,*]-FOVInfo.matrix_rEdge[0])/FOVInfo.matrix_dR

; Interpolate on data array

bb = (*FOVInfo.matrixb)[*,*,*,FOVInfo.matrixb_index]
bb = interpolate(bb,x[0,*], x[1,*], x[2,*], missing=BadValue(bb))
bb = reform(bb, nMesh, nMesh, nMesh, /overwrite)

shade_volume, bb, 0.0, V, P

;whatis, V,P
; V is an array index between 0 and nMesh-1; convert to AU
; V and P may not exist at this point

CASE IsType(V, /defined) OF
0: V = BadValue(0.0)
1: V = (2.0*V/(nMesh-1)-1.0)*FOVInfo.matrix_rEdge[1]
ENDCASE

RETURN, V  &  END