Skip to content

Commit fbee61f

Browse files
committed
sort table going into Accumulation, modify UpCat column naming
1 parent ead7ba2 commit fbee61f

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

StreamCat.py

+4
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@
154154
cat = appendConnectors(cat, Connector, zone, inter_vpu)
155155
accum = np.load("accum_npy/bastards/accum_%s.npz" % zone)
156156

157+
cat.COMID = cat.COMID.astype(accum["comids"].dtype)
158+
cat.set_index("COMID",inplace=True)
159+
cat = cat.loc[accum["comids"]].reset_index().copy()
160+
157161
up = Accumulation(
158162
cat, accum["comids"], accum["lengths"], accum["upstream"], "Up"
159163
)

StreamCat_functions.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -817,9 +817,8 @@ def Accumulation(tbl, comids, lengths, upstream, tbl_type, icol="COMID"):
817817
data[:, index] = values
818818
data = data[np.in1d(data[:, 0], coms), :] # Remove the extra comids
819819
outDF = pd.DataFrame(data)
820-
outDF.columns = np.append(
821-
icol, map(lambda x: x.replace("Cat", tbl_type), cols.values)
822-
)
820+
prefix = "UpCat" if tbl_type == "Up" else "Ws"
821+
outDF.columns = [icol] + [c.replace("Cat", prefix) for c in cols.tolist()]
823822
areaName = outDF.columns[outDF.columns.str.contains("Area")][0]
824823
# identifies that there is no area in catchment mask,
825824
# then NA values for everything past Area, covers upcats w. no area AND

0 commit comments

Comments
 (0)