Skip to content

Commit

Permalink
sort table going into Accumulation, modify UpCat column naming
Browse files Browse the repository at this point in the history
  • Loading branch information
debboutr committed Jan 25, 2021
1 parent ead7ba2 commit fbee61f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 4 additions & 0 deletions StreamCat.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@
cat = appendConnectors(cat, Connector, zone, inter_vpu)
accum = np.load("accum_npy/bastards/accum_%s.npz" % zone)

cat.COMID = cat.COMID.astype(accum["comids"].dtype)
cat.set_index("COMID",inplace=True)
cat = cat.loc[accum["comids"]].reset_index().copy()

up = Accumulation(
cat, accum["comids"], accum["lengths"], accum["upstream"], "Up"
)
Expand Down
5 changes: 2 additions & 3 deletions StreamCat_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,9 +817,8 @@ def Accumulation(tbl, comids, lengths, upstream, tbl_type, icol="COMID"):
data[:, index] = values
data = data[np.in1d(data[:, 0], coms), :] # Remove the extra comids
outDF = pd.DataFrame(data)
outDF.columns = np.append(
icol, map(lambda x: x.replace("Cat", tbl_type), cols.values)
)
prefix = "UpCat" if tbl_type == "Up" else "Ws"
outDF.columns = [icol] + [c.replace("Cat", prefix) for c in cols.tolist()]
areaName = outDF.columns[outDF.columns.str.contains("Area")][0]
# identifies that there is no area in catchment mask,
# then NA values for everything past Area, covers upcats w. no area AND
Expand Down

0 comments on commit fbee61f

Please sign in to comment.