FV3 Bundle
gsw_sa_from_sp.f90
Go to the documentation of this file.
1 !==========================================================================
2 elemental function gsw_sa_from_sp (sp, p, long, lat)
3 !==========================================================================
4 !
5 ! Calculates Absolute Salinity, SA, from Practical Salinity, SP
6 !
7 ! sp : Practical Salinity [unitless]
8 ! p : sea pressure [dbar]
9 ! long : longitude [DEG E]
10 ! lat : latitude [DEG N]
11 !
12 ! gsw_sa_from_sp : Absolute Salinity [g/kg]
13 !--------------------------------------------------------------------------
14 
16 
18 
20 
21 use gsw_mod_kinds
22 
23 implicit none
24 
25 real (r8), intent(in) :: sp, p, long, lat
26 
27 real (r8) :: gsw_sa_from_sp
28 
29 real (r8) :: saar, sa_baltic
30 
31 character (*), parameter :: func_name = "gsw_sa_from_sp"
32 
33 sa_baltic = gsw_sa_from_sp_baltic(sp,long,lat)
34 
35 if (sa_baltic .lt. 1e10_r8) then
36 
37  gsw_sa_from_sp = sa_baltic
38 
39 else
40 
41  saar = gsw_saar(p,long,lat)
42  if (saar .gt. gsw_error_limit) then
43  gsw_sa_from_sp = gsw_error_code(1,func_name,saar)
44  else
45  gsw_sa_from_sp = gsw_ups*sp*(1.0_r8 + saar)
46  end if
47 
48 end if
49 
50 return
51 end function
52 
53 !--------------------------------------------------------------------------
elemental real(r8) function gsw_sa_from_sp(sp, p, long, lat)
integer, parameter, public long
Definition: Type_Kinds.f90:76
real(r8), parameter, public gsw_error_limit
elemental real(r8) function, public gsw_error_code(err_num, func_name, error_code)