From 0a5e4be17e950237c2fa9d824496e8434ff5a037 Mon Sep 17 00:00:00 2001 From: Benjamin Auer Date: Wed, 1 Jul 2026 15:11:12 -0400 Subject: [PATCH 1/4] simple stuff to handle vrange --- Tests/ExtDataDriverGridComp.F90 | 5 +++- .../ExtData2G/ExtDataAbstractFileHandler.F90 | 9 +++---- gridcomps/ExtData2G/ExtDataGridCompNG.F90 | 27 ++++++++++++++++--- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/Tests/ExtDataDriverGridComp.F90 b/Tests/ExtDataDriverGridComp.F90 index a08a47f8a6f..7b814006dab 100644 --- a/Tests/ExtDataDriverGridComp.F90 +++ b/Tests/ExtDataDriverGridComp.F90 @@ -846,7 +846,7 @@ subroutine MAPL_ClockInit ( cf, Clock, nsteps, rc) integer :: status integer :: datetime(2) type(ESMF_Calendar) :: cal - type(ESMF_Time) :: CurrTime + type(ESMF_Time) :: CurrTime, StopTime type(ESMF_TimeInterval) :: timeInterval, duration @@ -909,6 +909,9 @@ subroutine MAPL_ClockInit ( cf, Clock, nsteps, rc) rc = STATUS ) _VERIFY(STATUS) nsteps = duration/timeInterval + StopTime = currTime+duration + call ESMF_ClockSet(clock, stopTime=stopTime, _RC) + _RETURN(ESMF_SUCCESS) end subroutine MAPL_ClockInit diff --git a/gridcomps/ExtData2G/ExtDataAbstractFileHandler.F90 b/gridcomps/ExtData2G/ExtDataAbstractFileHandler.F90 index 88356b80d5b..e51fe0f3211 100644 --- a/gridcomps/ExtData2G/ExtDataAbstractFileHandler.F90 +++ b/gridcomps/ExtData2G/ExtDataAbstractFileHandler.F90 @@ -181,17 +181,16 @@ function find_any_file(this, current_time, fail_on_missing, rc) result(filename) character(len=ESMF_MAXPATHLEN) :: trial_file logical :: file_found - useable_time = current_time - if (allocated(this%valid_range)) then - useable_time = this%valid_range(1) - end if - call fill_grads_template(trial_file, this%file_template, time=useable_time, _RC) + call fill_grads_template(trial_file, this%file_template, time=current_time, _RC) inquire(file=trim(trial_file),exist=file_found) if (file_found) then filename = trial_file _RETURN(_SUCCESS) end if + if (allocated(this%valid_range)) then + useable_time = this%valid_range(1) + end if do i=1, MAX_TRIALS useable_time = useable_time + this%frequency call fill_grads_template(trial_file, this%file_template, time=useable_time, _RC) diff --git a/gridcomps/ExtData2G/ExtDataGridCompNG.F90 b/gridcomps/ExtData2G/ExtDataGridCompNG.F90 index ce0fa69a97c..ace9d400984 100644 --- a/gridcomps/ExtData2G/ExtDataGridCompNG.F90 +++ b/gridcomps/ExtData2G/ExtDataGridCompNG.F90 @@ -262,8 +262,10 @@ SUBROUTINE Initialize_ ( GC, IMPORT, EXPORT, CLOCK, rc ) integer, pointer :: i_start integer :: new_size logical, allocatable :: rules_with_ps(:), rules_with_q(:) + type(ESMF_Time) :: run_range(2) !class(logger), pointer :: lgr + call ESMF_ClockGet(clock, starttime=run_range(1), stoptime=run_range(2), _RC) ! Get my name and set-up traceback handle ! --------------------------------------- call ESMF_GridCompGet( GC, name=comp_name, config=CF_master, vm=vm, _RC ) @@ -405,7 +407,9 @@ SUBROUTINE Initialize_ ( GC, IMPORT, EXPORT, CLOCK, rc ) do j=1,self%primary%number_of_rules%at(i) item => self%primary%item_vec%at(i_start+j-1) item%pfioCOllection_id = MAPL_DataAddCollection(item%file_template) - call GetLevs(item, time, _RC) + if (range_overlaps_item(run_range, item)) then + call GetLevs(item, time, _RC) + end if enddo enddo @@ -1805,9 +1809,26 @@ function get_item_index(this,base_name,current_time,rc) result(item_index) end if _ASSERT(item_index/=-1,"ExtData did not find item index for basename "//TRIM(base_name)) _RETURN(_SUCCESS) - end function get_item_index + end function get_item_index + + function range_overlaps_item(range, item) result(overlaps) + logical :: overlaps + type(ESMF_Time), intent(in) :: range(2) + type(PrimaryExport), intent(in) :: item + + ! Single-rule items carry no start_end_time constraint + if (.not. allocated(item%start_end_time)) then + overlaps = .true. + return + end if + + ! Half-open overlap: [A,B) and [C,D) overlap iff A Date: Thu, 2 Jul 2026 09:24:26 -0400 Subject: [PATCH 2/4] fix bug --- gridcomps/ExtData2G/ExtDataGridCompNG.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gridcomps/ExtData2G/ExtDataGridCompNG.F90 b/gridcomps/ExtData2G/ExtDataGridCompNG.F90 index ace9d400984..2ab952806a6 100644 --- a/gridcomps/ExtData2G/ExtDataGridCompNG.F90 +++ b/gridcomps/ExtData2G/ExtDataGridCompNG.F90 @@ -265,7 +265,6 @@ SUBROUTINE Initialize_ ( GC, IMPORT, EXPORT, CLOCK, rc ) type(ESMF_Time) :: run_range(2) !class(logger), pointer :: lgr - call ESMF_ClockGet(clock, starttime=run_range(1), stoptime=run_range(2), _RC) ! Get my name and set-up traceback handle ! --------------------------------------- call ESMF_GridCompGet( GC, name=comp_name, config=CF_master, vm=vm, _RC ) @@ -400,6 +399,7 @@ SUBROUTINE Initialize_ ( GC, IMPORT, EXPORT, CLOCK, rc ) end if enddo + call ESMF_ClockGet(clock, currtime=run_range(1), stoptime=run_range(2), _RC) ! now lets establish the horizonal and vertical grid for each component, replaces getlevs do i=1,self%primary%import_names%size() From 056fe4b35304f79f568b934aad111942a06a1b29 Mon Sep 17 00:00:00 2001 From: Benjamin Auer Date: Thu, 2 Jul 2026 10:34:08 -0400 Subject: [PATCH 3/4] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9f0b45cce4..b23b7e8848c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Update ExtData to not initialize primary items in multi rule case when the use this rule range does not overlap execution range - Update CI to use Baselibs 8.32.0 and circleci-tools orb v5 - Update `components.yaml` - ESMA_env v5.22.0 From 810135fdef2291fba5bd4bb4cad8b539acd2eaca Mon Sep 17 00:00:00 2001 From: Benjamin Auer Date: Thu, 2 Jul 2026 11:39:12 -0400 Subject: [PATCH 4/4] fix bug in previous commit that tripped a few unit tests --- gridcomps/ExtData2G/ExtDataAbstractFileHandler.F90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gridcomps/ExtData2G/ExtDataAbstractFileHandler.F90 b/gridcomps/ExtData2G/ExtDataAbstractFileHandler.F90 index e51fe0f3211..4806591c3e2 100644 --- a/gridcomps/ExtData2G/ExtDataAbstractFileHandler.F90 +++ b/gridcomps/ExtData2G/ExtDataAbstractFileHandler.F90 @@ -181,7 +181,8 @@ function find_any_file(this, current_time, fail_on_missing, rc) result(filename) character(len=ESMF_MAXPATHLEN) :: trial_file logical :: file_found - call fill_grads_template(trial_file, this%file_template, time=current_time, _RC) + useable_time = current_time + call fill_grads_template(trial_file, this%file_template, time=useable_time, _RC) inquire(file=trim(trial_file),exist=file_found) if (file_found) then