# [ncl-talk] for the conversion of pressure to depth

Dennis Shea shea at ucar.edu
Fri Mar 3 09:10:08 MST 2017

```You may have to change the following but it gives you the necessary
algorithm

("depth_unesco83")
function depth_unesco83(p[*]:numeric, lat[1]:numeric, Del[1]:numeric)
;
; Saunders P.M., Fofonoff N.P. (1976):
;         Conversion of pressure to depth in the ocean. Deep Sea Research
23:109-111.
; UNESCO (1983): Algorithms for computation of fundamental properties of
seawater.
;         UNESCO technical papers in marine science 44:1-55.
;
local w, gr, DepthTerm, depth
begin
w    = sin(lat*0.01745329)^2
gr   = 9.780318 * (1.0 + (5.2788e-3 + 2.36e-5*w)*w) + 1.092e-6*p
DepthTerm = (((-1.82e-15*p + 2.279e-10)*p - 2.2512e-5)*p + 9.72659)*p
depth     = DepthTerm/gr + Del/9.8
copy_VarCoords(p,depth)
depth at long_name = "depth"
depth at units           = "m"
return(depth)
end
;--------------MAIN-------------
p   = 10000.0
lat = 30.
del = 0

d   = depth_unesco83(p, lat, del)
print(d)
===============================

Variable: d
Type: float
Total Size: 4 bytes
1 values
Number of Dimensions: 1
Dimensions and sizes:    [1]
Coordinates:
Number Of Attributes: 2
long_name :    depth
units :    m
(0)    9712.653                       <=== Correct

========

See attached. you may have to alter the function.

On Thu, Mar 2, 2017 at 6:47 PM, saurabh rathore <rohitsrb2020 at gmail.com>
wrote:

> hi all
>
> i  am having ocean temperature data having depth in decibars instead of
> meters along the depth axis (z axis). i want to convert this pressure axis
> to the depth in meter axis. So i was wondering does NCL is having such a
> function to do that conversion for the depth axis.
>
> regards, saurabh
>
>
>
> --
>
>
> *REGARDS*
>
> *Saurabh Rathore*
> *Research Scholar (PhD.)*
> *Centre For Oceans, Rivers, Atmosphere & Land Science Technology*
> *Indian Institute Of Technology, Kharagpur*
> *contact :- 91- 8345984434*
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170303/30e366ff/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: depth.ncl
Type: text/x-ncl
Size: 947 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170303/30e366ff/attachment.bin
```