Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions configs/wc_sc_agg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"project_name": "MyProject",
"directory": "~/review_datasets/test/"

}
4 changes: 4 additions & 0 deletions configs/wtdb_test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"project_name": "WTDB Test",
"directory": "~/review_datasets/wtdb"
}
27 changes: 19 additions & 8 deletions reView/components/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
)



def make_view(df):
"""Return an updated center view object for mapbox."""
layout = copy.deepcopy(MAP_LAYOUT)
Expand Down Expand Up @@ -381,13 +380,24 @@ def figure(self, point_size, reverse_color=False):
figure.update_traces(marker=self.marker(point_size, reverse_color))
else:
# Create data object
figure = px.scatter_mapbox(
data_frame=self.df,
lon="longitude",
lat="latitude",
custom_data=["sc_point_gid", self.capcol],
hover_name="text",
)
if "p_name" in self.df:
figure = px.scatter_mapbox(
data_frame=self.df,
lon="longitude",
lat="latitude",
# custom_data=["sc_point_gid", self.capcol],
hover_name="p_name",
hover_data="built_capacity"
)
else:
figure = px.scatter_mapbox(
data_frame=self.df,
lon="longitude",
lat="latitude",
# custom_data=["sc_point_gid", self.capcol],
hover_name="sc_point_gid",
hover_data="built_capacity"
)

figure.update_traces(
marker=self.marker(point_size, reverse_color)
Expand Down Expand Up @@ -435,6 +445,7 @@ def hover_text(self):
df.loc[df["state"] != "nan", "state"] = \
df["state"] + ":"
else:
# print(df)
df.loc[:, "state"] = ""

if "county" in df:
Expand Down
27,842 changes: 27,842 additions & 0 deletions reView/data/reeds/pvdb_data_done1.csv

Large diffs are not rendered by default.

21,911 changes: 21,911 additions & 0 deletions reView/data/reeds/wtdb_data_filt2.csv

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions reView/pages/reeds/controller/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ def figure_map_reeds(
point_size=point_size,
reverse_color=reverse_color_clicks % 2 == 1,
)

mapcap = df[["sc_point_gid", "capacity"]].to_dict()
# removed sc_point_gid from 155
mapcap = df[["capacity"]].to_dict()

return figure, json.dumps(mapcap)

Expand Down
3 changes: 3 additions & 0 deletions reView/pages/reeds/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
def cache_reeds(path, year):
"""Create table of single year buildout."""
df = pd.read_csv(path)
# years = df["year"].values
# if year not in range(min(years.tolist()), max(years.tolist())+1):
# print(f"{path} does not have data for year : {year}")
if year not in df["year"].values:
df = df[df["year"] == year - 1]
else:
Expand Down
9 changes: 4 additions & 5 deletions reView/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import h5py
import pandas as pd
import pyarrow as pa
import pyarrow as pa

from pyarrow.parquet import ParquetFile

Expand Down Expand Up @@ -111,8 +111,8 @@ def read_rev(fpath, nrows=None):
if Path(fpath).name.endswith("parquet"):
if nrows:
pf = ParquetFile(fpath)
nrows = next(pf.iter_batches(batch_size=nrows))
sc = pa.Table.from_batches([nrows]).to_pandas()
nrows = next(pf.iter_batches(batch_size=nrows))
sc = pa.Table.from_batches([nrows]).to_pandas()
else:
sc = pd.read_parquet(fpath)
elif Path(fpath).name.endswith("csv"):
Expand Down Expand Up @@ -310,7 +310,7 @@ def all_files(self):
pfiles = self.directory.rglob("*.parquet")
hfiles = self.directory.rglob("*.h5")
files = chain(cfiles, pfiles, hfiles)
yield from files
yield from files

def _check_required_keys_exist(self):
"""Ensure all required keys are present in config file."""
Expand Down Expand Up @@ -345,7 +345,6 @@ def _project_files(self):
for file in self.all_files:
scenario = strip_rev_filename_endings(file.name)
if scenario.endswith(".csv"):
print(scenario)
continue
yield scenario, file

Expand Down
1 change: 0 additions & 1 deletion reView/utils/scripts/adjust_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

def adjust(file):
"""Separate lease/capacity rates, calculate total charge."""
print(file)
df = pd.read_csv(file)
df = df[KEEPERS]
del df["lbnl_upv_1km_buffer"]
Expand Down