12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- !!----------------------------------------------------------------------
- !! NEMO/OPA 3.3 , NEMO Consortium (2010)
- !! $Id: maxdist.h90 2287 2010-10-18 07:53:52Z smasson $
- !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
- !!----------------------------------------------------------------------
- REAL FUNCTION maxdist( pxv, pyv )
- !!----------------------------------------------------------------------
- !! *** FUNCTION maxdist ***
- !!
- !! ** Purpose : Compute the maximum distance between any points within
- !! a cell
- !!
- !! ** Method : Call to grt_cir_dis
- !!
- !! ** Action :
- !!
- !! History :
- !! ! 2006-08 (K. Mogensen)
- !! ! 2006-10 (A. Weaver) Cleanup
- !!----------------------------------------------------------------------
- !! * Arguments
- REAL(KIND=wp), DIMENSION(4), INTENT(IN) :: &
- & pxv, & ! (lon, lat) of the surrounding cell
- & pyv
- !! * Local declarations
- REAL(KIND=wp), DIMENSION(4) :: &
- & zxv, &
- & zyv, &
- & za, &
- & zb, &
- & zc
- REAL(KIND=wp) :: zdist
-
- INTEGER :: ji
- INTEGER :: jj
-
- !-----------------------------------------------------------------------
- ! Convert data to radians
- !-----------------------------------------------------------------------
- DO ji = 1, 4
- zxv(ji) = pxv(ji) * rad
- zyv(ji) = pyv(ji) * rad
- END DO
- !-----------------------------------------------------------------------
- ! Prepare input to grt_cir_dis
- !-----------------------------------------------------------------------
- DO ji = 1, 4
- za(ji) = SIN( zyv(ji) )
- zb(ji) = COS( zyv(ji) ) * COS( zxv(ji) )
- zc(ji) = COS( zyv(ji) ) * SIN( zxv(ji) )
- END DO
-
- !-----------------------------------------------------------------------
- ! Get max distance between any points in the area
- !-----------------------------------------------------------------------
- maxdist = 0.0
- DO jj = 1, 4
- DO ji = jj+1, 4
- zdist = grt_cir_dis( za(jj), za(ji), zb(jj), &
- & zb(ji), zc(jj), zc(ji))
- IF ( zdist > maxdist ) THEN
- maxdist = zdist
- ENDIF
- END DO
- END DO
-
- !-----------------------------------------------------------------------
- ! Convert to degrees.
- !-----------------------------------------------------------------------
- maxdist = maxdist / rad
- END FUNCTION maxdist
|