From bb0bd9bfbce6cb189aade954a04ef424cbc181f6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 16 Oct 2024 13:10:22 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../impa/src/eval/metrics/calc-metrics.py | 1 + .../impa/src/eval/update-real_time.py | 9 +++++++-- .../impa/src/eval/update-real_time_.py | 9 +++++++-- .../impa/src/eval/viz/plot-real_time.py | 1 + .../Evolution_Network/evolution_network.py | 8 +++++++- .../src/models/Evolution_Network/lightning.py | 10 ++++++++-- .../impa/src/models/Metnet3/lightning.py | 3 ++- .../impa/src/models/NowcastNet/lightning.py | 6 +++++- .../impa/src/models/UNET/lightning.py | 8 +++++++- .../context_LDM_concat_new/attention.py | 5 ++++- .../context_LDM_concat_new/autoenc_v2.py | 10 ++++++++-- .../autoencoder/loss.py | 3 ++- .../autoencoder/modules.py | 4 +++- .../src/models/context_LDM_concat_new/ddim.py | 3 ++- .../context_LDM_concat_new/lightning_v2.py | 19 ++++++++++++++----- .../context_LDM_concat_new/openaimodel.py | 5 ++++- .../models/context_LDM_concat_new/predict.py | 11 ++++++++--- .../impa/src/models/gan/gan_unet/model.py | 19 ++++++++++++++++--- .../impa/src/models/lightning_module.py | 5 ++++- .../impa/src/models/mamba/lightning.py | 5 ++++- .../impa/src/models/mamba/predict.py | 11 ++++++++--- .../layers/generation/generative_network.py | 5 ++++- .../impa/src/models/predict.py | 16 ++++++++++++---- .../impa/src/models/pysteps_LK/predict.py | 5 ++++- .../impa/src/utils/eval_utils.py | 17 +++++++++++++---- .../impa/src/utils/models_utils.py | 12 +++++++++--- pipelines/precipitation_model/impa/tasks.py | 12 ++++++++---- 27 files changed, 172 insertions(+), 50 deletions(-) diff --git a/pipelines/precipitation_model/impa/src/eval/metrics/calc-metrics.py b/pipelines/precipitation_model/impa/src/eval/metrics/calc-metrics.py index 4dba326..9961d1b 100644 --- a/pipelines/precipitation_model/impa/src/eval/metrics/calc-metrics.py +++ b/pipelines/precipitation_model/impa/src/eval/metrics/calc-metrics.py @@ -9,6 +9,7 @@ import numpy as np import pandas as pd import tqdm + from pipelines.precipitation_model.impa.src.eval.metrics.metrics import metrics_dict from pipelines.precipitation_model.impa.src.utils.general_utils import print_warning from pipelines.precipitation_model.impa.src.utils.hdf_utils import get_dataset_keys diff --git a/pipelines/precipitation_model/impa/src/eval/update-real_time.py b/pipelines/precipitation_model/impa/src/eval/update-real_time.py index 54d37d4..8f377c6 100644 --- a/pipelines/precipitation_model/impa/src/eval/update-real_time.py +++ b/pipelines/precipitation_model/impa/src/eval/update-real_time.py @@ -6,8 +6,13 @@ import boto3 from botocore import UNSIGNED from botocore.config import Config -from pipelines.precipitation_model.impa.src.data.process.build_dataframe import build_dataframe -from pipelines.precipitation_model.impa.src.data.process.process_satellite import process_satellite + +from pipelines.precipitation_model.impa.src.data.process.build_dataframe import ( + build_dataframe, +) +from pipelines.precipitation_model.impa.src.data.process.process_satellite import ( + process_satellite, +) from pipelines.precipitation_model.impa.src.eval.predict_real_time import predict BUCKET_NAME = "noaa-goes16" diff --git a/pipelines/precipitation_model/impa/src/eval/update-real_time_.py b/pipelines/precipitation_model/impa/src/eval/update-real_time_.py index d92b504..24a5f76 100644 --- a/pipelines/precipitation_model/impa/src/eval/update-real_time_.py +++ b/pipelines/precipitation_model/impa/src/eval/update-real_time_.py @@ -10,8 +10,13 @@ from botocore import UNSIGNED from botocore.config import Config from joblib import Parallel, delayed -from pipelines.precipitation_model.impa.src.data.process.build_dataframe import build_dataframe -from pipelines.precipitation_model.impa.src.data.process.process_satellite import process_satellite + +from pipelines.precipitation_model.impa.src.data.process.build_dataframe import ( + build_dataframe, +) +from pipelines.precipitation_model.impa.src.data.process.process_satellite import ( + process_satellite, +) from pipelines.precipitation_model.impa.src.eval.predict_real_time import predict # from itertools import product diff --git a/pipelines/precipitation_model/impa/src/eval/viz/plot-real_time.py b/pipelines/precipitation_model/impa/src/eval/viz/plot-real_time.py index 9079a18..b09c5e8 100644 --- a/pipelines/precipitation_model/impa/src/eval/viz/plot-real_time.py +++ b/pipelines/precipitation_model/impa/src/eval/viz/plot-real_time.py @@ -10,6 +10,7 @@ import numpy as np import pandas as pd import tqdm + from pipelines.precipitation_model.impa.src.eval.metrics.metrics import metrics_dict from pipelines.precipitation_model.impa.src.utils.eval_utils import get_img from pipelines.precipitation_model.impa.src.utils.general_utils import print_warning diff --git a/pipelines/precipitation_model/impa/src/models/Evolution_Network/evolution_network.py b/pipelines/precipitation_model/impa/src/models/Evolution_Network/evolution_network.py index e0b5f70..29911ea 100644 --- a/pipelines/precipitation_model/impa/src/models/Evolution_Network/evolution_network.py +++ b/pipelines/precipitation_model/impa/src/models/Evolution_Network/evolution_network.py @@ -1,7 +1,13 @@ # -*- coding: utf-8 -*- import torch import torch.nn as nn -from pipelines.precipitation_model.impa.src.models.Evolution_Network.model_parts import DoubleConv, Down, OutConv, Up + +from pipelines.precipitation_model.impa.src.models.Evolution_Network.model_parts import ( + DoubleConv, + Down, + OutConv, + Up, +) class Evolution_Encoder_Decoder(nn.Module): diff --git a/pipelines/precipitation_model/impa/src/models/Evolution_Network/lightning.py b/pipelines/precipitation_model/impa/src/models/Evolution_Network/lightning.py index 4956ebe..cf56d4a 100644 --- a/pipelines/precipitation_model/impa/src/models/Evolution_Network/lightning.py +++ b/pipelines/precipitation_model/impa/src/models/Evolution_Network/lightning.py @@ -1,7 +1,13 @@ # -*- coding: utf-8 -*- import torch -from pipelines.precipitation_model.impa.src.models.Evolution_Network.evolution_network import Evolution_Encoder_Decoder -from pipelines.precipitation_model.impa.src.models.Evolution_Network.utils import make_grid, warp + +from pipelines.precipitation_model.impa.src.models.Evolution_Network.evolution_network import ( + Evolution_Encoder_Decoder, +) +from pipelines.precipitation_model.impa.src.models.Evolution_Network.utils import ( + make_grid, + warp, +) from pipelines.precipitation_model.impa.src.models.lightning_module import LModule diff --git a/pipelines/precipitation_model/impa/src/models/Metnet3/lightning.py b/pipelines/precipitation_model/impa/src/models/Metnet3/lightning.py index 342ad12..07d736c 100644 --- a/pipelines/precipitation_model/impa/src/models/Metnet3/lightning.py +++ b/pipelines/precipitation_model/impa/src/models/Metnet3/lightning.py @@ -3,6 +3,8 @@ import torch import torch.nn as nn +from torch.nn import Sequential + from pipelines.precipitation_model.impa.src.models.lightning_module import LModule from pipelines.precipitation_model.impa.src.models.Metnet3.Max_Vit.Max_Vit import MaxViT from pipelines.precipitation_model.impa.src.models.Metnet3.metnet3_pytorch import ( @@ -12,7 +14,6 @@ ResnetBlocks, Upsample2x, ) -from torch.nn import Sequential class model(LModule): diff --git a/pipelines/precipitation_model/impa/src/models/NowcastNet/lightning.py b/pipelines/precipitation_model/impa/src/models/NowcastNet/lightning.py index 4145c4d..f377ad8 100644 --- a/pipelines/precipitation_model/impa/src/models/NowcastNet/lightning.py +++ b/pipelines/precipitation_model/impa/src/models/NowcastNet/lightning.py @@ -1,6 +1,10 @@ # -*- coding: utf-8 -*- import torch -from pipelines.precipitation_model.impa.src.models.gan.gan_unet.model import NowcasnetGenerator, TemporalDiscriminator + +from pipelines.precipitation_model.impa.src.models.gan.gan_unet.model import ( + NowcasnetGenerator, + TemporalDiscriminator, +) from pipelines.precipitation_model.impa.src.models.lightning_module import LModule diff --git a/pipelines/precipitation_model/impa/src/models/UNET/lightning.py b/pipelines/precipitation_model/impa/src/models/UNET/lightning.py index 8eeb335..de28661 100644 --- a/pipelines/precipitation_model/impa/src/models/UNET/lightning.py +++ b/pipelines/precipitation_model/impa/src/models/UNET/lightning.py @@ -1,7 +1,13 @@ # -*- coding: utf-8 -*- import torch + from pipelines.precipitation_model.impa.src.models.lightning_module import LModule -from pipelines.precipitation_model.impa.src.models.UNET.unet_parts import DoubleConv, Down, OutConv, Up +from pipelines.precipitation_model.impa.src.models.UNET.unet_parts import ( + DoubleConv, + Down, + OutConv, + Up, +) class model(LModule): diff --git a/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/attention.py b/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/attention.py index d371962..b695b10 100644 --- a/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/attention.py +++ b/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/attention.py @@ -5,9 +5,12 @@ import torch import torch.nn.functional as F from einops import rearrange, repeat -from pipelines.precipitation_model.impa.src.models.context_LDM_concat_new.utils import checkpoint from torch import einsum, nn +from pipelines.precipitation_model.impa.src.models.context_LDM_concat_new.utils import ( + checkpoint, +) + def exists(val): return val is not None diff --git a/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/autoenc_v2.py b/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/autoenc_v2.py index a3a958f..d52393a 100644 --- a/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/autoenc_v2.py +++ b/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/autoenc_v2.py @@ -2,11 +2,17 @@ import numpy as np import pytorch_lightning as pl import torch + from pipelines.precipitation_model.impa.src.models.context_LDM_concat_new.autoencoder.distributions import ( DiagonalGaussianDistribution, ) -from pipelines.precipitation_model.impa.src.models.context_LDM_concat_new.autoencoder.loss import LPIPSWithDiscriminator -from pipelines.precipitation_model.impa.src.models.context_LDM_concat_new.autoencoder.modules import Decoder, Encoder +from pipelines.precipitation_model.impa.src.models.context_LDM_concat_new.autoencoder.loss import ( + LPIPSWithDiscriminator, +) +from pipelines.precipitation_model.impa.src.models.context_LDM_concat_new.autoencoder.modules import ( + Decoder, + Encoder, +) class AutoencoderKL(pl.LightningModule): diff --git a/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/autoencoder/loss.py b/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/autoencoder/loss.py index f7ac26b..09d4a74 100644 --- a/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/autoencoder/loss.py +++ b/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/autoencoder/loss.py @@ -3,11 +3,12 @@ import torch import torch.nn.functional as F +from torch import nn + from pipelines.precipitation_model.impa.src.models.context_LDM_concat_new.autoencoder.discriminator import ( NLayerDiscriminator, weights_init, ) -from torch import nn def hinge_d_loss(logits_real, logits_fake): diff --git a/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/autoencoder/modules.py b/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/autoencoder/modules.py index 891c041..ad12e94 100644 --- a/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/autoencoder/modules.py +++ b/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/autoencoder/modules.py @@ -8,7 +8,9 @@ import torch.nn as nn # from ldm.util import instantiate_from_config -from pipelines.precipitation_model.impa.src.models.context_LDM_concat_new.attention import LinearAttention +from pipelines.precipitation_model.impa.src.models.context_LDM_concat_new.attention import ( + LinearAttention, +) class Encoder(nn.Module): diff --git a/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/ddim.py b/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/ddim.py index c73923c..a2b4b94 100644 --- a/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/ddim.py +++ b/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/ddim.py @@ -5,12 +5,13 @@ import numpy as np import torch +from tqdm import tqdm + from pipelines.precipitation_model.impa.src.models.context_LDM_concat_new.utils import ( make_ddim_sampling_parameters, make_ddim_timesteps, noise_like, ) -from tqdm import tqdm class DDIMSampler(object): diff --git a/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/lightning_v2.py b/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/lightning_v2.py index 33892ef..95c9e08 100644 --- a/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/lightning_v2.py +++ b/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/lightning_v2.py @@ -6,17 +6,26 @@ import torch.nn.functional as F from einops import rearrange from pytorch_lightning import LightningModule -from pipelines.precipitation_model.impa.src.models.context_LDM_concat_new.autoenc_v2 import AutoencoderKL +from tqdm import tqdm + +from pipelines.precipitation_model.impa.src.models.context_LDM_concat_new.autoenc_v2 import ( + AutoencoderKL, +) # from pipelines.precipitation_model.impa.src.models.context_LDM_concat.autoencoder.autoenc_old import AutoencoderKL -from pipelines.precipitation_model.impa.src.models.context_LDM_concat_new.ddim import DDIMSampler +from pipelines.precipitation_model.impa.src.models.context_LDM_concat_new.ddim import ( + DDIMSampler, +) from pipelines.precipitation_model.impa.src.models.context_LDM_concat_new.model import ( get_named_beta_schedule, linear_beta_schedule, ) -from pipelines.precipitation_model.impa.src.models.context_LDM_concat_new.openaimodel import UNetModel -from pipelines.precipitation_model.impa.src.utils.data_utils import data_modification_options -from tqdm import tqdm +from pipelines.precipitation_model.impa.src.models.context_LDM_concat_new.openaimodel import ( + UNetModel, +) +from pipelines.precipitation_model.impa.src.utils.data_utils import ( + data_modification_options, +) def extract(a, t, x_shape): diff --git a/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/openaimodel.py b/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/openaimodel.py index ef9b3a4..577de2b 100644 --- a/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/openaimodel.py +++ b/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/openaimodel.py @@ -8,7 +8,10 @@ import torch as th import torch.nn as nn import torch.nn.functional as F -from pipelines.precipitation_model.impa.src.models.context_LDM_concat_new.attention import SpatialTransformer + +from pipelines.precipitation_model.impa.src.models.context_LDM_concat_new.attention import ( + SpatialTransformer, +) from pipelines.precipitation_model.impa.src.models.context_LDM_concat_new.utils import ( avg_pool_nd, checkpoint, diff --git a/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/predict.py b/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/predict.py index 0dfc9df..ef6f900 100644 --- a/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/predict.py +++ b/pipelines/precipitation_model/impa/src/models/context_LDM_concat_new/predict.py @@ -4,11 +4,16 @@ import pytorch_lightning as pl import torch -from pipelines.precipitation_model.impa.src.data.HDFDatasetLocations import HDFDatasetLocations -from pipelines.precipitation_model.impa.src.models.context_LDM_concat_new.lightning_v2 import Diffusion_Model +from torch.utils.data import DataLoader + +from pipelines.precipitation_model.impa.src.data.HDFDatasetLocations import ( + HDFDatasetLocations, +) +from pipelines.precipitation_model.impa.src.models.context_LDM_concat_new.lightning_v2 import ( + Diffusion_Model, +) from pipelines.precipitation_model.impa.src.utils.general_utils import print_ok from pipelines.precipitation_model.impa.src.utils.hdf_utils import array_to_pred_hdf -from torch.utils.data import DataLoader MEAN = 0.08 STD = 0.39 diff --git a/pipelines/precipitation_model/impa/src/models/gan/gan_unet/model.py b/pipelines/precipitation_model/impa/src/models/gan/gan_unet/model.py index eabde3b..07c5238 100644 --- a/pipelines/precipitation_model/impa/src/models/gan/gan_unet/model.py +++ b/pipelines/precipitation_model/impa/src/models/gan/gan_unet/model.py @@ -3,13 +3,26 @@ import torch import torch.nn as nn -from pipelines.precipitation_model.impa.src.models.gan.gan_unet.unet_parts import DoubleConv, Down, OutConv, S, Up, Up2 -from pipelines.precipitation_model.impa.src.models.gan.parts_gan import AvgPool, L2_Block, L3_Block, Noise_Projector +from torch.nn.utils import spectral_norm + +from pipelines.precipitation_model.impa.src.models.gan.gan_unet.unet_parts import ( + DoubleConv, + Down, + OutConv, + S, + Up, + Up2, +) +from pipelines.precipitation_model.impa.src.models.gan.parts_gan import ( + AvgPool, + L2_Block, + L3_Block, + Noise_Projector, +) from pipelines.precipitation_model.impa.src.models.nowcasting.layers.generation.generative_network import ( Generative_Decoder, Generative_Encoder, ) -from torch.nn.utils import spectral_norm ni = 192 # size of image ndf = 32 # size of discriminator feature map diff --git a/pipelines/precipitation_model/impa/src/models/lightning_module.py b/pipelines/precipitation_model/impa/src/models/lightning_module.py index 0b21c98..df54a8e 100644 --- a/pipelines/precipitation_model/impa/src/models/lightning_module.py +++ b/pipelines/precipitation_model/impa/src/models/lightning_module.py @@ -3,7 +3,10 @@ import torch from einops import rearrange from pytorch_lightning import LightningModule -from pipelines.precipitation_model.impa.src.utils.data_utils import data_modification_options + +from pipelines.precipitation_model.impa.src.utils.data_utils import ( + data_modification_options, +) # define the LightningModule diff --git a/pipelines/precipitation_model/impa/src/models/mamba/lightning.py b/pipelines/precipitation_model/impa/src/models/mamba/lightning.py index 6f2fdac..deabd9c 100644 --- a/pipelines/precipitation_model/impa/src/models/mamba/lightning.py +++ b/pipelines/precipitation_model/impa/src/models/mamba/lightning.py @@ -3,8 +3,11 @@ import torch from einops import rearrange from pytorch_lightning import LightningModule + from pipelines.precipitation_model.impa.src.models.mamba.vmamba import VSSM -from pipelines.precipitation_model.impa.src.utils.data_utils import data_modification_options +from pipelines.precipitation_model.impa.src.utils.data_utils import ( + data_modification_options, +) class Vmamba_lightning(LightningModule): diff --git a/pipelines/precipitation_model/impa/src/models/mamba/predict.py b/pipelines/precipitation_model/impa/src/models/mamba/predict.py index 5abb79d..c501735 100644 --- a/pipelines/precipitation_model/impa/src/models/mamba/predict.py +++ b/pipelines/precipitation_model/impa/src/models/mamba/predict.py @@ -4,11 +4,16 @@ import pytorch_lightning as pl import torch -from pipelines.precipitation_model.impa.src.data.HDFDatasetLocations import HDFDatasetLocations -from pipelines.precipitation_model.impa.src.models.mamba.lightning import Vmamba_lightning +from torch.utils.data import DataLoader + +from pipelines.precipitation_model.impa.src.data.HDFDatasetLocations import ( + HDFDatasetLocations, +) +from pipelines.precipitation_model.impa.src.models.mamba.lightning import ( + Vmamba_lightning, +) from pipelines.precipitation_model.impa.src.utils.general_utils import print_ok from pipelines.precipitation_model.impa.src.utils.hdf_utils import array_to_pred_hdf -from torch.utils.data import DataLoader MEAN = 0.08 STD = 0.39 diff --git a/pipelines/precipitation_model/impa/src/models/nowcasting/layers/generation/generative_network.py b/pipelines/precipitation_model/impa/src/models/nowcasting/layers/generation/generative_network.py index 6d9443c..7f527f9 100644 --- a/pipelines/precipitation_model/impa/src/models/nowcasting/layers/generation/generative_network.py +++ b/pipelines/precipitation_model/impa/src/models/nowcasting/layers/generation/generative_network.py @@ -3,8 +3,11 @@ import torch.nn as nn import torch.nn.functional as F + from pipelines.precipitation_model.impa.src.models.nowcasting.layers.evolution.module import * -from pipelines.precipitation_model.impa.src.models.nowcasting.layers.generation.module import GenBlock +from pipelines.precipitation_model.impa.src.models.nowcasting.layers.generation.module import ( + GenBlock, +) class Generative_Encoder(nn.Module): diff --git a/pipelines/precipitation_model/impa/src/models/predict.py b/pipelines/precipitation_model/impa/src/models/predict.py index 7e07a18..33ef557 100644 --- a/pipelines/precipitation_model/impa/src/models/predict.py +++ b/pipelines/precipitation_model/impa/src/models/predict.py @@ -7,13 +7,21 @@ import pytorch_lightning as pl import torch from einops import rearrange -from pipelines.precipitation_model.impa.src.data.HDFDatasetLocations import HDFDatasetLocations -from pipelines.precipitation_model.impa.src.data.PredHDFDatasetLocations import PredHDFDatasetLocations +from torch.utils.data import DataLoader + +from pipelines.precipitation_model.impa.src.data.HDFDatasetLocations import ( + HDFDatasetLocations, +) +from pipelines.precipitation_model.impa.src.data.PredHDFDatasetLocations import ( + PredHDFDatasetLocations, +) from pipelines.precipitation_model.impa.src.utils.data_utils import sat_dataframe from pipelines.precipitation_model.impa.src.utils.general_utils import print_ok from pipelines.precipitation_model.impa.src.utils.hdf_utils import array_to_pred_hdf -from pipelines.precipitation_model.impa.src.utils.models_utils import get_ds, options_pretrained -from torch.utils.data import DataLoader +from pipelines.precipitation_model.impa.src.utils.models_utils import ( + get_ds, + options_pretrained, +) MEAN_LOG_SAT = 0.08 STD_LOG_SAT = 0.39 diff --git a/pipelines/precipitation_model/impa/src/models/pysteps_LK/predict.py b/pipelines/precipitation_model/impa/src/models/pysteps_LK/predict.py index 1b03482..4205a39 100644 --- a/pipelines/precipitation_model/impa/src/models/pysteps_LK/predict.py +++ b/pipelines/precipitation_model/impa/src/models/pysteps_LK/predict.py @@ -7,7 +7,10 @@ from joblib import Parallel, delayed from pysteps import motion, nowcasts from pysteps.utils import conversion, transformation -from pipelines.precipitation_model.impa.src.data.HDFDatasetLocations import HDFDatasetLocations + +from pipelines.precipitation_model.impa.src.data.HDFDatasetLocations import ( + HDFDatasetLocations, +) from pipelines.precipitation_model.impa.src.utils.general_utils import print_ok from pipelines.precipitation_model.impa.src.utils.hdf_utils import array_to_pred_hdf diff --git a/pipelines/precipitation_model/impa/src/utils/eval_utils.py b/pipelines/precipitation_model/impa/src/utils/eval_utils.py index 9be85a8..38ca89d 100644 --- a/pipelines/precipitation_model/impa/src/utils/eval_utils.py +++ b/pipelines/precipitation_model/impa/src/utils/eval_utils.py @@ -8,11 +8,20 @@ import pandas as pd import plotly.graph_objects as go from PIL import Image + from pipelines.precipitation_model.impa.src.eval.metrics.metrics import metrics_dict -from pipelines.precipitation_model.impa.src.models.context_LDM_concat_new.predict import main as latent_diffusion_predict -from pipelines.precipitation_model.impa.src.models.mamba.predict import main as mamba_predict -from pipelines.precipitation_model.impa.src.models.predict import main as general_predict -from pipelines.precipitation_model.impa.src.models.pysteps_LK.predict import main as pysteps_predict +from pipelines.precipitation_model.impa.src.models.context_LDM_concat_new.predict import ( + main as latent_diffusion_predict, +) +from pipelines.precipitation_model.impa.src.models.mamba.predict import ( + main as mamba_predict, +) +from pipelines.precipitation_model.impa.src.models.predict import ( + main as general_predict, +) +from pipelines.precipitation_model.impa.src.models.pysteps_LK.predict import ( + main as pysteps_predict, +) MAP_CENTER = {"lat": -22.914550816555533, "lon": -43.502443050594596} ZOOM = 8 diff --git a/pipelines/precipitation_model/impa/src/utils/models_utils.py b/pipelines/precipitation_model/impa/src/utils/models_utils.py index 2fa09ec..ac86fa7 100644 --- a/pipelines/precipitation_model/impa/src/utils/models_utils.py +++ b/pipelines/precipitation_model/impa/src/utils/models_utils.py @@ -1,9 +1,15 @@ # -*- coding: utf-8 -*- from pipelines.precipitation_model.impa.src.data.HDFDataset2 import HDFDataset2 -from pipelines.precipitation_model.impa.src.data.HDFDatasetLocations import HDFDatasetLocations -from pipelines.precipitation_model.impa.src.data.HDFDatasetMerged import HDFDatasetMerged +from pipelines.precipitation_model.impa.src.data.HDFDatasetLocations import ( + HDFDatasetLocations, +) +from pipelines.precipitation_model.impa.src.data.HDFDatasetMerged import ( + HDFDatasetMerged, +) from pipelines.precipitation_model.impa.src.data.PredHDFDataset2 import PredHDFDataset2 -from pipelines.precipitation_model.impa.src.data.PredHDFDatasetLocations import PredHDFDatasetLocations +from pipelines.precipitation_model.impa.src.data.PredHDFDatasetLocations import ( + PredHDFDatasetLocations, +) extension_dicts = { "context_LDM_VAE": ".pt", diff --git a/pipelines/precipitation_model/impa/tasks.py b/pipelines/precipitation_model/impa/tasks.py index 4f7c8fe..80971ba 100644 --- a/pipelines/precipitation_model/impa/tasks.py +++ b/pipelines/precipitation_model/impa/tasks.py @@ -11,10 +11,14 @@ from botocore.config import Config from prefect import task from prefeitura_rio.pipelines_utils.logging import log -from pipelines.precipitation_model.impa.src.data.process.build_dataframe import build_dataframe -from pipelines.precipitation_model.impa.src.data.process.process_satellite import process_satellite -from pipelines.precipitation_model.impa.src.eval.predict_real_time import predict +from pipelines.precipitation_model.impa.src.data.process.build_dataframe import ( + build_dataframe, +) +from pipelines.precipitation_model.impa.src.data.process.process_satellite import ( + process_satellite, +) +from pipelines.precipitation_model.impa.src.eval.predict_real_time import predict from pipelines.precipitation_model.impa.utils import download_file_from_s3 @@ -85,7 +89,7 @@ def process_data(year, day_of_year, num_workers, dt): num_workers (int): The number of workers to use for parallel processing. dt (datetime.datetime): The datetime object representing the date to process. - This function logs the processing activity, processes satellite data for specified + This function logs the processing activity, processes satellite data for specified products using `process_satellite`, and then builds a dataframe with `build_dataframe`. """ log("Processing satellite data...")