Skip to content
Snippets Groups Projects
  • Lionel GUEZ's avatar
    4ad2bfc8
    Rename spherical_polyline_area to spher_polyline_area and · 4ad2bfc8
    Lionel GUEZ authored
    spherical_polygon_area to spher_polygon_area.
    
    In procedure max_speed_contour_ssh, instead of aborting when the speed
    is not defined, continue with missing_ssh. Found such a case in
    November 29th, 2015 data. Added corresponding test. In procedure
    set_max_speed, if max_speed_contour_ssh returns missing_ssh then we
    just take the outermost contour as max-speed contour.
    4ad2bfc8
    History
    Rename spherical_polyline_area to spher_polyline_area and
    Lionel GUEZ authored
    spherical_polygon_area to spher_polygon_area.
    
    In procedure max_speed_contour_ssh, instead of aborting when the speed
    is not defined, continue with missing_ssh. Found such a case in
    November 29th, 2015 data. Added corresponding test. In procedure
    set_max_speed, if max_speed_contour_ssh returns missing_ssh then we
    just take the outermost contour as max-speed contour.
spher_polyline_area.f 878 B
module spher_polyline_area_m

  implicit none

contains

  pure real function spher_polyline_area(p)

    ! Assuming p is a polyline in longitude, latitude, compute the
    ! area (positive) of a polyline in longitude, sin(latitude) with
    ! the same vertices. Result in m2.

    ! Libraries:
    use contour_531, only: polyline
    use geometry, only: polygon_area_2d

    type(polyline), intent(in):: p ! Should be closed. In rad.

    ! Local:
    
    real v(2, p%n_points) ! points of a polyline in longitude, sin(latitude)

    real, parameter:: r_Earth = 6.371e6
    ! volumetric mean radius of the Earth, in m

    !------------------------------------------------------

    v(1, :) = p%points(1, :)
    v(2, :) = sin(p%points(2, :))
    spher_polyline_area = r_Earth**2 * abs(polygon_area_2d(v))

  end function spher_polyline_area

end module spher_polyline_area_m