[GRASS-user] GRASS GIS 6.4 batch
Hi there I am fairly new to GRASS GIS and need some help on how to use GRASS GIS for batch jobs. I have a series of 1000 MODIS sat-images that I want to batch-process in GRASS GIS in the following simple way: r.in.gdal -e input=F:\Projects\LSTdaily\2000_065_LST_Day_1km.tif output=g2000_065_LST_Day_1km r.mapcalc "LST65_Celcius=float(2000_065_LST_Day_1km * 0.02)-273.15" r.mapcalc "LST65_Celcius0 = if(LST65_Celcius>-200, LST65_Celcius, null())" r.out.gdal -c input=LST65_Celcius0 nodata=- output=F:\Projects\BBMB\GRASSGIS\LST65_c.tif type=Float32 I know I can do this manually with the GRASS command line, but I would like to create a batch file where this can be executed from. Thus the batch file should be able to open GRASS GIS and execute the few lines above without any interaction needed. Does anyone have a similar batch-file I can look into, or can anyone assist me? I am not experienced within shell-programming and other things that I have found related to this topic. I am working on a Win XP/7 with GRASS GIS 6.4. Best regard Rasmus ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] GRASS GIS 6.4 batch
Rasmus wrote: > I am fairly new to GRASS GIS and need some help on how to > use GRASS GIS for batch jobs. > I have a series of 1000 MODIS sat-images that I want to > batch-process in GRASS GIS in the following simple way: > > r.in.gdal -e > input=F:\Projects\LSTdaily\2000_065_LST_Day_1km.tif > output=g2000_065_LST_Day_1km > r.mapcalc "LST65_Celcius=float(2000_065_LST_Day_1km * > 0.02)-273.15" > r.mapcalc "LST65_Celcius0 = if(LST65_Celcius>-200, > LST65_Celcius, null())" > r.out.gdal -c input=LST65_Celcius0 nodata=- > output=F:\Projects\BBMB\GRASSGIS\LST65_c.tif type=Float32 > > I know I can do this manually with the GRASS command line, > but I would like to create a batch file where this can be > executed from. > Thus the batch file should be able to open GRASS GIS and > execute the few lines above without any interaction needed. see "GRASS_BATCH_JOB" http://grass.osgeo.org/grass64/manuals/html64_user/variables.html#enviro http://grass.osgeo.org/grass64/manuals/html64_user/grass6.html http://grass.osgeo.org/wiki/GRASS_and_Shell#GRASS_Batch_jobs > Does anyone have a similar batch-file I can look into, or > can anyone assist me? I am not experienced within > shell-programming and other things that I have found related > to this topic. > > I am working on a Win XP/7 with GRASS GIS 6.4. that may be a problem. as far as I know the Windows startup batch file bypasses the normal init.sh startup script, which is what handles the batch job processing. Also it is built for UNIX scripting, not msdos .bat files, so even if GRASS+MSys on WinGrass could do it (perhaps it can?), you'd have to look into writing it as a unix shell script. (in the most basic form a unix .sh and msdos .bat are the same thing, just commands pasted into a text file. things like automated loops are very different though) Hamish ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] GRASS GIS 6.4 batch
Dear Hamish Thank you for your reply. As I understand you it is not possible to do the batch processing in Windows then? (Unix is not an option here). If I am wrong about this, can you please explain me a bit further how to get started? I did not get much out of the "GRASS_BATCH_JOB" sections. Thank you in advance! Best, Rasmus >>> Hamish 19-08-2010 00:58 >>> Rasmus wrote: > I am fairly new to GRASS GIS and need some help on how to > use GRASS GIS for batch jobs. > I have a series of 1000 MODIS sat-images that I want to > batch-process in GRASS GIS in the following simple way: > > r.in.gdal -e > input=F:\Projects\LSTdaily\2000_065_LST_Day_1km.tif > output=g2000_065_LST_Day_1km > r.mapcalc "LST65_Celcius=float(2000_065_LST_Day_1km * > 0.02)-273.15" > r.mapcalc "LST65_Celcius0 = if(LST65_Celcius>-200, > LST65_Celcius, null())" > r.out.gdal -c input=LST65_Celcius0 nodata=- > output=F:\Projects\BBMB\GRASSGIS\LST65_c.tif type=Float32 > > I know I can do this manually with the GRASS command line, > but I would like to create a batch file where this can be > executed from. > Thus the batch file should be able to open GRASS GIS and > execute the few lines above without any interaction needed. see "GRASS_BATCH_JOB" http://grass.osgeo.org/grass64/manuals/html64_user/variables.html#enviro http://grass.osgeo.org/grass64/manuals/html64_user/grass6.html http://grass.osgeo.org/wiki/GRASS_and_Shell#GRASS_Batch_jobs > Does anyone have a similar batch-file I can look into, or > can anyone assist me? I am not experienced within > shell-programming and other things that I have found related > to this topic. > > I am working on a Win XP/7 with GRASS GIS 6.4. that may be a problem. as far as I know the Windows startup batch file bypasses the normal init.sh startup script, which is what handles the batch job processing. Also it is built for UNIX scripting, not msdos .bat files, so even if GRASS+MSys on WinGrass could do it (perhaps it can?), you'd have to look into writing it as a unix shell script. (in the most basic form a unix .sh and msdos .bat are the same thing, just commands pasted into a text file. things like automated loops are very different though) Hamish ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] GRASS GIS 6.4 batch
Rasmus Borgstrøm wrote: > As I understand you it is not possible .. make no mistake: this is a very flexible GIS platform, almost everything is possible, it just requires a little effort to add new things if they aren't there already. if you are comfortable with writing/editing msdos batch files, I think you have a good chance of success. (contributing a very worthwhile bit of knowledge to all other WinGRASS users in the process) > to do the batch processing in Windows then? (Unix is not an > option here). GRASS ships with "MSys" which provides a lot of UNIX tools re- built for Windows, including the UNIX shell. Nothing new to install. (If you did want a full UNIX environment on Windows, that would be "Cygwin", but that is overkill in this case) > If I am wrong about this, can you please explain me a bit > further how to get started? I did not get much out of the > "GRASS_BATCH_JOB" sections. The trick is to tell GRASS at startup that you want to run the batch job, and what data to run it on, instead of opening up the interactive "Welcome to GRASS, pick a mapset" window. I do not have a Windows machine on hand to test with, maybe it is not so hard to get it to work. May I ask if your task is for bulk-processing (single repetitive job over a big pile of data) or for on-demand processing? (e.g. processing begins once job requirements or new data arrive, like from a web site you run) ? how comfortable are you with editing/writing msdos .bat files? how about the Python programming language? (the future of grass scripting) regards, Hamish ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user