Skip to content

Commit

Permalink
Use raw strings for sep (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
dnowacki-usgs authored May 29, 2024
1 parent 6cb7771 commit a2cdea1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions stglib/aqd/hdr2cdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def load_sen(basefile):
SEN = pd.read_csv(
senfile,
header=None,
sep="\s+",
sep=r"\s+",
usecols=[0, 1, 2, 3, 4, 5, 8, 10, 11, 12, 13, 14, 15, 16],
)

Expand Down Expand Up @@ -119,7 +119,7 @@ def load_amp_vel(RAW, basefile):

for n in [1, 2, 3]:
afile = basefile + ".a" + str(n)
a = pd.read_csv(afile, header=None, sep="\s+")
a = pd.read_csv(afile, header=None, sep=r"\s+")

if "bindist" in RAW:
coords = [RAW["time"], RAW["bindist"]]
Expand All @@ -129,7 +129,7 @@ def load_amp_vel(RAW, basefile):
RAW["AMP" + str(n)] = xr.DataArray(a, dims=("time", "bindist"), coords=coords)

vfile = basefile + ".v" + str(n)
v = pd.read_csv(vfile, header=None, sep="\s+")
v = pd.read_csv(vfile, header=None, sep=r"\s+")

if RAW.attrs["AQDCoordinateSystem"] == "BEAM":
thevars = {1: "VEL1", 2: "VEL2", 3: "VEL3"}
Expand Down
8 changes: 4 additions & 4 deletions stglib/aqd/hrhdr2cdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def load_sen(ds):
SEN = pd.read_csv(
senfile,
header=None,
sep="\s+",
sep=r"\s+",
usecols=[0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 18],
)

Expand Down Expand Up @@ -142,7 +142,7 @@ def load_amp_vel_cor(RAW, basefile):

for n in [1, 2, 3]:
afile = basefile + ".a" + str(n)
a = pd.read_csv(afile, header=None, sep="\s+")
a = pd.read_csv(afile, header=None, sep=r"\s+")

spb = int(RAW.attrs["AQDHRSamplesPerBurst"])

Expand All @@ -160,7 +160,7 @@ def load_amp_vel_cor(RAW, basefile):
)

vfile = basefile + ".v" + str(n)
v = pd.read_csv(vfile, header=None, sep="\s+")
v = pd.read_csv(vfile, header=None, sep=r"\s+")

if RAW.attrs["AQDHRCoordinateSystem"] == "BEAM":
thevars = {1: "VEL1", 2: "VEL2", 3: "VEL3"}
Expand All @@ -177,7 +177,7 @@ def load_amp_vel_cor(RAW, basefile):

try:
cfile = basefile + ".c" + str(n)
c = pd.read_csv(cfile, header=None, sep="\s+")
c = pd.read_csv(cfile, header=None, sep=r"\s+")

spb = int(RAW.attrs["AQDHRSamplesPerBurst"])

Expand Down
4 changes: 2 additions & 2 deletions stglib/aqd/wvswad2cdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def load_whd(metadata):
WHD = pd.read_csv(
whdfile,
header=None,
sep="\s+",
sep=r"\s+",
usecols=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20],
)

Expand Down Expand Up @@ -150,7 +150,7 @@ def load_wad(ds):
wadfile = ds.attrs["basefile"] + ".wad"
print("Loading wave data from " + wadfile + "; this may take some time")
# pd.read_csv is ~10x faster than np.loadtxt or np.genfromtxt
WAD = pd.read_csv(wadfile, header=None, sep="\s+").values
WAD = pd.read_csv(wadfile, header=None, sep=r"\s+").values

r, c = np.shape(WAD)
print(wadfile + " has " + str(r) + " rows and " + str(c) + " columns")
Expand Down
8 changes: 4 additions & 4 deletions stglib/argonaut.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
def read_dat_raw(filnam):
df = pd.read_csv(
filnam,
sep="\s+",
sep=r"\s+",
parse_dates={"time": ["Year", "Month", "Day", "Hour", "Minute", "Second"]},
date_format="%Y %m %d %H %M %S",
)
Expand Down Expand Up @@ -44,7 +44,7 @@ def rename_columns(df):
def read_vel_snr_std(filbase):
df = pd.read_csv(
filbase + ".vel",
sep="\s+",
sep=r"\s+",
header=[0, 1],
parse_dates=[[1, 2, 3, 4, 5, 6]],
date_format="%Y %m %d %H %M %S",
Expand Down Expand Up @@ -92,7 +92,7 @@ def read_vel_snr_std(filbase):

snr = pd.read_csv(
filbase + ".snr",
sep="\s+",
sep=r"\s+",
header=[0, 1],
parse_dates=[[1, 2, 3, 4, 5, 6]],
date_format="%Y %m %d %H %M %S",
Expand All @@ -110,7 +110,7 @@ def read_vel_snr_std(filbase):

std = pd.read_csv(
filbase + ".std",
sep="\s+",
sep=r"\s+",
header=[0, 1],
parse_dates=[[1, 2, 3, 4, 5, 6]],
date_format="%Y %m %d %H %M %S",
Expand Down

0 comments on commit a2cdea1

Please sign in to comment.