Skip to content

Commit

Permalink
Merge pull request #347 from singularity-energy/development
Browse files Browse the repository at this point in the history
v0.3.3
  • Loading branch information
grgmiller authored Feb 27, 2024
2 parents f265b3d + 906d9f0 commit 7663993
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 33 deletions.
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ authors:
identifiers:
- type: doi
value: 'https://zenodo.org/doi/10.5281/zenodo.7062459'
version: 0.3.2
version: 0.3.3
license: MIT
date-released: '2024-02-14'
date-released: '2024-02-27'
39 changes: 25 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,9 @@ Please check out [our documentation](https://docs.singularity.energy/docs/open-g
The Open Grid Emissions Dataset can be [downloaded here](https://singularity.energy/open-grid-emissions). An archive of previous versions of the dataset and intermediate data outputs (for research and validation purposes) can be found on [Zenodo](https://zenodo.org/communities/singularity-energy?page=1&size=20).

## Installing and running the data pipeline
A couple of installation methods are available. First, navigate to the folder where you want to save the repository and run the following commands:
To manage the code environment necessary to run the OGE data pipeline, either `pipenv` or `conda` may be used. Currently, we utilize `pipenv` as our preferred environment manager for running the pipeline that is used for data releases, but `conda` will also work if you are more familiar with `conda`.

### If you are using conda
```bash
conda install git
git clone https://github.com/singularity-energy/open-grid-emissions.git
conda update conda
cd open-grid-emissions
conda env create -f environment.yml
conda activate open_grid_emissions
```
First, navigate to the folder where you want to save the repository and run the following commands:

### If you are using pipenv
Note that this option requires to have Python and git installed on your machine.
Expand All @@ -35,6 +27,19 @@ python -m build
pip install .
```

### If you are using conda
```bash
conda install git
git clone https://github.com/singularity-energy/open-grid-emissions.git
conda update conda
cd open-grid-emissions
conda env create -f environment.yml
conda activate open_grid_emissions
pip install build
python -m build
pip install .
```

The pipeline can be run as follows:
```bash
cd src/oge
Expand Down Expand Up @@ -133,11 +138,17 @@ Open anaconda prompt, use `cd` to navigate to the directory where your local fil
conda update conda
conda env create -f environment.yml
```
and activate the environment:
Installation requires that the conda channel-priority be set to "flexible". This is the default behavior, so if you've never manually changed this, you shouldn't have to worry about this. However, if you receive an error message like "Found conflicts!" when trying to install the environment, try setting your channel priority to flexible by running the following command:`conda config --set channel_priority flexible` and then re-running the above commands.

The final step is to install the `oge` package itself in the conda environment. To do so, run:
```bash
conda activate open_grid_emissions
pip install build
python -m build
pip install --editable .
```
Installation requires that the conda channel-priority be set to "flexible". This is the default behavior, so if you've never manually changed this, you shouldn't have to worry about this. However, if you receive an error message like "Found conflicts!" when trying to install the environment, try setting your channel priority to flexible by running the following command:`conda config --set channel_priority flexible` and then re-running the above commands.

The open_grid_emissions conda environment should now be set up and ready to run.

### Setup with pipenv
#### Install python and git
Expand Down Expand Up @@ -182,9 +193,9 @@ pip install –-editable .
If you ever need to remove and reinstall the environment, run `pipenv --rm` from the root directory then follow the directions above.

### Running the complete data pipeline
If you would like to run the full data pipeline to generate all intermediate outputs and results files, navigate to `open-grid-emissions/src`, and run the following (replacing 2021 with whichever year you want to run):
If you would like to run the full data pipeline to generate all intermediate outputs and results files, navigate to `open-grid-emissions/src/oge`, and run the following (replacing 2022 with whichever year you want to run):
```
python data_pipeline.py --year 2021
python data_pipeline.py --year 2022
```

### Keeping the code updated
Expand Down
18 changes: 7 additions & 11 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,30 @@ channels:
- defaults
- conda-forge
dependencies:
- blas=*=openblas # prevent mkl implementation of blas
- cvxopt
- cvxpy=1.2.1 # used by gridemissions, newer version not working as of 12/12/2022
- cvxpy
- osqp
- ipykernel
- nomkl # prevent mkl implementation of blas
- notebook
- numpy
- openpyxl
- pandas
- pandas>=2.0
- pip
- plotly
- pyarrow
- pytest
- python>=3.11,<3.12 # require 3.11.x for compatibility with pudl
- python-snappy # used for pudl
- qdldl-python==0.1.5,!=0.1.5.post2 # used for gridemissions, newer version not working as of 12/12/2022
- requests>=2.28.1
- qdldl-python
- requests
- ruff
- s3fs
- seaborn # used by gridemissions
- setuptools # used for pudl
- sqlalchemy
- sqlite # used for pudl
- statsmodels
- coloredlogs # used for prettier logging

- pip:
# --editable ../pudl #NOTE: this is for development use
- git+https://github.com/singularity-energy/pudl.git@main#egg=catalystcoop.pudl
- git+https://github.com/singularity-energy/pudl.git@oge_release#egg=catalystcoop.pudl
#- --editable ../gridemissions # NOTE: this is for development use
- git+https://github.com/gailin-p/gridemissions#egg=gridemissions
- git+https://github.com/singularity-energy/gridemissions#egg=gridemissions
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "hatchling.build"

[project]
name = "oge"
version = "0.3.2"
version = "0.3.3"
requires-python = ">=3.11,<3.12"
readme = "README.md"
authors = [
Expand Down
10 changes: 5 additions & 5 deletions src/oge/filepaths.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,24 @@ def top_folder(rel=""):


def reference_table_folder(rel=""):
return os.path.join(top_folder("reference_tables"), rel)
return os.path.join(top_folder("reference_tables"), rel).replace("\\", "/")


def data_folder(rel=""):
"""Returns a path relative to the `data` folder."""
return os.path.join(get_data_store(), rel)
return os.path.join(get_data_store(), rel).replace("\\", "/")


def downloads_folder(rel=""):
return os.path.join(data_folder("downloads"), rel)
return os.path.join(data_folder("downloads"), rel).replace("\\", "/")


def outputs_folder(rel=""):
return os.path.join(data_folder("outputs"), rel)
return os.path.join(data_folder("outputs"), rel).replace("\\", "/")


def results_folder(rel=""):
return os.path.join(data_folder("results"), rel)
return os.path.join(data_folder("results"), rel).replace("\\", "/")


def containing_folder(filepath: str) -> str:
Expand Down

0 comments on commit 7663993

Please sign in to comment.