Skip to content

Commit

Permalink
pep8speaks
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulaSp3 committed Sep 16, 2024
1 parent 571697e commit 0f54289
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion avaframe/com4FlowPy/com4FlowPy.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ def checkConvertReleaseShp2Tif(modelPaths):
#demHeader = io.read_header(modelPaths["demPath"])
_errMsg = "using release area in '.shp' format currently only supported in combination with '.asc' DEMs"
log.error(_errMsg)
raise ValueError(_errMsg)
raise ValueError(_errMsg)
else:
_errMsg = f"file format '{ext}' for DEM is not supported, please provide '.tif' or '.asc'"
log.error(_errMsg)
Expand Down
7 changes: 3 additions & 4 deletions avaframe/runStandardTestsCom4FlowPy.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def compareRasters(path, pathRef):
rasterRef = readRasters(pathRef)
diff = rasterRef - raster
equal = np.array_equal(rasterRef, raster)
closeArray = np.isclose(raster, rasterRef , rtol=1e-04, equal_nan=True)
closePercent = np.count_nonzero(closeArray[np.logical_or(raster>0, rasterRef>0)]) / rasterRef[np.logical_or(raster>0, rasterRef>0)].size
closeArray = np.isclose(raster, rasterRef, rtol=1e-04, equal_nan=True)
closePercent = np.count_nonzero(closeArray[np.logical_or(raster > 0, rasterRef > 0)]) / rasterRef[np.logical_or(raster > 0, rasterRef > 0)].size
return diff, equal, closePercent


Expand Down Expand Up @@ -124,7 +124,6 @@ def compareRasters(path, pathRef):
message = f'{testName}: for {variable}: rasters are equal \n'
else:
message = f'{testName}: for {variable}: rasters are *NOT* equal, but {np.round(close,4) * 100}% of the affected area is close (relative tolerance: 10^-4) \n'

log.info(message)
with open(reportFile, 'a') as pfile:
pfile.write(message )
pfile.write(message)

0 comments on commit 0f54289

Please sign in to comment.