Changeset 25167


Ignore:
Timestamp:
06/26/20 20:49:34 (5 years ago)
Author:
jdquinn
Message:

BUG: Scope of function naturetoint.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/classes/materials.py

    r25158 r25167  
    271271            return self
    272272    #}}}
    273 
    274     def naturetointeger(strnat): #{{{
    275         intnat = np.zeros(len(strnat))
    276 
    277         for i in range(len(intnat)):
    278             if strnat[i] == 'damageice':
    279                 intnat[i] = 1
    280             elif strnat[i] == 'estar':
    281                 intnat[i] = 2
    282             elif strnat[i] == 'ice':
    283                 intnat[i] = 3
    284             elif strnat[i] == 'enhancedice':
    285                 intnat[i] = 4
    286             # elif strnat[i] == 'materials':
    287             #     intnat[i] = 5 #this case will never happen, kept to ensure equivalent of codes between IoCodeToMeterialsEnum and IoCodeToNatureEnum
    288             elif strnat[i] == 'litho':
    289                 intnat[i] = 6
    290             elif strnat[i] == 'hydro':
    291                 intnat[i] = 7
    292             else:
    293                 raise RuntimeError("materials constructor error message: nature of the material not supported yet! ('ice' or 'litho' or 'hydro')")
    294 
    295         return intnat
    296     #}}}
     273#}}}
     274
     275def naturetointeger(strnat): #{{{
     276    intnat = np.zeros(len(strnat))
     277
     278    for i in range(len(intnat)):
     279        if strnat[i] == 'damageice':
     280            intnat[i] = 1
     281        elif strnat[i] == 'estar':
     282            intnat[i] = 2
     283        elif strnat[i] == 'ice':
     284            intnat[i] = 3
     285        elif strnat[i] == 'enhancedice':
     286            intnat[i] = 4
     287        # elif strnat[i] == 'materials':
     288        #     intnat[i] = 5 #this case will never happen, kept to ensure equivalent of codes between IoCodeToMeterialsEnum and IoCodeToNatureEnum
     289        elif strnat[i] == 'litho':
     290            intnat[i] = 6
     291        elif strnat[i] == 'hydro':
     292            intnat[i] = 7
     293        else:
     294            raise RuntimeError("materials constructor error message: nature of the material not supported yet! ('ice' or 'litho' or 'hydro')")
     295
     296    return intnat
     297#}}}
Note: See TracChangeset for help on using the changeset viewer.