[ncl-talk] using TEOS10 software with NCL
william.llovel@cerfacs.fr
llovel at cerfacs.fr
Tue Feb 24 09:00:15 MST 2015
Dear all,
I am an oceanographer and a new NCL user. I am interested in the ocean
heat content change and its contribution to sea level.
Thus, I need to compute some parameters as density, heat capacity
etc.... For that, I need to use the equation of state of the ocean.
The recommendation is now to consider the TEOS-10 software available at
http://www.teos-10.org/ .
This website provides a set of fortran90 functions and subroutines.
I have tried to call them using the WRAPIT command :
https://www.ncl.ucar.edu/Document/Tools/WRAPIT.shtml#Step_1
first, by creating a stub file and then, runing the WRAPIT command.
Unfortunately, this does not work. the results are wrong and totally
unphysical.
this is why I am contacting you and asking your help.
Below is an example of the F90 function.
!==========================================================================
function gsw_sa_from_sp(sp,p,lon,lat)
!==========================================================================
! Calculates Absolute Salinity, SA, from Practical Salinity, SP
!
! sp : Practical Salinity [unitless]
! p : sea pressure [dbar]
! lon : lonitude [DEG E]
! lat : latitude [DEG N]
!
! gsw_sa_from_sp : Absolute Salinity [g/kg]
implicit none
integer, parameter :: r14 = selected_real_kind(14,30)
real (r14) :: sp, lon, lat, p, gsw_sa_from_sp, gsw_saar, saar
real (r14) :: gsw_sa_baltic, gsw_sa_from_sp_baltic
saar = gsw_saar(p,lon,lat)
gsw_sa_from_sp = (35.16504d0/35.d0)*sp*(1.d0 + saar)
!==========================================================================
And my stub file before invoking WRAPIT.
!==========================================================================
C NCLFORTSTART
function gsw_sa_from_sp(sp,p,lon,lat)
double precision sp, lon, lat, p
C NCLEND
!==========================================================================
I am able to run the WRAPIT command and create the file.so, but when I
try to call a function or subroutine with NCL, the results are totally
wrong.
I think this is because of this line : integer, parameter :: r14 =
selected_real_kind(14,30) in the F90 functions that defines my variables.
If you have any idea on how I could resolve this issue, I will be more
than happy to hear from you.
This toolbox is very important for any oceanographer. So, implementing
this toolbox into NCL will motive more researchers to use your software.
Thanks for your help,
Best regards,
William
More information about the ncl-talk
mailing list