From 645833ddc4501b11882a373fe6a949793fca2149 Mon Sep 17 00:00:00 2001 From: Trey Stafford Date: Wed, 18 Oct 2023 16:24:51 -0600 Subject: [PATCH] Init default locations for daily output files --- seaice_ecdr/constants.py | 8 ++++++++ seaice_ecdr/initial_daily_ecdr.py | 4 +++- seaice_ecdr/nrt.py | 5 +++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/seaice_ecdr/constants.py b/seaice_ecdr/constants.py index 8b4b02ac..419b56c4 100644 --- a/seaice_ecdr/constants.py +++ b/seaice_ecdr/constants.py @@ -3,7 +3,15 @@ # NSIDC infrastructure-specific paths: NSIDC_NFS_SHARE_DIR = Path("/share/apps/amsr2-cdr") +# Outputs from the `seaice_ecdr` go to these locations. +BASE_OUTPUT_DIR = NSIDC_NFS_SHARE_DIR / "ecdr_outputs" +# Daily initial output from 'final' input data (e.g., AU_SI12) +INITIAL_DAILY_OUTPUT_DIR = BASE_OUTPUT_DIR / "final" / "initial_daily" +# Daily initial output from NRT LANCE AMSR2 data (AU_SI12_NRT_R04) +NRT_INITIAL_DAILY_OUTPUT_DIR = BASE_OUTPUT_DIR / "nrt" / "initial_daily" + # Location of LANCE AMSR2 NRT data files: +# TODO: nest the subdir under an `ecdr_inputs` or similar? LANCE_NRT_DATA_DIR = NSIDC_NFS_SHARE_DIR / "lance_amsr2_nrt_data" CDR_DATA_DIR = NSIDC_NFS_SHARE_DIR / "cdr_data" diff --git a/seaice_ecdr/initial_daily_ecdr.py b/seaice_ecdr/initial_daily_ecdr.py index e08e8183..09ba1d6c 100644 --- a/seaice_ecdr/initial_daily_ecdr.py +++ b/seaice_ecdr/initial_daily_ecdr.py @@ -35,6 +35,7 @@ from seaice_ecdr.land_spillover import load_or_create_land90_conc, read_adj123_file from seaice_ecdr.masks import psn_125_near_pole_hole_mask from seaice_ecdr.cli.util import datetime_to_date +from seaice_ecdr.constants import INITIAL_DAILY_OUTPUT_DIR EXPECTED_TB_NAMES = ("h18", "v18", "v23", "h36", "v36") @@ -957,7 +958,6 @@ def create_idecdr_for_date_range( required=True, type=click.Choice(get_args(Hemisphere)), ) -# TODO: default output-dir for initial daily files. @click.option( "-o", "--output-dir", @@ -970,6 +970,8 @@ def create_idecdr_for_date_range( resolve_path=True, path_type=Path, ), + default=INITIAL_DAILY_OUTPUT_DIR, + show_default=True, ) @click.option( "-r", diff --git a/seaice_ecdr/nrt.py b/seaice_ecdr/nrt.py index 08460934..9b71aa47 100644 --- a/seaice_ecdr/nrt.py +++ b/seaice_ecdr/nrt.py @@ -11,7 +11,7 @@ from pm_tb_data._types import Hemisphere from pm_tb_data.fetch.au_si import AU_SI_RESOLUTIONS -from seaice_ecdr.constants import LANCE_NRT_DATA_DIR +from seaice_ecdr.constants import LANCE_NRT_DATA_DIR, NRT_INITIAL_DAILY_OUTPUT_DIR from seaice_ecdr.initial_daily_ecdr import make_cdr_netcdf from seaice_ecdr.cli.util import datetime_to_date @@ -65,7 +65,6 @@ def download_latest_nrt_data(*, output_dir: Path, overwrite: bool) -> None: required=True, type=click.Choice(get_args(Hemisphere)), ) -# TODO: default output-dir for initial daily nrt files. @click.option( "-o", "--output-dir", @@ -78,6 +77,8 @@ def download_latest_nrt_data(*, output_dir: Path, overwrite: bool) -> None: resolve_path=True, path_type=Path, ), + show_default=True, + default=NRT_INITIAL_DAILY_OUTPUT_DIR, ) @click.option( "-r",