Skip to main content
deleted 49 characters in body; edited title
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

Using r.mapcalculator and python againPython

I've been trying to write a script creating binary maps:

a=raw_input ("enter a threshold") 
b=float(a) 
grass.run_command('r.mapcalculator', formula="**'base_map'>=b**", outfile='map'+str(a), overwrite=True) 

When I'm trying to execute it there's an error message :

Invalid map
Parse error 

Obviously, when the relevant part of the code is changed (e.g. formula="'base_map'>=**0.7**") everything is working fine. However, my goal was to write a script creating a map automatically when the "a" (the threshold) is provided.

I would be grateful for any hints.

Cheers

r.mapcalculator and python again

I've been trying to write a script creating binary maps:

a=raw_input ("enter a threshold") 
b=float(a) 
grass.run_command('r.mapcalculator', formula="**'base_map'>=b**", outfile='map'+str(a), overwrite=True) 

When I'm trying to execute it there's an error message :

Invalid map
Parse error 

Obviously, when the relevant part of the code is changed (e.g. formula="'base_map'>=**0.7**") everything is working fine. However, my goal was to write a script creating a map automatically when the "a" (the threshold) is provided.

I would be grateful for any hints.

Cheers

Using r.mapcalculator and Python

I've been trying to write a script creating binary maps:

a=raw_input ("enter a threshold") 
b=float(a) 
grass.run_command('r.mapcalculator', formula="**'base_map'>=b**", outfile='map'+str(a), overwrite=True) 

When I'm trying to execute it there's an error message :

Invalid map
Parse error 

Obviously, when the relevant part of the code is changed (e.g. formula="'base_map'>=**0.7**") everything is working fine. However, my goal was to write a script creating a map automatically when the "a" (the threshold) is provided.

added 33 characters in body
Source Link
whuber
  • 70.2k
  • 16
  • 187
  • 282

I've been trying to write a script creating binary maps:

a=raw_input ("enter a treshold") b=float(a) grass.run_command('r.mapcalculator', formula="'base_map'>=b", outfile='map'+str(a),overwrite=True)

a=raw_input ("enter a threshold") 
b=float(a) 
grass.run_command('r.mapcalculator', formula="**'base_map'>=b**", outfile='map'+str(a), overwrite=True) 

When I'm trying to execute it there's an error message : Invalid map Parse error

Invalid map
Parse error 

Obviously, when the relevant part of the code is changed (e.g. formula="'base_map'>=0.7"formula="'base_map'>=**0.7**") everything is working fine. However, my goal was to write a script creating a map automatically when the "a" (the tresholdthreshold) is provided.

I would be grateful for any hints.

Cheers

I've been trying to write a script creating binary maps:

a=raw_input ("enter a treshold") b=float(a) grass.run_command('r.mapcalculator', formula="'base_map'>=b", outfile='map'+str(a),overwrite=True)

When I'm trying to execute it there's an error message : Invalid map Parse error

Obviously, when the relevant part of the code is changed (e.g. formula="'base_map'>=0.7") everything is working fine. However, my goal was to write a script creating a map automatically when the "a" (the treshold) is provided.

I would be grateful for any hints

Cheers

I've been trying to write a script creating binary maps:

a=raw_input ("enter a threshold") 
b=float(a) 
grass.run_command('r.mapcalculator', formula="**'base_map'>=b**", outfile='map'+str(a), overwrite=True) 

When I'm trying to execute it there's an error message :

Invalid map
Parse error 

Obviously, when the relevant part of the code is changed (e.g. formula="'base_map'>=**0.7**") everything is working fine. However, my goal was to write a script creating a map automatically when the "a" (the threshold) is provided.

I would be grateful for any hints.

Cheers

Source Link
Dawid
  • 151
  • 4

r.mapcalculator and python again

I've been trying to write a script creating binary maps:

a=raw_input ("enter a treshold") b=float(a) grass.run_command('r.mapcalculator', formula="'base_map'>=b", outfile='map'+str(a),overwrite=True)

When I'm trying to execute it there's an error message : Invalid map Parse error

Obviously, when the relevant part of the code is changed (e.g. formula="'base_map'>=0.7") everything is working fine. However, my goal was to write a script creating a map automatically when the "a" (the treshold) is provided.

I would be grateful for any hints

Cheers