The routine regridData
regrids from lat-lon to cubed-sphere,
using tile file data already read in.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=sp), | intent(in) | :: | in2D(:,:) | |||
real(kind=sp), | intent(inout) | :: | out2D(:,:) | |||
integer, | optional | :: | RC |
Subroutine regridData(in2D,out2D,RC) ! ! !USES: ! ! Use Precision_Mod, Only: f4 ! ! !INPUT PARAMETERS: ! Real(Kind=sp),Intent(In) :: in2D(:,:) ! ! !INPUT/OUTPUT PARAMETERS: ! Real(Kind=sp),Intent(InOut) :: out2D(:,:) ! ! !OUTPUT PARAMETERS: ! Integer, Optional :: RC ! !----------------------------------------------------------------------- ! ! !LOCAL VARIABLES: ! Integer :: I, iX, iY Real(kind=sp) :: wVal, inVal, outVal Real(kind=sp), Parameter :: missingVal=0.0 !================================================================= ! regridData starts here! !================================================================= ! Zero the output arrays outSum(:,:) = 0.0e0 out2D(:,:) = 0.0e0 Do I=1,nWeight iX = II_In(I) iY = JJ_In(I) wVal = W(I) inVal = in2D(iX,iY) iX = II_Out(I) iY = JJ_Out(I) outVal = wVal*inVal out2D(iX,iY) = out2D(iX,iY) + outVal outSum(iX,iY) = outSum(iX,iY) + wVal End Do Do iX = 1,Size(out2D,1) Do iY = 1,Size(out2D,2) If (outSum(iX,iY) .le. Tiny(1.0e+0_sp)) Then out2D(iX,iY) = missingVal Else wVal = outSum(iX,iY) out2D(iX,iY) = out2D(iX,iY)/wVal End If End Do End Do If (Present(RC)) RC = 0 End Subroutine regridData