[GRASSLIST:607] Re: GOES images - Got it!!

Daniel Victoria daniel.victoria at gmail.com
Thu Apr 6 10:08:23 EDT 2006


Finally I made it.

I wrote a simple python program that converts the goes.nav file to a
format that can be used by i.rectify (POINTS file).

The only thing that I'm worried now is that the rms = 0.31 in
i.points. Is that too high? I'm attaching both the i.points screen
dump and the python script, in case someone needs it

Thanks
Daniel

PS - Murphy's law rules everything. After a couple of days to get this
working I found out I downloaded the wrong images :(  they don't cover
the area I want... At least it's all done now

On 4/5/06, Glynn Clements <glynn at gclements.plus.com> wrote:
>
> Daniel Victoria wrote:
>
> > > > I'm trying to import GOES tif images that have no georeferencing. The
> > > > georef information is in a separate file which I finaly opened. It
> > > > contains the lat and lon for every cell in the GOES images. The
> > > > problem is, I just can't seem to get the lat/lon information into the
> > > > TIF files. Is there any way to do this? gdalwarp? gdal_translate?
> > > > i.points?
> > >
> > > add GCPs with gdal_translate, then gdalwarp?
> >
> > but my control points are in a huge text list and the switch -gcp in
> > gdal_translate does not accept that. So, I have to enter the corner
> > points by hand? Or is there a way to make gdal_translate read from a
> > text file (all 1200000 points)?
>
> I don't think that gdal_translate was designed to handle such large
> numbers of control points.
>
> You could import your data as a vector point map then use v.surf.rst.
>
> You would probably need to match the coordinates with the cell values
> manually (e.g. exporting the raster with r.out.ascii, importing the
> coordinates along with the r.out.ascii output into a DBMS, then
> joining the two tables).
>
> Alternatively, you may be able to get adequate results by using a
> small sample of the control points and gdalwarp's -tps switch.
>
> --
> Glynn Clements <glynn at gclements.plus.com>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ipoints.png
Type: image/png
Size: 23086 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-user/attachments/20060406/758509f1/ipoints.png
-------------- next part --------------
#!/usr/bin/python

# program to read goes.nav and write POINTS file lat/lon list
# can then be used with i.rectify after imagery group and target is set up
# Daniel de Castro Victoria <daniel.victoria at gmail dot com>
# 06 april 2006

# libraries for binary data
from struct import *

entrada = file('goes.nav','r')
saida = file('teste.txt','w')

col = unpack('h',entrada.read(2))[0]
row = unpack('h',entrada.read(2))[0]

w = 0

for r in range(row):
    for c in range(col,0,-1):
#for r in range(0,row*-1,-1):
#    for c in range((col-1)*-1,-1):
#for c in range((col-1)*-1,-1):
#    for l in range(0,(lin)*-1,-1):
        lat = unpack('h',entrada.read(2))[0]/100.0
        lon = unpack('h',entrada.read(2))[0]/100.0
        # write only every hundredth point
        if w == 0:
            saida.write(str(c*-1)+'\t'+str(r*-1)+'\t'+str(lon)+'\t'+str(lat)+'\t1\n')
        w = w + 1
        if w == 100:
            w = 0

entrada.close()
saida.close()


More information about the grass-user mailing list