Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print helpful information for certain ExtData problems. #2452

Merged
merged 5 commits into from
Dec 20, 2023
Merged
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 @@ -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