FV3 Bundle
gsw_sp_from_sstar.f90
Go to the documentation of this file.
1 !==========================================================================
2 elemental function gsw_sp_from_sstar (sstar, p, long, lat)
3 !==========================================================================
4 !
5 ! Calculates Practical Salinity, SP, 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_sp_from_Sstar : Preformed Salinity [g/kg]
13 !--------------------------------------------------------------------------
14 
16 
18 
20 
21 use gsw_mod_kinds
22 
23 implicit none
24 
25 real (r8), intent(in) :: sstar, p, long, lat
26 
27 real (r8) :: gsw_sp_from_sstar
28 
29 real (r8) :: saar, sp_baltic
30 
31 character (*), parameter :: func_name = "gsw_sp_from_sstar"
32 
33 ! In the Baltic Sea, SA = Sstar.
34 sp_baltic = gsw_sp_from_sa_baltic(sstar,long,lat)
35 
36 if (sp_baltic .lt. 1e10_r8) then
37 
38  gsw_sp_from_sstar = sp_baltic
39 
40 else
41 
42  saar = gsw_saar(p,long,lat)
43  if (saar .gt. gsw_error_limit) then
44  gsw_sp_from_sstar = gsw_error_code(1,func_name,saar)
45  else
46  gsw_sp_from_sstar = (sstar/gsw_ups)/(1.0_r8 - 0.35_r8*saar)
47  end if
48 
49 end if
50 
51 return
52 end function
53 
54 !--------------------------------------------------------------------------
elemental real(r8) function gsw_sp_from_sstar(sstar, 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)