Skip to content

Commit

Permalink
bug fix for profile reading in up direction
Browse files Browse the repository at this point in the history
  • Loading branch information
giumas committed Nov 1, 2018
1 parent 3e9f02b commit 22b21c3
Show file tree
Hide file tree
Showing 7 changed files with 243,790 additions and 7 deletions.
243,734 changes: 243,734 additions & 0 deletions data/input/seabird/EX1811_DIVE01_20181031_ROVCTD.cnv

Large diffs are not rendered by default.

50 changes: 49 additions & 1 deletion freeze/SoundSpeedManager.1folder.spec
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
#
# It may be required to manually copy mkl_avx.dll or mkl_p4.dll or msvcr100.dll

import sys, os
from PyInstaller.building.build_main import Analysis, PYZ, EXE, COLLECT, BUNDLE, TOC
from PyInstaller import is_darwin
from PyInstaller.compat import is_darwin, is_win

from hyo.soundspeed import __version__ as ssm_version

Expand Down Expand Up @@ -40,6 +41,52 @@ def collect_pkg_data(package, include_py_files=False, subdir=None):

return data_toc


def python_path() -> str:
""" Return the python site-specific directory prefix (PyInstaller-aware) """

# required by PyInstaller
if hasattr(sys, '_MEIPASS'):

if is_win():
import win32api
# noinspection PyProtectedMember
sys_prefix = win32api.GetLongPathName(sys._MEIPASS)
else:
# noinspection PyProtectedMember
sys_prefix = sys._MEIPASS

print("using _MEIPASS: %s" % sys_prefix)
return sys_prefix

# check if in a virtual environment
if hasattr(sys, 'real_prefix'):
return sys.real_prefix

return sys.prefix


def collect_folder_data(input_data_folder: str, relative_output_folder: str):

data_toc = TOC()
if not os.path.exists(input_data_folder):
print("issue with folder: %s" % input_data_folder)
return data_toc

for dir_path, dir_names, files in os.walk(input_data_folder):
for f in files:
source_file = os.path.join(dir_path, f)
dest_file = os.path.join(relative_output_folder, f)
data_toc.append((dest_file, source_file, 'DATA'))
break

return data_toc


share_folder = os.path.join(python_path(), "Library", "share")
output_folder = os.path.join("Library", "share")
pyproj_data = collect_folder_data(input_data_folder=share_folder, relative_output_folder=output_folder)

pkg_data = collect_pkg_data('hyo.soundspeedmanager')
pkg_data_2 = collect_pkg_data('hyo.soundspeedsettings')
pkg_data_3 = collect_pkg_data('gsw.utilities')
Expand Down Expand Up @@ -80,6 +127,7 @@ coll = COLLECT(exe,
pkg_data_3,
pkg_data_4,
pkg_data_5,
pyproj_data,
strip=None,
upx=True,
name='SoundSpeedManager.%s' % ssm_version)
2 changes: 1 addition & 1 deletion hyo/soundspeed/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
log = logging.getLogger(__name__)
log.addHandler(logging.NullHandler())

__version__ = '2018.1.46'
__version__ = '2018.1.47'
__doc__ = "Sound Speed"
__author__ = '[email protected]; [email protected]; [email protected]; ' \
'[email protected]'
Expand Down
5 changes: 3 additions & 2 deletions hyo/soundspeed/profile/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ def reduce_up_down(self, ssp_direction, use_pressure=False):

elif ssp_direction == Dicts.ssp_directions['down'] and not max_reached:

if i != 0:
if (i != 0) and (last_value is not None):
if value <= last_value:
# print(last_value, value)
self.data.flag[i] = Dicts.flags['direction'] # set invalid for direction
Expand All @@ -563,7 +563,7 @@ def reduce_up_down(self, ssp_direction, use_pressure=False):

elif ssp_direction == Dicts.ssp_directions['up'] and max_reached:

if i != 0:
if (i != 0) and (last_value is not None):
if value >= last_value:
self.data.flag[i] = Dicts.flags['direction'] # set invalid for direction
else:
Expand All @@ -573,6 +573,7 @@ def reduce_up_down(self, ssp_direction, use_pressure=False):

if value == max_value:
max_reached = True
last_value = value

def calc_salinity_from_conductivity(self):
if np.count_nonzero(self.data.pressure):
Expand Down
2 changes: 1 addition & 1 deletion hyo/soundspeedmanager/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())

__version__ = '2018.1.46'
__version__ = '2018.1.47'
__doc__ = "Sound Speed Manager"
__author__ = '[email protected]; [email protected]; [email protected]; ' \
'[email protected]'
Expand Down
2 changes: 1 addition & 1 deletion hyo/soundspeedsettings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())

__version__ = '2018.1.46'
__version__ = '2018.1.47'
__doc__ = "Sound Speed Settings"
__author__ = '[email protected]; [email protected]; [email protected]; ' \
'[email protected]'
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def txt_read(*paths):
setup_args = dict()

setup_args['name'] = 'hyo.soundspeed'
setup_args['version'] = '2018.1.46'
setup_args['version'] = '2018.1.47'
setup_args['url'] = 'https://bitbucket.org/ccomjhc/hyo_soundspeed/'
setup_args['license'] = 'LGPLv2.1 or CCOM-UNH Industrial Associate license'
setup_args['author'] = 'Giuseppe Masetti(UNH,CCOM); Barry Gallagher(NOAA,OCS); ' \
Expand Down

0 comments on commit 22b21c3

Please sign in to comment.