Skip to content

Commit

Permalink
Merge branch 'main' into features/various_cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ladsmund authored Sep 28, 2023
2 parents 684f2bf + c93cac8 commit fe337a1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
6 changes: 2 additions & 4 deletions src/pypromice/postprocess/wmo_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
'discontinued': ['CEN1','TAS_U','QAS_A','NUK_N','THU_U','JAR','SWC'],
'no_instantaneous': ['ZAK_L','ZAK_U','KAN_B'], # currently not transmitting instantaneous values
'suspect_data': [], # instantaneous data is suspect
'use_v3': ['KPC_L','KPC_U','NUK_U','ZAK_L','ZAK_U','QAS_U','QAS_M','KAN_L'], # use v3 versions instead (but registered IDs are non-v3 names)
'v3_bad': ['QAS_Lv3'] # QAS_Lv3 new ablation sensor & non-standard logger program. Must be addressed in field. Talk to RSF.
# Eventually, as we change all stations to v3, the use_v3 list should be empty (there will not be v3 and non-v3 stations operating together)
# If your remove a station from 'v3_bad', then add it to 'use_v3' if both v2 and v3 stations still exist together
'use_v3': ['KPC_L', 'KPC_U', 'NUK_U', 'ZAK_L', 'ZAK_U', 'QAS_U', 'QAS_L', 'QAS_M', 'KAN_L'], # use v3 versions instead (but registered IDs are non-v3 names)
'v3_bad': []
}
# NOTE: Use both THU_L and THU_L2; use ONLY THU_U2, but register it as THU_U (this is dealt with in csv2bufr.py)
# NOTE: JAR_O and SWC_O are used, but registered as JAR and SWC
Expand Down
15 changes: 9 additions & 6 deletions src/pypromice/process/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from functools import reduce
from importlib import metadata
import os, unittest, toml, datetime, uuid, pkg_resources
from typing import Sequence
from typing import Sequence, Optional

import numpy as np
import warnings
Expand Down Expand Up @@ -248,9 +248,9 @@ def readL0file(self, conf):
ds : xr.Dataset
L0 data
'''
file_version = conf.get('file_version', -1)
ds = getL0(conf['file'], conf['nodata'], conf['columns'],
conf["skiprows"], file_version)
file_version = conf.get('file_version', -1)
ds = getL0(conf['file'], conf['nodata'], conf['columns'],
conf["skiprows"], file_version, time_offset=conf.get('time_offset'))
ds = populateMeta(ds, conf, ["columns", "skiprows", "modem"])
return ds

Expand Down Expand Up @@ -293,7 +293,7 @@ def getConfig(config_file, inpath, default_columns: Sequence[str] = ('msg_lat',
return conf

def getL0(infile, nodata, cols, skiprows, file_version,
delimiter=',', comment='#'):
delimiter=',', comment='#', time_offset: Optional[float] = None) -> xr.Dataset:
''' Read L0 data file into pandas DataFrame object
Parameters
Expand All @@ -312,7 +312,8 @@ def getL0(infile, nodata, cols, skiprows, file_version,
String delimiter for L0 file
comment : str
Notifier of commented sections in L0 file
time_offset : Optional[float]
Time offset in hours for correcting for non utc time data.
Returns
-------
ds : xarray.Dataset
Expand Down Expand Up @@ -355,6 +356,8 @@ def getL0(infile, nodata, cols, skiprows, file_version,
logger.info('\t\t> Trying again removing apostrophes in timestamp (old files format)')
df.index = pd.to_datetime(df.index.str.replace("\"",""))

if time_offset is not None:
df.index = df.index + timedelta(hours=time_offset)

# Drop SKIP columns
for c in df.columns:
Expand Down

0 comments on commit fe337a1

Please sign in to comment.