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 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..4806591c3e2 100644 --- a/gridcomps/ExtData2G/ExtDataAbstractFileHandler.F90 +++ b/gridcomps/ExtData2G/ExtDataAbstractFileHandler.F90 @@ -182,9 +182,6 @@ function find_any_file(this, current_time, fail_on_missing, rc) result(filename) 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) inquire(file=trim(trial_file),exist=file_found) @@ -192,6 +189,9 @@ function find_any_file(this, current_time, fail_on_missing, rc) result(filename) 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..2ab952806a6 100644 --- a/gridcomps/ExtData2G/ExtDataGridCompNG.F90 +++ b/gridcomps/ExtData2G/ExtDataGridCompNG.F90 @@ -262,6 +262,7 @@ 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 ! Get my name and set-up traceback handle @@ -398,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() @@ -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