Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sat): Update script to match VM #142

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions containers/sat/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ COPY --from=install-reqs /venv /venv
COPY . /app
WORKDIR /app
ENTRYPOINT ["/venv/bin/python3", "download_process_sat.py"]
VOLUME /mnt/disks/sat

30 changes: 8 additions & 22 deletions containers/sat/download_process_sat.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,18 +603,12 @@ def _rewrite_zarr_times(output_name: str) -> None:
default="/mnt/disks/sat",
type=pathlib.Path,
)
range_group = parser.add_mutually_exclusive_group(
required=True,
)
range_group.add_argument(
parser.add_argument(
"--month", "-m",
help="Month to download data for (YYYY-MM)",
type=str,
)
range_group.add_argument(
"--day", "-d",
help="Day to download data for (YYYY-MM-DD)",
type=str,
required=True,
default=str(dt.datetime.now(tz=dt.UTC).strftime("%Y-%m")),
)
parser.add_argument(
"--delete_raw", "--rm",
Expand All @@ -635,19 +629,11 @@ def run(args: argparse.Namespace) -> None:
sat_config = CONFIGS[args.sat]

# Get start and end times for run
if args.month:
start: dt.datetime = dt.datetime.strptime(args.month, "%Y-%m")
end: dt.datetime = \
start.replace(month=start.month + 1) if start.month < 12 \
else start.replace(year=start.year + 1, month=1) \
- dt.timedelta(days=1)
elif args.day:
start = dt.datetime.strptime(args.day, "%Y-%m-%d")
end = start + dt.timedelta(days=1)
else:
log.error("Invalid args.")
return

start: dt.datetime = dt.datetime.strptime(args.month, "%Y-%m")
end: dt.datetime = \
start.replace(month=start.month + 1) if start.month < 12 \
else start.replace(year=start.year + 1, month=1) \
- dt.timedelta(days=1)
scan_times: list[pd.Timestamp] = pd.date_range(
start=start,
end=end,
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ dependencies = [
[project.optional-dependencies]
dev = [
"mypy == 1.7.1",
"types-PyYAML",
"types-pytz",
"types-requests",
"ruff == 0.1.7",
"unittest-xml-reporting == 3.2.0",
"pytest >= 7.4.1",
Expand Down
Loading