[Thread Prev][Thread Next][Index]
Re: [ferret_users] converting depth cordinated into density (sigma) cordinate
Thanks for that useful code.
One suggestion. It is helpful to define pi exactly: LET PI=4*atan(1)
Then you can do calculations with the variable PI instead of writing numbers like 57.29578. It help reduce typos.
I have a file "redefine.go" which does this (and other useful numbers). redefine.go is the single line:
let pi=4*atan(1); let deg=111198.6; let twomega=1.458e-4; let beta=2.28e-11
Then if I want to clear out a mess of definitions, I can just
yes? can var/all
yes? go redefine.go ! restore basic definitions
This stuff can also be scripted to run automatically whenever you start a ferret session.
Billy
> On Jan 20, 2017, at 11:49 AM, James Orr <James.Orr@xxxxxxxxxxxx> wrote:
>
> If you really want to convert pressure to depth, see the paper by
>
> Saunders P.M., Fofonoff N.P. (1976): Conversion of pressure to depth in the ocean. Deep-Sea Res. 23:109-111.
>
> Here is a code snippet to do that conversion in Ferret:
>
> ! Input for pressure-to-depth conversion
> let lat = -30 ! latitude in degrees (30S, same result as 30N)
> let P = 10000 ! hydrostatic pressure in decibars
>
> ! Saunders & Fofonoff algorithm to compute depth (m) from pressure (db)
> let alat = abs(lat)
> let a = sin(alat / 57.29578)
> let xx = a * a
> let gr = 9.780318 * (1.0 + (5.2788E-3 + 2.36E-5 * xx) * xx) + 1.092E-6 * P
> let depthterm = (((-1.82E-15 * P + 2.279E-10) * P - 2.2512E-5) * P + 9.72659) * P
> let depth = depthterm / gr
> list depth
>
> The corresponding code in Fortran is available in a 1983 report from UNESCO (see page 28):
>
> UNESCO (1983): Algorithms for computation of fundamental properties of seawater. UNESCO technical papers in marine science 44:1-55.
>
> http://unesdoc.unesco.org/images/0005/000598/059832eb.pdf
>
> Cheers,
>
> Jim
>
> On Wed, 18 Jan 2017, binny ra wrote:
>
>> Hi Ryo, Ansley and Ferreters
>> As of now its very difficult for me to get Z axis in meters from Z axis of dbars but what I can do is this:-
>> suppose I am having two NC files
>> salt_pressure.nc !! salinity in unit of dbars axis
>> salt_meter.nc !! salinity in units of meter axis
>> so can I do like this to get salinity in the Z axis of units of meter
>> let salt_new_meter=salt_pressure[gz=salt_meter]
>> so in this way I am replacing the Z axis of dbars from Z axis of meters. Is this the way I can use to get my
>> desired results ?
>> regards, binny
>> On Wed, Jan 18, 2017 at 1:09 PM, Ryo Furue <furue@xxxxxxxxxx> wrote:
>> Hi Binny, Ansley, and ferret users,
>>
>> On Wed, Jan 18, 2017 at 5:32 AM, Ansley C. Manke
>> <ansley.b.manke@xxxxxxxx> wrote:
>>
>> > The method would be the same. You need an expression that relates the units
>> > of Z axis to the other; it doesn't matter what is being converted to what.
>>
>> I agree, but one issue that may not be obvious when you want to
>> convert to the z axis, is how to find the "z field". In the
>> z-to-sigma (z-to-density) conversion of the 3D variable salt
>>
>> ZAXREPLACE( salt, sigma, z[gz=axden]) ,
>>
>> you need the 3D variable sigma(x,y,z). To convert a 3D variable
>> salt(x,y,p) to the z axis, one needs the 3D "z field" z3d(x,y,p),
>> which is the depth of the isobaric surface p at (x,y). If you have
>> such a variable, then the conversion would be
>>
>> ZAXREPLACE(salt, z3d, z[gz=z_axis]) .
>>
>> You can compute z3d using the hydrostatic relation dp/dz = - rho z if
>> you know density.
>>
>> HAVING SAID THAT, is this really what you are after, Binny?
>>
>> Normally, pressure-to-z conversion is just to "re-interpret" the
>> vertical axis: You equate 10 dbar to 10 meters, for example. If this
>> re-interpretation is fine, all you need is
>>
>> define axis/z= . . . ./units=meters z_axis
>> let salt_in_z = salt_in_p[gz=z_axis@ASN]
>>
>> See
>> http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/Grids-Regions/GRIDS#_VPINDEXENTRY_663
>> for the @ASN transformation. There is an example down the webpage.
>>
>> Regards,
>>
>> Ryo
>>
>
> --
> LSCE/IPSL, Laboratoire des Sciences du Climat et de l'Environnement
> CEA-CNRS-UVSQ
>
> LSCE/IPSL, CEA Saclay http://www.ipsl.jussieu.fr/~jomce
> Bat. 712 - Orme mailto: James.Orr@xxxxxxxxxxxx
> Point courrier 132
> F-91191 Gif-sur-Yvette Cedex Phone: (33) (0)1 69 08 39 73
> FRANCE Fax: (33) (0)1 69 08 30 73
[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce /
NOAA /
OAR /
PMEL /
Ferret
Privacy Policy | Disclaimer | Accessibility Statement