Skip to content

add meta-types for landunit types #5

Open
@billsacks

Description

@billsacks

Bill Sacks < sacks@ucar.edu > - 2012-03-22 16:20:18 -0600
Bugzilla Id: 1483
Bugzilla CC: rfisher@ucar.edu,

There are lots of checks in the code that look like this:

if (ltype(l) == istsoil .or. ltype(l) == istcrop)

or:

if (ltype(l)==istice .or. ltype(l)==istice_mec) then

or:

elseif ( itypelun(l) == istdlak .or. itypelun(l) == istslak ) then

I would propose adding some logical variables like:

is_vegetated(l) (true for soil & crop landunits)

is_ice(l) (true for ice & ice_mec landunits)

is_lake(l) (true for deep & shallow lake)

This would have these advantages:

  • more easily extensible: e.g., could add a new vegetated landunit without having to change conditionals that occur throughout the code

  • safer: e.g., I just found an instance where a conditional checked ltype(l)==istice, forgetting to also check the possibility of istice_mec

Metadata

Metadata

Assignees

No one assigned

    Labels

    code healthimproving internal code structure to make easier to maintain (sustainability)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions