Opened 10 years ago

Closed 10 years ago

#5431 closed enhancement (fixed)

[PATCH] Add support for two bytes data into the IRIS driver

Reported by: rveciana Owned by: warmerdam
Priority: normal Milestone: 1.11.0
Component: default Version: unspecified
Severity: normal Keywords:
Cc:

Description

I've improved the IRIS driver so it can read more product types. With the old version, some quite common products failed when opened, because the driver couldn't read its data type. I don't know if this case is an enhacement or a bug, since some files failed without the changes.

Attachments (1)

irisdataset.cpp (41.7 KB ) - added by rveciana 10 years ago.
The file to be changed

Download all attachments as: .zip

Change History (6)

by rveciana, 10 years ago

Attachment: irisdataset.cpp added

The file to be changed

comment:1 by Even Rouault, 10 years ago

Summary: Add support for two bytes data into the IRIS driver[PATCH] Add support for two bytes data into the IRIS driver

Roger, I don't know which base version you've used (please always start from the trunk version !), but it looks like your version has reverted recent changes in the driver, namely that one : http://trac.osgeo.org/gdal/changeset/26065/trunk/gdal/frmts/iris that you asked in #5104

I suppose the real diff you want is ? :

Index: irisdataset.cpp
===================================================================
--- irisdataset.cpp	(revision 27110)
+++ irisdataset.cpp	(working copy)
@@ -229,9 +229,9 @@
     if( (int)VSIFReadL( pszRecord, nBlockXSize*nDataLength, 1, poGDS->fp ) != 1 )
         return CE_Failure;
     
-    //If datatype is dbZ:
-    //See point 3.3.5 at page 3.42 of the manual
-    if(poGDS->nDataTypeCode == 2){
+    //If datatype is dbZ or dBT:
+    //See point 3.3.3 at page 3.33 of the manual
+    if(poGDS->nDataTypeCode == 2 || poGDS->nDataTypeCode == 1){
         float fVal;
         for (i=0;i<nBlockXSize;i++){
             fVal = (((float) *(pszRecord+i*nDataLength)) -64)/2.0;
@@ -239,6 +239,16 @@
                 fVal = -9999;
             ((float *) pImage)[i] = fVal;
         }
+    //If datatype is dbZ2 or dBT2:
+    //See point 3.3.4 at page 3.33 of the manual
+    } else if(poGDS->nDataTypeCode == 8 || poGDS->nDataTypeCode == 9){
+        float fVal;
+        for (i=0;i<nBlockXSize;i++){
+            fVal = (((float) CPL_LSBUINT16PTR(pszRecord+i*nDataLength)) - 32768)/100.0;
+            if (fVal == 327.67)
+                fVal = -9999;
+            ((float *) pImage)[i] = fVal;
+        }
     //Fliquid2 (Rain1 & Rainn products)
     //See point 3.3.11 at page 3.43 of the manual
     } else if(poGDS->nDataTypeCode == 37){

comment:2 by rveciana, 10 years ago

Sorry, I missed the old change.

Yes, the diff I want is what you write here.

If datatype is dbZ2 or dBT2:

See point 3.3.4 at page 3.33 of the manual

} else if(poGDS->nDataTypeCode == 8
poGDS->nDataTypeCode == 9){

float fVal; for (i=0;i<nBlockXSize;i++){

fVal = (((float) CPL_LSBUINT16PTR(pszRecord+i*nDataLength)) - 32768)/100.0; if (fVal == 327.67)

fVal = -9999;

((float *) pImage)[i] = fVal;

}

comment:3 by Even Rouault, 10 years ago

Roger, you mention only the second part of the patch. What about the previous one ? :

+    //If datatype is dbZ or dBT:
+    //See point 3.3.3 at page 3.33 of the manual
+    if(poGDS->nDataTypeCode == 2 || poGDS->nDataTypeCode == 1){

comment:4 by rveciana, 10 years ago

Sorry again! Yes, this is also necessary to allow readint the daya type T.

comment:5 by Even Rouault, 10 years ago

Resolution: fixed
Status: newclosed

trunk r27141 "IRIS: add support for two bytes data (patch by Roger Veciana, #5431)"

Note: See TracTickets for help on using tickets.