diff --git a/seaice_ecdr/constants.py b/seaice_ecdr/constants.py index 398e970e..dcc41bf5 100644 --- a/seaice_ecdr/constants.py +++ b/seaice_ecdr/constants.py @@ -1,7 +1,7 @@ from pathlib import Path # This is the version string for the ECDR product. -ECDR_PRODUCT_VERSION = "v05r01" +ECDR_PRODUCT_VERSION = "v05r00" # NSIDC infrastructure-specific paths: NSIDC_NFS_SHARE_DIR = Path("/share/apps/G02202_V5") diff --git a/seaice_ecdr/initial_daily_ecdr.py b/seaice_ecdr/initial_daily_ecdr.py index 90ecd655..aaadd524 100644 --- a/seaice_ecdr/initial_daily_ecdr.py +++ b/seaice_ecdr/initial_daily_ecdr.py @@ -40,7 +40,11 @@ nh_polehole_mask, ) from seaice_ecdr.cli.util import datetime_to_date -from seaice_ecdr.constants import CDR_ANCILLARY_DIR, DEFAULT_BASE_OUTPUT_DIR +from seaice_ecdr.constants import ( + CDR_ANCILLARY_DIR, + DEFAULT_BASE_OUTPUT_DIR, + ECDR_PRODUCT_VERSION, +) from seaice_ecdr.grid_id import get_grid_id from seaice_ecdr.platforms import PLATFORM_CONFIG, SUPPORTED_PLATFORM_ID from seaice_ecdr.regrid_25to12 import reproject_ideds_25to12 @@ -331,7 +335,7 @@ def get_flagmask( if ancillary_source == "CDRv4": version_string = "v04r00" elif ancillary_source == "CDRv5": - version_string = "v05r01" + version_string = ECDR_PRODUCT_VERSION flagmask_fn = CDR_ANCILLARY_DIR / f"flagmask_{gridid}_{version_string}.dat" try: diff --git a/seaice_ecdr/temporal_composite_daily.py b/seaice_ecdr/temporal_composite_daily.py index 06fbe1e4..ac792fd8 100644 --- a/seaice_ecdr/temporal_composite_daily.py +++ b/seaice_ecdr/temporal_composite_daily.py @@ -521,6 +521,7 @@ def get_daily_climatology_mask( daily_ds = None if hemisphere == "north" and resolution == "25": + # TODO: here and below, replace the hard-coded string with use of `CDR_ANCILLARY_DIR` # New mask. Valid/invalid extends into landmask # daily_ds = Dataset( # "/share/apps/G02202_V5/v05r01_ancillary/ecdr-ancillary-psn25-dailyclim.nc" diff --git a/seaice_ecdr/tests/unit/test_monthly.py b/seaice_ecdr/tests/unit/test_monthly.py index 285b10b2..c80cb9d2 100644 --- a/seaice_ecdr/tests/unit/test_monthly.py +++ b/seaice_ecdr/tests/unit/test_monthly.py @@ -9,6 +9,7 @@ from pm_tb_data._types import NORTH from seaice_ecdr import monthly, util +from seaice_ecdr.constants import ECDR_PRODUCT_VERSION from seaice_ecdr.intermediate_daily import get_ecdr_dir from seaice_ecdr.monthly import ( CDR_SEAICE_CONC_QA_DAILY_BITMASKS, @@ -41,30 +42,28 @@ def test__get_daily_complete_filepaths_for_month(fs): ) year = 2022 month = 3 - # TODO: get the version string from config instead of hard-coding it to - # `v05r01` here. _fake_files_for_test_year_month_and_hemisphere = [ - nh_intermediate_dir / "sic_psn12.5_20220301_F17_v05r01.nc", - nh_intermediate_dir / "sic_psn12.5_20220302_F17_v05r01.nc", - nh_intermediate_dir / "sic_psn12.5_20220303_F17_v05r01.nc", + nh_intermediate_dir / f"sic_psn12.5_20220301_F17_{ECDR_PRODUCT_VERSION}.nc", + nh_intermediate_dir / f"sic_psn12.5_20220302_F17_{ECDR_PRODUCT_VERSION}.nc", + nh_intermediate_dir / f"sic_psn12.5_20220303_F17_{ECDR_PRODUCT_VERSION}.nc", ] _fake_files = [ - nh_intermediate_dir / "sic_psn12.5_20220201_F17_v05r01.nc", - nh_intermediate_dir / "sic_pss12.5_20220201_F17_v05r01.nc", - nh_intermediate_dir / "sic_psn12.5_20220202_F17_v05r01.nc", - nh_intermediate_dir / "sic_pss12.5_20220202_F17_v05r01.nc", - nh_intermediate_dir / "sic_psn12.5_20220203_F17_v05r01.nc", - nh_intermediate_dir / "sic_pss12.5_20220203_F17_v05r01.nc", - nh_intermediate_dir / "sic_pss12.5_20220301_F17_v05r01.nc", - nh_intermediate_dir / "sic_pss12.5_20220302_F17_v05r01.nc", - nh_intermediate_dir / "sic_pss12.5_20220303_F17_v05r01.nc", + nh_intermediate_dir / f"sic_psn12.5_20220201_F17_{ECDR_PRODUCT_VERSION}.nc", + nh_intermediate_dir / f"sic_pss12.5_20220201_F17_{ECDR_PRODUCT_VERSION}.nc", + nh_intermediate_dir / f"sic_psn12.5_20220202_F17_{ECDR_PRODUCT_VERSION}.nc", + nh_intermediate_dir / f"sic_pss12.5_20220202_F17_{ECDR_PRODUCT_VERSION}.nc", + nh_intermediate_dir / f"sic_psn12.5_20220203_F17_{ECDR_PRODUCT_VERSION}.nc", + nh_intermediate_dir / f"sic_pss12.5_20220203_F17_{ECDR_PRODUCT_VERSION}.nc", + nh_intermediate_dir / f"sic_pss12.5_20220301_F17_{ECDR_PRODUCT_VERSION}.nc", + nh_intermediate_dir / f"sic_pss12.5_20220302_F17_{ECDR_PRODUCT_VERSION}.nc", + nh_intermediate_dir / f"sic_pss12.5_20220303_F17_{ECDR_PRODUCT_VERSION}.nc", *_fake_files_for_test_year_month_and_hemisphere, - nh_intermediate_dir / "sic_psn12.5_20220401_F17_v05r01.nc", - sh_intermediate_dir / "sic_pss12.5_20220401_F17_v05r01.nc", - nh_intermediate_dir / "sic_psn12.5_20220402_F17_v05r01.nc", - sh_intermediate_dir / "sic_pss12.5_20220402_F17_v05r01.nc", - nh_intermediate_dir / "sic_psn12.5_20220403_F17_v05r01.nc", - sh_intermediate_dir / "sic_pss12.5_20220403_F17_v05r01.nc", + nh_intermediate_dir / f"sic_psn12.5_20220401_F17_{ECDR_PRODUCT_VERSION}.nc", + sh_intermediate_dir / f"sic_pss12.5_20220401_F17_{ECDR_PRODUCT_VERSION}.nc", + nh_intermediate_dir / f"sic_psn12.5_20220402_F17_{ECDR_PRODUCT_VERSION}.nc", + sh_intermediate_dir / f"sic_pss12.5_20220402_F17_{ECDR_PRODUCT_VERSION}.nc", + nh_intermediate_dir / f"sic_psn12.5_20220403_F17_{ECDR_PRODUCT_VERSION}.nc", + sh_intermediate_dir / f"sic_pss12.5_20220403_F17_{ECDR_PRODUCT_VERSION}.nc", ] for _file in _fake_files: logger.info(f"creating {_file=}") diff --git a/seaice_ecdr/util.py b/seaice_ecdr/util.py index e60f1014..031c9c5b 100644 --- a/seaice_ecdr/util.py +++ b/seaice_ecdr/util.py @@ -24,8 +24,8 @@ def standard_daily_filename( ) -> str: """Return standard daily NetCDF filename. - North Daily files: sic_psn12.5_{YYYYMMDD}_{platform_id}_v05r01.nc - South Daily files: sic_pss12.5_{YYYYMMDD}_{platform_id}_v05r01.nc + North Daily files: sic_psn12.5_{YYYYMMDD}_{platform_id}_{cdr_product_version}.nc + South Daily files: sic_pss12.5_{YYYYMMDD}_{platform_id}_{cdr_product_version}.nc """ grid_id = get_grid_id( hemisphere=hemisphere, @@ -67,8 +67,8 @@ def standard_daily_aggregate_filename( ) -> str: """Return standard daily aggregate NetCDF filename. - North Daily aggregate files: sic_psn12.5_YYYYMMDD-YYYYMMDD_v05r01.nc - South Daily aggregate files: sic_pss12.5_YYYYMMDD-YYYYMMDD_v05r01.nc + North Daily aggregate files: sic_psn12.5_YYYYMMDD-YYYYMMDD_{cdr_product_version}.nc + South Daily aggregate files: sic_pss12.5_YYYYMMDD-YYYYMMDD_{cdr_product_version}.nc """ grid_id = get_grid_id( hemisphere=hemisphere, @@ -91,8 +91,8 @@ def standard_monthly_filename( ) -> str: """Return standard monthly NetCDF filename. - North Monthly files: sic_psn12.5_{YYYYMM}_{platform_id}_v05r01.nc - South Monthly files: sic_pss12.5_{YYYYMM}_{platform_id}_v05r01.nc + North Monthly files: sic_psn12.5_{YYYYMM}_{platform_id}_{cdr_product_version}.nc + South Monthly files: sic_pss12.5_{YYYYMM}_{platform_id}_{cdr_product_version}.nc """ grid_id = get_grid_id( hemisphere=hemisphere, @@ -114,8 +114,8 @@ def standard_monthly_aggregate_filename( ) -> str: """Return standard monthly aggregate NetCDF filename. - North Monthly aggregate files: sic_psn12.5_YYYYMM-YYYYMM_v05r01.nc - South Monthly aggregate files: sic_pss12.5_YYYYMM-YYYYMM_v05r01.nc + North Monthly aggregate files: sic_psn12.5_YYYYMM-YYYYMM_{cdr_product_version}.nc + South Monthly aggregate files: sic_pss12.5_YYYYMM-YYYYMM_{cdr_product_version}.nc """ date_str = f"{start_year}{start_month:02}-{end_year}{end_month:02}"