En raison du déménagement des baies serveurs, les services gitlab.irstea.fr et mattermost.irstea.fr seront interrompus le samedi 2 octobre 2021 au matin. Ils devraient revenir à la normale dans la journée.

Unverified Commit edcb8eda authored by Julien Veyssier's avatar Julien Veyssier
Browse files

fix step3 and 4 reclass rules


Signed-off-by: default avatarJulien Veyssier <eneiluj@posteo.net>
parent 19ea6701
......@@ -486,12 +486,13 @@ def main(parms_file, nbProc, generator=False):
pReclass = grass.feed_command('r.reclass', input='hrus_tmp_wrong', output='hrus_tmp', rules='-', overwrite='True')
c = 1
for l in p.stdout:
spl = decode(l).rstrip(os.linesep).split()
dl = decode(l).rstrip(os.linesep)
spl = dl.split()
cat = spl[0]
label = ' '.join(spl[1:])
# used to be this but does not work in grass74 because result of r.cross is slightly different than grass >= 76...
#if 'NULL' in l:
if not l.startswith('*') and ('NULL' in l or 'no data' in l or l.strip() == '0'):
if not dl.startswith('*') and ('NULL' in dl or 'no data' in dl or dl.strip() == '0'):
pReclass.stdin.write(encode('%s = 0\n' % (cat)))
else:
pReclass.stdin.write(encode('%s = %s %s\n' % (cat, c, label)))
......
......@@ -131,12 +131,13 @@ def processSubbasin(params):
pReclass = grass.feed_command('r.reclass', input='res1', output='res2', rules='-', overwrite='True')
c = 1
for l in p.stdout:
spl = decode(l).rstrip(os.linesep).split()
dl = decode(l).rstrip(os.linesep)
spl = dl.split()
res1Cat = spl[0]
res1Label = ' '.join(spl[1:])
# used to be this but does not work in grass74 because result of r.cross is slightly different than grass >= 76...
#if 'NULL' in l:
if not l.startswith('*') and ('NULL' in l or 'no data' in l or l.strip() == '0'):
if not dl.startswith('*') and ('NULL' in dl or 'no data' in dl or dl.strip() == '0'):
pReclass.stdin.write(encode('%s = 0\n' % (res1Cat)))
else:
pReclass.stdin.write(encode('%s = %s %s\n' % (res1Cat, c, res1Label)))
......
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