Skip to content

Commit

Permalink
Reset ECDR Product version for initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
trey-stafford committed Sep 18, 2024
1 parent 0e4b9d2 commit ec8b62f
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 31 deletions.
2 changes: 1 addition & 1 deletion seaice_ecdr/constants.py
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
8 changes: 6 additions & 2 deletions seaice_ecdr/initial_daily_ecdr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions seaice_ecdr/temporal_composite_daily.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
39 changes: 19 additions & 20 deletions seaice_ecdr/tests/unit/test_monthly.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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=}")
Expand Down
16 changes: 8 additions & 8 deletions seaice_ecdr/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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}"

Expand Down

0 comments on commit ec8b62f

Please sign in to comment.