Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion Tests/ExtDataDriverGridComp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions gridcomps/ExtData2G/ExtDataAbstractFileHandler.F90
Original file line number Diff line number Diff line change
Expand Up @@ -182,16 +182,16 @@ 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)

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)
Expand Down
27 changes: 24 additions & 3 deletions gridcomps/ExtData2G/ExtDataGridCompNG.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -398,14 +399,17 @@ 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()

i_start => self%primary%export_id_start%at(i)
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
Expand Down Expand Up @@ -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<D and C<B
overlaps = (item%start_end_time(1) < range(2)) .and. &
(range(1) < item%start_end_time(2))

end function range_overlaps_item

subroutine get_global_options(yaml_file,am_running,use_file_weights,rc)
subroutine get_global_options(yaml_file,am_running,use_file_weights,rc)
character(len=*), intent(in) :: yaml_file
logical,intent(out) :: am_running
logical,intent(out) :: use_file_weights
Expand Down
Loading