FV3 Bundle
gsw_sstar_from_sp.f90
Go to the documentation of this file.
1 !==========================================================================
2 elemental function gsw_sstar_from_sp (sp, p, long, lat)
3 !==========================================================================
4 !
5 ! Calculates Preformed Salinity, Sstar, 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_sstar_from_sp : Preformed 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_sstar_from_sp
28 
29 real (r8) :: saar, sstar_baltic
30 
31 character (*), parameter :: func_name = "gsw_sstar_from_sp"
32 
33 !In the Baltic Sea, Sstar = SA.
34 sstar_baltic = gsw_sa_from_sp_baltic(sp,long,lat)
35 
36 if (sstar_baltic .lt. 1e10_r8) then
37 
38  gsw_sstar_from_sp = sstar_baltic
39 
40 else
41 
42  saar = gsw_saar(p,long,lat)
43  if (saar .gt. gsw_error_limit) then
44  gsw_sstar_from_sp = gsw_error_code(1,func_name,saar)
45  else
46  gsw_sstar_from_sp = gsw_ups*sp*(1 - 0.35_r8*saar)
47  end if
48 
49 end if
50 
51 return
52 end function
53 
54 !--------------------------------------------------------------------------
integer, parameter, public long
Definition: Type_Kinds.f90:76
real(r8), parameter, public gsw_error_limit
elemental real(r8) function gsw_sstar_from_sp(sp, p, long, lat)
elemental real(r8) function, public gsw_error_code(err_num, func_name, error_code)