Skip to content

Commit

Permalink
Add checks for empty properties
Browse files Browse the repository at this point in the history
- Some sample data might omit properties to save space or they could be missing for other reasons.
  • Loading branch information
eldond committed Jul 18, 2024
1 parent ad0d2a2 commit f20ca63
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/subset_tools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,9 @@ function project_prop_on_subset!(
return project_prop_on_subset!(prop, from_subset, to_subset)
elseif from_subset.element[1].object[1].dimension >
to_subset.element[1].object[1].dimension
if length(prop_arr) < 1
error("The property $(strip(repr(prop_arr))) is empty; there are no data available for any subset.")
end
from_prop =
get_prop_with_grid_subset_index(prop_arr, from_subset.identifier.index)
if isnothing(from_prop)
Expand Down Expand Up @@ -371,6 +374,9 @@ function project_prop_on_subset!(
value_field::Symbol=:values,
) where {T <: edge_profiles__prop_on_subset}
from_prop = get_prop_with_grid_subset_index(prop_arr, from_subset.identifier.index)
if length(prop_arr) < 1
error("The property $(strip(repr(prop_arr))) is empty; there are no data available for any subset.")
end
if isnothing(from_prop)
error(
"from_subset ($(from_subset.identifier.index)) not represented in the property yet",
Expand Down

0 comments on commit f20ca63

Please sign in to comment.