wrap360 Function

private pure function wrap360(x) result(y)

Fold an angle in degrees to the canonical residue [0,360). (Fortran mod returns the sign of the argument, so a negative polynomial value needs the +360 canonicalisation.)

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: x

Return Value real(kind=wp)


Called by

proc~~wrap360~~CalledByGraph proc~wrap360 wrap360 proc~mean_longitudes mean_longitudes proc~mean_longitudes->proc~wrap360 proc~equilibrium_arguments equilibrium_arguments proc~equilibrium_arguments->proc~mean_longitudes proc~nodal_fu nodal_fu proc~nodal_fu->proc~mean_longitudes proc~configure_ocean_bc configure_ocean_bc proc~configure_ocean_bc->proc~equilibrium_arguments proc~configure_ocean_bc->proc~nodal_fu proc~tides_configure_astronomy tides_configure_astronomy proc~tides_configure_astronomy->proc~equilibrium_arguments proc~tides_configure_astronomy->proc~nodal_fu proc~configure_ocean_tides configure_ocean_tides proc~configure_ocean_tides->proc~tides_configure_astronomy proc~engine_setup engine_setup proc~engine_setup->proc~configure_ocean_bc proc~engine_setup->proc~configure_ocean_tides proc~complete_ocean_create complete_ocean_create proc~complete_ocean_create->proc~engine_setup proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_setup proc~driver_validate driver_validate proc~driver_validate->proc~engine_setup

Source Code

   pure function wrap360(x) result(y)
      !! Fold an angle in degrees to the canonical residue [0,360).
      !! (Fortran `mod` returns the sign of the argument, so a negative
      !! polynomial value needs the +360 canonicalisation.)
      real(wp), intent(in) :: x
      real(wp) :: y
      y = mod(x, 360.0_wp)
      if (y < 0.0_wp) y = y + 360.0_wp
   end function wrap360