Skip to content

Commit

Permalink
Merge pull request #2452 from GEOS-ESM/feature/mmanyin/ExtData_explai…
Browse files Browse the repository at this point in the history
…n_error

Print helpful information for certain ExtData problems.
  • Loading branch information
mathomp4 authored Dec 20, 2023
2 parents 2eb9da2 + d847a29 commit 7086edb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- New directory (`docs/tutorial/grid_comps/automatic_code_generator`) containing an example showing how to automatically generate the source code using the `MAPL_GridCompSpecs_ACG.py` tool.
- Added/modified a few _ASSERT calls in ExtData, to better explain what is wrong in .yaml file

### Changed

Expand Down
10 changes: 6 additions & 4 deletions gridcomps/ExtData2G/ExtDataGridCompNG.F90
Original file line number Diff line number Diff line change
Expand Up @@ -387,14 +387,16 @@ SUBROUTINE Initialize_ ( GC, IMPORT, EXPORT, CLOCK, rc )
do j=1,num_rules
num_primary=num_primary+1
write(sidx,'(I1)')j
call config_yaml%fillin_primary(current_base_name//"+"//sidx,current_base_name,self%primary%item(num_primary),time,clock,_RC)
call config_yaml%fillin_primary(current_base_name//"+"//sidx,current_base_name,self%primary%item(num_primary),time,clock,rc=status)
_ASSERT(status==0, "ExtData multi-rule problem with BASE NAME "//TRIM(current_base_name))
allocate(self%primary%item(num_primary)%start_end_time(2))
self%primary%item(num_primary)%start_end_time(1)=time_ranges(j)
self%primary%item(num_primary)%start_end_time(2)=time_ranges(j+1)
enddo
else
num_primary=num_primary+1
call config_yaml%fillin_primary(current_base_name,current_base_name,self%primary%item(num_primary),time,clock,_RC)
call config_yaml%fillin_primary(current_base_name,current_base_name,self%primary%item(num_primary),time,clock,rc=status)
_ASSERT(status==0, "ExtData single-rule problem with BASE NAME "//TRIM(current_base_name))
end if
call ESMF_StateGet(Export,current_base_name,state_item_type,_RC)
if (state_item_type /= ESMF_STATEITEM_NOTFOUND) then
Expand Down Expand Up @@ -1757,7 +1759,7 @@ function get_item_index(this,base_name,current_time,rc) result(item_index)
exit
end if
enddo
_ASSERT(found,"no item with that basename found")
_ASSERT(found,"ExtData no item with basename '"//TRIM(base_name)//"' found")

item_index = -1
if (num_rules == 1) then
Expand All @@ -1771,7 +1773,7 @@ function get_item_index(this,base_name,current_time,rc) result(item_index)
endif
enddo
end if
_ASSERT(item_index/=-1,"did not find item")
_ASSERT(item_index/=-1,"ExtData did not find item index for basename "//TRIM(base_name))
_RETURN(_SUCCESS)
end function get_item_index

Expand Down
8 changes: 7 additions & 1 deletion gridcomps/ExtData2G/ExtDataOldTypesCreator.F90
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,13 @@ subroutine fillin_primary(this,item_name,base_name,primary_item,time,clock,unusa
! file_template
primary_item%isConst = .false.
if (index(rule%collection,"/dev/null")==0) then
dataset => this%file_stream_map%at(trim(rule%collection))

if ( ASSOCIATED(this%file_stream_map%at(trim(rule%collection))) ) then
dataset => this%file_stream_map%at(trim(rule%collection))
else
_FAIL("ExtData problem with collection "//TRIM(rule%collection))
end if

primary_item%file_template = dataset%file_template
get_range = trim(time_sample%extrap_outside) /= "none"
call dataset%detect_metadata(primary_item%file_metadata,time,rule%multi_rule,get_range=get_range,_RC)
Expand Down

0 comments on commit 7086edb

Please sign in to comment.