Skip to content

Commit

Permalink
Check for pressure
Browse files Browse the repository at this point in the history
  • Loading branch information
cproof committed Aug 31, 2024
1 parent 79cc246 commit c268bc9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pyglider/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ def get_profiles(ds, min_dp=10.0, inversion=3., filt_length=7,
make two variables: profile_direction and profile_index; this version
is good for lots of data. Less good for sparse data
"""
if 'pressure' not in ds:
_log.warning('No "pressure" variable in the data set; not searching for profiles')
return ds
profile = ds.pressure.values * np.nan
direction = ds.pressure.values * np.nan
pronum = 1
Expand Down Expand Up @@ -162,6 +165,10 @@ def get_profiles_new(ds, min_dp=10.0, filt_time=100, profile_min_time=300):
Minimum time length of profile in s.
"""

if 'pressure' not in ds:
_log.warning('No "pressure" variable in the data set; not searching for profiles')
return ds

profile = ds.pressure.values * 0
direction = ds.pressure.values * 0
pronum = 1
Expand Down Expand Up @@ -230,7 +237,6 @@ def get_profiles_new(ds, min_dp=10.0, filt_time=100, profile_min_time=300):
direction[ins] = -1
pronum += 1

_log.debug('Doing this...')
attrs = collections.OrderedDict([
('long_name', 'profile index'),
('units', '1'),
Expand Down

0 comments on commit c268bc9

Please sign in to comment.