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

Add --no-multiprocesing option to daily CLI #154

Merged
merged 1 commit into from
Sep 18, 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
2 changes: 1 addition & 1 deletion make_25km_ecdr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ START_DATE="2022-03-01"
END_DATE="2022-04-01"
HEMISPHERE="north"

./scripts/cli.sh daily --date $START_DATE --end-date $END_DATE --hemisphere $HEMISPHERE --base-output-dir $BASE_OUTPUT_DIR
./scripts/cli.sh daily --date $START_DATE --end-date $END_DATE --hemisphere $HEMISPHERE --base-output-dir $BASE_OUTPUT_DIR --no-multiprocessing
18 changes: 16 additions & 2 deletions seaice_ecdr/cli/daily.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def make_25km_ecdr(
end_date: dt.date,
hemisphere: Hemisphere,
base_output_dir: Path,
no_multiprocessing: bool,
):
# TODO: consider extracting these to CLI options that default to these values.
RESOLUTION: Final = "25"
Expand All @@ -39,8 +40,12 @@ def make_25km_ecdr(
# date config.
AM2_START_DATE = dt.date(2013, 1, 1)
# Use the default platform dates, which excldues AMSR2
if no_multiprocessing:
daily_intermediate_cmd = "intermediate-daily"
else:
daily_intermediate_cmd = "multiprocess-intermediate-daily"
_run_cmd(
f"{CLI_EXE_PATH} multiprocess-intermediate-daily"
f"{CLI_EXE_PATH} {daily_intermediate_cmd}"
f" --start-date {start_date:%Y-%m-%d} --end-date {end_date:%Y-%m-%d}"
f" --hemisphere {hemisphere}"
f" --base-output-dir {base_output_dir}"
Expand All @@ -54,7 +59,7 @@ def make_25km_ecdr(
if start_date >= AM2_START_DATE:
_run_cmd(
f"export PLATFORM_START_DATES_CONFIG_FILEPATH={PROTOTYPE_PLATFORM_START_DATES_CONFIG_FILEPATH} &&"
f" {CLI_EXE_PATH} multiprocess-intermediate-daily"
f" {CLI_EXE_PATH} {daily_intermediate_cmd}"
f" --start-date {start_date:%Y-%m-%d} --end-date {end_date:%Y-%m-%d}"
f" --hemisphere {hemisphere}"
f" --base-output-dir {base_output_dir}"
Expand All @@ -77,6 +82,7 @@ def make_25km_ecdr(
@click.option(
"-d",
"--date",
"--start-date",
required=True,
type=click.DateTime(
formats=(
Expand Down Expand Up @@ -127,12 +133,19 @@ def make_25km_ecdr(
),
show_default=True,
)
@click.option(
"--no-multiprocessing",
help="Disable multiprocessing. Useful for debugging purposes.",
is_flag=True,
default=False,
)
def cli(
*,
date: dt.date,
end_date: dt.date | None,
hemisphere: Hemisphere,
base_output_dir: Path,
no_multiprocessing: bool,
):
if end_date is None:
end_date = copy.copy(date)
Expand All @@ -141,6 +154,7 @@ def cli(
end_date=end_date,
hemisphere=hemisphere,
base_output_dir=base_output_dir,
no_multiprocessing=no_multiprocessing,
)


Expand Down
3 changes: 2 additions & 1 deletion seaice_ecdr/intermediate_daily.py
Original file line number Diff line number Diff line change
Expand Up @@ -724,10 +724,11 @@ def create_standard_ecdr_for_dates(
return error_dates


@click.command(name="cdecdr")
@click.command(name="intermediate-daily")
@click.option(
"-d",
"--date",
"--start-date",
required=True,
type=click.DateTime(
formats=(
Expand Down