[GRASS-user] Cannot change directory via GRASS command console

Helmut Kudrnovsky hellik at web.de
Thu Dec 5 07:42:23 PST 2013


PB wrote
> Dear List - I am having difficulties with the below script, and it seems
> to be because there is a possible bug in the the GRASS installation that
> comes bundled with QGIS2.
> 
> To synthesis the problem, through the GRASS command console, I can't seem
> to change directory.  After launching GRASS, typing DIR or LS produces the
> contents of C:\PROGRA~1\QGISDU~1\bin.  Then I type cd
> <D:/....../raw_data> to change directory and point GRASS to where my
> data is stored (and to the directory where gdal_translate writes processed
> tiff files) - this runs without error.  However, typing LS or DIR then
> still show the original C:/ directory.
> 
> I can run the below script, gdal_translate finds the raw files in the C:/
> directory, r.in.gdal finds the processed files in the C:/ directory, and
> places them in the correct MAPSET.   But its not ideal to have to load my
> C:/....bin directory with hundreds of raw files, then have it filled with
> processed files, etc.  I think this is having other down-stream effects on
> how GRASS works when I want to start working with my imported layers.
> 
> I've talked to a few unix people here and they're stumped.  I've also
> scoured the GRASS environment variables and online help.  I'm using the
> GRASS 6.4 bundled with QGIS2, on Windows 7.  It would be great if someone
> could check if this CD issue is common to other's similar installations,
> and if not, suggest what might be wrong with my system.
> 
> Thanks,
> Paul.
> 
> ________________________________
> From: 

> grass-user-bounces at .osgeo

>  [mailto:

> grass-user-bounces at .osgeo

> ] On Behalf Of Paul Brewin
> Sent: 03 December 2013 09:33
> To: 

> grass-user at .osgeo

> Subject: [GRASS-user] Help: cannot change directory in GRASS - QGIS
> installation
> 
> Hello,  I can't seem to change the search path in GRASS 6.4.3, Windows 7,
> installed with the QGIS 2.0 bundle.  To walk through my steps so far...
> I have a bash script example below called myscript.sh.  It comes from
> http://grasswiki.osgeo.org/wiki/MODIS#MODIS_Aqua
> 
> ##################
> #!/bin/sh
> for file in A*SST_4 ; do
>     echo "map: $file"
>     gdal_translate -a_srs "+init=epsg:4326" -a_nodata 65535 \
>     -a_ullr -180 90 180 -90 -co "COMPRESS=PACKBITS" \
>     HDF4_SDS:UNKNOWN:"$file":0 ${file}_prep.tif
>     r.in.gdal in=${file}_prep.tif out=$file
> done
> ##################
> 
> The script and data files (with the pattern A*SST_4) are stored in 
> <D:/....../raw_data>. To run the script in the GRASS command console
> I use
> 
> sh D:/...../raw_data/mystript.sh
> 
> This does not work, and I see that its because the data files can't be
> found.  So using DIR in the GRASS command console reveals that the search
> path is C:\PROGRA~1\QGISDU~1\bin
> 
> In the GRASS command console I then type cd D:/....../raw_data, with no
> errors.  However, typing DIR or LS in the command line shows that I'm
> still in C:\...\bin
> 
> I can make this work by simply copying the data files to the C:\...\bin
> directory, but its not ideal as the processed files (the ${file}_prep.tif
> bit) end up in the C:\ directory.  I can also modify the 
> <for>
>  loop by adding the full file path, but as you can see, that breaks the
> script at the r.in.gdal line because r.in.gdal then tries to create a db
> in my Mapset that has a huge directory path in the name ($file), which is
> not allowed.
> 
> I think there are other issues, for example when I run the script using
> the C:/ as above, it adds the db to my Mapset (I can see it with r.info),
> but I then can't seem to add them as layers.
> 
> Very long winded, but the I think the basic problem is that I can't change
> the path.  Launching GRASS as administrator does not help.   Ultimately,
> I'd like to process the raw modis files, add them to my mapset, and view
> the layer.  Working through the rest of the example in 
> http://grasswiki.osgeo.org/wiki/MODIS#MODIS_Aqua also falls over when I
> get to the Set Colours section with 
> <palette_sst.gcolors>
>  also because I think the path is not correct.
> 
> Thanks for your help!
> 
> Paul
> 
> ______________________________________________________________________
> This email has been scanned by the Symantec Email Security.cloud service.
> For more information please visit http://www.symanteccloud.com
> ______________________________________________________________________
> 
> ______________________________________________________________________
> This email has been scanned by the Symantec Email Security.cloud service.
> For more information please visit http://www.symanteccloud.com
> ______________________________________________________________________
> 
> ______________________________________________________________________
> This email has been scanned by the Symantec Email Security.cloud service.
> For more information please visit http://www.symanteccloud.com
> ______________________________________________________________________
> _______________________________________________
> grass-user mailing list

> grass-user at .osgeo

> http://lists.osgeo.org/mailman/listinfo/grass-user

the command CD doesn't change the drive e.g. c:\ to d:\






-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Cannot-change-directory-via-GRASS-command-console-tp5092923p5092971.html
Sent from the Grass - Users mailing list archive at Nabble.com.


More information about the grass-user mailing list