Opened 18 years ago

Last modified 18 years ago

#988 closed defect (fixed)

LANDSAT 5 FAST read problems

Reported by: Markus Neteler Owned by: dron
Priority: high Milestone:
Component: GDAL_Raster Version: unspecified
Severity: normal Keywords:
Cc:

Description

Frank, Andrey,

I am trying to read LANDSAT 5 FAST data which come like this:

-rw-rw-rw-   1 gomez ssi  41243200 Apr  6  2005 BAND1.dat
-rw-rw-rw-   1 gomez ssi  41243200 Apr  6  2005 BAND2.dat
-rw-rw-rw-   1 gomez ssi  41243200 Apr  6  2005 BAND3.dat
-rw-rw-rw-   1 gomez ssi  41243200 Apr  6  2005 BAND4.dat
-rw-rw-rw-   1 gomez ssi  41243200 Apr  6  2005 BAND5.dat
-rw-rw-rw-   1 gomez ssi  41243200 Apr  6  2005 BAND6.dat
-rw-rw-rw-   1 gomez ssi  41243200 Apr  6  2005 BAND7.dat
-rw-rw-rw-   1 gomez ssi      1536 Apr  6  2005 header.dat

Attached the header file.

Frank commented:
> I see that gdal/frmts/raw/fastdataset.cpp checks for ACQUISITION DATE
> at byte 52 but it is at byte 32 in the file you provided.  I think the
> Open() rules will need to be revised.

Hopefully there is a chance to support this sort of LANDSAT 5 data.

If needed, I can make the entire scene available.

Thanks

 Markus

Attachments (2)

header.dat (1.5 KB ) - added by neteler@… 18 years ago.
LANDSAT 5 FAST header (South America scene)
header.2.dat (1.5 KB ) - added by neteler@… 18 years ago.
Another Argentinian head file with again different position of ACQUISITION DATE

Download all attachments as: .zip

Change History (7)

by neteler@…, 18 years ago

Attachment: header.dat added

LANDSAT 5 FAST header (South America scene)

comment:1 by neteler@…, 18 years ago

Hi Andrey,

do you see a chance to look into this? The key work
"ACQUISITION DATE" is at byte 37 in these LANDSAT 5 FAST data,
it would probabyl suffice to modify lines 500/501 in
 frmts/raw/fastdataset.cpp
searching for the exact position of "ACQUISITION DATE".

In GRASS there is this function doing such a job:

/*
 * G_strstr(mainString, subString)
 *      Return a pointer to the first occurrence of subString
 *      in mainString, or NULL if no occurrences are found.
*/

char *G_strstr(char *mainString, const char *subString)
{
    const char *p;
    char *q;
    int length;

    p = subString;
    q = mainString;
    length = strlen(subString);

    do {
        while (*q != '\0' && *q != *p) {        /* match 1st subString char */
            q++;
        }
    } while (*q != '\0' && strncmp(p, q, length) != 0 && q++);
                                /* Short-circuit evaluation is your friend */

    if (*q == '\0') {                           /* ran off end of mainString */
        return NULL;
    } else {
        return q;
    }
}

Best regards

 Markus

by neteler@…, 18 years ago

Attachment: header.2.dat added

Another Argentinian head file with again different position of ACQUISITION DATE

comment:2 by neteler@…, 18 years ago

Frank,

new Argentinian LANDSAT 5 files arrived here with again a different
position of ACQUISITION DATE... (char 37).
Hoping the best for a dynamically parsing of the position of
ACQUISITION DATE (frmts/raw/fastdataset.cpp) to make the files readable.

Thanks,

 Markus

comment:3 by dron, 18 years ago

Markus,

This variant of FAST header has multiple problems.

1. "ACQUISITION DATE" position. Not a problem to read this value, because we already using the strstr() to search for values, but there is a problem to identify dataset as FAST, because this parameter used as signature. I just added another possible offset (36) for that value to check.

2. The whole header is too short, it is just 1/3 of the standard size.

3. The valuse parsing code also should be changed, because some values have '=' sign right after the parameter name, which is not standard.

4. There is no "OUTPUT BITS PER PIXEL" field.

Well, hope all of that fixed now!

There are number of other issues: "GAINS/BIASES" field and some other fields need specific handling, but I do not have time to fix it right now, so I will not close this bug report.

Best regards,
Andrey

comment:4 by neteler@…, 18 years ago

Andrey,

I have made a test and it works now (despite the indicated
remaining problems). I don't remember if gdalwarp would
warp LANDSAT 5 once it recognizes the projection parameters
in the header file. We'll see.

Thanks so far,

 Markus


comment:5 by dron, 18 years ago

I have fixed GAINES/BIASES issue. I do not see a way to properly fix parsing the wrong "SATELLITE" field, because we do not have any "language standards" here and I do not know how to write a good parser which will work in all cases. So I am closing this bug with that only problem remains.

Regards,
Andrey
Note: See TracTickets for help on using tickets.