Commit 7f643264 authored by POLCHER Jan's avatar POLCHER Jan 🚴🏾
Browse files

Check the existence of attributes to allow to switch to other convention.

parent b866f085
......@@ -94,7 +94,13 @@ def calctopoindex(nf, istr, iend, jstr, jend, index, hydrogrid) :
elevation_precision=0.1
#
jlen,ilen = nf.variables["orog"].shape
missing = nf.variables["orog"].missing_value
if "missing_value" in nf.variables["orog"].ncattrs() :
missing = nf.variables["orog"].missing_value
elif "_FillValue" in nf.variables["orog"].ncattrs() :
missing = nf.variables["orog"]._FillValue
else :
print("No Missing values or Fill values in variable orography")
sys.exit()
land = np.where(nf.variables["orog"][jstr:jend,istr:iend] < missing)
topoind=np.zeros((jend-jstr,iend-istr))
topoind[:,:] = np.nan
......@@ -271,7 +277,7 @@ class HydroParameter :
self.swamp_cst = 0.2
elif hydrogrid.hd >= 0.016 :
# Case for MERIT
self.stream_tcst = 0.7
self.stream_tcst = 0.07
self.fast_tcst = 1.0
self.slow_tcst = 10.0
self.flood_tcst = 4.0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment