def test_validateLayers(): data = {'cti1': os.path.join(datadir, 'test_cti1.bil'), 'friction': os.path.join(datadir, 'test_friction.bil'), 'precip': [os.path.join(datadir, 'test_precip/prec_Jan.bil')], 'slope': os.path.join(datadir, 'test_slope.bil'), 'vs30': os.path.join(datadir, 'test_vs30.bil')} layers = LM.validateLayers(cmodel) assert data == layers
def test_validateUnits(): data = {'cti1': 'unitless', 'friction': 'degrees', 'precip': 'mm', 'slope': 'degrees', 'vs30': 'm/s'} layers = LM.validateLayers(cmodel) interp = LM.validateUnits(cmodel, layers) assert data == interp
def test_validateInterpolations(): data = {'cti1': 'nearest', 'friction': 'nearest', 'precip': 'nearest', 'slope': 'nearest', 'vs30': 'nearest'} layers = LM.validateLayers(cmodel) interp = LM.validateInterpolations(cmodel, layers) assert data == interp
def test_checkTerm(): term1 = 'precipMONTH' layers = LM.validateLayers(cmodel) term, tterm, timeField = LM.checkTerm(term1, layers) assert term == "self.layerdict['precip'].getSlice(rowstart, rowend, "\ "colstart, colend, name='precip')" assert tterm == '' assert timeField == 'MONTH' term2 = 'MWextrajunk' term, tterm, timeField = LM.checkTerm(term2, layers) assert term == "self.eventdict['magnitude']extrajunk" assert tterm == 'extrajunk'
def test_validateTerms(): data = {'b1': "np.nan_to_num(self.layerdict['friction'].getSlice(" "rowstart, rowend, colstart, colend, name='friction'))", 'b2': "self.layerdict['slope'].getSlice(rowstart, rowend, " "colstart, colend, name='slope')/100.", 'b3': "np.log(self.layerdict['vs30'].getSlice(rowstart, rowend, " "colstart, colend, name='vs30'))", 'b4': "self.layerdict['cti1'].getSlice(rowstart, rowend, " "colstart, colend, name='cti1')", 'b5': "self.layerdict['precip'].getSlice(rowstart, rowend, " "colstart, colend, name='precip')"} timeField = 'MONTH' coeff = LM.validateCoefficients(cmodel) layers = LM.validateLayers(cmodel) terms, time = LM.validateTerms(cmodel, coeff, layers) assert time == timeField assert data == terms