[GRASS-dev] changes in r.in.aster

Carlos Grohmann carlos.grohmann at gmail.com
Wed Mar 16 09:30:53 PDT 2016

Hi all

After an unsuccessful import of ASTER images, I went looking into the
r.in.aster script and made a few changes that allowed me to import
correctly the images.

OS: Mac OSX El Capitan (with Michael's binary version 7.0.3)

The original issues: The individual bandas were being imported with 15m
resolution for all bands (the region wasn't being re-set for the coarser
resolutions), and all bands imported after 3B had the southern section of
the 3B band (the temp file wasn't being reseted).

My changes:

1 - I changed the band names from 1,2,3b... to 01, 02, 03b... so they are
listed in the right order by the gui (instead of 1, 10, 11,...)

2 - I moved the lines:

tempfile = grass.read_command("g.tempfile", pid = os.getpid()).strip() +


to the loop:

    if proctype in ["L1A", "L1B"]:
        for band in bandlist:
            if band in allbands:

so the tempfile is created and destroyed for each band, assuring it is
created according to the band spatial extent and resolution.

3 - This line was giving me errors:
    if platform.system() == "Darwin":
        cmd = ["arch", "-i386", "gdalwarp", "-t_srs", proj, srcfile,
tempfile ]

arch: posix_spawnp: gdalwarp: Bad CPU type in executable

This is probably because I run OSC El Cap, which is 64bits. So to get it
working, I had to ignore this system test and use

cmd = ["gdalwarp", "-t_srs", proj, srcfile, tempfile ]

Nut I'm not sure what would be the best way to keep the test and maintain
compatibility with older systems. Perhaps a try/except would do.

I attached the modified version.



Prof. Carlos Henrique Grohmann
Institute of Energy and Environment - Univ. of São Paulo, Brazil
- Digital Terrain Analysis | GIS | Remote Sensing -

Can’t stop the signal.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20160316/f3db3d71/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: r.in.aster2
Type: application/octet-stream
Size: 5524 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20160316/f3db3d71/attachment-0001.obj>

More information about the grass-dev mailing list