[ncl-talk] rho_mwjf

Dennis Shea shea at ucar.edu
Sun Jan 16 20:38:07 MST 2022


THX, Will
============

Two ocean functions: *potmp_insitu_ocn*
<https://www.ncl.ucar.edu/Document/Functions/Built-in/potmp_insitu_ocn.shtml>*
, depth_to_pres
<https://www.ncl.ucar.edu/Document/Functions/Built-in/depth_to_pres.shtml>*

-----------------------------------------------------------------------

Assorted ocean functions in contributed.ncl :. These are NOT SUPPORTED;
documented in functions

gravity_ocn         : Gravity as a function of latitude
depth_ocn           : Depth(pressure, depth, correction_term) [ UNESCO:
1983 ]
salinity_un83_ocn   : Salinity calculation (pss) from conductivity
atg_ocn             : Computes the adiabatic temperature gradient
potentmp_ocn        : Potential temperature from in-situ measurements
vsnd_un95_ocn       : speed of sound in seawater as a function of s, t & p
vsnd_teos10_ocn     : speed of sound in seawater as a function of s, t & p
(van T Hoff eqn)
densatp_ocn         : Calculate the density of seawater at a given s, t AND
p [Millero & Poisson (1981)]
aou_ocn             : Oxygen concentration at saturation


%> less $NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl
~

On Sun, Jan 16, 2022 at 2:43 PM Will Hobbs via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:

> Chathu
>
>
>
> The function rho_mwjf() should really be deprecated, it’s only applicable
> to the Equation of State for the CESM3 version of POP and NOT for
> observations (I would guess that POP has moved on now as well).
>
>
>
> If you’re working with observational data that you should really be using
> TEOS-10 (https://www.teos-10.org) and if you’re working with a model then
> strictly speaking you should track down the EoS for that model (which is
> likely a simplified version of TEOS-19).
>
>
>
> If you’re really wedded to using rho_mwjf(), then double-check that you
> have the correct salinity units. Also, you have to accept that the EoS
> probably doesn’t work that for extreme conditions (for example supercooled
> water near ice shelves), which may explain the erroneous density.
>
>
>
> I did start a few years ago with Dennis on implementing NCL wrappers for
> the fortran TEOS-10 library, but life/work got in the way, and with the
> deprecation of NCL it became a low priority. I’ve attached an NCL library
> of some of the (now obsolete) UNESCO EoS functions – you’re welcome to use
> but AT YOUR OWN RISK.
>
>
>
> Will
>
>
>
> *From: *ncl-talk <ncl-talk-bounces at mailman.ucar.edu> on behalf of
> Chathurika via ncl-talk <ncl-talk at mailman.ucar.edu>
> *Reply to: *Chathurika <chatu at scsio.ac.cn>
> *Date: *Sunday, 16 January 2022 at 12:52 am
> *To: *ncl-talk <ncl-talk at ucar.edu>
> *Subject: *[ncl-talk] rho_mwjf
>
>
>
> Dear NCL users,
>
>
>
> I am really appreciate if you can show me what I is wrong with my script.
> As you know the southern ocean density is around 26-27 as follows at each
> depth level.
>
>
>
> (0) 26.34497
>
> (1) 26.3656
>
> (2) 26.40527
>
> (3) 26.45532
>
> (4) 26.5199
>
> (5) 26.58557
>
> (6) 26.65369
>
> (7) 26.71924
>
> (8) 26.77869
>
> (9) 26.83704
>
> (10) 26.89197
>
> (11) 26.94214
>
> (12) 26.99036
>
> (13) 27.0343
>
> (14) 27.0769
>
> (15) 27.11511
>
> (16) 27.15247
>
> (17) 27.18738
>
> (18) 27.22571
>
> (19) 27.26978
>
> (20) 27.32153
>
> (21) 27.39014
>
> (22) 27.46655
>
> (23) 27.52747
>
> (24) 27.57336
>
> (25) 27.61084
>
> (26) 27.65247
>
> (27) 27.6958
>
> (28) 27.73132
>
> (29) 27.75598
>
> (30) 27.77417
>
> (31) 27.78784
>
> (32) 27.79846
>
> (33) 27.80762
>
> (34) 27.81592
>
> (35) 27.82202
>
> (36) 27.82605
>
> (37) 27.82739
>
> (38) 27.82776
>
> (39) 27.8324
>
>
>
> However, when I calculate the density at each depth levels using rho_mwjf
> (script is attached below), It calculate density which is not reasonable,
> shows;
>
>
>
> (0) 26.3907
>
> (1) 26.4604
>
> (2) 26.54432
>
> (3) 26.6379
>
> (4) 26.74557
>
> (5) 26.85472
>
> (6) 26.97386
>
> (7) 27.10243
>
> (8) 27.24155
>
> (9) 27.40277
>
> (10) 27.58386
>
> (11) 27.78384
>
> (12) 28.00518
>
> (13) 28.24571
>
> (14) 28.5084
>
> (15) 28.79022
>
> (16) 29.09488
>
> (17) 29.43268
>
> (18) 29.82106
>
> (19) 30.26328
>
> (20) 30.76077
>
> (21) 31.32516
>
> (22) 31.94666
>
> (23) 32.59835
>
> (24) 33.27908
>
> (25) 33.99501
>
> (26) 34.78358
>
> (27) 35.64154
>
> (28) 36.53573
>
> (29) 37.46336
>
> (30) 38.45152
>
> (31) 39.54657
>
> (32) 40.74771
>
> (33) 42.0564
>
> (34) 43.53943
>
> (35) 45.23687
>
> (36) 47.14139
>
> (37) 49.24323
>
> (38) 51.43494
>
> (39) 53.81633
>
>
>
> depth from 6 m to 5720 m, 40 levels
>
>
>
> Could please anyone say what am I doing here wrong? if this is not the
> right way to calculate density using temperature and salinity what will be
> the other way? Many many thanks. Please be kind to reply me.
>
>
>
> The script:
>
>
>
> diri=".../salinity/hist/"
> sfile = "salinity.nc"
>
>
> f = addfile(diri+sfile,"r")
> vname=getfilevarnames(f)
> print(vname)
>
>
>   salt           = f->so(:,:,{-25:-70},:)
>   printVarSummary(salt)
>   printMinMax(salt, False)
>
>
>  s_range = dim_avg_n_Wrap(salt, 0)
>  printVarSummary(s_range)
>
>
>  delete(salt)
>
>
> diri=".../temperature/hist/"
> sfile = "temperature.nc"
>
>
> f = addfile(diri+sfile,"r")
> vname=getfilevarnames(f)
> print(vname)
>
>
>   temp           = f->thetao(:,:,{-25:-70},:)
>   printVarSummary(temp)
>   printMinMax(temp, False)
>
>
>  t_range = dim_avg_n_Wrap(temp, 0)
>  printVarSummary(t_range)
>
>
>  delete(temp)
>
>
> depth = (/6, 17,27,37,47,57,68.5,82.5,100,122.5,150,182.5,220\
>    ,262.5,310,362.5,420,485,560,645,740,845,960,1085,1220,1365\
>
>  ,1525,1700,1885,2080,2290,2525,2785,3070,3395,3770,4195,4670,5170,5720/)
>
>
> ndim = dimsizes(t_range)
>
>
> nlev = ndim(0)
> nlat = ndim(1)
> nlon = ndim(2)
>
>
>
>
> rho = new((/nlev,nlat,nlon/), typeof(t_range))
>
>
> do i = 0, nlev-1
>     rho(i,:,:) = rho_mwjf(t_range(i,:,:),s_range(i,:,:),depth(i))
>
> end do
>
>
> copy_VarCoords(t_range, rho)
> rho = 1000.*(rho-1.)
>
>
> printVarSummary(rho)
> printMinMax(rho, True)
>
>
> abc = dim_avg_n_Wrap(rho, (/1,2/))
> printVarSummary(abc)
>
>
> print(abc)
>
>
>
> Thank you and best regards,
>
> Chathu
> ------------------------------
>
>
>
>
>
> *Wickramage Chathurika Hemamali*
>
> *Msc in Physical Oceanography*
>
>
>
>
>
> This email is confidential, and is for the intended recipient only.
> Access, disclosure, copying, distribution, or reliance on any of it by
> anyone outside the intended recipient organisation is prohibited and may be
> a criminal offence. Please delete if obtained in error and email
> confirmation to the sender. The views expressed in this email are not
> necessarily the views of the University of Tasmania, unless clearly
> intended otherwise.
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20220116/1d322ba3/attachment.html>


More information about the ncl-talk mailing list