Skip to content

Commit

Permalink
Merge pull request #133 from intelligent-environments-lab/datasets-no…
Browse files Browse the repository at this point in the history
…t-in-installation

Datasets not in installation
  • Loading branch information
kingsleynweye authored Nov 7, 2024
2 parents 9124a44 + 2a40ce1 commit 5ceb46f
Show file tree
Hide file tree
Showing 975 changed files with 572 additions and 384 deletions.
12 changes: 0 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,6 @@ cython_debug/
# MacOS
.DS_Store

# do not track data
data/cc2022_d1/*
cc2022_staging/*

# track schema
!data/*/schema.json

# do not track docs for now
docs/build/*
docs/_build/*
Expand All @@ -179,10 +172,5 @@ examples/*
!examples/*.py
!examples/*.ipynb

# test files
reward_exploration_simulation_output/
reward_exploration.sh
test_notebooks/

# ignore folder
.ignore
4 changes: 1 addition & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
include citylearn/assets/*
recursive-include citylearn/data *
recursive-include citylearn/misc *
include citylearn/assets/*
2 changes: 1 addition & 1 deletion citylearn/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ def main():
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
help='Lists available dataset names that can be parsed as `schema` in `citylearn simulate schema`.'
)
subparser_datasets.set_defaults(func=DataSet.get_names)
subparser_datasets.set_defaults(func=DataSet().get_dataset_names)

# get default time series variables
subparser_time_series_variables = subparsers.add_parser(
Expand Down
1 change: 1 addition & 0 deletions citylearn/building.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from citylearn.preprocessing import Normalize, PeriodicNormalization

LOGGER = logging.getLogger()
logging.basicConfig(level=logging.INFO)

class Building(Environment):
r"""Base class for building.
Expand Down
11 changes: 7 additions & 4 deletions citylearn/citylearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,14 +747,16 @@ def power_outage(self) -> np.ndarray:

@schema.setter
def schema(self, schema: Union[str, Path, Mapping[str, Any]]):
dataset = DataSet()

if isinstance(schema, (str, Path)) and os.path.isfile(schema):
schema_filepath = Path(schema) if isinstance(schema, str) else schema
schema = read_json(schema)
schema['root_directory'] = os.path.split(schema_filepath.absolute())[0] if schema['root_directory'] is None\
else schema['root_directory']

elif isinstance(schema, str) and schema in DataSet.get_names():
schema = DataSet.get_schema(schema)
elif isinstance(schema, str) and schema in dataset.get_dataset_names():
schema = dataset.get_schema(schema)
schema['root_directory'] = '' if schema['root_directory'] is None else schema['root_directory']

elif isinstance(schema, dict):
Expand Down Expand Up @@ -1395,8 +1397,9 @@ def _load(self, schema: Mapping[str, Any], **kwargs) -> Tuple[Union[Path, str],
episode_tracker = EpisodeTracker(schema['simulation_start_time_step'], schema['simulation_end_time_step'])

# get sizing data to reduce read time
pv_sizing_data = EnergySimulation.get_pv_sizing_data()
battery_sizing_data = EnergySimulation.get_battery_sizing_data()
dataset = DataSet()
pv_sizing_data = dataset.get_pv_sizing_data()
battery_sizing_data = dataset.get_battery_sizing_data()

# get buildings to include
buildings_to_include = list(schema['buildings'].keys())
Expand Down
Loading

0 comments on commit 5ceb46f

Please sign in to comment.