From 2cf75c6943f09f57c7302a92e5f4589b884d4010 Mon Sep 17 00:00:00 2001 From: Lionel GUEZ <guez@lmd.ens.fr> Date: Tue, 20 Mar 2018 16:10:08 +0100 Subject: [PATCH] Polish. --- derived_types.f | 20 +++++++++++--------- get_1_outerm.f | 5 ++++- good_contour.f | 2 +- set_all_outerm.f | 6 ++---- set_max_speed.f | 27 +++++++++++++-------------- 5 files changed, 31 insertions(+), 29 deletions(-) diff --git a/derived_types.f b/derived_types.f index 9dd32009..7c988c3c 100644 --- a/derived_types.f +++ b/derived_types.f @@ -17,10 +17,12 @@ module derived_types logical cyclone type(ssh_contour) out_cont ! outermost contour type(ssh_contour) speed_cont ! contour with maximum average azimuthal speed - real max_speed ! average of azimuthal speed on max_speed_contour, in m s-1 - logical suff_amp ! outermost_contour found and sufficient - ! amplitude of ssh between extremum and - ! outermost contour + real max_speed ! average of azimuthal speed on speed_cont, in m s-1 + + logical suff_amp + ! out_cont found and sufficient amplitude of ssh between extremum + ! and out_cont + logical interpolated logical twice ! outermost contour computed twice @@ -40,11 +42,11 @@ module derived_types integer number_vis_eddies ! number of visible eddies integer, allocatable:: extr_map(:, :) ! (nlon, nlat) At a point - ! of extremum SSH with outermost_contour found, of sufficient - ! amplitude: identification number or this extremum. At a point - ! of extremum SSH with no outermost_contour or outermost_contour - ! of insufficient amplitude: the opposite of the identification - ! number or this extremum. 0 at other points. + ! of extremum SSH with out_cont found, of sufficient amplitude: + ! identification number or this extremum. At a point of extremum + ! SSH with no out_cont or out_cont of insufficient amplitude: the + ! opposite of the identification number or this extremum. 0 at + ! other points. integer, allocatable:: ind_extr(:, :) ! (2, number_vis_eddies) ! indices in the global grid of ssh extrema diff --git a/get_1_outerm.f b/get_1_outerm.f index 2615a7dd..23cfa038 100644 --- a/get_1_outerm.f +++ b/get_1_outerm.f @@ -7,7 +7,10 @@ contains type(ssh_contour) function get_1_outerm(ssh_extremum, cyclone, coord_extr, & i, innermost_level, extr_map, ssh, corner, step) - ! Get one outermost contour. Method: dichotomy on level of ssh. + ! Gets one outermost contour, if it can find one. Method: + ! dichotomy on level of ssh. If the procedure cannot find an + ! outermost contour, it return a null polyline, zero area and ssh + ! equal to ssh extremum. use contour_531, only: polyline, convert_to_reg_coord use derived_types, only: ssh_contour diff --git a/good_contour.f b/good_contour.f index 2f9a456a..69f41f8f 100644 --- a/good_contour.f +++ b/good_contour.f @@ -11,7 +11,7 @@ contains ! inside_point and does not contain any of outside_points. There ! might be several satisfying contours, this procedure returns the ! first satisfying contour it finds. If such a contour does not - ! exist, the procedure returns an empty polyline. + ! exist, the procedure returns a null polyline. use contour_531, only: polyline, find_contours_reg_grid, null_polyline use geometry, only: polygon_contains_point diff --git a/set_all_outerm.f b/set_all_outerm.f index 55ce6a39..6a3aa92d 100644 --- a/set_all_outerm.f +++ b/set_all_outerm.f @@ -122,15 +122,13 @@ contains do i = 1, s%number_vis_eddies if (s%list_vis(i)%suff_amp .and. noise_around(i) & .or. .not. flat_extr(i)) then - s%list_vis(i)%out_cont & - = get_1_outerm(s%list_vis(i)%ssh_extr, & + s%list_vis(i)%out_cont = get_1_outerm(s%list_vis(i)%ssh_extr, & s%list_vis(i)%cyclone, s%list_vis(i)%coord_extr, i, & innermost_level(i), & s%extr_map(llc(1, i):urc(1, i), llc(2, i):urc(2, i)), & ssh(llc(1, i):urc(1, i), llc(2, i):urc(2, i)), & corner_window(:, i), step) - s%list_vis(i)%suff_amp & - = s%list_vis(i)%out_cont%n_points /= 0 + s%list_vis(i)%suff_amp = s%list_vis(i)%out_cont%n_points /= 0 end if end do diff --git a/set_max_speed.f b/set_max_speed.f index 49841efa..9390c0b0 100644 --- a/set_max_speed.f +++ b/set_max_speed.f @@ -6,7 +6,7 @@ contains subroutine set_max_speed(e, ind_targ_extr, extr_map, ssh, u, v, corner, step) - ! Defines the components max_speed_contour and max_speed of argument e. + ! Defines the components speed_cont and max_speed of argument e. use, intrinsic:: IEEE_ARITHMETIC, only: IEEE_IS_NAN @@ -29,8 +29,8 @@ contains real, intent(in):: ssh(:, :), u(:, :), v(:, :) ! The domain is allowed to be as small as the bounding box of - ! outermost_contour. If the domain is larger, this subroutine will - ! work too, but with wasted computation. + ! out_cont. If the domain is larger, this subroutine will work + ! too, but with wasted computation. real, intent(in):: corner(:) ! (2) ! longitude and latitude of the lower left corner of the grid, in rad @@ -57,15 +57,15 @@ contains noise_around = any(extr_map < 0) ! Compute radius from distance in index space, as a lower bound: - radius = floor(polygon_point_dist_2d(convert_to_ind( & - e%out_cont%points, corner, step), real(ind_targ_extr))) + 1 + radius = floor(polygon_point_dist_2d(convert_to_ind(e%out_cont%points, & + corner, step), real(ind_targ_extr))) + 1 do while (inside_4(radius * step, e%coord_extr, e%out_cont%points)) radius = radius + 1 end do if (radius == 1) then - ! We cannot find max_speed_contour. + ! We cannot find speed_cont. e%speed_cont%ssh = e%ssh_extr e%speed_cont%polyline = null_polyline() e%speed_cont%area = 0. @@ -73,8 +73,8 @@ contains else ! {radius >= 2} - e%speed_cont%ssh = max_speed_contour_ssh(ssh, u, v, & - ind_targ_extr, radius) + e%speed_cont%ssh = max_speed_contour_ssh(ssh, u, v, ind_targ_extr, & + radius) i = extr_map(ind_targ_extr(1), ind_targ_extr(2)) if (noise_around) then @@ -87,12 +87,12 @@ contains e%speed_cont%polyline = good_contour(corner, step, ssh, & e%speed_cont%ssh, e%coord_extr, nearby_extr) - e%max_speed = mean_speed(u, v, e%speed_cont%polyline, & - e%coord_extr, corner, step) + e%max_speed = mean_speed(u, v, e%speed_cont%polyline, e%coord_extr, & + corner, step) ! Might the outermost contour be a better choice? - speed_outerm = mean_speed(u, v, e%out_cont%polyline, & - e%coord_extr, corner, step) + speed_outerm = mean_speed(u, v, e%out_cont%polyline, e%coord_extr, & + corner, step) if (IEEE_IS_NAN(speed_outerm)) speed_outerm = 0. ! (This may happen when the outermost contour is near land.) @@ -103,8 +103,7 @@ contains e%max_speed = speed_outerm else ! Stick to the contour coming from max_speed_contour_ssh. - e%speed_cont%area & - = spherical_polygon_area(e%speed_cont%polyline) + e%speed_cont%area = spherical_polygon_area(e%speed_cont%polyline) end if end if -- GitLab