Skip to content

Commit 86edaed

Browse files
committed
Merge pull request #29 from ocefpaf/soundspeed
Soundspeed
2 parents 7532cc0 + c81051e commit 86edaed

File tree

4 files changed

+10
-29
lines changed

4 files changed

+10
-29
lines changed

CHANGES.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
Changelog
22
---------
33

4+
Version 0.2.4, 05-May-2015.
5+
6+
* Added `woa_profile`.
7+
* Re-write of `woa_subset` to use iris instead of Pandas.
8+
* Deprecate 'state' option in soundspeed.
9+
410
Version 0.2.3, 23-Jan-2015.
511

6-
* Unpinned version in setup.py.
712
* Several small bugs and typos fixes.
813

914
Version 0.2.2, 18-Aug-2014.

oceans/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
__version__ = '0.2.3'
3+
__version__ = '0.2.4'
44

55
__all__ = ['RPSstuff',
66
'datasets',

oceans/datasets/datasets.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# e-mail: ocefpaf@gmail
88
# web: http://ocefpaf.tiddlyspot.com/
99
# created: 09-Sep-2011
10-
# modified: Mon 04 May 2015 02:30:43 PM BRT
10+
# modified: Mon 04 May 2015 05:44:40 PM BRT
1111
#
1212
# obs: some Functions were based on:
1313
# http://www.trondkristiansen.com/?page_id=1071
@@ -92,8 +92,6 @@ def woa_subset(bbox=[2.5, 357.5, -87.5, 87.5], variable='temperature',
9292
... gl.yformatter = LATITUDE_FORMATTER
9393
... return fig, ax
9494
>>> # Extract a 2D surface -- Annual temperature climatology:
95-
>>> import numpy as np
96-
>>> import numpy.ma as ma
9795
>>> import matplotlib.pyplot as plt
9896
>>> from oceans.ff_tools import wrap_lon180
9997
>>> from oceans.colormaps import cm, get_color
@@ -154,7 +152,7 @@ def woa_subset(bbox=[2.5, 357.5, -87.5, 87.5], variable='temperature',
154152
cubes = iris.load_raw(url)
155153
cubes = [cube.intersection(longitude=(bbox[0], bbox[1]),
156154
latitude=(bbox[2], bbox[3])) for cube in cubes]
157-
155+
cubes = iris.cube.CubeList(cubes)
158156
if full:
159157
return cubes
160158
else:
@@ -225,7 +223,7 @@ def woa_profile(lon, lat, variable='temperature', clim_type='00',
225223
cubes = [extract_nearest_neighbour(cube, [('longitude', lon),
226224
('latitude', lat)])
227225
for cube in cubes]
228-
226+
cubes = iris.cube.CubeList(cubes)
229227
if full:
230228
return cubes
231229
else:

oceans/sw_extras/sw_extras.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -620,14 +620,6 @@ def psu2ppt(psu):
620620
psu ** 2 + a[6] * psu ** 2.5)
621621

622622

623-
def swstate():
624-
pass
625-
626-
627-
def adiabattempgrad():
628-
pass
629-
630-
631623
def soundspeed(S, T, D, equation='mackenzie'):
632624
"""Various sound-speed equations.
633625
1) soundspeed(s, t, d) returns the sound speed (m/sec) given vectors
@@ -721,20 +713,6 @@ def soundspeed(S, T, D, equation='mackenzie'):
721713
C = ((C3 * P + C2) * P + C1) * P + C0
722714
# SOUND SPEED RETURN.
723715
ssp = C + (A + B * SR + D * S) * S
724-
elif equation == 'state':
725-
raise TypeError("Not implemented!")
726-
P = D
727-
# Copied somewhat from program EOSSPEED.F
728-
svan, sigma = swstate(S, T, P)
729-
VOL = (1.) / (1000. + sigma)
730-
# DV/DP|ADIA = (DV/DP) AT CONSTANT T + ADIA.LAPSE RATE *
731-
# (DV/DT) AT CONSTANT P
732-
# Note: factor of 10 is convert pressure from dB to Bars.
733-
dVdP = swstate(S, T, P, 'dP')
734-
dVdT = swstate(S, T, P, 'dT')
735-
dVdPad = (dVdP + adiabattempgrad(S, T, P) * dVdT) * 10
736-
# C = V * SQRT ( 1/DV/DP| ADIA)
737-
ssp = VOL * np.sqrt(np.abs((1.e5) / dVdPad))
738716
else:
739717
raise TypeError('Unrecognizable equation specified: %s' % equation)
740718
return ssp

0 commit comments

Comments
 (0)