Re: [JGrass-utenti] A strange script error

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: [JGrass-utenti] A strange script error

Andrea Antonello
I finally was able to understand why the error occurres.
The console engine tokenizes every pieces of script code that enters
and parses and analyses it, before generating the needed code to be
executed.

The words that can be used as a variable name, are tested to match the
following regular expression:
^[$][a-zA-Z_]+[a-zA-Z0-9_]?+$

This probably won't help most of the users at that point (that is why
I include the developers list), but it solves the current problem,
since it states that in the first "piece" of variable name there can't
be numbers.

So by changing
       $d2o3d_map
to
       $dtwoothreed_map
the thing will work properly.

We will need to add a section to the wiki in which we report this.

Andrea


On Thu, Jan 8, 2009 at 2:52 PM, andrea antonello
<[hidden email]> wrote:

> Fabrizio,
> please bring the English mails only to the English list. This is the
> last mail that goes in the Italian also.
>
> I didn't read carefully enough your email. From the below I get that
> the first change worked?
> The map is created, right?
> Which version are you using?
>
> Please describe your problem again.
>
> Andrea
>
>
> On Thu, Jan 8, 2009 at 2:28 PM, andrea antonello
> <[hidden email]> wrote:
>> Ok, try with letting him decide what to use:
>>
>> def d2o3d_map="BASINDTM_d2o3d";
>>
>> note the def at the begin.
>>
>> Andrea
>>
>> On Thu, Jan 8, 2009 at 2:23 PM, Fabrizio Zanotti
>> <[hidden email]> wrote:
>>> Hy Andrea,
>>> I have tried that you write, but the result is the same: error!
>>> I think that the problem is inside the declaration of strings in groovy....
>>> I have tried so:
>>> * 3D distance to the outlet with h.d2o3d*/
>>> /* DECLARATION OF STRINGS: name of the map, name of the asccii file reletad
>>> */
>>> String d2o3d_map="BASINDTM_d2o3d";
>>> String d2o3d_map_ascii="/Users/fabrizio/grasstemp/geotop/"+d2o3d_map+".asc";
>>>
>>> jgrass h.d2o3d --igrass-pit BASINDTM --igrass-flow BASINDTM_mdir
>>> --ograss-d2o3d pippo
>>> grass r.mapcalc $d2o3d_map=pippo
>>> grass r.out.ascii input=$d2o3d_map output=$d2o3d_map_ascii  null=*
>>>
>>> and it return this:
>>> JGrass 2 Console ML (Model Language) Compiler, Version 1.0.0.832, for i386
>>> Copyright (C)
>>> HydroloGIS - www.hydrologis.com,
>>> C.U.D.A.M. - http://www.unitn.it/dipartimenti/cudam
>>> -------------------------------- Compiling...
>>> ---------------------------------
>>> default.jgrass
>>> default.jgrass - 5 model/s compiled, total compilation time: 86 ms
>>> -------------------------------------------------------------------------------
>>> GroovyShell, Version 1.5.5, http://groovy.codehaus.org
>>> ------------------------------ Running model...
>>> -------------------------------
>>> Reading map PIT
>>> Reading map FLOW
>>> Working on h.d2o3d
>>> Took 15 sec
>>> Writing output map D2O3D
>>> Writing map: pippo
>>> org.codehaus.groovy.runtime.GStringImpl
>>> org.codehaus.groovy.runtime.GStringImpl
>>> Total run time: 1232 ms
>>> The map "pippo" was created and displayed and then it stops.
>>> Any idea?
>>> bye
>>> Fabrizio
>>> On Jan 8, 2009, at 11:50 AM, andrea antonello wrote:
>>>
>>> Hi Fabrizio,
>>>
>>> [...]
>>>
>>> default.jgrass
>>>
>>> default.jgrass(91) : error E2111: argument value expected after
>>>
>>> '--ograss-d2o3d'.
>>>
>>> default.jgrass - 5 model/s compiled, total compilation time: 82 ms
>>>
>>> -------------------------------------------------------------------------------
>>>
>>> GroovyShell, Version 1.5.5, http://groovy.codehaus.org
>>>
>>> ------------------------------ Running model...
>>>
>>> -------------------------------
>>>
>>> org.codehaus.groovy.runtime.GStringImpl
>>>
>>> org.codehaus.groovy.runtime.GStringImpl
>>>
>>> Total run time: 288 ms
>>>
>>> My source code is:
>>>
>>> /* 3D distance to the outlet with h.d2o3d*/
>>>
>>> /* DECLARATION OF STRINGS: name of the map, name of the asccii file reletad
>>>
>>> */
>>>
>>> String d2o3d_map="BASINDTM"+"_d2o3d";
>>>
>>> String d2o3d_map_ascii="/Users/fabrizio/grasstemp/geotop/"+d2o3d_map+".asc";
>>>
>>> jgrass h.d2o3d --igrass-pit BASINDTM --igrass-flow BASINDTM_mdir
>>>
>>> --ograss-d2o3d $d2o3d_map
>>>
>>> That is indeed strange.
>>> Can you try with:
>>> String d2o3d_map="BASINDTM_d2o3d";
>>> instead of:
>>> String d2o3d_map="BASINDTM"+"_d2o3d";
>>>
>>> I'm not sure what groovy decides to do if two static strings are
>>> concatenated.
>>>
>>> Let me know, I am not able to test it right now.
>>>
>>> Andrea
>>>
>>>
>>> PS: I redirect on the english user list, this one is Italian.
>>>
>>> //grass r.mapcalc $d2o3d_map=d2o3d_temporary_map
>>>
>>> grass r.mapcalc $d2o3d_map=d2o3d_temporary_map*1.0
>>>
>>> grass r.out.ascii input=$d2o3d_map output=$d2o3d_map_ascii  null=*
>>>
>>> I don't understand....
>>>
>>> thanks
>>>
>>> Fabrizio
>>>
>>>
>>>
>>>
>>> -----------------------------------------------------------------
>>>
>>> ing. Fabrizio Zanotti
>>>
>>> Università degli Studi di Trento
>>>
>>> Dipartimento di Ingegneria Civile ed Ambientale
>>>
>>> Via Mesiano 77
>>>
>>> 38100 Trento TN
>>>
>>> Italia
>>>
>>> Mobile: +39 3478882151
>>>
>>> Phone: +39 0461 88 2610
>>>
>>> Fax: +39 0461 88 2672
>>>
>>> e-mail:   [hidden email]
>>>
>>> ------------------------------------------------------------------
>>>
>>> Nella vita le sconfitte sono le svolte migliori.
>>>
>>> Perché costringono a pensare in modo
>>>
>>> diverso e creativo (Steve Jobs,  2005)
>>>
>>> ------------------------------------------------------------------
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>>
>>> JGrass-utenti mailing list
>>>
>>> [hidden email]
>>>
>>> https://dev.fsc.bz.it/cgi-bin/mailman/listinfo/jgrass-utenti
>>>
>>>
>>> _______________________________________________
>>> JGrass-utenti mailing list
>>> [hidden email]
>>> https://dev.fsc.bz.it/cgi-bin/mailman/listinfo/jgrass-utenti
>>>
>>>
>>> _______________________________________________
>>> JGrass-utenti mailing list
>>> [hidden email]
>>> https://dev.fsc.bz.it/cgi-bin/mailman/listinfo/jgrass-utenti
>>>
>>>
>>
>
_______________________________________________
JGrass-devel mailing list
[hidden email]
https://dev.fsc.bz.it/cgi-bin/mailman/listinfo/jgrass-devel