Changeset 26645
- Timestamp:
- 11/19/21 00:12:18 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/classes/stochasticforcing.py
r26644 r26645 60 60 # Check that all fields agree with the corresponding md class 61 61 checkdefaults = False 62 structstoch = self.structstochforcing() 62 structstoch = self.structstochforcing() 63 print(type(structstoch)) 63 64 for field in self.fields: 64 # ## Checks are temporarily commented out: need to debug why this does not work (18Nov2021) ###65 # Checks are temporarily commented out: need to debug why this does not work (18Nov2021) # 65 66 if 'SMB' in field: 66 mdname = structstoch[ 'mdnames'][structstoch['fields']==field]67 #if (type(md.smb)!= mdname):68 # raise TypeError('md.smb does not agree with stochasticforcing field {}'.format(field))67 mdname = structstoch[field] 68 if (type(md.smb).__name__ != mdname): 69 raise TypeError('md.smb does not agree with stochasticforcing field {}'.format(mdname)) 69 70 if 'FrontalForcings' in field: 70 mdname = structstoch[ 'mdnames'][structstoch['fields']==field]71 #if (type(md.frontalforcings)!= mdname):72 # raise TypeError('md.frontalforcings does not agree with stochasticforcing field {}'.format(field))71 mdname = structstoch[field] 72 if (type(md.frontalforcings).__name__ != mdname): 73 raise TypeError('md.frontalforcings does not agree with stochasticforcing field {}'.format(mdname)) 73 74 if 'Calving' in field: 74 mdname = structstoch[ 'mdnames'][structstoch['fields']==field]75 #if (type(md.calving)!= mdname):76 # raise TypeError('md.calving does not agree with stochasticforcing field {}'.format(field))75 mdname = structstoch[field] 76 if (type(md.calving).__name__ != mdname): 77 raise TypeError('md.calving does not agree with stochasticforcing field {}'.format(mdname)) 77 78 if 'BasalforcingsFloatingice' in field: 78 mdname = structstoch[ 'mdnames'][structstoch['fields']==field]79 #if (type(md.basalforcings)!= mdname):80 # raise TypeError('md.basalforcings does not agree with stochasticforcing field {}'.format(field))#Checking for specific dimensions79 mdname = structstoch[field] 80 if (type(md.basalforcings).__name__ != mdname): 81 raise TypeError('md.basalforcings does not agree with stochasticforcing field {}'.format(mdname)) #Checking for specific dimensions 81 82 if not (field == 'SMBautoregression' or field == 'FrontalForcingsRignotAutoregression'): 82 83 checkdefaults = True #field with non-specific dimensionality … … 91 92 if ('FrontalForcingsRignotAutoregression' in self.fields): 92 93 size_tot = size_tot - self.defaultdimension + md.frontalforcings.num_basins 93 indTFar 94 indTFar = self.fields.index('FrontalForcingsRignotAutoregression') 94 95 if (indSMBar != -1 and indTFar != -1): 95 96 covsum = self.covariance[np.sum(self.defaultdimensions[0:indSMBar]).astype(int):np.sum(self.defaultdimensions[0:indSMBar + 1]).astype(int), np.sum(self.defaultdimensions[0:indTFar]).astype(int):np.sum(self.defaultdimensions[0:indTFar + 1]).astype(int)] … … 152 153 # }}} 153 154 154 def supportedstochforcings(self): # {{{155 def supportedstochforcings(self): # {{{ 155 156 """Defines list of fields supported by the class md.stochasticforcing 156 157 """ 157 158 list1 = self.structstochforcing() 158 list1 = list1['fields'] 159 return(list1) #}}} 159 list1 = list1.keys() 160 return list(list1) 161 #}}} 160 162 161 def structstochforcing(self): # {{{163 def structstochforcing(self): # {{{ 162 164 """Defines dictionary with list of fields 163 165 supported and corresponding md names 164 166 """ 165 structure = dict({ 166 'fields': 167 ['DefaultCalving', 168 'FloatingMeltRate', 169 'FrontalForcingsRignotAutoregression', 170 'SMBautoregression'], 171 172 'mdnames': 173 ['calving', 174 'basalforcings', 175 'frontalforcingsrignotautoregression', 176 'SMBautoregression']}) 177 return(structure) # }}} 178 167 structure = {'DefaultCalving': 'calving', 168 'FloatingMeltRate': 'basalforcings', 169 'FrontalForcingsRignotAutoregression': 'frontalforcingsrignotautoregression', 170 'SMBautoregression': 'SMBautoregression'} 171 return structure 172 # }}}
Note:
See TracChangeset
for help on using the changeset viewer.