FV3 Bundle
gsw_sa_from_sstar.f90
Go to the documentation of this file.
1 !==========================================================================
2 elemental function gsw_sa_from_sstar (sstar, p, long, lat)
3 !==========================================================================
4 !
5 ! Calculates Absolute Salinity, SA, from Preformed Salinity, Sstar.
6 !
7 ! Sstar : Preformed Salinity [g/kg]
8 ! p : sea pressure [dbar]
9 ! long : longitude [deg E]
10 ! lat : latitude [deg N]
11 !
12 ! gsw_sa_from_sstar : Absolute Salinity [g/kg]
13 !--------------------------------------------------------------------------
14 
15 use gsw_mod_toolbox, only : gsw_saar
16 
18 
19 use gsw_mod_kinds
20 
21 implicit none
22 
23 real (r8), intent(in) :: sstar, p, long, lat
24 
25 real (r8) :: gsw_sa_from_sstar
26 
27 real (r8) :: saar
28 
29 character (*), parameter :: func_name = "gsw_sa_from_sstar"
30 
31 saar = gsw_saar(p,long,lat)
32 
33 if (saar.gt.gsw_error_limit) then
34 
35  gsw_sa_from_sstar = gsw_error_code(1,func_name,saar)
36 
37 else
38 
39  ! In the Baltic Sea, Sstar = SA, and note that gsw_saar returns zero
40  ! for SAAR in the Baltic.
41 
42  gsw_sa_from_sstar = sstar*(1.0_r8 + saar)/(1.0_r8 - 0.35_r8*saar)
43 
44 end if
45 
46 return
47 end function
48 
49 !--------------------------------------------------------------------------
integer, parameter, public long
Definition: Type_Kinds.f90:76
elemental real(r8) function gsw_sa_from_sstar(sstar, p, long, lat)
real(r8), parameter, public gsw_error_limit
elemental real(r8) function, public gsw_error_code(err_num, func_name, error_code)