Skip to content

Commit

Permalink
make minor formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwilby committed Oct 21, 2024
1 parent 970b9f8 commit b072723
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 19 deletions.
2 changes: 1 addition & 1 deletion deepsensor/data/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ def time_slice_variable(self, var, date, delta_t=0):
raise ValueError(f"Unknown variable type {type(var)}")
return var

def task_generation( # noqa: D102
def task_generation( # noqa: D102
self,
date: pd.Timestamp,
context_sampling: Union[
Expand Down
3 changes: 1 addition & 2 deletions deepsensor/eval/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@


def compute_errors(pred: Prediction, target: xr.Dataset) -> xr.Dataset:
"""
Compute errors between predictions and targets.
"""Compute errors between predictions and targets.
Args:
pred: Prediction object.
Expand Down
2 changes: 1 addition & 1 deletion deepsensor/model/convnp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ruff: noqa: D102
# ruff: noqa: D102

import copy
import os.path
Expand Down
5 changes: 2 additions & 3 deletions deepsensor/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,8 +650,7 @@ def unnormalise_pred_array(arr, **kwargs):


def add_valid_time_coord_to_pred_and_move_time_dims(pred: Prediction) -> Prediction:
"""
Add a valid time coordinate "time" to a Prediction object based on the
"""Add a valid time coordinate "time" to a Prediction object based on the
initialisation times "init_time" and lead times "lead_time", and
reorder the time dims from ("lead_time", "init_time") to ("init_time", "lead_time").
Expand Down Expand Up @@ -680,7 +679,7 @@ def add_valid_time_coord_to_pred_and_move_time_dims(pred: Prediction) -> Predict
return pred


def main(): # pragma: no cover # noqa
def main(): # pragma: no cover # noqa: D103
import deepsensor.tensorflow
from deepsensor.data.loader import TaskLoader
from deepsensor.data.processor import DataProcessor
Expand Down
22 changes: 10 additions & 12 deletions deepsensor/model/pred.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,18 +145,16 @@ def assign(
data: np.ndarray,
lead_times: Optional[List[pd.Timedelta]] = None,
):
"""
Args:
prediction_parameter (str)
...
date (Union[str, pd.Timestamp])
...
data (np.ndarray)
If off-grid: Shape (N_var, N_targets) or (N_samples, N_var, N_targets).
If on-grid: Shape (N_var, N_x1, N_x2) or (N_samples, N_var, N_x1, N_x2).
lead_time (pd.Timedelta, optional)
Lead time of the forecast. Required if forecasting_mode is True. Default None.
"""Args:
prediction_parameter (str)
...
date (Union[str, pd.Timestamp])
...
data (np.ndarray)
If off-grid: Shape (N_var, N_targets) or (N_samples, N_var, N_targets).
If on-grid: Shape (N_var, N_x1, N_x2) or (N_samples, N_var, N_x1, N_x2).
lead_time (pd.Timedelta, optional)
Lead time of the forecast. Required if forecasting_mode is True. Default None.
"""
if self.forecasting_mode:
assert (
Expand Down

0 comments on commit b072723

Please sign in to comment.