orog_mask_tools  1.8.0
find_limit.F90 File Reference

Geo-reference utilities for a cubed-sphere grid. More...

Go to the source code of this file.

Functions/Subroutines

subroutine find_limit (p1_in, p2_in, latmin, latmax)
 Given two points on a cubed-sphere grid, compute the maximum and minimum latitudinal extent of the resulting great circle. More...
 
subroutine middle (p1, p2, p)
 Compute the latitude and longitude of the middle point between two given points. More...
 

Detailed Description

Geo-reference utilities for a cubed-sphere grid.

Author
Ning Wang

Definition in file find_limit.F90.

Function/Subroutine Documentation

◆ find_limit()

subroutine find_limit ( real*8, dimension(2), intent(in)  p1_in,
real*8, dimension(2), intent(in)  p2_in,
real*8, intent(out)  latmin,
real*8, intent(out)  latmax 
)

Given two points on a cubed-sphere grid, compute the maximum and minimum latitudinal extent of the resulting great circle.

Parameters
[in]p1_inLatitude and longitude of point 1.
[in]p2_inLatitude and longitude of point 2.
[out]latminMinimum latitudinal extent.
[out]latmaxMaximum latitudinal extent.
Author
Ning Wang

Definition at line 16 of file find_limit.F90.

References middle().

Referenced by cal_lake_frac_depth().

◆ middle()

subroutine middle ( real*8, dimension(2), intent(in)  p1,
real*8, dimension(2), intent(in)  p2,
real*8, dimension(2), intent(out)  p 
)

Compute the latitude and longitude of the middle point between two given points.

There are two formulae available to compute it.

One derived from a more general m-sect formula:

  xyz = sin((1-f)*theta) / sin(theta) * xyz1 +
        sin(f*theta) /sin(theta) * xyz2 ;
  where theta is the angle of xyz1, and xyz2.
  
  xyz = 0.5 / sqrt[(1+dot(xyz1,xyz2))/2] * (xyz1+xyz2)
  

and the other one is the normalized middle point of the two end points:

  xyz = 0.5 * (xyz1+xyz2), xyz = xyz / sqrt(dot(xyz,xyz))
  
Parameters
[in]p1Latitude/longitude of first end point.
[in]p2Latitude/longitude of second end point
[out]pLatitude/longitude of the mid-point.
Author
Ning Wang
Date
March, 2006

Definition at line 80 of file find_limit.F90.

Referenced by find_limit().