1818
1919from seaice_ecdr ._types import ECDR_SUPPORTED_RESOLUTIONS
2020from seaice_ecdr .ancillary import (
21+ get_cdr_conc_threshold ,
2122 get_daily_climatology_mask ,
2223 get_non_ocean_mask ,
2324 nh_polehole_mask ,
2930from seaice_ecdr .initial_daily_ecdr import (
3031 read_or_create_and_read_idecdr_ds ,
3132)
32- from seaice_ecdr .platforms import PLATFORM_CONFIG
33+ from seaice_ecdr .platforms import PLATFORM_CONFIG , Platform
3334from seaice_ecdr .spillover import LAND_SPILL_ALGS
3435from seaice_ecdr .util import (
3536 date_range ,
@@ -203,6 +204,8 @@ def is_seaice_conc(
203204def temporally_composite_dataarray (
204205 * ,
205206 target_date : dt .date ,
207+ platform : Platform ,
208+ hemisphere : Hemisphere ,
206209 da : xr .DataArray ,
207210 interp_range : int = 5 ,
208211 one_sided_limit : int = 3 ,
@@ -362,8 +365,14 @@ def temporally_composite_dataarray(
362365 # temporal_flags[have_only_next] = pdist[have_only_next] # CDRv04r00 error
363366 temporal_flags [have_only_next ] = ndist [have_only_next ] # Correct
364367
365- # Ensure that no conc values are between 0 and 10% after temporal interp
366- is_conc_too_low = (temp_comp_2d > 0 ) & (temp_comp_2d < 0.1 )
368+ # Ensure that no conc values are between 0 and the threshold
369+ conc_threshold_perc = get_cdr_conc_threshold (
370+ date = target_date ,
371+ hemisphere = hemisphere ,
372+ platform = platform ,
373+ )
374+ conc_threshold_frac = conc_threshold_perc / 100.0
375+ is_conc_too_low = (temp_comp_2d > 0 ) & (temp_comp_2d < conc_threshold_frac )
367376 temp_comp_2d [is_conc_too_low ] = 0
368377
369378 # Ensure flag values do not occur over land
@@ -557,6 +566,7 @@ def filter_field_via_bitmask(
557566def temporal_interpolation (
558567 * ,
559568 date : dt .date ,
569+ platform : Platform ,
560570 hemisphere : Hemisphere ,
561571 resolution : ECDR_SUPPORTED_RESOLUTIONS ,
562572 data_stack : xr .Dataset ,
@@ -591,6 +601,8 @@ def temporal_interpolation(
591601 # Actually compute the cdr_conc temporal composite
592602 ti_var , ti_flags = temporally_composite_dataarray (
593603 target_date = date ,
604+ hemisphere = hemisphere ,
605+ platform = platform ,
594606 da = data_stack .conc ,
595607 interp_range = interp_range ,
596608 non_ocean_mask = non_ocean_mask ,
@@ -697,6 +709,8 @@ def temporal_interpolation(
697709 # NOTE: the bt_conc array does not have daily_climatology applied
698710 bt_conc , _ = temporally_composite_dataarray (
699711 target_date = date ,
712+ hemisphere = hemisphere ,
713+ platform = platform ,
700714 da = data_stack .raw_bt_seaice_conc ,
701715 interp_range = interp_range ,
702716 non_ocean_mask = non_ocean_mask ,
@@ -706,6 +720,8 @@ def temporal_interpolation(
706720 # NOTE: the nt_conc array does not have daily_climatology applied
707721 nt_conc , _ = temporally_composite_dataarray (
708722 target_date = date ,
723+ hemisphere = hemisphere ,
724+ platform = platform ,
709725 da = data_stack .raw_nt_seaice_conc ,
710726 interp_range = interp_range ,
711727 non_ocean_mask = non_ocean_mask ,
@@ -869,7 +885,10 @@ def temporally_interpolated_ecdr_dataset(
869885
870886 data_stack = xr .concat (init_datasets , dim = "time" ).sortby ("time" )
871887
888+ target_platform = PLATFORM_CONFIG .get_platform_by_date (date )
889+
872890 tie_ds = temporal_interpolation (
891+ platform = target_platform ,
873892 hemisphere = hemisphere ,
874893 resolution = resolution ,
875894 date = date ,
0 commit comments