Re: [GRASS-user] GRASS 7.0.0 Issues with Object Based Image Analysis
Hey thanks Moritz! I will try the i.segment.stats moving forward. Thanks for the 'heads-up'! JDC On Mon, May 18, 2015 at 8:20 AM, Moritz Lennert < mlenn...@club.worldonline.be> wrote: > On 15/05/15 16:02, Jake Chila wrote: > >> Actually, scratch that. The script ran once, but now when I run it from >> the GUI it doesn't actually update the table, it just runs through >> without doing anything. >> > > Before going any further with this, try the new addon: i.segment.stats [1] > which does the calculations for you without having to define the loop and > dropping excess columns. > > Moritz > > [1] http://grass.osgeo.org/grass70/manuals/addons/i.segment.stats.html > > ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] GRASS 7.0.0 Issues with Object Based Image Analysis
Actually, scratch that. The script ran once, but now when I run it from the GUI it doesn't actually update the table, it just runs through without doing anything. JDC On Fri, May 15, 2015 at 10:56 AM, Jake Chila wrote: > HI all, > > So I think I figured it out with help from Vaclav. When I launch the > script from within the GUI the real errors are displayed in the Command > Console. The issue I was having had to do with mislabelled column names; I > was using numbers are the first character (my database management skills > need some refinement apparently). > > Now the script works when I launch it from within the GUI (no error > messages in the command line), but when I launch the script from outside of > Grass it is giving me grief. > > Here is the code I am running: > > MAPS = grass.read_command('i.group', > group='LE7_SEG', > flags='g', > quiet=True).splitlines() > > > for maps in MAPS: > > band=maps.split('@',1)[0] > > bnum=band[-2:] > > grass.run_command('v.build', > map='LE7_2001_SEG', > option='build') > > grass.run_command('v.rast.stats', > map='LE7_2001_SEG', > flags='c', > raster=band, > method='median', > column_prefix='%s' % bnum) > > grass.run_command('v.db.update', > map='LE7_2001_SEG', > column='bright', > qcolumn='bright+%s_median' %bnum) > > grass.run_command('v.db.dropcolumn', > map='LE7_2001_SEG', > column = '%s_median' % bnum) > > I have to include the v.build command because, for some reason, the > polygon topology needs to be rebuilt every time I try to use it. The code > also includes all the environment settings needed to access GRASS which I > know work because the script gets past the v.build command and repeatedly > fails on the v.rast.stats command. > > Thanks, > > JDC > > On Thu, May 14, 2015 at 5:23 PM, Vaclav Petras > wrote: > >> >> On Thu, May 14, 2015 at 2:00 PM, Jake Chila wrote: >> > >> > The first issue I ran into was trying to the python code (about halfway >> down the page, "for maps in MAPS"). I have changed the parameters so they >> suit GRASS 7.0 but I still receive this error: >> > >> > Traceback (most recent call last): >> > File "C:\Users\Jacob\Desktop\Python\SEG_DB_MAN.py", line 111, in >> >> > column_prefix='%s' % bnum) >> > File "C:\Program Files (x86)\GRASS GIS >> 7.0.0\etc\python\grass\script\core.py", line 375, in run_command >> > return handle_errors(returncode, returncode, args, kwargs) >> > File "C:\Program Files (x86)\GRASS GIS >> 7.0.0\etc\python\grass\script\core.py", line 310, in handle_errors >> > returncode=returncode) >> > CalledModuleError: Module run None ['v.rast.stats', '-c', >> 'map=LE7_2001_SEG', 'column_prefix=B1', 'method=median', >> 'raster=LE7_ATCORR_2001_B1'] ended with error >> > Process ended with non-zero return code 1. See errors in the (error) >> output. >> >> Hi, are there any other errors above or elsewhere the output? The actual >> error messages start with "ERROR:". (I guess I should add this note to the >> error message.) Vaclav >> > > ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] GRASS 7.0.0 Issues with Object Based Image Analysis
HI all, So I think I figured it out with help from Vaclav. When I launch the script from within the GUI the real errors are displayed in the Command Console. The issue I was having had to do with mislabelled column names; I was using numbers are the first character (my database management skills need some refinement apparently). Now the script works when I launch it from within the GUI (no error messages in the command line), but when I launch the script from outside of Grass it is giving me grief. Here is the code I am running: MAPS = grass.read_command('i.group', group='LE7_SEG', flags='g', quiet=True).splitlines() for maps in MAPS: band=maps.split('@',1)[0] bnum=band[-2:] grass.run_command('v.build', map='LE7_2001_SEG', option='build') grass.run_command('v.rast.stats', map='LE7_2001_SEG', flags='c', raster=band, method='median', column_prefix='%s' % bnum) grass.run_command('v.db.update', map='LE7_2001_SEG', column='bright', qcolumn='bright+%s_median' %bnum) grass.run_command('v.db.dropcolumn', map='LE7_2001_SEG', column = '%s_median' % bnum) I have to include the v.build command because, for some reason, the polygon topology needs to be rebuilt every time I try to use it. The code also includes all the environment settings needed to access GRASS which I know work because the script gets past the v.build command and repeatedly fails on the v.rast.stats command. Thanks, JDC On Thu, May 14, 2015 at 5:23 PM, Vaclav Petras wrote: > > On Thu, May 14, 2015 at 2:00 PM, Jake Chila wrote: > > > > The first issue I ran into was trying to the python code (about halfway > down the page, "for maps in MAPS"). I have changed the parameters so they > suit GRASS 7.0 but I still receive this error: > > > > Traceback (most recent call last): > > File "C:\Users\Jacob\Desktop\Python\SEG_DB_MAN.py", line 111, in > > > column_prefix='%s' % bnum) > > File "C:\Program Files (x86)\GRASS GIS > 7.0.0\etc\python\grass\script\core.py", line 375, in run_command > > return handle_errors(returncode, returncode, args, kwargs) > > File "C:\Program Files (x86)\GRASS GIS > 7.0.0\etc\python\grass\script\core.py", line 310, in handle_errors > > returncode=returncode) > > CalledModuleError: Module run None ['v.rast.stats', '-c', > 'map=LE7_2001_SEG', 'column_prefix=B1', 'method=median', > 'raster=LE7_ATCORR_2001_B1'] ended with error > > Process ended with non-zero return code 1. See errors in the (error) > output. > > Hi, are there any other errors above or elsewhere the output? The actual > error messages start with "ERROR:". (I guess I should add this note to the > error message.) Vaclav > ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] GRASS 7.0.0 Issues with Object Based Image Analysis
Hey all, So I'm back to pick your brains... this time with a few questions. GRASS 7.0.0 on Windows 7 Basically, I am trying to copy the workflow outlined by Martin here ( http://translate.google.com/translate?sl=cs&tl=en&js=n&prev=_t&hl=en&ie=UTF-8&u=http%3A%2F%2Fgeo.fsv.cvut.cz%2Fgwiki%2F153ZODH_%2F_15._cvi%25C4%258Den%25C3%25AD&act=url) but I am having a couple problems. The first issue I ran into was trying to the python code (about halfway down the page, "for maps in MAPS"). I have changed the parameters so they suit GRASS 7.0 but I still receive this error: Traceback (most recent call last): File "C:\Users\Jacob\Desktop\Python\SEG_DB_MAN.py", line 111, in column_prefix='%s' % bnum) File "C:\Program Files (x86)\GRASS GIS 7.0.0\etc\python\grass\script\core.py", line 375, in run_command return handle_errors(returncode, returncode, args, kwargs) File "C:\Program Files (x86)\GRASS GIS 7.0.0\etc\python\grass\script\core.py", line 310, in handle_errors returncode=returncode) CalledModuleError: Module run None ['v.rast.stats', '-c', 'map=LE7_2001_SEG', 'column_prefix=B1', 'method=median', 'raster=LE7_ATCORR_2001_B1'] ended with error Process ended with non-zero return code 1. See errors in the (error) output. However, when I enter the variables in manually using the Command Console in the GUI (using the exact same inputs), the command runs perfectly. Does anyone know why this would happen? This is the command line from the GUI (Thu May 14 13:12:10 2015) v.rast.stats -c map=LE7_2001_SEG column_prefix=B1 method=median raster=LE7_ATCORR_2001_B1 Processing data (4298 categories)... Updating the database ... (Thu May 14 13:12:26 2015) Command finished (15 sec) The second issue is trying to set up the training areas. When I open the vector file in the map display and change the mode to digitizer it crashes when I set the vector file I want to edit. Sometimes it doesn't crash (per se) just goes totally unresponsive. I can move the windows around but nothing happens when I click any of the buttons up top (specifically Display attributes), and when I go to click back in the Layer Manager then GRASS crashes. Does anyone have experience with this? It should also be noted that I had the digitizer tool working normally for about ten minutes before it crashed for the first time. I don't see any error messages either, but maybe I am not looking in the right places? Any ways, any advice would be welcome! Thanks, JDC ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] Creating Raster Subsets in GRASS 7.0.0
Hi Micha, No worries, thanks for the headsup re: creating subsets. I noticed that resolution thing also, and just thought that it was because that scene is from a different path/row and the g.region command actually sets the region on the edge of this scene, so there are null values from this scene in the processing region. I have since gotten rid of this scene, but I figure that might explain it? JDC On Tue, May 12, 2015 at 1:52 PM, Micha Silver wrote: > Hi Jake > Excuse for butting in... > > On 05/12/2015 05:23 PM, Jake Chila wrote: > > Hi Moritz, > > I definitely did mean 'g.region -p', sorry for that. I ended up getting it > to work using 'r.mapcalc' after setting the region. I saw someone online > had used it with the simple expression newmap=oldmap. Then, when I export > the newmap it is only of the subset. This small workaround was easy to set > up, but I don't have any idea why it didn't work in the first place. > > > It's not a "workaround". The correct way to clip a section of a raster is > two steps: define the new region with g.region, then run r.mapcalc (which > honors the region settings) to get a new raster, at the new region > settings, with values equal to the original. > > However, in your r.info output below, something seems wrong with the > resolution. The landsat imagery is at 30 meters resolution. WHere did the > (very small) values below come from? And why is the N-S 6 times smaller > than the E-W ?? > > > > r.info returns: > > (Tue May 12 11:19:01 2015) > > r.info map=L5_2007_ATCOR_COMP@Jacob > > > > ++ > | Map: L5_2007_ATCOR_COMP@Jacob Date: Mon May 04 14:31:43 > 2015| > | Mapset: Jacob Login of Creator: Jacob > | > | Location: FordingRiver > | > | DataBase: C:\Users\Jacob\Documents\grassdata > | > | Title: ( L5_2007_ATCOR_COMP ) >| > | Timestamp: none >| > > > || > | >| > | Type of Map: raster Number of Categories: 0 > | > | Data Type:CELL > | > | Rows: 11374 >| > | Columns: 12191 >| > | Total Cells: 138660434 >| > |Projection: UTM (zone 11) > | > |N: 557000S: 554300 Res: 0.23738351 >| > |E: 659000W: 642200 Res: 1.37806579 >| > | Range of data:min = 0 max = 32767 > | > | >| > | Data Description: >| > |generated by r.composite >| > | >| > | Comments: >| > |r.composite red="GRASS_ATCOR_2007_B3@Jacob" > green="GRASS_ATCOR_2007_\ | > |B2@Jacob" blue="GRASS_ATCOR_2007_B1@Jacob" levels=32 > output="L5_2007\ | > |_ATCOR_COMP" >| > | >| > > > ++ > (Tue May 12 11:19:02 2015) Command finished (0 sec) > > > However, I have encountered a new problem. On one of my ETM+ images, the > subset is returned as an empty raster. The process runs fine on the other > ETM+ image from one year earlier but for some reason, the subset from the > scene one year later has a min and max data range of 'NULL'. This range > appears to be constant across all the other scenes, so is there a way for > me to quickly edit this scene so it has the correct data? > > > As before, I would double check "g.region -p", and "r.info" for both the > original Landsat image, and the clipped image that comes out NULL. > > > Thanks, > > JDC > > On Tue, May 12, 2015 at 3:33 AM, Moritz Lennert < > mlenn...@club.worldonline.be> wrote: > >> On 08/05/15 19:13, Jake Chila wrote: >> >>> Hey all, >>> >>> I am currently working with some landsat data in Grass 7.0.0 on windows >>> 7, and am trying to hone in on my study area (much smaller than the >>> whole scene). From what I can tell, the best way to do this is through >>> the 'g.region' command however, I am having significant problems getting >>> this module to run correctly. >>> >>> my input is: >>> >>> g.region n=5572425 s=5536865 e=655050 w=626350 res=30 >>> >>> One thing is that it runs in '0 seconds' so I think that is a little odd. >>> >> >> It's normal as the command just changes a few entries in a text file, so >> it
Re: [GRASS-user] Creating Raster Subsets in GRASS 7.0.0
Hi Moritz, I definitely did mean 'g.region -p', sorry for that. I ended up getting it to work using 'r.mapcalc' after setting the region. I saw someone online had used it with the simple expression newmap=oldmap. Then, when I export the newmap it is only of the subset. This small workaround was easy to set up, but I don't have any idea why it didn't work in the first place. r.info returns: (Tue May 12 11:19:01 2015) r.info map=L5_2007_ATCOR_COMP@Jacob ++ | Map: L5_2007_ATCOR_COMP@Jacob Date: Mon May 04 14:31:43 2015 | | Mapset: Jacob Login of Creator: Jacob | | Location: FordingRiver | | DataBase: C:\Users\Jacob\Documents\grassdata | | Title: ( L5_2007_ATCOR_COMP ) | | Timestamp: none | || | | | Type of Map: raster Number of Categories: 0 | | Data Type:CELL | | Rows: 11374 | | Columns: 12191 | | Total Cells: 138660434 | |Projection: UTM (zone 11) | |N: 557000S: 554300 Res: 0.23738351 | |E: 659000W: 642200 Res: 1.37806579 | | Range of data:min = 0 max = 32767 | | | | Data Description: | |generated by r.composite | | | | Comments: | |r.composite red="GRASS_ATCOR_2007_B3@Jacob" green="GRASS_ATCOR_2007_\ | |B2@Jacob" blue="GRASS_ATCOR_2007_B1@Jacob" levels=32 output="L5_2007\ | |_ATCOR_COMP" | | | ++ (Tue May 12 11:19:02 2015) Command finished (0 sec) However, I have encountered a new problem. On one of my ETM+ images, the subset is returned as an empty raster. The process runs fine on the other ETM+ image from one year earlier but for some reason, the subset from the scene one year later has a min and max data range of 'NULL'. This range appears to be constant across all the other scenes, so is there a way for me to quickly edit this scene so it has the correct data? Thanks, JDC On Tue, May 12, 2015 at 3:33 AM, Moritz Lennert < mlenn...@club.worldonline.be> wrote: > On 08/05/15 19:13, Jake Chila wrote: > >> Hey all, >> >> I am currently working with some landsat data in Grass 7.0.0 on windows >> 7, and am trying to hone in on my study area (much smaller than the >> whole scene). From what I can tell, the best way to do this is through >> the 'g.region' command however, I am having significant problems getting >> this module to run correctly. >> >> my input is: >> >> g.region n=5572425 s=5536865 e=655050 w=626350 res=30 >> >> One thing is that it runs in '0 seconds' so I think that is a little odd. >> > > It's normal as the command just changes a few entries in a text file, so > it is really fast. > > >> When I use the 'g.region -d' command I can see that everything is set >> properly, >> > > Did you maybe mean g.region -p ? At least this is the command you should > use to check current region settings. > > however when I update the map display nothing changes. Also, >> when I export the file using 'r.out.gdal' it exports nothing. >> >> >> ('r.out.gdal -t -f --overwrite input=LT5_2007_ATCORRCOMP@May_Project >> output=C:\Users\Jacob\Desktop\GRASS_Trials\exportattempt5 format=GTiff >> type=Uint16 nodata=0) >> > > That should normally respect the region settings. > > What does > > r.info LT5_2007_ATCORRCOMP > > give you ? > > Moritz > ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] Creating Raster Subsets in GRASS 7.0.0
Hey all, I am currently working with some landsat data in Grass 7.0.0 on windows 7, and am trying to hone in on my study area (much smaller than the whole scene). From what I can tell, the best way to do this is through the 'g.region' command however, I am having significant problems getting this module to run correctly. my input is: g.region n=5572425 s=5536865 e=655050 w=626350 res=30 One thing is that it runs in '0 seconds' so I think that is a little odd. When I use the 'g.region -d' command I can see that everything is set properly, however when I update the map display nothing changes. Also, when I export the file using 'r.out.gdal' it exports nothing. ('r.out.gdal -t -f --overwrite input=LT5_2007_ATCORRCOMP@May_Project output=C:\Users\Jacob\Desktop\GRASS_Trials\exportattempt5 format=GTiff type=Uint16 nodata=0) Before I was having problems getting the bounds set correctly, but now when I view the file in Arcmap, I can see that it is aligned with the basemap properly it just shows me nothing. Does anyone know what I am doing wrong? I feel like this is a simple task and I am just making some rookie mistakes, so any advice on how to create subests in GRASS would be a very welcome, Thanks! Have a good one, JDC ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] GRASS crashes while running i.atcorr
Hi all, So I think I have managed to fix my problems with help from Markus and Nikos. As it turns out my issue was predictably (and embarrassingly) quite simple. In my parameters file both the month and day variables were in float format and so had the decimals after them which I think caused some problems in the program. I also found an old email in this list which said to convert the DEM to an integer so I also did that. Part of my project will be to compare the results from i.atcorr to those produced by the Atmospheric Correction Module in PCI Geomatica and so if there is interest I would be happy to post my results! Thanks again, JDC On Fri, May 1, 2015 at 11:33 AM, Jake Chila wrote: > hi all, > > So I am trying to run i.atcorr but every time I run it, the whole program > goes unresponsive and crashes. Has anyone experienced this before? Is there > any way I can fix it? > > One thing that might be causing it is my parameters text file. I'm not > totally sure I understand what all the fields are but here is an example of > the parameter files I have created. This one is for the second band of a > landsat 5 TM scene over central British Columbia > > 7 > 8 15 18.49 -116.027755 50.267045 > 2 > 0 > 0 > 0 > -1000 > 26 > > I understand most of the parameters except the aerosol model, mean target > elevation and sensor height. Are these in the metadata file? I don't know > about the aerosol module, but for the elevation, doesn't this come from the > DEM attached? Lastly, I went with -1000 for sensor height because the grass > wiki page says -1000 sensor height (here, sensor on board a satellite) so I > assumed this was a preset value. > > Once again, I don't know if the parameter file is the issue, or the only > issue at least, so any advice running i.atcorr would be much appreciated! > > Thanks, > > JDC > ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] GRASS crashes while running i.atcorr
Sorry, I forgot to mention I am using GRASS 7.0.0 on windows 7 Thanks, JDC On Fri, May 1, 2015 at 11:33 AM, Jake Chila wrote: > hi all, > > So I am trying to run i.atcorr but every time I run it, the whole program > goes unresponsive and crashes. Has anyone experienced this before? Is there > any way I can fix it? > > One thing that might be causing it is my parameters text file. I'm not > totally sure I understand what all the fields are but here is an example of > the parameter files I have created. This one is for the second band of a > landsat 5 TM scene over central British Columbia > > 7 > 8 15 18.49 -116.027755 50.267045 > 2 > 0 > 0 > 0 > -1000 > 26 > > I understand most of the parameters except the aerosol model, mean target > elevation and sensor height. Are these in the metadata file? I don't know > about the aerosol module, but for the elevation, doesn't this come from the > DEM attached? Lastly, I went with -1000 for sensor height because the grass > wiki page says -1000 sensor height (here, sensor on board a satellite) so I > assumed this was a preset value. > > Once again, I don't know if the parameter file is the issue, or the only > issue at least, so any advice running i.atcorr would be much appreciated! > > Thanks, > > JDC > ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] GRASS crashes while running i.atcorr
hi all, So I am trying to run i.atcorr but every time I run it, the whole program goes unresponsive and crashes. Has anyone experienced this before? Is there any way I can fix it? One thing that might be causing it is my parameters text file. I'm not totally sure I understand what all the fields are but here is an example of the parameter files I have created. This one is for the second band of a landsat 5 TM scene over central British Columbia 7 8 15 18.49 -116.027755 50.267045 2 0 0 0 -1000 26 I understand most of the parameters except the aerosol model, mean target elevation and sensor height. Are these in the metadata file? I don't know about the aerosol module, but for the elevation, doesn't this come from the DEM attached? Lastly, I went with -1000 for sensor height because the grass wiki page says -1000 sensor height (here, sensor on board a satellite) so I assumed this was a preset value. Once again, I don't know if the parameter file is the issue, or the only issue at least, so any advice running i.atcorr would be much appreciated! Thanks, JDC ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user