Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Commit

Permalink
Remove data folder
Browse files Browse the repository at this point in the history
All the data operations/loading will now be done in nowcasting-dataloader or nowcasting-utils
  • Loading branch information
jacobbieker committed Nov 2, 2021
1 parent 2cbea87 commit 361cb3d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 24 deletions.
28 changes: 11 additions & 17 deletions satflow/core/utils.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,5 @@
import logging
import typing as Dict
from nowcasting_dataset.config.load import load_yaml_configuration

import yaml


def load_config(file_path: str) -> Dict:
with open(file_path, "r") as f:
config = yaml.load(f)
return config


def make_logger(name: str, level=logging.DEBUG) -> logging.Logger:
logger = logging.getLogger(name)
logger.setLevel(level=level)
return logger


import logging
import warnings
from typing import List, Sequence
Expand All @@ -28,6 +11,12 @@ def make_logger(name: str, level=logging.DEBUG) -> logging.Logger:
from pytorch_lightning.utilities import rank_zero_only


def make_logger(name: str, level=logging.DEBUG) -> logging.Logger:
logger = logging.getLogger(name)
logger.setLevel(level=level)
return logger


def get_logger(name=__name__, level=logging.INFO) -> logging.Logger:
"""Initializes multi-GPU-friendly python logger."""

Expand Down Expand Up @@ -211,3 +200,8 @@ def log_hyperparameters(
# this is just a trick to prevent trainer from logging hparams of model,
# since we already did that above
trainer.logger.log_hyperparams = empty


def load_config(config_file):
with open(config_file, "r") as cfg:
return yaml.load(cfg, Loader=yaml.FullLoader)["config"]
Empty file removed satflow/data/__init__.py
Empty file.
Empty file removed satflow/data/utils/__init__.py
Empty file.
6 changes: 0 additions & 6 deletions satflow/data/utils/utils.py

This file was deleted.

8 changes: 7 additions & 1 deletion satflow/models/joint_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,13 @@ def configure_optimizers(self):
return {"optimizer": optimizer, "lr_scheduler": lr_dict}

def construct_query(self, x: dict) -> Tuple[torch.Tensor, torch.Tensor]:
return self.query(x), self.pv_query(x)
sat_fourier_features = x[SATELLITE_DATA + "_position_encoding"][
:, :, : -self.forecast_steps
] # Only want future steps
gsp_fourier_features = x[GSP_YIELD + "_position_encoding"][
:, :, : -self.gsp_forecast_steps
] # Only want future features
return self.query(x, sat_fourier_features), self.pv_query(x, gsp_fourier_features)

def forward(self, x, mask=None, query=None):
return self.model.forward(x, mask=mask, queries=query)

0 comments on commit 361cb3d

Please sign in to comment.