Skip to content

Commit

Permalink
different decoding of GPS data if "L" is in GPS string
Browse files Browse the repository at this point in the history
  • Loading branch information
BaptisteVandecrux committed Aug 15, 2024
1 parent 777c5e8 commit 2dbf0f1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/pypromice/process/L0toL1.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,15 @@ def toL1(L0, vars_df, T_0=273.15, tilt_threshold=-100):
if ds['gps_lat'].dtype.kind == 'O': # Decode and reformat GPS information
if 'NH' in ds['gps_lat'].dropna(dim='time').values[1]:
ds = decodeGPS(ds, ['gps_lat','gps_lon','gps_time'])
elif 'L' in ds['gps_lat'].dropna(dim='time').values[1]:
logger.info('Found L in GPS string')
ds = decodeGPS(ds, ['gps_lat','gps_lon','gps_time'])
for l in ['gps_lat', 'gps_lon']:
ds[l] = ds[l]/100000
else:
try:
ds = decodeGPS(ds, ['gps_lat','gps_lon','gps_time']) # TODO this is a work around specifically for L0 RAW processing for THU_U. Find a way to make this slicker

except:
print('Invalid GPS type {ds["gps_lat"].dtype} for decoding')

Expand Down Expand Up @@ -180,7 +186,7 @@ def addTimeShift(ds, vars_df):
if ds.attrs['logger_type'] == 'CR1000X':
# v3, data is hourly all year long
# shift everything except instantaneous
df_a = df_a.shift(periods=-1, freq="H")
df_a = df_a.shift(periods=-1, freq="h")
df_out = pd.concat([df_a, df_i], axis=1) # different columns, same datetime indices
df_out = df_out.sort_index()
elif ds.attrs['logger_type'] == 'CR1000':
Expand Down

0 comments on commit 2dbf0f1

Please sign in to comment.