Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdudfield committed Sep 10, 2024
1 parent 497cce5 commit 0e0fc73
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 36 deletions.
2 changes: 1 addition & 1 deletion satip/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import satip
from satip import utils
from satip.download import RSS_ID, SEVIRI_ID, SEVIRI_IODC_ID
from satip.constants import RSS_ID, SEVIRI_ID, SEVIRI_IODC_ID
from satip.eumetsat import EUMETSATDownloadManager

log = structlog.stdlib.get_logger()
Expand Down
20 changes: 20 additions & 0 deletions satip/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,23 @@

HRV_SCALER_MIN = np.array([-1.2278595])
HRV_SCALER_MAX = np.array([103.90016])
SAT_VARIABLE_NAMES = (
"HRV",
"IR_016",
"IR_039",
"IR_087",
"IR_097",
"IR_108",
"IR_120",
"IR_134",
"VIS006",
"VIS008",
"WV_062",
"WV_073",
)
NATIVE_FILESIZE_MB = 102.210123
CLOUD_FILESIZE_MB = 3.445185
RSS_ID = "EO:EUM:DAT:MSG:MSG15-RSS"
CLOUD_ID = "EO:EUM:DAT:MSG:RSS-CLM"
SEVIRI_ID = "EO:EUM:DAT:MSG:HRSEVIRI"
SEVIRI_IODC_ID = "EO:EUM:DAT:MSG:HRSEVIRI-IODC"
Empty file added satip/download/__init__.py
Empty file.
22 changes: 1 addition & 21 deletions satip/download.py → satip/download/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,32 +28,12 @@
import yaml

from satip import eumetsat
from satip.constants import NATIVE_FILESIZE_MB, CLOUD_FILESIZE_MB, RSS_ID, CLOUD_ID, SEVIRI_ID, SEVIRI_IODC_ID
from satip.eumetsat import EUMETSATDownloadManager
from satip.utils import format_dt_str

log = structlog.stdlib.get_logger()

SAT_VARIABLE_NAMES = (
"HRV",
"IR_016",
"IR_039",
"IR_087",
"IR_097",
"IR_108",
"IR_120",
"IR_134",
"VIS006",
"VIS008",
"WV_062",
"WV_073",
)

NATIVE_FILESIZE_MB = 102.210123
CLOUD_FILESIZE_MB = 3.445185
RSS_ID = "EO:EUM:DAT:MSG:MSG15-RSS"
CLOUD_ID = "EO:EUM:DAT:MSG:RSS-CLM"
SEVIRI_ID = "EO:EUM:DAT:MSG:HRSEVIRI"
SEVIRI_IODC_ID = "EO:EUM:DAT:MSG:HRSEVIRI-IODC"

def download_eumetsat_data(
download_directory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def __init__(self, provider: str = "EUMETSAT", user_key=None,
self.download_manager = EUMETSATDownloadManager(user_key, user_secret,
data_dir, log_directory)
elif self.provider == "GOES":
from satip.goes_download_manager import GOESDownloadManager
from satip.download.goes_download_manager import GOESDownloadManager
self.download_manager = GOESDownloadManager(data_dir, log_directory)
else:
raise ValueError("Invalid provider. Supported providers are 'EUMETSAT' and 'GOES'.")
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions scripts/get_raw_eumetsat_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import click

import satip.download
import satip.download.download
from satip.utils import format_dt_str

NATIVE_FILESIZE_MB = 102.210123
Expand Down Expand Up @@ -100,7 +100,7 @@ def _validate_date(ctx, param, value):
)
def download_sat_files(*args, **kwargs):
"""Wrapper around downloader for eumetsat data to attach decorators to it."""
satip.download.download_eumetsat_data(*args, **kwargs)
satip.download.download.download_eumetsat_data(*args, **kwargs)


if __name__ == "__main__":
Expand Down
5 changes: 1 addition & 4 deletions tests/integration_test/test_integration_download.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
"""integration Tests for satip.download.py."""
import os
import pytest

import pandas as pd

from satip.download import (
from satip.download.download import (
download_eumetsat_data,
)
from satip.utils import format_dt_str
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_test/test_integration_eumetsat.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pandas as pd

from satip.eumetsat import EUMETSATDownloadManager, eumetsat_filename_to_datetime
from satip.download import SEVIRI_IODC_ID
from satip.constants import SEVIRI_IODC_ID


def test_download_manager_setup():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from datetime import datetime
from satip.goes_download_manager import GOESDownloadManager
from satip.download.goes_download_manager import GOESDownloadManager


# Test case for downloading GOES-15 data from CLAss
Expand Down
6 changes: 1 addition & 5 deletions tests/unit_test/test_unit_download.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
"""Unit Tests for satip.download.py."""
import os
import pytest

import pandas as pd

from satip.download import (
from satip.download.download import (
_determine_datetimes_to_download_files,
_get_missing_datetimes_from_list_of_files,
download_eumetsat_data,
)
from satip.utils import format_dt_str


class TestDownload():
Expand Down

0 comments on commit 0e0fc73

Please sign in to comment.