Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Mar 18, 2024
1 parent ed8b25f commit 68e2078
Show file tree
Hide file tree
Showing 120 changed files with 140 additions and 18 deletions.
1 change: 1 addition & 0 deletions ocf_datapipes/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""OCF Datapipes"""

import ocf_datapipes.batch
import ocf_datapipes.convert
import ocf_datapipes.experimental
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/batch/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Datapipes for batching together data"""

from .batches import BatchKey, NumpyBatch, NWPBatchKey, NWPNumpyBatch, XarrayBatch
from .merge_numpy_examples_to_batch import (
MergeNumpyBatchIterDataPipe as MergeNumpyBatch,
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/batch/fake/fake_batch.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Make fake batch """

from datetime import datetime, timezone
from typing import Optional, Union

Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/batch/fake/gsp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Make fake GSP data """

from datetime import datetime

import numpy as np
Expand Down
13 changes: 7 additions & 6 deletions ocf_datapipes/batch/fake/nwp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Make fake NWP data """

from datetime import datetime

import numpy as np
Expand Down Expand Up @@ -49,12 +50,12 @@ def make_fake_nwp_data(

# main nwp components

source_batch[
NWPBatchKey.nwp_init_time_utc
] = time_utc # Seconds since UNIX epoch (1970-01-01).
source_batch[
NWPBatchKey.nwp_target_time_utc
] = time_utc # Seconds since UNIX epoch (1970-01-01).
source_batch[NWPBatchKey.nwp_init_time_utc] = (
time_utc # Seconds since UNIX epoch (1970-01-01).
)
source_batch[NWPBatchKey.nwp_target_time_utc] = (
time_utc # Seconds since UNIX epoch (1970-01-01).
)
source_batch[NWPBatchKey.nwp] = np.random.random(
(batch_size, n_times, n_channels, n_y_osgb, n_x_osgb)
)
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/batch/fake/pv.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Make fake PV data """

from datetime import datetime

import numpy as np
Expand Down
7 changes: 4 additions & 3 deletions ocf_datapipes/batch/fake/satellite.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Make fake Satellite data """

from datetime import datetime

import numpy as np
Expand Down Expand Up @@ -80,9 +81,9 @@ def make_fake_satellite_data(
0, 100, (batch_size, width)
)

batch[
getattr(BatchKey, f"{variable}_time_utc")
] = time_utc # Seconds since UNIX epoch (1970-01-01).
batch[getattr(BatchKey, f"{variable}_time_utc")] = (
time_utc # Seconds since UNIX epoch (1970-01-01).
)
# Added by np_batch_processor.Topography:
batch[getattr(BatchKey, f"{variable}_surface_height")] = np.random.randint(
0, 100, (batch_size, height, width)
Expand Down
13 changes: 7 additions & 6 deletions ocf_datapipes/batch/fake/sun.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Make fake Sun data """

import numpy as np

from ocf_datapipes.batch import BatchKey, NWPBatchKey
Expand Down Expand Up @@ -62,11 +63,11 @@ def make_fake_sun_data(configuration: Configuration, batch_size: int = 8):
batch[BatchKey.nwp][nwp_source] = {}

n_nwp_timesteps = get_n_time_steps_from_config(configuration.input_data.nwp[nwp_source])
batch[BatchKey.nwp][nwp_source][
NWPBatchKey.nwp_target_time_solar_azimuth
] = np.random.random((batch_size, n_nwp_timesteps))
batch[BatchKey.nwp][nwp_source][
NWPBatchKey.nwp_target_time_solar_elevation
] = np.random.random((batch_size, n_nwp_timesteps))
batch[BatchKey.nwp][nwp_source][NWPBatchKey.nwp_target_time_solar_azimuth] = (
np.random.random((batch_size, n_nwp_timesteps))
)
batch[BatchKey.nwp][nwp_source][NWPBatchKey.nwp_target_time_solar_elevation] = (
np.random.random((batch_size, n_nwp_timesteps))
)

return batch
1 change: 1 addition & 0 deletions ocf_datapipes/batch/fake/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Utils Functions to for fake data """

from datetime import timedelta

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/batch/merge_numpy_examples_to_batch.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Merge individual examples into a batch"""

import logging
from typing import Sequence, Union

Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/batch/merge_numpy_modalities.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Merge multiple modalities together in NumpyBatch"""

from torch.utils.data import IterDataPipe, functional_datapipe

from ocf_datapipes.batch import BatchKey, NumpyBatch
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/config/load.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Loading configuration functions """

import logging
from typing import Union

Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/config/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
are used to validate the values of the data itself.
"""

import logging
from datetime import datetime
from typing import Dict, List, Optional, Union
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/config/save.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Save functions for the configuration model"""

import json
import logging
from typing import Optional, Union
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/convert/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Various conversion datapipes"""

from .coordinates import ConvertGeostationaryToLonLatIterDataPipe as ConvertGeostationaryToLonLat
from .coordinates import ConvertLonLatToOSGBIterDataPipe as ConvertLonLatToOSGB
from .coordinates import ConvertOSGBToLonLatIterDataPipe as ConvertOSGBToLonLat
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/convert/coordinates.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Convert coordinates Datapipes"""

from typing import Union

import xarray as xr
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/convert/numpy/gsp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Convert GSP to Numpy Array"""

import logging

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/convert/numpy/pv.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Convert PV to Numpy"""

import numpy as np
from torch.utils.data import IterDataPipe, functional_datapipe

Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/convert/numpy_batch/gsp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Convert GSP to Numpy Batch"""

import logging

from torch.utils.data import IterDataPipe, functional_datapipe
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/convert/numpy_batch/nwp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Convert NWP to NumpyBatch"""

import numpy as np
from torch.utils.data import IterDataPipe, functional_datapipe

Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/convert/numpy_batch/pv.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Convert PV to Numpy Batch"""

import logging

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/convert/numpy_batch/satellite.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Convert Satellite to NumpyBatch"""

from torch.utils.data import IterDataPipe, functional_datapipe

from ocf_datapipes.batch import BatchKey, NumpyBatch
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/convert/numpy_batch/sensor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Convert PV to Numpy Batch"""

import logging

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/convert/numpy_batch/wind.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Convert Wind to Numpy Batch"""

import logging

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/convert/stack_xarray_to_numpy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Stacking Xarray objects to Numpy inputs"""

from typing import List

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/load/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Loading datapipes from the raw data"""

from ocf_datapipes.load.gsp.database import OpenGSPFromDatabaseIterDataPipe as OpenGSPFromDatabase
from ocf_datapipes.load.gsp.gsp import OpenGSPIterDataPipe as OpenGSP
from ocf_datapipes.load.gsp.gsp_national import OpenGSPNationalIterDataPipe as OpenGSPNational
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/load/configuration.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Configuration Loader"""

import logging

from torch.utils.data.datapipes._decorator import functional_datapipe
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/load/gsp/database.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Function to get data from live database """

import logging
import os
from datetime import datetime, timedelta, timezone
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/load/gsp/gsp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""GSP Loader"""

import datetime
import logging
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/load/gsp/gsp_national.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""GSP Loader"""

import datetime
import logging
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/load/gsp/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Utils for GSP loading"""

import geopandas as gpd
import numpy as np
import pandas as pd
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/load/nwp/nwp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""NWP Loader"""

import logging
from pathlib import Path
from typing import Union
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/load/nwp/providers/ecmwf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""ECMWF provider loaders"""

import pandas as pd
import xarray as xr

Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/load/nwp/providers/gfs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Open GFS Forecast data"""

import logging
from pathlib import Path
from typing import Union
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/load/nwp/providers/icon.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""DWD ICON Loading"""

import pandas as pd
import xarray as xr

Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/load/nwp/providers/ukv.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""UKV provider loaders"""

import numpy as np
import pandas as pd
import xarray as xr
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/load/nwp/providers/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Common NWP providers"""

import xarray as xr


Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/load/pv/database.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Data pipes and utils for getting PV data from database"""

import logging
import os
from datetime import datetime, timedelta
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/load/pv/pv.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Datapipe and utils to load PV data from NetCDF for training"""

import io
import logging
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/load/pv/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Util functions for PV data source"""

from typing import Optional

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/load/satellite.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Satellite loader"""

import logging
import subprocess
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/load/sensor/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
"""Loading sensor data (i.e. weather station, rainfall radar, etc.)"""

from .awos import OpenAWOSFromNetCDFIterDataPipe as OpenAWOSFromNetCDF
1 change: 1 addition & 0 deletions ocf_datapipes/load/sensor/awos.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Load ASOS data from local files for training/inference"""

import logging

import fsspec
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/load/topographic.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Load Topographic data"""

from pathlib import Path
from typing import Union

Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/load/wind/wind.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Datapipe and utils to load PV data from NetCDF for training"""

import io
import logging
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/select/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Selection datapipes"""

from .apply_pv_dropout import ApplyPVDropoutIterDataPipe as ApplyPVDropout
from .apply_standard_dropout import ApplyDropoutTimeIterDataPipe as ApplyDropoutTime
from .apply_standard_dropout import DrawDropoutTimeIterDataPipe as DrawDropoutTime
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/select/apply_pv_dropout.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Convert NWP data to the target time with dropout"""

import logging
from datetime import timedelta
from typing import List, Optional, Union
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/select/apply_standard_dropout.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Selects time slice from satellite, GSP data, or other xarray objects, and masks with dropout"""

from datetime import timedelta
from typing import List, Optional, Union

Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/select/filter_channels.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Select channels"""

import logging
from typing import List, Union

Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/select/filter_gsp_ids.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Drop GSP output from xarray"""

from typing import List

from torch.utils.data import IterDataPipe, functional_datapipe
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/select/filter_pv_sys_generating_overnight.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
This is a class function that drops the pv systems with generates power over night.
"""

import logging

import xarray as xr
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Drop PV systems which has only NaN's in a single day
"""

import logging

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/select/filter_pv_systems_by_capacity.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Select PV systems based off their capacity"""

from typing import Union

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/select/filter_time_periods.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Select time periods"""

import logging
from typing import Union

Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/select/filter_times.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Select time periods"""

import datetime
import logging
from typing import Union
Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/select/filter_to_overlapping_time_periods.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Select overlapping time slices for training"""

import logging
from typing import Iterable, Optional

Expand Down
1 change: 1 addition & 0 deletions ocf_datapipes/select/find_contiguous_t0_time_periods.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Get contiguous time periods for training"""

import logging
from datetime import timedelta
from typing import Optional
Expand Down

0 comments on commit 68e2078

Please sign in to comment.