Add check for consistency in land cover and soil - #100
Conversation
|
This PR has sanity checks to ensure grid cells that define water or ice do not also have a vegetation type. The sanity checks touched only the initialize_from_file subroutine in RunModule.f90.
|
drakest123
left a comment
There was a problem hiding this comment.
If possible, report problematic grid cell locations rather than the fact that there is/are problematic grid cells.
|
Thanks for the review @drakest123. I went ahead and add locational information to the error messages. |
|
@SnowHydrology Do you think this PR's checks are too restrictive? Here, we're requiring grid cells that have |
|
Note: I'm leaving the |
| integer :: forcing_timestep ! integer time step (set to dt) for some subroutine calls | ||
| integer :: ii ! indices | ||
| integer, allocatable, dimension(:,:) :: err_grid ! to catch land use vs. soil inconsistencies | ||
| integer, dimension(2) :: err_indices ! to hold ix, iy for err_grid |
There was a problem hiding this comment.
Note: it may be preferable to move these error-related objects to the ErrorCheckModule if PR #108 elects to make greater use of that module for error checking and messaging purposes.
Purpose
This PR fixes issue #97.
Additions
Added land cover and soil consistency checks to
initialize_from_fileinRunModule.f90. These checks throw an error and stop the program if any cell is initialized with the following conditions:Testing
I manually/hardcoded problematic values for vegtyp and isltyp to produce errors:
where (domaingrid%mask.eq.1) domaingrid%vegtyp = parametersgrid%ISWATERwhere (domaingrid%mask.eq.1) domaingrid%isltyp = 1returns =>
ERROR: one or more grid cells have a water land cover (vegtyp = 16) and a non-water soil type (isltyp != 14)where (domaingrid%mask.eq.1) domaingrid%vegtyp = 1where (domaingrid%mask.eq.1) domaingrid%isltyp = 14returns =>
ERROR: one or more grid cells have a non-water land cover (vegtyp != 16) and a water soil type (isltyp = 14)where (domaingrid%mask.eq.1) domaingrid%vegtyp = parametersgrid%ISICEwhere (domaingrid%mask.eq.1) domaingrid%isltyp = 1returns =>
ERROR: one or more grid cells have an ice land cover (vegtyp = 24) and a non-ice soil type (isltyp != 16)where (domaingrid%mask.eq.1) domaingrid%vegtyp = 1where (domaingrid%mask.eq.1) domaingrid%isltyp = 16returns =>
ERROR: one or more grid cells have a non-ice land cover (vegtyp != 24) and an ice soil type (isltyp = 16)Notes
wherestatements to avoid iterating over the gridISWATERandISICEvalues for the utilized soil classification scheme (as the user already must provide for the utilized land cover classification scheme).