Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename gspconsumer to pvliveconsumer for clarity #93

Merged
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
2 changes: 1 addition & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
}
],
"contributorsPerLine": 7,
"projectName": "GSPConsumer",
"projectName": "pvlive-consumer",
"projectOwner": "openclimatefix",
"repoType": "github",
"repoHost": "https://github.com",
Expand Down
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ tag = True
current_version = 1.2.1
message = Bump version: {current_version} → {new_version} [skip ci]

[bumpversion:file:gspconsumer/__init__.py]
[bumpversion:file:pvliveconsumer/__init__.py]
search = __version__ = "{current_version}"
replace = __version__ = "{new_version}"
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ jobs:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
with:
image_base_name: gspconsumer
image_base_name: pvliveconsumer
docker_file: infrastructure/docker/Dockerfile
2 changes: 1 addition & 1 deletion .github/workflows/test-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
run: docker compose -f test-docker-compose.yml build

- name: Run tests inside the container
run: docker compose -f test-docker-compose.yml run gspconsumer
run: docker compose -f test-docker-compose.yml run pvliveconsumer
env: # Or as an environment variable
API_KEY: ${{ secrets.API_KEY }}
SYSTEM_ID: ${{ secrets.SYSTEM_ID }}
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# GSPConsumer
# PVLiveConsumer
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
Expand All @@ -8,7 +8,7 @@ Collect GSP solar generation data from PVlive from Sheffield Solar

To the run the appication install this library and run
```
python gspconsumer/app.py
python pvliveconsumer/app.py
```

The environmental variables are
Expand All @@ -23,7 +23,7 @@ The environmental variables are

These options can also be enter like this:
```
python gspconsumer/app.py --n-gsps=10
python pvliveconsumer/app.py --n-gsps=10
```

## Tests
Expand All @@ -32,7 +32,7 @@ To run tests use the following command
```bash
docker stop $(docker ps -a -q)
docker-compose -f test-docker-compose.yml build
docker-compose -f test-docker-compose.yml run gspconsumer
docker-compose -f test-docker-compose.yml run pvliveconsumer
```

## Contributors ✨
Expand All @@ -45,9 +45,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<table>
<tbody>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/rachel-labri-tipton"><img src="https://avatars.githubusercontent.com/u/86949265?v=4?s=100" width="100px;" alt="rachel tipton"/><br /><sub><b>rachel tipton</b></sub></a><br /><a href="https://github.com/openclimatefix/GSPConsumer/commits?author=rachel-labri-tipton" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/peterdudfield"><img src="https://avatars.githubusercontent.com/u/34686298?v=4?s=100" width="100px;" alt="Peter Dudfield"/><br /><sub><b>Peter Dudfield</b></sub></a><br /><a href="https://github.com/openclimatefix/GSPConsumer/commits?author=peterdudfield" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/mduffin95"><img src="https://avatars.githubusercontent.com/u/6598483?v=4?s=100" width="100px;" alt="Matthew Duffin"/><br /><sub><b>Matthew Duffin</b></sub></a><br /><a href="https://github.com/openclimatefix/GSPConsumer/commits?author=mduffin95" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/rachel-labri-tipton"><img src="https://avatars.githubusercontent.com/u/86949265?v=4?s=100" width="100px;" alt="rachel tipton"/><br /><sub><b>rachel tipton</b></sub></a><br /><a href="https://github.com/openclimatefix/pvlive-consumer/commits?author=rachel-labri-tipton" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/peterdudfield"><img src="https://avatars.githubusercontent.com/u/34686298?v=4?s=100" width="100px;" alt="Peter Dudfield"/><br /><sub><b>Peter Dudfield</b></sub></a><br /><a href="https://github.com/openclimatefix/pvlive-consumer/commits?author=peterdudfield" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/mduffin95"><img src="https://avatars.githubusercontent.com/u/6598483?v=4?s=100" width="100px;" alt="Matthew Duffin"/><br /><sub><b>Matthew Duffin</b></sub></a><br /><a href="https://github.com/openclimatefix/pvlive-consumer/commits?author=mduffin95" title="Code">💻</a></td>
</tr>
</tbody>
</table>
Expand Down
4 changes: 2 additions & 2 deletions infrastructure/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RUN pip install -r app/requirements.txt
Run pip install git+https://github.com/SheffieldSolar/PV_Live-API#pvlive_api

# copy library files
COPY gspconsumer/ app/gspconsumer/
COPY pvliveconsumer/ app/pvliveconsumer/
COPY tests/ app/tests/

# change to app folder
Expand All @@ -28,4 +28,4 @@ RUN pip install -e .

RUN if [ "$TESTING" = 1 ]; then pip install pytest pytest-cov coverage; fi

CMD ["python", "-u","gspconsumer/app.py"]
CMD ["python", "-u","pvliveconsumer/app.py"]
File renamed without changes.
14 changes: 7 additions & 7 deletions gspconsumer/app.py → pvliveconsumer/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
from pvlive_api import PVLive
from sqlalchemy.orm import Session

import gspconsumer
from gspconsumer.backup import make_gsp_yields_from_national
from gspconsumer.gsps import filter_gsps_which_have_new_data, get_gsps
from gspconsumer.nitghtime import make_night_time_zeros
from gspconsumer.time import check_uk_london_hour
import pvliveconsumer
from pvliveconsumer.backup import make_gsp_yields_from_national
from pvliveconsumer.gsps import filter_gsps_which_have_new_data, get_gsps
from pvliveconsumer.nitghtime import make_night_time_zeros
from pvliveconsumer.time import check_uk_london_hour

logging.basicConfig(
level=getattr(logging, os.getenv("LOGLEVEL", "DEBUG")),
Expand All @@ -37,7 +37,7 @@
)

sentry_sdk.set_tag("app_name", "GSP_consumer")
sentry_sdk.set_tag("version", gspconsumer.__version__)
sentry_sdk.set_tag("version", pvliveconsumer.__version__)


@click.command()
Expand Down Expand Up @@ -95,7 +95,7 @@ def app(
This is to solve clock change issues when running with cron in UTC.
"""

logger.info(f"Running GSP Consumer app ({gspconsumer.__version__}) for regime {regime}")
logger.info(f"Running GSP Consumer app ({pvliveconsumer.__version__}) for regime {regime}")

if uk_london_time_hour is not None:
check_uk_london_hour(hour=int(uk_london_time_hour))
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions scripts/gsp_name_update/merge_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import pandas as pd

# importing file with new ids
new_df = pd.read_csv("GSPConsumer/gsp_name_update/gsp_new_ids.csv")
new_df = pd.read_csv("pvliveconsumer/gsp_name_update/gsp_new_ids.csv")
print(new_df.head())

# importing file with old ids
old_df = pd.read_csv("GSPConsumer/gsp_name_update/gsp_old_ids.csv")
old_df = pd.read_csv("pvliveconsumer/gsp_name_update/gsp_old_ids.csv")
print(old_df.head())


Expand All @@ -22,7 +22,7 @@
print("subset removed")


joined_df.to_csv("GSPConsumer/gsp_name_update/gsp_new_ids_and_names.csv")
joined_df.to_csv("pvliveconsumer/gsp_name_update/gsp_new_ids_and_names.csv")
print(joined_df.head())


Expand Down
4 changes: 2 additions & 2 deletions scripts/gsp_name_update/update_region_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from nowcasting_datamodel.models.base import Base_Forecast
from nowcasting_datamodel.read.read import get_location

import gspconsumer
import pvliveconsumer

# laod database secret from AWS secrets
client = boto3.client("secretsmanager")
Expand All @@ -30,7 +30,7 @@
connection = DatabaseConnection(url=db_url, base=Base_Forecast, echo=True)

# load new region names
folder = os.path.dirname(gspconsumer.__file__) + "/../gsp_name_update"
folder = os.path.dirname(pvliveconsumer.__file__) + "/../gsp_name_update"
data_df = pd.read_csv(f"{folder}/gsp_new_ids_and_names-edited.csv")
# this has columns 'gsp_id' and 'region_name'

Expand Down
4 changes: 2 additions & 2 deletions scripts/v3_to_v4/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
import geopandas as gpd
import plotly.graph_objects as go

import gspconsumer
import pvliveconsumer

file_v3 = "data/gsp_regions_20181031.geojson"
file_v4 = "data/gsp_regions_20220314.geojson"

dir = os.path.dirname(gspconsumer.__file__) + "/../scripts/v3_to_v4/"
dir = os.path.dirname(pvliveconsumer.__file__) + "/../scripts/v3_to_v4/"

v3_gdf = gpd.read_file(dir + file_v3) # 329
v4_gdf = gpd.read_file(dir + file_v4) # 333
Expand Down
4 changes: 2 additions & 2 deletions scripts/v3_to_v4/plot_gsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
import geopandas as gpd
import plotly.graph_objects as go

import gspconsumer
import pvliveconsumer

file_v3 = "data/gsp_regions_20181031.geojson"
file_v4 = "data/gsp_regions_20220314.geojson"

dir = os.path.dirname(gspconsumer.__file__) + "/../scripts/v3_to_v4/"
dir = os.path.dirname(pvliveconsumer.__file__) + "/../scripts/v3_to_v4/"

v3_gdf = gpd.read_file(dir + file_v3) # 329
v4_gdf = gpd.read_file(dir + file_v4) # 333
Expand Down
4 changes: 2 additions & 2 deletions scripts/v3_to_v4/plot_gsp_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
# get installed capacity from pv live (this takes ~30 seconds)
from nowcasting_dataset.data_sources.gsp.pvlive import get_installed_capacity

import gspconsumer
import pvliveconsumer

file_v3 = "data/gsp_regions_20181031.geojson"
file_v4 = "data/gsp_regions_20220314.geojson"

dir = os.path.dirname(gspconsumer.__file__) + "/../scripts/v3_to_v4/"
dir = os.path.dirname(pvliveconsumer.__file__) + "/../scripts/v3_to_v4/"

# load data
v3_gdf = gpd.read_file(dir + file_v3) # 329
Expand Down
6 changes: 3 additions & 3 deletions scripts/v3_to_v4/update_installed_capacity.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from nowcasting_datamodel.models.base import Base_Forecast
from nowcasting_datamodel.read.read import get_all_locations

import gspconsumer
import pvliveconsumer

# get db connection from database
client = boto3.client("secretsmanager")
Expand All @@ -26,7 +26,7 @@

# get installed cpapacity from file
file = "data/pv_capacity_by_20220314_GSP.csv"
dir = os.path.dirname(gspconsumer.__file__) + "/../scripts/v3_to_v4/"
dir = os.path.dirname(pvliveconsumer.__file__) + "/../scripts/v3_to_v4/"
installed_capacity = pd.read_csv(f"{dir}/{file}")

# gsps names
Expand All @@ -39,7 +39,7 @@

# get installed cpapacity from file
file = "data/pv_capacity_by_20220314_GSP.csv"
dir = os.path.dirname(gspconsumer.__file__) + "/../scripts/v3_to_v4/"
dir = os.path.dirname(pvliveconsumer.__file__) + "/../scripts/v3_to_v4/"
installed_capacity = pd.read_csv(f"{dir}/{file}")

# add national
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Setup file for gspconsumer package."""
"""Setup file for pvliveconsumer package."""
from pathlib import Path

from setuptools import find_packages, setup
Expand All @@ -7,14 +7,14 @@
install_requires = (this_directory / "requirements.txt").read_text().splitlines()

# get version
with open("gspconsumer/__init__.py") as f:
with open("pvliveconsumer/__init__.py") as f:
for line in f:
if line.startswith("__version__"):
_, _, version = line.replace("'", "").split()
version = version.replace('"', "")

setup(
name="gspconsumer",
name="pvliveconsumer",
version=version,
packages=find_packages(),
install_requires=install_requires,
Expand Down
6 changes: 3 additions & 3 deletions test-docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
ports:
- "5432:5432"

gspconsumer:
pvliveconsumer:
build:
context: .
dockerfile: infrastructure/docker/Dockerfile
Expand All @@ -23,7 +23,7 @@ services:
- SYSTEM_ID=$SYSTEM_ID
- DATA_SERVICE_URL=https://pvoutput.org/
command: >
bash -c "pytest --cov=./gspconsumer
bash -c "pytest --cov=./pvliveconsumer
&& coverage report -m
&& coverage xml
&& cp .coverage ./tests/
Expand All @@ -32,4 +32,4 @@ services:
- "postgres"
volumes:
- ./tests/:/app/tests
- ./gspconsumer/:/app/gspconsumer
- ./pvliveconsumer/:/app/pvliveconsumer
2 changes: 1 addition & 1 deletion tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from nowcasting_datamodel.models.gsp import GSPYieldSQL, Location, LocationSQL
from nowcasting_datamodel.models.models import national_gb_label

from gspconsumer.app import app, pull_data_and_save
from pvliveconsumer.app import app, pull_data_and_save

from freezegun import freeze_time

Expand Down
2 changes: 1 addition & 1 deletion tests/test_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from nowcasting_datamodel.models.gsp import GSPYield, GSPYieldSQL, Location, LocationSQL
from nowcasting_datamodel.read.read_gsp import get_latest_gsp_yield

from gspconsumer.backup import get_number_gsp_yields, make_gsp_yields_from_national
from pvliveconsumer.backup import get_number_gsp_yields, make_gsp_yields_from_national


def add_national_gsp_yields(db_session):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_gsps.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from nowcasting_datamodel.models.gsp import GSPYield, Location, LocationSQL
from nowcasting_datamodel.read.read_gsp import get_latest_gsp_yield

from gspconsumer.gsps import filter_gsps_which_have_new_data, get_gsps
from pvliveconsumer.gsps import filter_gsps_which_have_new_data, get_gsps


def test_get_gsps(db_session):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_nighttime.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from gspconsumer.nitghtime import make_night_time_zeros
from pvliveconsumer.nitghtime import make_night_time_zeros
from datetime import datetime
from nowcasting_datamodel.models.gsp import LocationSQL, GSPYieldSQL
import pandas as pd
Expand Down
2 changes: 1 addition & 1 deletion tests/test_time.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
from freezegun import freeze_time

from gspconsumer.time import check_uk_london_hour
from pvliveconsumer.time import check_uk_london_hour


def test_time_none():
Expand Down
Loading